File size: 2,398 Bytes
ab776a3 790a764 ab776a3 790a764 ab776a3 93928b2 ab776a3 790a764 ab776a3 93928b2 790a764 93928b2 790a764 93928b2 790a764 | 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 | ---
license: mit
pipeline_tag: image-feature-extraction
tags:
- cell representation
- histology
- medical imaging
- self-supervised learning
- vision transformer
- foundation model
---
# Model card for LEMON
`LEMON` (Learning Embeddings from Morphology Of Nuclei) is an open-source foundation model for single-cell histology images, presented in the paper [LEMON: a foundation model for nuclear morphology in Computational Pathology](https://arxiv.org/abs/2603.25802).
The model is a Vision Transformer (ViT-s/8) trained using self-supervised learning on a dataset of 10 million histology cell images sampled from 10,000 slides from TCGA.
`LEMON` can be used to extract robust features from single-cell histology images for various downstream applications, such as gene expression prediction or cell type classification.
## How to use it to extract features
The code below can be used to run inference. `LEMON` expects images of size 40x40 that were extracted at 0.25 microns per pixel (40X). Note that the code requires the `model.py` script provided in the repository.
```python
import torch
from pathlib import Path
from torchvision.transforms import ToPILImage
from model import prepare_transform, get_vit_feature_extractor
device = "cpu"
model_name = "vits8"
target_cell_size = 40
weight_path = Path("lemon.pth.tar")
stats_path = Path("mean_std.json")
# Model
transform = prepare_transform(stats_path, size=target_cell_size)
model = get_vit_feature_extractor(weight_path, model_name, img_size=target_cell_size)
model.eval()
model.to(device)
# Data
input = torch.rand(3, target_cell_size, target_cell_size)
input = ToPILImage()(input)
# Inference
with torch.autocast(device_type=device, dtype=torch.float16):
with torch.inference_mode():
features = model(transform(input).unsqueeze(0).to(device))
assert features.shape == (1, 384)
```
## Citation
If you found our work useful in your research, please consider citing our work:
```bibtex
@misc{chadoutaud2026lemonfoundationmodelnuclear,
title={LEMON: a foundation model for nuclear morphology in Computational Pathology},
author={Loïc Chadoutaud and Alice Blondel and Hana Feki and Jacqueline Fontugne and Emmanuel Barillot and Thomas Walter},
year={2026},
eprint={2603.25802},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2603.25802},
}
``` |