Views
No views yet
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.state_dict saved as .safetensors (not a transformers model).
Rebuild the architecture and load the weights:1import torch
2from torchvision.models import densenet121
3from safetensors.torch import load_file
4
5model = densenet50(weights=None)
6model.fc = torch.nn.Linear(model.fc.in_features, 4)
7model.load_state_dict(load_file("model.safetensors"))
8model.eval()[0.485, 0.456, 0.406] and
std [0.229, 0.224, 0.225] (see config.json for the full label mapping).