Skip to content

zak-510/bt-mri

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Brain Tumor MRI Classification

The model is a ResNet-18 CNN that has been pre-trained on the ImageNet dataset. The goal is to classify MRI images into four categories: glioma, meningioma, pituitary, and no tumor.

Kaggle Dataset: https://www.kaggle.com/datasets/masoudnickparvar/brain-tumor-mri-dataset

Key Features

  • Transfer Learning: Uses a pre-trained ResNet-18 model to leverage learned features from a large dataset.
  • Data Augmentation: Applies transformations like random resized cropping and horizontal flipping to the training data to increase its diversity.
  • Early Stopping: Monitors the validation accuracy and stops training if there is no improvement for five consecutive epochs.

Training and Evaluation

The model is trained using the AdamW optimizer and cross-entropy loss with label smoothing. A learning rate scheduler (ReduceLROnPlateau) is used to adjust the learning rate during training. The final evaluation is performed on a separate test set, and the results are visualized with a confusion matrix.

How to Use

  1. Set up the environment:

    pip install -r requirements.txt
  2. Organize the data: Place the training and testing datasets in the data/ directory, following the structure below:

    data/
    ├── Training/
    │   ├── glioma/
    │   ├── meningioma/
    │   ├── notumor/
    │   └── pituitary/
    └── Testing/
        ├── glioma/
        ├── meningioma/
        ├── notumor/
        └── pituitary/
    
  3. Run the notebook: Open and run the notebook.ipynb file in the src/ directory to train the model and see the results.

About

ResNet-18 to classify MRI images into four categories: glioma, meningioma, pituitary, and no tumor.

Topics

Resources

Stars

Watchers

Forks

Contributors