Views
No views yet
torchvision ImageNet-pretrained ResNet50 on the
Brain Tumor MRI Dataset
(classes: glioma, meningioma, notumor, pituitary).state_dict saved as .safetensors (not a transformers model).
Rebuild the architecture and load the weights:1import torch
2from torchvision.models import resnet50
3from safetensors.torch import load_file
4
5model = resnet50(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).