Update README.md
Browse files
README.md
CHANGED
|
@@ -2,4 +2,47 @@
|
|
| 2 |
license: cc-by-nc-nd-4.0
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: cc-by-nc-nd-4.0
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
+
---
|
| 6 |
+
# Model Card for StainNet
|
| 7 |
+
|
| 8 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
+
|
| 10 |
+
`StainNet` is a lightweight foundation model for special staining histology images.
|
| 11 |
+
|
| 12 |
+
The model is a Vision Transformer Small/16 with DINO [1] self-supervised pre-training on 1,418,938 patch images from 20,231 special staining whole slide images (WSIs) in HISTAI [2].
|
| 13 |
+
|
| 14 |
+
## Using StainNet to extract features
|
| 15 |
+
|
| 16 |
+
```python
|
| 17 |
+
import timm
|
| 18 |
+
import torch
|
| 19 |
+
|
| 20 |
+
model = timm.create_model('hf_hub:JWonderLand/StainNet', pretrained=True)
|
| 21 |
+
|
| 22 |
+
preprocess = transforms.Compose([
|
| 23 |
+
transforms.Resize(224, interpolation=transforms.InterpolationMode.BICUBIC),
|
| 24 |
+
transforms.ToTensor(),
|
| 25 |
+
transforms.Normalize(mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5)),
|
| 26 |
+
])
|
| 27 |
+
|
| 28 |
+
model = model.to('cuda')
|
| 29 |
+
model.eval()
|
| 30 |
+
|
| 31 |
+
input = torch.randn([1, 3, 224, 224]).cuda()
|
| 32 |
+
|
| 33 |
+
with torch.no_grad():
|
| 34 |
+
output = model(input) # [1, 384]
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Citation
|
| 38 |
+
|
| 39 |
+
If `StainNet` is helpful to you, please cite our work.
|
| 40 |
+
```
|
| 41 |
+
@misc{TBA
|
| 42 |
+
}
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## References
|
| 46 |
+
|
| 47 |
+
[1] Caron, M., Touvron, H., Misra, I., Jégou, H., Mairal, J., Bojanowski, P., & Joulin, A. (2021). Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 9650-9660).
|
| 48 |
+
[2] Nechaev, D., Pchelnikov, A., & Ivanova, E. (2025). HISTAI: An Open-Source, Large-Scale Whole Slide Image Dataset for Computational Pathology. arXiv preprint arXiv:2505.12120.
|