Views
No views yet
🧠 Developed by Luca Zedda, Andrea Loddo, and Cecilia Di Ruberto
🏥 Department of Mathematics and Computer Science, University of Cagliari
📄 Published in: Computers in Biology and Medicine, 2025
s16)1from PIL import Image
2from torchvision import transforms
3import timm
4import torch
5
6# Load model from Hugging Face Hub
7model = timm.create_model("hf_hub:Snarcy/RadioDino-s16", pretrained=True)
8model.eval()
9device = "cuda" if torch.cuda.is_available() else "cpu"
10model.to(device)
11
12# Load and preprocess a sample image
13image = Image.open("path/to/your/image").convert("RGB")
14transform = transforms.Compose([
15 transforms.Resize((224, 224)),
16 transforms.ToTensor(),
17 transforms.Normalize(mean=[0.485, 0.456, 0.406],
18 std=[0.229, 0.224, 0.225]),
19])
20input_tensor = transform(image).unsqueeze(0).to(device)
21
22# Forward pass to obtain feature embedding
23with torch.no_grad():
24 embedding = model(input_tensor)
251@article{ZEDDA2025110583,
2 title = {Radio DINO: A foundation model for advanced radiomics and AI-driven medical imaging analysis},
3 journal = {Computers in Biology and Medicine},
4 volume = {195},
5 pages = {110583},
6 year = {2025},
7 issn = {0010-4825},
8 doi = {https://doi.org/10.1016/j.compbiomed.2025.110583},
9 url = {https://www.sciencedirect.com/science/article/pii/S0010482525009345},
10 author = {Luca Zedda and Andrea Loddo and Cecilia {Di Ruberto}},
11 keywords = {Radiomics, Self-supervised learning, Deep learning, DINO, DINOV2, Medical imaging, Feature extraction, Generalizability},
12}