Instructions to use MohammedAH/Brrain-MRI-Classification with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use MohammedAH/Brrain-MRI-Classification with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://MohammedAH/Brrain-MRI-Classification") - Notebooks
- Google Colab
- Kaggle
license: mit
language:
- en
pipeline_tag: image-classification
library_name: keras
🧠 Brain Tumor Multi-Class Classification (TensorFlow)
Model Details
Model Name: Brain Tumor Classification Model
Model Type: Multi-class Image Classification
Framework: TensorFlow / Keras
Architecture: Convolutional Neural Network (CNN) (or specify: e.g., EfficientNetB0, ResNet50, etc.)
Task: Classify brain MRI images into four categories:
- No Tumor
- Meningioma
- Glioma
- Pituitary Tumor
Intended Use
Primary Use Cases
- Assistive diagnostic tool for detecting brain tumor types from MRI scans
- Educational and research purposes
- Prototype for AI-powered medical imaging systems
Out-of-Scope Use
- Not intended for real-world clinical diagnosis without expert validation
- Should not replace medical professionals
Dataset
Type: Brain MRI images
Classes: 4 (No Tumor, Meningioma, Glioma, Pituitary)
Input Shape: (e.g., 224 × 224 × 3)
Preprocessing:
- Resizing to fixed dimensions
- Normalization (pixel values scaled to [0,1])
- Data augmentation (rotation, flipping, zooming)
(Add dataset source if public, e.g., Kaggle or hospital dataset)
Model Architecture
Base model: (e.g., EfficientNetB0 / Custom CNN)
Layers:
- Convolutional layers for feature extraction
- Pooling layers
- Fully connected dense layers
- Softmax output layer (4 neurons)
Loss Function: Categorical Crossentropy
Optimizer: Adam
Metrics: Accuracy, Precision, Recall
Training Details
- Epochs: (e.g., 20–50)
- Batch Size: (e.g., 16 or 32)
- Train/Validation Split: (e.g., 80/20)
- Hardware: CPU / GPU (specify if available)
Evaluation Results
| Metric | Value (example) |
|---|---|
| Accuracy | 92% |
| Precision | 91% |
| Recall | 90% |
| F1 Score | 90% |
Confusion Matrix Insights
- Strong performance on No Tumor and Pituitary
- Some confusion between Glioma and Meningioma (common in MRI tasks)
Limitations
Performance depends heavily on dataset quality and diversity
May not generalize well to:
- Different MRI machines
- Different populations
Class imbalance can affect predictions
Cannot explain predictions (unless paired with explainability tools like Grad-CAM)
Ethical Considerations
- Risk of misclassification in sensitive medical contexts
- Must include human oversight in real applications
- Dataset bias could affect fairness across demographics
How to Use
import tensorflow as tf
import numpy as np
import cv2
model = tf.keras.models.load_model("model.h5")
img = cv2.imread("image.jpg")
img = cv2.resize(img, (224, 224))
img = img / 255.0
img = np.expand_dims(img, axis=0)
prediction = model.predict(img)
classes = ["No Tumor", "Meningioma", "Glioma", "Pituitary"]
print("Prediction:", classes[np.argmax(prediction)])
Model Outputs
- Input: MRI brain image
- Output: Probability distribution across 4 classes
Example:
[0.85, 0.05, 0.07, 0.03]
→ No Tumor
Future Improvements
- Use transfer learning (EfficientNet, Vision Transformers)
- Add explainability (Grad-CAM heatmaps)
- Deploy with optimized inference (TensorFlow Lite)
- Improve dataset diversity and size
License
- Specify license (e.g., MIT, Apache 2.0)
Contact
- Name: (Your Name)
- Project: (e.g., NeuroScopeAI)
- Email/GitHub: (optional)
If you want, I can upgrade this into a Hugging Face model card format (README.md) so you can upload it directly with your model.