Brain Cancer Detection
Model Description
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.
Model Architecture
- Base Model: EfficientNet-B0
- Framework: PyTorch
- Task: Binary / Multi-class image classification
- Input: MRI brain scan images (RGB, resized to model input size)
Training Details
- Dataset: Brain MRI tumor classification dataset (e.g., Kaggle Brain MRI Dataset)
- Approach: Transfer learning with EfficientNet-B0 pre-trained on ImageNet, fine-tuned on brain MRI data
- Augmentations: Random flips, rotations, normalization
Performance
Evaluated on held-out test split from the brain MRI dataset. Achieves high accuracy in distinguishing tumor from non-tumor MRI scans.
Files
| File | Description |
|---|---|
brain_model.pth |
Final fine-tuned model weights |
efficientnet_b0.pth |
EfficientNet-B0 backbone weights |
Usage
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())
Download & Use
from huggingface_hub import hf_hub_download
model_path = hf_hub_download(repo_id='devanshty/brain-cancer-detection', filename='brain_model.pth')
Disclaimer
This model is intended for research and educational purposes only. It should not be used as a substitute for professional medical diagnosis.