image-classification dataset:benschill/brain-tumor-collection license:apache-2.0 region:us
---
license: apache-2.0
datasets:
- benschill/brain-tumor-collection
metrics:
- accuracy
pipeline_tag: image-classification
---

# Brain Tumor Classification Model

## Overview
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'.

## Model Details
- **Framework**: Hugging Face Transformers
- **Dataset**: Brain Tumor Dataset
- **Training Data**: 5712 samples
- **Validation Data**: 1311 samples
- **Input Shape**: 130x130 pixels with 3 channels (RGB)
- **Data Preprocessing**: Data is normalized
- **Validation Accuracy**: 72%

## Classes
The model classifies brain tumor images into the following classes:
- 'glioma' (Class 0)
- 'meningioma' (Class 1)
- 'notumor' (Class 2)
- 'pituitary' (Class 3)

## Usage
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:

```python
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import tensorflow as tf
import numpy as np

# Load the pre-trained model
model_name = "model/brain_tumor_model.h5"  # Replace with the actual model name
model = tf.keras.models.load_model(model_name)

# to get prediction
x = numpy array image
pred = np.argmax(model.predict(x),axis=-1)

# class label
class_labels = {0: 'glioma', 1: 'meningioma', 2: 'notumor', 3: 'pituitary'}
