– Deep learning framework for model building
– High-level API for TensorFlow
– Image processing and computer vision
– Visualization library for plots & images
– Data splitting and evaluation metrics
– Helper functions for image processing
BRAIN_TUMOR_DETECTION/
│── brain_tumor_dataset/
│ ├── no/ # MRI images without tumor
│ └── yes/ # MRI images with tumor
│── cnn-parameters-improvement-24-0.86.model # Trained CNN weights
│── data_aug.py # Script for data augmentation
│── final_rslt.py # Run inference on a single MRI image
│── ver1_train.py # Train & evaluate CNN model
Install dependencies with:
pip install -r requirements.txt
requirements.txt
tensorflow
numpy
matplotlib
opencv-python
imutils
scikit-learn
- Prepare Dataset
Organize your data as:brain_tumor_dataset/ ├── no/ └── yes/
- Augment Data (optional)
python data_aug.py
- Train Model
This will generate
python ver1_train.py
cnn-parameters-improvement-24-0.86.model
. - Run Inference on a New Image
Editfinal_rslt.py
to point to your test image, then run:python final_rslt.py
Accuracy (Test): 0.95
F1 Score (Test): 0.93
- Preprocessing: grayscale conversion → Gaussian blur → thresholding → morphological cleanup → contour cropping.
- CNN Model: convolutional layers → batch norm & pooling → dense classification head.
- Prediction Logic: outputs probability; if > 0.6 → “Brain Tumor Detected,” else “Normal.”
Please cite our peer-reviewed work if you use this repository:
Brain Tumour Detection Using Deep Learning
ResearchGate Publication