Downloads · 30 days
10
8% of all-time downloads
cagrigungor/brainbenigntumorclassification
brainbenigntumorclassification is a machine learning model from cagrigungor. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for keras. The card lists the license as apache-2.0.
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 us…
Downloads · 30 days
10
8% of all-time downloads
All-time downloads
129
Public
Repo size
33.9 MB
Likes
2
Public
Click a slice to open those files.
.keras33.9 MB · 100%
From the Hugging Face model README
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.
(224, 224, 3).keras (SavedModel)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))