This project is designed to detect brain tumors from MRI images using the YOLOv8n (You Only Look Once) object detection model. The goal is to offer a quick and accurate tool for identifying tumors in MRI scans, supporting early diagnosis and potential treatment decisions. Trained on a dataset of 20,000 images, the model performs with high precision and accuracy. A user-friendly interface enables users to upload images and detect tumors in real time.
Explore the full project video for a demonstration of its functionalities. Here
This project is part of an innovative assignment for the Drone Lab at Scaler School of Technology, focusing on applying technology to real-world problems. Detecting brain tumors is a critical task due to the life-threatening implications if not identified early. Manual analysis of MRI images is time-intensive and subject to human error, so this project leverages deep learning to aid radiologists with faster, more accurate diagnoses.
The dataset for this project, sourced from Kaggle, consists of 20,000 MRI brain images annotated for tumor detection.
- Image Format: JPEG
- Annotations: Provided in YOLO format (bounding boxes for tumor regions)
- Dataset Split:
- Training Set: Used to train the model.
- Validation Set: For model fine-tuning during training.
- Test Set: For evaluating final performance metrics.
-
Python Installation
- This project uses Python 3.x. Ensure that Python is installed.
-
Required Libraries
- Install necessary libraries for data management, model training, and UI creation:
pip install ultralytics opencv-python matplotlib pandas ipywidgets notebook
- Ultralytics: For YOLOv8 model training and inference.
- OpenCV: For image processing and displaying results.
- Matplotlib: For plotting graphs and visualizations.
- Pandas: For data structuring.
- Ipywidgets: For interactive file upload widgets.
- Install necessary libraries for data management, model training, and UI creation:
-
Setting Up Jupyter Notebook
- Jupyter Notebook was used for model training and visualization.
pip install notebook
- Jupyter Notebook was used for model training and visualization.
YOLOv8n was chosen for its balance of speed and accuracy, ideal for real-time tumor detection in MRI images.
The model was trained on 20,000 MRI images, optimized for high performance.
After training, the model’s accuracy was evaluated using several metrics:
Metric | Value |
---|---|
Accuracy | 0.839 |
Precision | 1.000 |
Recall | 0.839 |
F1 Score | 0.913 |
This project includes a user-friendly GUI interface that allows users to upload an MRI image and check for the presence of a tumor.
- Upload Image: Click the upload button to select an MRI image from your device.
- Real-Time Detection: The model processes the uploaded image and detects tumors, drawing a bounding box around any detected tumor regions.
- Accuracy Display: A confidence score is displayed above the bounding box to indicate detection accuracy.
Simply upload an image and let the model handle the rest!