Armanx200 / Brain-Tumor-Detector

🧠 A deep learning model that classifies brain images as either having a tumor or not.

Home Page:https://github.com/Armanx200

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

# 🧠 Brain Tumor Detection with Deep Learning

Welcome to the **Brain Tumor Detection** project! This repository contains a deep learning model that classifies brain images as either having a tumor or not. Dive into the power of convolutional neural networks (CNNs) and see how they can be used in medical imaging! πŸš€

## πŸ“ Project Structure

```plaintext
brain-tumor-detection/
β”‚
β”œβ”€β”€ brain_tumor_dataset/
β”‚   β”œβ”€β”€ no/         # Images without tumors
β”‚   └── yes/        # Images with tumors
β”‚
β”œβ”€β”€ Brain-tumor-detector.py        # Model training and evaluation
└── Brain-tumor-probability.py     # Tumor probability prediction for a specific image

πŸ“œ Description

This project uses a CNN model to classify brain images into two categories:

  • No tumor (stored in brain_tumor_dataset/no)
  • Tumor (stored in brain_tumor_dataset/yes)

πŸ› οΈ Getting Started

  1. Clone the repository:

    git clone https://github.com/Armanx200/Brain-tumor-detector.git
    cd Brain-tumor-detector
  2. Install dependencies:

    pip install tensorflow opencv-python scikit-learn
  3. Download the dataset:

    • Ensure you have the brain tumor dataset in the correct structure as shown above.

πŸš€ Training the Model

Run the Brain-tumor-detector.py script to train the model:

python Brain-tumor-detector.py

This script:

  • Loads and preprocesses the dataset.
  • Splits the data into training and testing sets.
  • Builds and trains a CNN model.
  • Evaluates the model and displays the test accuracy.

πŸ” Predicting Tumor Probability

To predict the probability of a specific image having a tumor, use the Brain-tumor-probability.py script:

  1. Ensure the model is trained and saved as brain_tumor_model.h5.

  2. Run the prediction script:

    python Brain-tumor-probability.py

    This script will:

    • Load the trained model.
    • Preprocess the specified image.
    • Output the probability of the image being a tumor.

πŸ“Š Model Performance

The model achieves impressive accuracy on the test set. See the script output for detailed performance metrics.

πŸ› οΈ Tools and Technologies

  • TensorFlow/Keras: For building and training the neural network.
  • OpenCV: For image processing.
  • Scikit-learn: For data splitting and preprocessing.

πŸ“Έ Sample Results

Below is an example of how the model predicts the probability of an image being a tumor:

Sample Brain Image

Probability of the image being a tumor: 95.44%

🀝 Contributing

Contributions are welcome! Please create a pull request or open an issue for any improvements or bug fixes.

πŸ“œ License

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


Developed with ❀️ by Armanx200

About

🧠 A deep learning model that classifies brain images as either having a tumor or not.

https://github.com/Armanx200


Languages

Language:Python 100.0%