DeepActionPotential commited on
Commit
e729ad2
·
verified ·
1 Parent(s): 9a52777

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +121 -109
README.md CHANGED
@@ -1,109 +1,121 @@
1
- # Brain Tumor MRI Classification
2
-
3
- ## About the Project
4
-
5
- This project aims to automate the classification of brain tumors from MRI images using deep learning techniques. Early and accurate detection of brain tumors is critical for effective treatment and improved patient outcomes. By leveraging Convolutional Neural Networks (CNNs), this project provides a robust solution for distinguishing between different types of brain tumors and healthy brain scans. The solution is designed to assist clinicians and researchers by providing fast, reliable, and reproducible results, reducing the burden of manual image analysis and supporting clinical decision-making.
6
-
7
- The project encompasses the entire machine learning pipeline, including data preprocessing, model development, training, evaluation, and deployment. The codebase is organized for clarity and reproducibility, making it easy for other researchers and practitioners to adapt or extend the work for related medical imaging tasks.
8
-
9
- ## About the Dataset
10
-
11
- The dataset used in this project is sourced from Kaggle: [Brain Tumor MRI Dataset](https://www.kaggle.com/datasets/masoudnickparvar/brain-tumor-mri-dataset/data).
12
-
13
- - **Total Images:** 7,023 MRI scans
14
- - **Classes:** Glioma Tumor, Meningioma Tumor, Pituitary Tumor, No Tumor
15
- - **Data Sources:** The dataset is a combination of multiple sources, including Figshare, SARTAJ, and Br35H datasets, ensuring diversity in imaging conditions and patient demographics.
16
- - **Image Characteristics:** Images vary in size, resolution, and margin. Some classes, such as Glioma, required relabeling due to inconsistencies in the original datasets.
17
- - **Data Structure:** The dataset is organized into separate folders for training and testing, with subfolders for each class.
18
-
19
- This dataset presents real-world challenges such as class imbalance, varying image quality, and potential mislabeling, making it suitable for developing robust and generalizable models.
20
-
21
- ## Notebook Summary
22
-
23
- The provided Jupyter notebook walks through the complete workflow for brain tumor classification:
24
-
25
- 1. **Problem Definition:** Outlines the clinical motivation and the importance of automated tumor detection.
26
- 2. **Data Preparation:** Details the loading, augmentation, and normalization of MRI images to ensure consistency and improve model generalization.
27
- 3. **Model Building:** Implements a custom CNN architecture tailored for multi-class classification of MRI images.
28
- 4. **Training:** Trains the model using the prepared dataset, tracks performance metrics, and saves the best-performing model.
29
- 5. **Evaluation:** Evaluates the trained model using accuracy, precision, recall, F1-score, and confusion matrix. Visualizes both the training process and the results.
30
- 6. **Results and Discussion:** Summarizes findings and suggests potential improvements, such as increasing training epochs or experimenting with different architectures.
31
-
32
- The notebook is modular, with clear separation between data handling, model logic, and evaluation, making it easy to follow and modify.
33
-
34
- ## Model Results
35
-
36
- ### Preprocessing
37
-
38
- - **Resizing:** All images are resized to 224x224 pixels to standardize input dimensions for the CNN.
39
- - **Augmentation:** Random horizontal flips and rotations (up to 10 degrees) are applied to increase data diversity and reduce overfitting.
40
- - **Normalization:** Images are normalized using ImageNet mean and standard deviation values to facilitate transfer learning and stable training.
41
-
42
- ### Training
43
-
44
- - **Architecture:** The model is a custom CNN with two convolutional layers followed by fully connected layers. It is designed to balance complexity and computational efficiency.
45
- - **Loss Function:** Cross-entropy loss is used for multi-class classification.
46
- - **Optimizer:** Adam optimizer is employed for efficient gradient-based optimization.
47
- - **Training Regimen:** The model is trained for 15 epochs (with suggestions to increase to 20-25 for improved results), using separate loaders for training and validation data.
48
- - **Checkpointing:** The best model (based on validation accuracy) is saved for later evaluation.
49
-
50
- ### Evaluation
51
-
52
- - **Metrics:** The model is evaluated using accuracy, precision, recall, and F1-score (macro-averaged for multi-class).
53
- - **Confusion Matrix:** A confusion matrix is plotted to visualize class-wise performance and identify potential misclassifications.
54
- - **Training History:** Loss and accuracy curves are plotted for both training and validation sets to monitor learning dynamics and detect overfitting or underfitting.
55
-
56
- The model achieves a macro F1-score of approximately 0.97, demonstrating strong performance across all classes. Further improvements can be made by tuning hyperparameters, increasing training epochs, or experimenting with deeper architectures.
57
-
58
- ## How to Install
59
-
60
- Follow these steps to set up the environment using Python's built-in `venv` module:
61
-
62
- ```bash
63
- # Clone the repository
64
- git clone https://github.com/DeepActionPotential/TumrioAI
65
- cd TumrioAI
66
-
67
-
68
- # Create a virtual environment
69
- python -m venv venv
70
-
71
- # Activate the virtual environment
72
- # On Windows:
73
- venv\Scripts\activate
74
- # On macOS/Linux:
75
- source venv/bin/activate
76
-
77
-
78
- # Install required dependencies
79
- pip install -r requirements.txt
80
- ```
81
-
82
-
83
-
84
- ## How to Use the Software
85
-
86
-
87
-
88
- 1. **Demo:**
89
- ## [demo-video](assets/brain_tumor_demo.mp4)
90
- ![Demo-screenshot](assets/1.jpg)
91
-
92
-
93
- ## Technologies Used
94
-
95
-
96
- - **PyTorch:** Used for building, training, and evaluating the deep learning model. PyTorch provides flexibility and ease of use for custom model development.
97
- - **Torchvision:** Supplies datasets, model architectures, and image transformation utilities, streamlining the data preprocessing and augmentation process.
98
- - **NumPy:** Facilitates efficient numerical computations and array manipulations.
99
- - **Matplotlib & Seaborn:** Used for data visualization, including plotting images, training curves, and confusion matrices.
100
- - **scikit-learn:** Provides metrics for model evaluation, such as precision, recall, and F1-score.
101
- - **Jupyter Notebook / VS Code:** Interactive development environments for running and documenting experiments.
102
-
103
- These technologies were chosen for their robustness, community support, and suitability for rapid prototyping and research in deep learning and computer vision.
104
-
105
- ## License
106
-
107
- This project is licensed under the MIT License. You are free to use, modify, and distribute this software for personal, academic, or commercial purposes, provided that you include the original copyright and license notice.
108
-
109
- See the [LICENSE](LICENSE) file for more details.
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: TumrioAI - Brain Tumor MRI Classification
3
+ emoji: 🤖
4
+ colorFrom: indigo
5
+ colorTo: blue
6
+ sdk: streamlit
7
+ sdk_version: 1.30.0
8
+ app_file: app.py
9
+ pinned: false
10
+ license: mit
11
+ ---
12
+
13
+ # TumrioAI - Brain Tumor MRI Classification
14
+
15
+ ## About the Project
16
+
17
+ This project aims to automate the classification of brain tumors from MRI images using deep learning techniques. Early and accurate detection of brain tumors is critical for effective treatment and improved patient outcomes. By leveraging Convolutional Neural Networks (CNNs), this project provides a robust solution for distinguishing between different types of brain tumors and healthy brain scans. The solution is designed to assist clinicians and researchers by providing fast, reliable, and reproducible results, reducing the burden of manual image analysis and supporting clinical decision-making.
18
+
19
+ The project encompasses the entire machine learning pipeline, including data preprocessing, model development, training, evaluation, and deployment. The codebase is organized for clarity and reproducibility, making it easy for other researchers and practitioners to adapt or extend the work for related medical imaging tasks.
20
+
21
+ ## About the Dataset
22
+
23
+ The dataset used in this project is sourced from Kaggle: [Brain Tumor MRI Dataset](https://www.kaggle.com/datasets/masoudnickparvar/brain-tumor-mri-dataset/data).
24
+
25
+ - **Total Images:** 7,023 MRI scans
26
+ - **Classes:** Glioma Tumor, Meningioma Tumor, Pituitary Tumor, No Tumor
27
+ - **Data Sources:** The dataset is a combination of multiple sources, including Figshare, SARTAJ, and Br35H datasets, ensuring diversity in imaging conditions and patient demographics.
28
+ - **Image Characteristics:** Images vary in size, resolution, and margin. Some classes, such as Glioma, required relabeling due to inconsistencies in the original datasets.
29
+ - **Data Structure:** The dataset is organized into separate folders for training and testing, with subfolders for each class.
30
+
31
+ This dataset presents real-world challenges such as class imbalance, varying image quality, and potential mislabeling, making it suitable for developing robust and generalizable models.
32
+
33
+ ## Notebook Summary
34
+
35
+ The provided Jupyter notebook walks through the complete workflow for brain tumor classification:
36
+
37
+ 1. **Problem Definition:** Outlines the clinical motivation and the importance of automated tumor detection.
38
+ 2. **Data Preparation:** Details the loading, augmentation, and normalization of MRI images to ensure consistency and improve model generalization.
39
+ 3. **Model Building:** Implements a custom CNN architecture tailored for multi-class classification of MRI images.
40
+ 4. **Training:** Trains the model using the prepared dataset, tracks performance metrics, and saves the best-performing model.
41
+ 5. **Evaluation:** Evaluates the trained model using accuracy, precision, recall, F1-score, and confusion matrix. Visualizes both the training process and the results.
42
+ 6. **Results and Discussion:** Summarizes findings and suggests potential improvements, such as increasing training epochs or experimenting with different architectures.
43
+
44
+ The notebook is modular, with clear separation between data handling, model logic, and evaluation, making it easy to follow and modify.
45
+
46
+ ## Model Results
47
+
48
+ ### Preprocessing
49
+
50
+ - **Resizing:** All images are resized to 224x224 pixels to standardize input dimensions for the CNN.
51
+ - **Augmentation:** Random horizontal flips and rotations (up to 10 degrees) are applied to increase data diversity and reduce overfitting.
52
+ - **Normalization:** Images are normalized using ImageNet mean and standard deviation values to facilitate transfer learning and stable training.
53
+
54
+ ### Training
55
+
56
+ - **Architecture:** The model is a custom CNN with two convolutional layers followed by fully connected layers. It is designed to balance complexity and computational efficiency.
57
+ - **Loss Function:** Cross-entropy loss is used for multi-class classification.
58
+ - **Optimizer:** Adam optimizer is employed for efficient gradient-based optimization.
59
+ - **Training Regimen:** The model is trained for 15 epochs (with suggestions to increase to 20-25 for improved results), using separate loaders for training and validation data.
60
+ - **Checkpointing:** The best model (based on validation accuracy) is saved for later evaluation.
61
+
62
+ ### Evaluation
63
+
64
+ - **Metrics:** The model is evaluated using accuracy, precision, recall, and F1-score (macro-averaged for multi-class).
65
+ - **Confusion Matrix:** A confusion matrix is plotted to visualize class-wise performance and identify potential misclassifications.
66
+ - **Training History:** Loss and accuracy curves are plotted for both training and validation sets to monitor learning dynamics and detect overfitting or underfitting.
67
+
68
+ The model achieves a macro F1-score of approximately 0.97, demonstrating strong performance across all classes. Further improvements can be made by tuning hyperparameters, increasing training epochs, or experimenting with deeper architectures.
69
+
70
+ ## How to Install
71
+
72
+ Follow these steps to set up the environment using Python's built-in `venv` module:
73
+
74
+ ```bash
75
+ # Clone the repository
76
+ git clone https://github.com/DeepActionPotential/TumrioAI
77
+ cd TumrioAI
78
+
79
+
80
+ # Create a virtual environment
81
+ python -m venv venv
82
+
83
+ # Activate the virtual environment
84
+ # On Windows:
85
+ venv\Scripts\activate
86
+ # On macOS/Linux:
87
+ source venv/bin/activate
88
+
89
+
90
+ # Install required dependencies
91
+ pip install -r requirements.txt
92
+ ```
93
+
94
+
95
+
96
+ ## How to Use the Software
97
+
98
+
99
+
100
+ 1. **Demo:**
101
+ ## [demo-video](assets/brain_tumor_demo.mp4)
102
+ ![Demo-screenshot](assets/1.jpg)
103
+
104
+
105
+ ## Technologies Used
106
+
107
+
108
+ - **PyTorch:** Used for building, training, and evaluating the deep learning model. PyTorch provides flexibility and ease of use for custom model development.
109
+ - **Torchvision:** Supplies datasets, model architectures, and image transformation utilities, streamlining the data preprocessing and augmentation process.
110
+ - **NumPy:** Facilitates efficient numerical computations and array manipulations.
111
+ - **Matplotlib & Seaborn:** Used for data visualization, including plotting images, training curves, and confusion matrices.
112
+ - **scikit-learn:** Provides metrics for model evaluation, such as precision, recall, and F1-score.
113
+ - **Jupyter Notebook / VS Code:** Interactive development environments for running and documenting experiments.
114
+
115
+ These technologies were chosen for their robustness, community support, and suitability for rapid prototyping and research in deep learning and computer vision.
116
+
117
+ ## License
118
+
119
+ This project is licensed under the MIT License. You are free to use, modify, and distribute this software for personal, academic, or commercial purposes, provided that you include the original copyright and license notice.
120
+
121
+ See the [LICENSE](LICENSE) file for more details.