CoolFace
Modelpublic

rabbitarii/densenet121-brain-tumor-detection

sourceHugging Faceupdated 1mo agoView on Hugging Face
0likes19downloads
Model Card

DenseNet121 fine-tuned on the Brain Tumor Detection Dataset

Fine-tuned from torchvision ImageNet-pretrained DenseNet121 on the Brain Tumor Detection Dataset (5,249 MRI images, YOLO-annotated; classes used here as image-level labels: glioma, meningioma, notumor, pituitary). Only the tumor-class label was used for training — the bounding boxes were not.

Test accuracy: 0.9738 Test loss: 0.0783

Usage

This is a plain PyTorch state_dict saved as .safetensors (not a transformers model). Rebuild the architecture and load the weights:

python
import torch
from torchvision.models import densenet121
from safetensors.torch import load_file

model = densenet50(weights=None)
model.fc = torch.nn.Linear(model.fc.in_features, 4)
model.load_state_dict(load_file("model.safetensors"))
model.eval()

Preprocess inputs to 224x224 RGB, normalized with mean [0.485, 0.456, 0.406] and std [0.229, 0.224, 0.225] (see config.json for the full label mapping).

⚠️ Disclaimer

Trained for research/educational purposes only. This is not a medical device and must not be used for real clinical diagnosis or treatment decisions.