A deep learning-powered brain tumor detection system that uses computer vision to analyze MRI images and identify the presence of brain tumors.
TumourTrace is a machine learning project that combines a TensorFlow-based CNN model with a user-friendly web interface to detect brain tumors in MRI scans. The system provides both a Jupyter notebook for model training and analysis, as well as a web application for real-time tumor detection.
- Deep Learning Model: CNN architecture trained on brain MRI images
- Web Interface: Simple HTML/JavaScript interface for image upload and prediction
- Real-time Detection: Instant tumor classification (Positive/Negative)
- TensorFlow.js Integration: Client-side inference without server requirements
- GradCAM Analysis: Visualization of model attention areas for false negative cases
- Comprehensive Dataset: Training on positive and negative brain tumor cases
TumourTrace/
├── TumourTrace.ipynb # Main Jupyter notebook for model training
├── index.html # Web application interface
├── requirements.txt # Python dependencies
├── tfjs_model/ # TensorFlow.js model files
│ ├── model.json
│ └── group1-shard*.bin
├── brain-tumor-dataset/ # Training dataset
│ └── Brain_Tumor_Dataset/
│ ├── Positive/ # MRI images with tumors
│ └── Negative/ # MRI images without tumors
├── gradcam_false_negatives/ # GradCAM analysis of false negatives
└── venv39/ # Python virtual environment
- Python 3.9+
- Modern web browser with JavaScript enabled
- Git (for cloning the repository)
-
Clone the repository
git clone <repository-url> cd TumourTrace
-
Set up Python environment
python -m venv venv39 source venv39/bin/activate # On macOS/Linux # or venv39\Scripts\activate # On Windows
-
Install dependencies
pip install -r requirements.txt
-
Start a local server (required for TensorFlow.js to load the model):
python -m http.server 8000
-
Open your browser and navigate to:
http://localhost:8000 -
Upload an MRI image and get instant tumor detection results
-
Launch Jupyter:
jupyter notebook TumourTrace.ipynb
-
Run the cells to:
- Load and preprocess the dataset
- Train the CNN model
- Evaluate model performance
- Generate GradCAM visualizations
- Export the model to TensorFlow.js format
The project uses a Convolutional Neural Network (CNN) with the following characteristics:
- Input: 180x180 RGB MRI images
- Architecture: Sequential CNN with multiple conv/pooling layers
- Output: Binary classification (Tumor/No Tumor)
- Framework: TensorFlow/Keras
- Deployment: TensorFlow.js for web inference
The model is trained on a comprehensive brain tumor dataset containing:
- Positive cases: MRI images showing brain tumors
- Negative cases: MRI images without tumors
- Image format: JPG files at 180x180 resolution
- Split: 80% training, 20% validation
The project includes advanced analysis features:
- GradCAM Visualization: Understanding what regions the model focuses on
- False Negative Analysis: Special attention to missed tumor cases
- Performance Metrics: Accuracy, precision, recall, and F1-score evaluation
Key libraries used in this project:
- TensorFlow 2.x
- Keras
- NumPy
- Matplotlib
- Jupyter Notebook
- TensorFlow.js (for web deployment)
The training process includes:
- Data preprocessing and augmentation
- CNN architecture design
- Model compilation with appropriate loss function
- Training with validation monitoring
- Model evaluation and metrics calculation
- Export to TensorFlow.js format
The web interface features:
- HTML5 file upload
- Canvas-based image preview
- TensorFlow.js model loading
- Real-time prediction display
- Responsive design for mobile compatibility
- Training Accuracy: [To be filled based on your results]
- Validation Accuracy: [To be filled based on your results]
- Model Size: Optimized for web deployment
- Inference Time: Near real-time prediction in browser
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This tool is intended for educational and research purposes only. It should not be used as a substitute for professional medical diagnosis. Always consult with qualified healthcare professionals for medical advice and diagnosis.
For questions, suggestions, or collaborations, please reach out:
- Project: TumourTrace
- Purpose: Brain Tumor Detection using Deep Learning
- Technologies: TensorFlow, JavaScript, HTML5, Python
- Brain tumor dataset contributors
- TensorFlow and Keras communities
- Open source machine learning community
- Medical imaging research community
Made with ❤️ for advancing medical AI research