Feature Extraction
timm
Safetensors
self-supervised
histology
computational-pathology
foundation-model
Instructions to use 1aurent/vit_base_patch8_224.lemon with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use 1aurent/vit_base_patch8_224.lemon with timm:
import timm model = timm.create_model("hf-hub:1aurent/vit_base_patch8_224.lemon", pretrained=True) - Notebooks
- Google Colab
- Kaggle
Add vit_base_patch8_224.lemon (timm re-upload of official upstream checkpoint; bit-identical weights, parity PASS)
Browse files- README.md +72 -0
- config.json +38 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- timm
|
| 4 |
+
- feature-extraction
|
| 5 |
+
- self-supervised
|
| 6 |
+
- histology
|
| 7 |
+
- computational-pathology
|
| 8 |
+
- foundation-model
|
| 9 |
+
- arxiv:2603.25802
|
| 10 |
+
library_name: timm
|
| 11 |
+
license: mit
|
| 12 |
+
pipeline_tag: feature-extraction
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Model card for vit_base_patch8_224.lemon
|
| 16 |
+
|
| 17 |
+
A Vision Transformer (ViT) single-cell nuclear morphology model. \
|
| 18 |
+
Trained with MoCo v3 on ~10M 40x40 px single-cell images from ~10k TCGA slides (LEMON).
|
| 19 |
+
|
| 20 |
+
## Model Details
|
| 21 |
+
|
| 22 |
+
- **Model Type:** Feature backbone
|
| 23 |
+
- **Model Stats:**
|
| 24 |
+
- - Params: 85.8M (base)
|
| 25 |
+
- - Image size: 40 x 40 x 3
|
| 26 |
+
- - Patch size: 8 x 8 x 3
|
| 27 |
+
- **Papers:**
|
| 28 |
+
- - [LEMON: a foundation model for nuclear morphology in Computational Pathology](https://arxiv.org/abs/2603.25802)
|
| 29 |
+
- **Original:** https://huggingface.co/aliceblondel/LEMON (lemon_vitb8.pth.tar)
|
| 30 |
+
- **License:** [MIT](https://huggingface.co/aliceblondel/LEMON)
|
| 31 |
+
|
| 32 |
+
## Model Usage
|
| 33 |
+
|
| 34 |
+
### Image Embeddings
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
from urllib.request import urlopen
|
| 38 |
+
from PIL import Image
|
| 39 |
+
import timm
|
| 40 |
+
|
| 41 |
+
# get example image
|
| 42 |
+
img = Image.open(
|
| 43 |
+
urlopen("https://github.com/owkin/HistoSSLscaling/raw/main/assets/example.tif")
|
| 44 |
+
).convert('RGB')
|
| 45 |
+
|
| 46 |
+
# load model from the hub
|
| 47 |
+
model = timm.create_model(
|
| 48 |
+
model_name="hf-hub:1aurent/vit_base_patch8_224.lemon",
|
| 49 |
+
pretrained=True,
|
| 50 |
+
).eval()
|
| 51 |
+
|
| 52 |
+
# get model specific transforms (normalization, resize)
|
| 53 |
+
data_config = timm.data.resolve_model_data_config(model)
|
| 54 |
+
transforms = timm.data.create_transform(**data_config, is_training=False)
|
| 55 |
+
|
| 56 |
+
data = transforms(img).unsqueeze(0) # input is a (batch_size, num_channels, img_size, img_size) shaped tensor
|
| 57 |
+
output = model(data) # output is a (batch_size, num_features) shaped tensor
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Citation
|
| 61 |
+
|
| 62 |
+
```bibtex
|
| 63 |
+
@misc{chadoutaud2026lemon,
|
| 64 |
+
title = {LEMON: a foundation model for nuclear morphology in Computational Pathology},
|
| 65 |
+
author = {Chadoutaud, Loïc and Blondel, Alice and Feki, Hana and Fontugne, Jacqueline and Barillot, Emmanuel and Walter, Thomas},
|
| 66 |
+
year = {2026},
|
| 67 |
+
eprint = {2603.25802},
|
| 68 |
+
archivePrefix = {arXiv},
|
| 69 |
+
primaryClass = {cs.CV},
|
| 70 |
+
url = {https://arxiv.org/abs/2603.25802}
|
| 71 |
+
}
|
| 72 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architecture": "vit_base_patch8_224",
|
| 3 |
+
"num_classes": 0,
|
| 4 |
+
"num_features": 768,
|
| 5 |
+
"global_pool": "token",
|
| 6 |
+
"model_args": {
|
| 7 |
+
"img_size": 40,
|
| 8 |
+
"num_classes": 0
|
| 9 |
+
},
|
| 10 |
+
"pretrained_cfg": {
|
| 11 |
+
"hf_hub_id": "1aurent/vit_base_patch8_224.lemon",
|
| 12 |
+
"tag": "lemon",
|
| 13 |
+
"input_size": [
|
| 14 |
+
3,
|
| 15 |
+
40,
|
| 16 |
+
40
|
| 17 |
+
],
|
| 18 |
+
"fixed_input_size": true,
|
| 19 |
+
"interpolation": "bilinear",
|
| 20 |
+
"crop_pct": 1.0,
|
| 21 |
+
"crop_mode": "center",
|
| 22 |
+
"mean": [
|
| 23 |
+
0.5626310706138611,
|
| 24 |
+
0.3856309652328491,
|
| 25 |
+
0.5453572869300842
|
| 26 |
+
],
|
| 27 |
+
"std": [
|
| 28 |
+
0.18103212118148804,
|
| 29 |
+
0.1668265014886856,
|
| 30 |
+
0.13694556057453156
|
| 31 |
+
],
|
| 32 |
+
"num_classes": 0,
|
| 33 |
+
"first_conv": "patch_embed.proj",
|
| 34 |
+
"classifier": "head",
|
| 35 |
+
"license": "mit",
|
| 36 |
+
"custom_load": false
|
| 37 |
+
}
|
| 38 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2178706ecaf540176b777b374f5d5298c1433b8b8796b38fd1431b2f95231f30
|
| 3 |
+
size 340913760
|