Brain tumor Detection by CT Scan

Brain Tumor Detection Model ๐Ÿง  This Brain Tumor Detection Model is a Convolutional Neural Network (CNN) trained to classify brain CT scan images into two categories:

Healthy (No Tumor) Tumor Detected The model is designed to assist healthcare professionals by providing an automated solution for detecting brain tumors in CT scans. With high accuracy and balanced metrics, it is a reliable tool for preliminary screening and decision support.

Model Performance

Precision- 97% Recall - 97% F1-Score - 97% Accuracy - 97%

False Positives (Healthy misclassified as Tumor): 17 False Negatives (Tumor misclassified as Healthy): 15

Model Strengths High Accuracy: Achieves a test accuracy of 97%, making it reliable for tumor detection. Balanced Metrics: Precision and recall are well-balanced across both classes. Low False Negatives: The model minimizes missed tumor cases, crucial for medical applications. Efficient Architecture: Lightweight CNN architecture ensures quick inference times, suitable for real-time applications.

Model Limitations

No Multi-Class Support: The model supports binary classification (Healthy/Tumor); it cannot classify tumor subtypes.

# Example Code: Want To Quick try our model?just copy paste this code on colab

# Step 1: Install Required Libraries
!pip install huggingface_hub

# Step 2: Import Necessary Libraries
import tensorflow as tf
from tensorflow.keras.preprocessing.image import load_img, img_to_array
from huggingface_hub import hf_hub_download
import numpy as np
from google.colab import files
import os

# Step 3: Download Model from Hugging Face
model_path = hf_hub_download(repo_id="krishnamishra8848/Brain_Tumor_Detection_Model", filename="brain_tumor_model.h5")

# Step 4: Load the Model
model = tf.keras.models.load_model(model_path)

# Step 5: Upload an Image
print("Please upload an image to test:")
uploaded = files.upload()

# Step 6: Process the Uploaded Image
for file_name in uploaded.keys():
    # Load and preprocess the image
    img_path = file_name
    IMG_HEIGHT, IMG_WIDTH = 128, 128  # Ensure this matches your model's input size
    img = load_img(img_path, target_size=(IMG_HEIGHT, IMG_WIDTH))  # Resize image
    img_array = img_to_array(img)  # Convert image to array
    img_array = np.expand_dims(img_array, axis=0)  # Add batch dimension
    img_array = img_array / 255.0  # Normalize pixel values to [0, 1]

    # Step 7: Make Prediction
    prediction = model.predict(img_array)[0][0]
    confidence = prediction if prediction > 0.5 else 1 - prediction

    # Step 8: Display Result
    if prediction > 0.5:
        print(f"Prediction: Tumor Detected with {confidence:.2f} confidence.")
    else:
        print(f"Prediction: Healthy with {confidence:.2f} confidence.")

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Examples
Unable to determine this model's library. Check the docs .

Space using krishnamishra8848/Brain_Tumor_Detection_Model 1