Skip to content

bhavya-323/TumourTrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TumourTrace 🧠

A deep learning-powered brain tumor detection system that uses computer vision to analyze MRI images and identify the presence of brain tumors.

🎯 Overview

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.

✨ Features

  • 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

🏗️ Project Structure

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

🚀 Quick Start

Prerequisites

  • Python 3.9+
  • Modern web browser with JavaScript enabled
  • Git (for cloning the repository)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd TumourTrace
  2. Set up Python environment

    python -m venv venv39
    source venv39/bin/activate  # On macOS/Linux
    # or
    venv39\Scripts\activate     # On Windows
  3. Install dependencies

    pip install -r requirements.txt

💻 Usage

Web Application

  1. Start a local server (required for TensorFlow.js to load the model):

    python -m http.server 8000
  2. Open your browser and navigate to:

    http://localhost:8000
    
  3. Upload an MRI image and get instant tumor detection results

Jupyter Notebook

  1. Launch Jupyter:

    jupyter notebook TumourTrace.ipynb
  2. 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

🧠 Model Architecture

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

📊 Dataset

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

🔬 Model Analysis

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

🛠️ Technical Details

Dependencies

Key libraries used in this project:

  • TensorFlow 2.x
  • Keras
  • NumPy
  • Matplotlib
  • Jupyter Notebook
  • TensorFlow.js (for web deployment)

Model Training

The training process includes:

  1. Data preprocessing and augmentation
  2. CNN architecture design
  3. Model compilation with appropriate loss function
  4. Training with validation monitoring
  5. Model evaluation and metrics calculation
  6. Export to TensorFlow.js format

Web Implementation

The web interface features:

  • HTML5 file upload
  • Canvas-based image preview
  • TensorFlow.js model loading
  • Real-time prediction display
  • Responsive design for mobile compatibility

📈 Performance

  • 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

🤝 Contributing

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.

Development Setup

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Disclaimer

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.

📞 Contact

For questions, suggestions, or collaborations, please reach out:

  • Project: TumourTrace
  • Purpose: Brain Tumor Detection using Deep Learning
  • Technologies: TensorFlow, JavaScript, HTML5, Python

🙏 Acknowledgments

  • Brain tumor dataset contributors
  • TensorFlow and Keras communities
  • Open source machine learning community
  • Medical imaging research community

Made with ❤️ for advancing medical AI research

About

A deep learning-powered brain tumor detection system.

Resources

Stars

Watchers

Forks