Run this model with HF Jobs

Run itistamtran/vit_brain_tumor_multiclass_v2 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/itistamtran/vit_brain_tumor_multiclass_v2. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/itistamtran/vit_brain_tumor_multiclass_v2 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Vision Transformer for Brain Tumor Multiclass Classification (v2)

This model is a fine-tuned Vision Transformer (ViT) for multiclass brain tumor MRI classification. It predicts one of the following five classes:

β€’ Glioma
β€’ Meningioma
β€’ Pituitary Tumor
β€’ No Tumor
β€’ Unknown

The model is integrated into an online diagnostic support platform at https://www.medscanai.net/.


Model Details

  • Base Model: google/vit-base-patch16-224-in21k
  • Architecture: Vision Transformer
  • Image Size: 224 Γ— 224
  • Number of Classes: 5
  • License: CC-BY-NC 4.0
  • Intended Use: Research and educational purposes only
  • Not for clinical diagnosis

Dataset

The primary dataset is sourced from the Kaggle "Brain Tumor MRI Dataset" by Masoud Nickparvar.
Additional "unknown" category samples were collected from publicly available online sources to evaluate robustness.


Training

  • 20 epochs using Hugging Face Trainer
  • Learning rate: 3e-5
  • Augmentation: flips, rotation, brightness/contrast jittering
  • Optimizer: AdamW
  • Evaluation metric: Accuracy

Performance

Class Precision Recall F1-score
Glioma 0.97 0.98 0.98
Meningioma 0.97 0.96 0.97
No Tumor 0.99 1.00 0.99
Pituitary 0.99 0.99 0.99
Unknown 1.00 0.99 1.00

Overall accuracy: 98 percent


How to Use

from transformers import AutoModelForImageClassification, AutoImageProcessor
from PIL import Image
import torch

model = AutoModelForImageClassification.from_pretrained("itistamtran/vit_brain_tumor_multiclass_v2")
processor = AutoImageProcessor.from_pretrained("itistamtran/vit_brain_tumor_multiclass_v2")

image = Image.open("mri_image.png")
inputs = processor(images=image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)
    preds = outputs.logits.argmax(dim=1)
print(preds)
Downloads last month
25
Safetensors
Model size
85.8M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for itistamtran/vit_brain_tumor_multiclass_v2

Finetuned
(2,597)
this model

Spaces using itistamtran/vit_brain_tumor_multiclass_v2 2