Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
# 🧠 Brain MRI Classification with TensorFlow and Streamlit
|
| 5 |
+
|
| 6 |
+
## 🇬🇧 English
|
| 7 |
+
|
| 8 |
+
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.
|
| 9 |
+
|
| 10 |
+
### 🧪 Model Information
|
| 11 |
+
|
| 12 |
+
- Input shape: `(224, 224, 3)`
|
| 13 |
+
- Model format: `.keras` (SavedModel)
|
| 14 |
+
- Output classes:
|
| 15 |
+
- 0: Glioma
|
| 16 |
+
- 1: Meningioma
|
| 17 |
+
- 2: Normal
|
| 18 |
+
- 3: Pituitary
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
### 🧠 Example Usage (Python Script)
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
from tensorflow.keras.models import load_model
|
| 26 |
+
from tensorflow.keras.preprocessing import image
|
| 27 |
+
import numpy as np
|
| 28 |
+
|
| 29 |
+
# Load the trained model
|
| 30 |
+
model = load_model('brainmri.keras')
|
| 31 |
+
|
| 32 |
+
# Load and preprocess the image
|
| 33 |
+
img = image.load_img('example.jpeg', target_size=(224, 224))
|
| 34 |
+
img_array = image.img_to_array(img) / 255.0
|
| 35 |
+
img_array = np.expand_dims(img_array, axis=0)
|
| 36 |
+
|
| 37 |
+
# Define class labels
|
| 38 |
+
classes = {
|
| 39 |
+
0: "Glioma",
|
| 40 |
+
1: "Meningioma",
|
| 41 |
+
2: "Normal",
|
| 42 |
+
3: "Pituitary"
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
# Make prediction
|
| 46 |
+
result = model.predict(img_array)
|
| 47 |
+
predicted_class = np.argmax(result)
|
| 48 |
+
|
| 49 |
+
# Print result
|
| 50 |
+
print("Predicted Class:", classes.get(predicted_class))
|