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/RedDino-small", pretrained=True)
8model.eval()
9device = "cuda" if torch.cuda.is_available() else "cpu"
10model.to(device)
11
12# Load and preprocess image
13image = Image.open("path/to/rbc_image.jpg").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# Extract features
23with torch.no_grad():
24 embedding = model(input_tensor)
RedDino: A foundation model for red blood cell analysis
Luca Zedda, Andrea Loddo, Cecilia Di Ruberto, Carsten Marr — 2025
Preprint: arXiv:2508.08180.
https://arxiv.org/abs/2508.08180
1@misc{zedda2025reddinofoundationmodelred,
2 title={RedDino: A foundation model for red blood cell analysis},
3 author={Luca Zedda and Andrea Loddo and Cecilia Di Ruberto and Carsten Marr},
4 year={2025},
5 eprint={2508.08180},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2508.08180},
9}
RedDino is the first family of foundation models tailored for comprehensive red blood cell image analysis, using large-scale self-supervised learning to set new performance benchmarks and generalization standards for computational hematology. Models and pretrained weights are available for research and practical deployment.