{"id":26349704,"url":"https://github.com/esnanta/alzheimer-image-classification-cnn","last_synced_at":"2025-03-16T09:20:00.126Z","repository":{"id":281864479,"uuid":"946685834","full_name":"esnanta/alzheimer-image-classification-cnn","owner":"esnanta","description":"This image classification project is part of the submission for the Intermediate Data Scientist Learning Path on the Dicoding platform. It is also a part of the IDCAMP 2024 training program.","archived":false,"fork":false,"pushed_at":"2025-03-11T14:28:25.000Z","size":1207,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T15:35:38.796Z","etag":null,"topics":["alzheimer-detection","cnn-classification","computer-vision","deep-learning","image-classification","keras","machine-learning","neural-networks","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/esnanta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-11T14:19:40.000Z","updated_at":"2025-03-11T14:28:29.000Z","dependencies_parsed_at":"2025-03-11T15:47:50.884Z","dependency_job_id":null,"html_url":"https://github.com/esnanta/alzheimer-image-classification-cnn","commit_stats":null,"previous_names":["esnanta/alzheimer-image-classification-cnn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esnanta%2Falzheimer-image-classification-cnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esnanta%2Falzheimer-image-classification-cnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esnanta%2Falzheimer-image-classification-cnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esnanta%2Falzheimer-image-classification-cnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esnanta","download_url":"https://codeload.github.com/esnanta/alzheimer-image-classification-cnn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847687,"owners_count":20357427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alzheimer-detection","cnn-classification","computer-vision","deep-learning","image-classification","keras","machine-learning","neural-networks","tensorflow"],"created_at":"2025-03-16T09:19:59.546Z","updated_at":"2025-03-16T09:20:00.117Z","avatar_url":"https://github.com/esnanta.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Alzheimer Image Classification using Convolutional Neural Network (CNN)\n\n## 📌 About Alzheimer’s Disease\nAlzheimer's disease is a progressive neurological disorder that leads to memory loss and cognitive decline. It is one of the most common causes of dementia, affecting millions of people worldwide. Early detection through MRI imaging can assist in diagnosis and treatment.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/esnanta/alzheimer-image-classification-cnn/blob/89b9ab8ac33d6ffae674ab42780d4894f884f824/image/alzheimer_images_1.png?raw=true\" width=\"45%\" /\u003e\n  \u003cimg src=\"https://github.com/esnanta/alzheimer-image-classification-cnn/blob/89b9ab8ac33d6ffae674ab42780d4894f884f824/image/alzheimer_images_2.png?raw=true\" width=\"45%\" /\u003e\n\u003c/p\u003e\n\n## 🧠 About the Dataset\nThis dataset contains MRI images categorized into four classes:\n- **Mild Demented**: 8,960 images\n- **Moderate Demented**: 6,464 images\n- **Very Mild Demented**: 8,960 images\n- **Non Demented**: 9,600 images\n\n📌 **Dataset Link**: [Alzheimer Dataset](https://www.kaggle.com/datasets/uraninjo/augmented-alzheimer-mri-dataset)\n\n## 🏗 Project Structure\nThis project classifies Alzheimer’s disease using CNN. Below is the structured workflow:\n\n### 1️⃣ Importing Required Libraries\n\n### 2️⃣ Data Preparation\n\n### 3️⃣ Dataset Splitting\nThe dataset is divided into:\n- **70% Training**\n- **20% Validation**\n- **10% Testing**\n\n### 4️⃣ Data Loading\n\n### 5️⃣ Preprocessing Data\n- **Resize Images** to 224x224 pixels for uniform input size.\n- **Normalize Pixel Values** to improve model stability.\n- **Shuffle Data** to prevent order bias during training.\n- **Batching \u0026 Prefetching** to optimize training speed.\n\n### 6️⃣ Model Architecture\nThe CNN model consists of:\n- **Feature Extraction**\n  - `Conv2D` + `BatchNormalization` + `ReLU` Activation (Extracts features from MRI images)\n  - `MaxPooling2D` (Reduces feature dimension and prevents overfitting)\n  - **5 Convolution Layers** to capture complex patterns\n- **Classification Layers**\n  - `Dense(128) + BatchNormalization + ReLU` (Fully connected layer for feature representation)\n  - `Dropout(0.5)` (Reduces overfitting)\n  - `Dense(4, activation='softmax')` (Outputs probability for 4 classes)\n- **Training Setup**\n  - `Adam Optimizer` (Adaptive learning for stable convergence)\n  - `Sparse Categorical Crossentropy` (Handles integer class labels efficiently)\n  - **Callbacks:**\n    - `EarlyStopping`: Stops training if no improvement after 5 epoch.\n    - `ReduceLROnPlateau`: Reduces learning rate if validation loss stagnates.\n    - **Custom Callback:** Stops training when validation accuracy hits **95%**.\n\n### 7️⃣ Evaluation and Visualization\nAfter training, the model achieves:\n- **Test Accuracy**: **96.59%**\n- **Test Loss**: **0.0991**\n\n![Training \u0026 Validation Accuracy](https://github.com/esnanta/alzheimer-image-classification-cnn/blob/c5977b0594fc128be3a5db9c10f42c9d3e1c498d/image/training_validation_accuracy.png?raw=true)\n\n#### Training \u0026 Validation Accuracy Analysis\n📈 **Accuracy Trends:**\n- Sharp accuracy increase at the beginning, stabilizing around **95%** for validation accuracy.\n- Training accuracy almost reaches **100%**, with validation accuracy around **95%**.\n- Minimal gap between training and validation accuracy, indicating **good generalization**.\n\n#### Training \u0026 Validation Loss Analysis\n📉 **Loss Trends:**\n- Training loss consistently decreases, showing the model learns well.\n- Validation loss also decreases but fluctuates slightly mid-training.\n- The small gap between training and validation loss confirms **no significant overfitting**.\n\n## 📢 Conclusion\nThis CNN-based Alzheimer image classification model demonstrates high accuracy and stability in detecting different stages of Alzheimer's disease using MRI images. The balanced preprocessing, proper augmentations, and deep network architecture contribute to its efficiency and generalization.\n\n🚀 **Next Steps:**\n- Improve model robustness with more data augmentation.\n- Experiment with transfer learning (e.g., ResNet, EfficientNet).\n- Optimize hyperparameters for further accuracy gains.\n\n📌 **Developed with TensorFlow \u0026 Keras.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesnanta%2Falzheimer-image-classification-cnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesnanta%2Falzheimer-image-classification-cnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesnanta%2Falzheimer-image-classification-cnn/lists"}