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
b16)1from PIL import Image
2from torchvision import transforms
3import timm
4import torch
5# Load model from Hugging Face Hub
6model = timm.create_model("hf_hub:Snarcy/RadioDino-b16", pretrained=True)
7model.eval()
8device = "cuda" if torch.cuda.is_available() else "cpu"
9model.to(device)
10# Load and preprocess a sample image
11image = Image.open("path/to/your/image").convert("RGB")
12transform = transforms.Compose([
13 transforms.Resize((224, 224)),
14 transforms.ToTensor(),
15 transforms.Normalize(mean=[0.485, 0.456, 0.406],
16 std=[0.229, 0.224, 0.225]),
17])
18input_tensor = transform(image).unsqueeze(0).to(device)
19# Forward pass to obtain feature embedding
20with torch.no_grad():
21 embedding = model(input_tensor)1@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}