devadethanr commited on
Commit
8334394
·
verified ·
1 Parent(s): 8457837

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +11 -11
README.md CHANGED
@@ -1,16 +1,16 @@
1
  ---
2
  license: apache-2.0
3
  ---
4
- Alzheimer's Disease MRI Image Classifier (beagle final coding test): Report
5
- 1. Introduction
6
  The goal of this project was to develop a deep learning model capable of classifying MRI images as indicative of Alzheimer's disease or a healthy brain. This report details the approach, methodology, and results of the project.
7
- 2. Dataset
8
  The project utilized the "Alzheimer_MRI" dataset hosted on Hugging Face Datasets. This dataset contains MRI scans of brains labeled with different stages of Alzheimer's disease. The images are in grayscale and come preprocessed in PIL (Python Imaging Library) format.
9
  Link : dataset
10
  Columns : images, labels
11
  Rows : 5.1k
12
  Labels : {0: 'Mild_Demented', 1: 'Moderate_Demented', 2: 'Non_Demented', 3: 'Very_Mild_Demented'}
13
- 3. Model Selection and Architecture
14
  Given the constraints of the Hugging Face free tier, the primary consideration was choosing a lightweight and efficient model architecture. The following options were evaluated:
15
  MobileNetV2: Known for its exceptional speed and small model size.
16
  EfficientNet-B0: A good balance between accuracy and efficiency. (5.3 million params)
@@ -19,28 +19,28 @@ SqueezeNet: Very small but less accurate than the other options.
19
  Ultimately, EfficientNet-B0 was chosen due to its balance of accuracy and efficiency. While slightly larger than MobileNetV2, it was expected to fit within the free tier's resource limits and potentially provide better performance for this medical imaging task.
20
  Link : Efficientnet-b0
21
 
22
- Hyperparameter Choices:
23
 
24
  per_device_train_batch_size=32
25
  num_train_epochs=25
26
  fp16=True : Mixed precision training is enabled to leverage the GPU's Tensor Cores (if available) and speed up training.
27
  load_best_model_at_end=True : This ensures that we use the best performing model
28
  push_to_hub=True & hub_model_id & hub_strategy = "every_save"
29
- 4. Preprocessing
30
  The dataset's images were already in a usable format (PIL). The preprocessing steps involved:
31
  Splitting: The dataset was split into training (80%) and validation (20%) sets.
32
  Resizing: All images were resized to 224x224 pixels to match the input requirements of EfficientNet-B0.
33
  Normalization: Pixel values were normalized to have zero mean and unit variance, a standard practice in image classification tasks.
34
  Channel Expansion: Since the images are grayscale, a channel dimension was added to make them compatible with the model's architecture.
35
- 5. Model Fine-tuning
36
  The pre-trained EfficientNet-B0 model from Hugging Face Transformers was fine-tuned on the preprocessed Alzheimer's MRI dataset, steps included:
37
  Classification Head: Tried to change : The original classification head, designed for 1000 ImageNet classes, was replaced with a new linear layer to output predictions for the four Alzheimer's disease stages.Because of extensive change required I implemented the args : ignore_mismatched_sizes=True,
38
  num_labels=len(labels),
39
  Training Configuration: The model was trained on a GPU with CUDA 12.1 support using mixed-precision training (fp16) for faster computation. The training was configured for 25 epochs, with the best model saved at the end of each epoch.
40
  Pushing to Hugging Face Hub: The model was automatically uploaded to the Hugging Face Hub after each epoch to track progress and enable easy sharing and deployment.
41
- 6. Deployment on Hugging Face Spaces
42
  A Gradio app was created locally and tested before creating on Hugging Face Spaces to provide an interactive interface for the trained model. The app allows users to upload MRI images and get predictions about the stage of Alzheimer's disease, along with confidence scores for each class.
43
- 7. Results and Evaluation
44
  The final model achieved :
45
  Training:
46
 
@@ -48,8 +48,8 @@ Training:
48
  Validation:
49
 
50
 
51
- 9. Links
52
  Fine-tuned Model: https://huggingface.co/devadethanr/alz_model
53
  Hugging Face Space: https://huggingface.co/spaces/devadethanr/alzheimers-mri-classifier
