Delete README
Browse files
README
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
# Fine-Tuning ResNet50 for Alzheimer's MRI Classification
|
2 |
-
|
3 |
-
This repository contains a Jupyter Notebook for fine-tuning a ResNet50 model to classify Alzheimer's disease stages from MRI images. The notebook uses PyTorch and the dataset is loaded from the Hugging Face Datasets library.
|
4 |
-
|
5 |
-
## Table of Contents
|
6 |
-
- [Introduction](#introduction)
|
7 |
-
- [Dataset](#dataset)
|
8 |
-
- [Model Architecture](#model-architecture)
|
9 |
-
- [Setup](#setup)
|
10 |
-
- [Training](#training)
|
11 |
-
- [Evaluation](#evaluation)
|
12 |
-
- [Usage](#usage)
|
13 |
-
- [Results](#results)
|
14 |
-
- [Contributing](#contributing)
|
15 |
-
- [License](#license)
|
16 |
-
|
17 |
-
## Introduction
|
18 |
-
This notebook fine-tunes a pre-trained ResNet50 model to classify MRI images into one of four stages of Alzheimer's disease:
|
19 |
-
- Mild Demented
|
20 |
-
- Moderate Demented
|
21 |
-
- Non-Demented
|
22 |
-
- Very Mild Demented
|
23 |
-
|
24 |
-
## Dataset
|
25 |
-
The dataset used is [Falah/Alzheimer_MRI](https://huggingface.co/datasets/Falah/Alzheimer_MRI) from the Hugging Face Datasets library. It consists of MRI images categorized into the four stages of Alzheimer's disease.
|
26 |
-
|
27 |
-
## Model Architecture
|
28 |
-
The model architecture is based on ResNet50. The final fully connected layer is modified to output predictions for 4 classes.
|
29 |
-
|
30 |
-
## Setup
|
31 |
-
To run the notebook locally, follow these steps:
|
32 |
-
|
33 |
-
1. Clone the repository:
|
34 |
-
```bash
|
35 |
-
git clone https://github.com/your_username/alzheimer_mri_classification.git
|
36 |
-
cd alzheimer_mri_classification
|
37 |
-
```
|
38 |
-
|
39 |
-
2. Install the required dependencies:
|
40 |
-
```bash
|
41 |
-
pip install -r requirements.txt
|
42 |
-
```
|
43 |
-
|
44 |
-
3. Open the notebook:
|
45 |
-
```bash
|
46 |
-
jupyter notebook fine-tuning.ipynb
|
47 |
-
```
|
48 |
-
|
49 |
-
## Training
|
50 |
-
The notebook includes sections for:
|
51 |
-
- Loading and preprocessing the dataset
|
52 |
-
- Defining the model architecture
|
53 |
-
- Setting up the training loop with a learning rate scheduler and optimizer
|
54 |
-
- Training the model for a specified number of epochs
|
55 |
-
- Saving the trained model weights
|
56 |
-
|
57 |
-
## Evaluation
|
58 |
-
The notebook includes a section for evaluating the trained model on the validation set. It calculates and prints the validation loss and accuracy.
|
59 |
-
|
60 |
-
## Usage
|
61 |
-
Once trained, the model can be saved and used for inference on new MRI images. The trained model weights are saved as alzheimer_model_resnet50.pth.
|
62 |
-
|
63 |
-
## Load the model architecture and weights
|
64 |
-
```python
|
65 |
-
model = models.resnet50(weights=None)
|
66 |
-
model.fc = nn.Linear(model.fc.in_features, 4)
|
67 |
-
model.load_state_dict(torch.load("alzheimer_model_resnet50.pth", map_location=torch.device('cpu')))
|
68 |
-
model.eval()
|
69 |
-
```
|
70 |
-
## Results
|
71 |
-
The model achieved an accuracy of 95.9375% on the validation set.
|
72 |
-
|
73 |
-
## Contributing
|
74 |
-
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|