Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
datasets:
|
| 4 |
+
- benschill/brain-tumor-collection
|
| 5 |
+
metrics:
|
| 6 |
+
- accuracy
|
| 7 |
+
pipeline_tag: image-classification
|
| 8 |
---
|
| 9 |
+
|
| 10 |
+
# Brain Tumor Classification Model
|
| 11 |
+
|
| 12 |
+
## Overview
|
| 13 |
+
This repository contains a deep learning model for brain tumor classification using Hugging Face Transformers. The model has been trained on a brain tumor dataset consisting of 5712 training samples and validated on 1311 samples. It is designed to classify brain tumor images into four classes: 'glioma', 'meningioma', 'notumor', and 'pituitary'.
|
| 14 |
+
|
| 15 |
+
## Model Details
|
| 16 |
+
- **Framework**: Hugging Face Transformers
|
| 17 |
+
- **Dataset**: Brain Tumor Dataset
|
| 18 |
+
- **Training Data**: 5712 samples
|
| 19 |
+
- **Validation Data**: 1311 samples
|
| 20 |
+
- **Input Shape**: 130x130 pixels with 3 channels (RGB)
|
| 21 |
+
- **Data Preprocessing**: Data is normalized
|
| 22 |
+
- **Validation Accuracy**: 72%
|
| 23 |
+
|
| 24 |
+
## Classes
|
| 25 |
+
The model classifies brain tumor images into the following classes:
|
| 26 |
+
- 'glioma' (Class 0)
|
| 27 |
+
- 'meningioma' (Class 1)
|
| 28 |
+
- 'notumor' (Class 2)
|
| 29 |
+
- 'pituitary' (Class 3)
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
You can use this model for brain tumor classification tasks. Here's an example of how to load and use the model for predictions in Python:
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 36 |
+
import tensorflow as tf
|
| 37 |
+
import numpy as np
|
| 38 |
+
|
| 39 |
+
# Load the pre-trained model
|
| 40 |
+
model_name = "model/brain_tumor_model." # Replace with the actual model name
|
| 41 |
+
model = tf.keras.models.load_model(model_name)
|
| 42 |
+
|
| 43 |
+
# to get prediction
|
| 44 |
+
x = numpy array image
|
| 45 |
+
pred = np.argmax(model.predict(x),axis=-1)
|
| 46 |
+
|
| 47 |
+
# class label
|
| 48 |
+
class_labels = {0: 'glioma', 1: 'meningioma', 2: 'notumor', 3: 'pituitary'}
|