Image Feature Extraction
timm
Safetensors
microscopy
single-cell
self-supervised
dinov2
vision-transformer
biology
Instructions to use CSEM-AI4LS/scdino-v2-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use CSEM-AI4LS/scdino-v2-base with timm:
import timm model = timm.create_model("hf-hub:CSEM-AI4LS/scdino-v2-base", pretrained=True) - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- README.md +48 -0
- config.json +77 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: timm
|
| 3 |
+
license: mit
|
| 4 |
+
pipeline_tag: image-feature-extraction
|
| 5 |
+
inference: false # the widget cannot feed 5-channel TIFFs
|
| 6 |
+
tags:
|
| 7 |
+
- microscopy
|
| 8 |
+
- single-cell
|
| 9 |
+
- self-supervised
|
| 10 |
+
- dinov2
|
| 11 |
+
- vision-transformer
|
| 12 |
+
- biology
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# scdino-v2-base
|
| 16 |
+
|
| 17 |
+
Self-supervised Vision Transformer (DINOv2) for 5-channel
|
| 18 |
+
single-cell microscopy crops of human peripheral blood mononuclear cells (PBMCs). It returns one
|
| 19 |
+
128-dimensional embedding per crop.
|
| 20 |
+
|
| 21 |
+
- **Input:** 50x50 px crops, channels in the order 1 647 nm (CD3 APC, CD14 Alexa Fluor 647), 2 brightfield, 3 DAPI, 4 488 nm (CD4 FITC, CD19 FITC), 5 594 nm (CD8 PE, CD16 PE, CD56 PE, CD20 Alexa Fluor 594).
|
| 22 |
+
- **Data:** A labelled set of more than 1.3 million single-cell images of seven immune cell types is openly available: [Morphologically annotated single-cell images of human PBMCs](https://doi.org/10.3929/ethz-c-000806089).
|
| 23 |
+
|
| 24 |
+
## Usage
|
| 25 |
+
|
| 26 |
+
See the README of the code repository, https://github.com/JonasMeirer/scDINOv2, for how to load the model,
|
| 27 |
+
preprocess crops and evaluate embeddings. The preprocessing statistics are part
|
| 28 |
+
of the model: they are stored in `config.json` under `scdino_preprocessing`,
|
| 29 |
+
and the embeddings are only correct when you apply them.
|
| 30 |
+
|
| 31 |
+
## Intended use and limits
|
| 32 |
+
|
| 33 |
+
- **Use:** feature extraction for single-cell crops, then kNN, clustering or a
|
| 34 |
+
linear probe. Inference only.
|
| 35 |
+
- **One dataset, one imaging setup.** Other microscopes, stains, channel orders
|
| 36 |
+
or crop sizes need at least new normalization statistics, and probably
|
| 37 |
+
retraining.
|
| 38 |
+
- **Not a diagnostic tool, and not for clinical use.**
|
| 39 |
+
|
| 40 |
+
## Citation
|
| 41 |
+
|
| 42 |
+
```bibtex
|
| 43 |
+
TODO bibtex entry (paper or Zenodo DOI)
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## License
|
| 47 |
+
|
| 48 |
+
MIT, like the scDINO code. Training used timm (Apache-2.0) and code vendored from Lightly (MIT). No DINOv3 code was involved in this model, so the DINOv3 License Agreement does not apply to it.
|
config.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architecture": "vit_base_patch16_224",
|
| 3 |
+
"num_classes": 0,
|
| 4 |
+
"num_features": 128,
|
| 5 |
+
"global_pool": "token",
|
| 6 |
+
"model_args": {
|
| 7 |
+
"img_size": 56,
|
| 8 |
+
"patch_size": 4,
|
| 9 |
+
"in_chans": 5,
|
| 10 |
+
"embed_dim": 128,
|
| 11 |
+
"depth": 12,
|
| 12 |
+
"num_heads": 8,
|
| 13 |
+
"mlp_ratio": 4,
|
| 14 |
+
"reg_tokens": 8,
|
| 15 |
+
"init_values": 1e-05,
|
| 16 |
+
"dynamic_img_size": true,
|
| 17 |
+
"num_classes": 0
|
| 18 |
+
},
|
| 19 |
+
"pretrained_cfg": {
|
| 20 |
+
"custom_load": false,
|
| 21 |
+
"input_size": [
|
| 22 |
+
5,
|
| 23 |
+
56,
|
| 24 |
+
56
|
| 25 |
+
],
|
| 26 |
+
"fixed_input_size": true,
|
| 27 |
+
"interpolation": "bilinear",
|
| 28 |
+
"crop_pct": 1.0,
|
| 29 |
+
"crop_mode": "center",
|
| 30 |
+
"mean": [
|
| 31 |
+
0.0972,
|
| 32 |
+
0.7408,
|
| 33 |
+
0.103,
|
| 34 |
+
0.0761,
|
| 35 |
+
0.0893
|
| 36 |
+
],
|
| 37 |
+
"std": [
|
| 38 |
+
0.141,
|
| 39 |
+
0.118,
|
| 40 |
+
0.1694,
|
| 41 |
+
0.1051,
|
| 42 |
+
0.0972
|
| 43 |
+
],
|
| 44 |
+
"num_classes": 0,
|
| 45 |
+
"pool_size": null,
|
| 46 |
+
"first_conv": null,
|
| 47 |
+
"classifier": "head"
|
| 48 |
+
},
|
| 49 |
+
"scdino_variant": "dinov2",
|
| 50 |
+
"scdino_preprocessing": {
|
| 51 |
+
"norm_type": "clip_max",
|
| 52 |
+
"clip_mode": "clip_and_scale",
|
| 53 |
+
"input_layout": "HWC",
|
| 54 |
+
"max_vals_clip": [
|
| 55 |
+
3713.48,
|
| 56 |
+
1297.59,
|
| 57 |
+
6904.38,
|
| 58 |
+
3412.43,
|
| 59 |
+
3133.96
|
| 60 |
+
],
|
| 61 |
+
"mean": [
|
| 62 |
+
0.0972,
|
| 63 |
+
0.7408,
|
| 64 |
+
0.103,
|
| 65 |
+
0.0761,
|
| 66 |
+
0.0893
|
| 67 |
+
],
|
| 68 |
+
"std": [
|
| 69 |
+
0.141,
|
| 70 |
+
0.118,
|
| 71 |
+
0.1694,
|
| 72 |
+
0.1051,
|
| 73 |
+
0.0972
|
| 74 |
+
],
|
| 75 |
+
"resize": 56
|
| 76 |
+
}
|
| 77 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:60219ef9d089bba29903593e5a2b49c7424c895f4f9fba7af7c66e454c99e053
|
| 3 |
+
size 9696824
|