54
- 10. Conclusion
55
  This project successfully demonstrates the development and deployment of an Alzheimer's Disease MRI Image Classifier using EfficientNet-B0. The resulting model and user-friendly Gradio app on detecting Alzheimer's disease in four different stages.
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+ ### Alzheimer's Disease MRI Image Classifier (beagle final coding test): Report
5
+ - 1. Introduction
6
  The goal of this project was to develop a deep learning model capable of classifying MRI images as indicative of Alzheimer's disease or a healthy brain. This report details the approach, methodology, and results of the project.
7
+ - 2. Dataset
8
  The project utilized the "Alzheimer_MRI" dataset hosted on Hugging Face Datasets. This dataset contains MRI scans of brains labeled with different stages of Alzheimer's disease. The images are in grayscale and come preprocessed in PIL (Python Imaging Library) format.
9
  Link : dataset
10
  Columns : images, labels
11
  Rows : 5.1k
12
  Labels : {0: 'Mild_Demented', 1: 'Moderate_Demented', 2: 'Non_Demented', 3: 'Very_Mild_Demented'}
13
+ - 3. Model Selection and Architecture
14
  Given the constraints of the Hugging Face free tier, the primary consideration was choosing a lightweight and efficient model architecture. The following options were evaluated:
15
  MobileNetV2: Known for its exceptional speed and small model size.
16
  EfficientNet-B0: A good balance between accuracy and efficiency. (5.3 million params)
 
19
  Ultimately, EfficientNet-B0 was chosen due to its balance of accuracy and efficiency. While slightly larger than MobileNetV2, it was expected to fit within the free tier's resource limits and potentially provide better performance for this medical imaging task.
20
  Link : Efficientnet-b0
21
 
22
+ #### Hyperparameter Choices:
23
 
24
  per_device_train_batch_size=32
25
  num_train_epochs=25
26
  fp16=True : Mixed precision training is enabled to leverage the GPU's Tensor Cores (if available) and speed up training.
27
  load_best_model_at_end=True : This ensures that we use the best performing model
28
  push_to_hub=True & hub_model_id & hub_strategy = "every_save"
29
+ - 4. Preprocessing
30
  The dataset's images were already in a usable format (PIL). The preprocessing steps involved:
31
  Splitting: The dataset was split into training (80%) and validation (20%) sets.
32
  Resizing: All images were resized to 224x224 pixels to match the input requirements of EfficientNet-B0.
33
  Normalization: Pixel values were normalized to have zero mean and unit variance, a standard practice in image classification tasks.
34
  Channel Expansion: Since the images are grayscale, a channel dimension was added to make them compatible with the model's architecture.
35
+ - 5. Model Fine-tuning
36
  The pre-trained EfficientNet-B0 model from Hugging Face Transformers was fine-tuned on the preprocessed Alzheimer's MRI dataset, steps included:
37
  Classification Head: Tried to change : The original classification head, designed for 1000 ImageNet classes, was replaced with a new linear layer to output predictions for the four Alzheimer's disease stages.Because of extensive change required I implemented the args : ignore_mismatched_sizes=True,
38
  num_labels=len(labels),
39
  Training Configuration: The model was trained on a GPU with CUDA 12.1 support using mixed-precision training (fp16) for faster computation. The training was configured for 25 epochs, with the best model saved at the end of each epoch.
40
  Pushing to Hugging Face Hub: The model was automatically uploaded to the Hugging Face Hub after each epoch to track progress and enable easy sharing and deployment.
41
+ - 6. Deployment on Hugging Face Spaces
42
  A Gradio app was created locally and tested before creating on Hugging Face Spaces to provide an interactive interface for the trained model. The app allows users to upload MRI images and get predictions about the stage of Alzheimer's disease, along with confidence scores for each class.
43
+ - 7. Results and Evaluation
44
  The final model achieved :
45
  Training:
46
 
 
48
  Validation:
49
 
50
 
51
+ - 8. Links
52
  Fine-tuned Model: https://huggingface.co/devadethanr/alz_model
53
  Hugging Face Space: https://huggingface.co/spaces/devadethanr/alzheimers-mri-classifier
54
+ - 9. Conclusion
55
  This project successfully demonstrates the development and deployment of an Alzheimer's Disease MRI Image Classifier using EfficientNet-B0. The resulting model and user-friendly Gradio app on detecting Alzheimer's disease in four different stages.