File size: 3,943 Bytes
9adf01f
50c97ee
 
 
 
 
9adf01f
50c97ee
9adf01f
50c97ee
 
 
 
 
 
 
9adf01f
50c97ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9adf01f
 
50c97ee
9adf01f
50c97ee
9adf01f
50c97ee
9adf01f
50c97ee
9adf01f
 
 
 
 
50c97ee
 
 
 
 
9adf01f
 
50c97ee
 
9adf01f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50c97ee
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
---
datasets:
- Elsafty
- Chula
- DSE
library_name: timm
license: cc-by-4.0
pipeline_tag: image-feature-extraction
tags:
- red-blood-cells
- hematology
- medical-imaging
- vision-transformer
- dino
- dinov2
- foundation-model
model-index:
- name: RedDino-small
  results:
  - task:
      type: image-classification
      name: RBC Shape Classification
    dataset:
      name: Elsafty
      type: Classification
    metrics:
    - type: Weighted F1
      value: 86.0
    - type: Balanced Accuracy
      value: 87.2
    - type: Accuracy
      value: 86.2
    - type: Weighted F1
      value: 84.3
    - type: Balanced Accuracy
      value: 78.5
    - type: Accuracy
      value: 84.4
    - type: Weighted F1
      value: 84.9
    - type: Balanced Accuracy
      value: 56.5
    - type: Accuracy
      value: 84.9
---

# RedDino: A foundation model for red blood cell analysis

[📄 Paper](https://arxiv.org/abs/2508.08180) | [💻 Code](https://github.com/Snarci/RedDino)

**RedDino** is a self-supervised Vision Transformer foundation model specifically designed for **red blood cell (RBC)** image analysis. This variant, **RedDino-small**, is the compact model in the family, delivering strong performance with lighter computational cost.

It leverages a tailored version of the **DINOv2** framework, trained on a meticulously curated dataset of 1.25 million RBC images from diverse acquisition modalities and sources. The model excels at extracting robust features for downstream hematology tasks such as **shape classification**, **morphological subtype recognition**, and **batch-effect–robust analysis**.

---

## Model Details

-   **Architecture:** ViT-small, patch size 14
-   **SSL framework:** DINOv2 (customized for RBC morphology)
-   **Pretraining dataset:** Curated RBC images from 18 datasets (multiple modalities and sources)
-   **Embedding size:** 384
-   **Intended use:** RBC morphology classification, feature extraction, batch-effect–robust analysis

Notes:
-   Trained with RBC-specific augmentations and DINOv2 customizations (e.g., removal of KoLeo regularizer; Sinkhorn-Knopp centering).
-   Optimized using smear patches rather than only single-cell crops to improve generalization across sources.

## Example Usage

```python
from PIL import Image
from torchvision import transforms
import timm
import torch

# Load model from Hugging Face Hub
model = timm.create_model("hf_hub:Snarcy/RedDino-small", pretrained=True)
model.eval()
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)

# Load and preprocess image
image = Image.open("path/to/rbc_image.jpg").convert("RGB")
transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406],
                         std=[0.229, 0.224, 0.225]),
])
input_tensor = transform(image).unsqueeze(0).to(device)

# Extract features
with torch.no_grad():
    embedding = model(input_tensor)
```
## 📝 Citation

If you use this model, please cite the following paper:

**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

```bibtex
@misc{zedda2025reddinofoundationmodelred,
      title={RedDino: A foundation model for red blood cell analysis}, 
      author={Luca Zedda and Andrea Loddo and Cecilia Di Ruberto and Carsten Marr},
      year={2025},
      eprint={2508.08180},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2508.08180}, 
}
```

---

## Summary

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.