🧠 Brain MRI Classification with TensorFlow and Streamlit

🇬🇧 English

This project is a deep learning-based solution for classifying Brain MRI images into four categories: Glioma, Meningioma, Pituitary, and Normal. The classification model is trained using TensorFlow/Keras and can be used either programmatically or with a Streamlit web interface.

🧪 Model Information

  • Input shape: (224, 224, 3)
  • Model format: .keras (SavedModel)
  • Output classes:
    • 0: Glioma
    • 1: Meningioma
    • 2: Normal
    • 3: Pituitary

🧠 Example Usage (Python Script)

from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing import image
import numpy as np

# Load the trained model
model = load_model('brainmri.keras')

# Load and preprocess the image
img = image.load_img('example.jpeg', target_size=(224, 224))
img_array = image.img_to_array(img) / 255.0
img_array = np.expand_dims(img_array, axis=0)

# Define class labels
classes = {
    0: "Glioma",
    1: "Meningioma",
    2: "Normal",
    3: "Pituitary"
}

# Make prediction
result = model.predict(img_array)
predicted_class = np.argmax(result)

# Print result
print("Predicted Class:", classes.get(predicted_class))
Downloads last month
4
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support