Downloads · 30 days
0
devanshty/brain-cancer-detection
brain-cancer-detection is a image classification model from devanshty. Use it when you need a label for an image. The card lists the license as mit.
A fine-tuned EfficientNet-B0 model for classifying brain MRI scans into tumor vs. non-tumor categories. Trained to assist radiologists and medical professionals in the early detection of brain cancer from MRI images.
Downloads · 30 days
0
Access
Public
Updated Aug 22, 2026
Repo size
67.4 MB
Likes
0
Public
Click a slice to open those files.
.pth61.1 MB · 91%
From the Hugging Face model README
A fine-tuned EfficientNet-B0 model for classifying brain MRI scans into tumor vs. non-tumor categories. Trained to assist radiologists and medical professionals in the early detection of brain cancer from MRI images.
Evaluated on held-out test split from the brain MRI dataset. Achieves high accuracy in distinguishing tumor from non-tumor MRI scans.
| File | Description |
|---|---|
brain_model.pth | Final fine-tuned model weights |
efficientnet_b0.pth | EfficientNet-B0 backbone weights |
import torch
import torchvision.transforms as transforms
from PIL import Image
from huggingface_hub import hf_hub_download
# Download model
model_path = hf_hub_download(repo_id='devanshty/brain-cancer-detection', filename='brain_model.pth')
# Load model (adjust to your model class definition)
model = torch.load(model_path, map_location='cpu')
model.eval()
# Preprocess image
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
img = Image.open('brain_mri.jpg').convert('RGB')
input_tensor = transform(img).unsqueeze(0)
# Inference
with torch.no_grad():
output = model(input_tensor)
prediction = torch.argmax(output, dim=1)
print("Predicted class:", prediction.item())
from huggingface_hub import hf_hub_download
model_path = hf_hub_download(repo_id='devanshty/brain-cancer-detection', filename='brain_model.pth')
This model is intended for research and educational purposes only. It should not be used as a substitute for professional medical diagnosis.