Instructions to use 1aurent/vit_base_patch16_224.pathoduet_ihc with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use 1aurent/vit_base_patch16_224.pathoduet_ihc with timm:
import timm model = timm.create_model("hf-hub:1aurent/vit_base_patch16_224.pathoduet_ihc", pretrained=True) - Notebooks
- Google Colab
- Kaggle
|
Download README.md from 1aurent/vit_base_patch16_224.pathoduet_ihc: direct link, hf CLI and curl.
- Browser
- Download file 2.24 kB
-
https://huggingface.co/1aurent/vit_base_patch16_224.pathoduet_ihc/resolve/main/README.md
- Command line
-
hf download hf://1aurent/vit_base_patch16_224.pathoduet_ihc/README.md
-
curl -L -o README.md https://huggingface.co/1aurent/vit_base_patch16_224.pathoduet_ihc/resolve/main/README.md
2.24 kB
| tags: | |
| - timm | |
| - feature-extraction | |
| - self-supervised | |
| - histology | |
| - foundation-model | |
| library_name: timm | |
| license: cc-by-nc-4.0 | |
| pipeline_tag: feature-extraction | |
| # Model card for vit_base_patch16_224.pathoduet_ihc | |
| A Vision Transformer (ViT-Base/16, MoCo v3 with pretext token) histopathology foundation model for IHC images (PathoDuet). \ | |
| Cross-scale position / cross-stain transfer pre-training on TCGA. | |
|  | |
| ## Model Details | |
| - **Model Type:** Feature backbone (ViT-B/16 + 1 pretext/register token) | |
| - **Model Stats:** | |
| - - Params: 85.8M (base) | |
| - - Image size: 224 x 224 x 3 | |
| - - Patch size: 16 x 16 x 3 | |
| - **Papers:** | |
| - - [PathoDuet: Foundation models for pathological slide analysis of H&E and IHC stains](https://doi.org/10.1016/j.media.2024.103289) (Medical Image Analysis 97:103289, 2024; arXiv:2312.09894) | |
| - **Original:** https://github.com/openmedlab/PathoDuet (checkpoint_IHC.pth, Google Drive) | |
| - **License:** [CC BY-NC 4.0](https://github.com/openmedlab/PathoDuet/blob/main/LICENSE) | |
| ## Model Usage | |
| ### Image Embeddings | |
| ```python | |
| from urllib.request import urlopen | |
| from PIL import Image | |
| import timm | |
| # get example image | |
| img = Image.open( | |
| urlopen("https://github.com/owkin/HistoSSLscaling/raw/main/assets/example.tif") | |
| ).convert('RGB') | |
| # load model from the hub | |
| model = timm.create_model( | |
| model_name="hf-hub:1aurent/vit_base_patch16_224.pathoduet_ihc", | |
| pretrained=True, | |
| ).eval() | |
| # get model specific transforms (normalization, resize) | |
| data_config = timm.data.resolve_model_data_config(model) | |
| transforms = timm.data.create_transform(**data_config, is_training=False) | |
| data = transforms(img).unsqueeze(0) # input is a (batch_size, num_channels, img_size, img_size) shaped tensor | |
| output = model(data) # output is a (batch_size, num_features) shaped tensor | |
| ``` | |
| ## Citation | |
| ```bibtex | |
| @article{hua2024pathoduet, | |
| title = {PathoDuet: Foundation models for pathological slide analysis of H&E and IHC stains}, | |
| author = {Hua, Shengyi and Yan, Fang and Shen, Tianle and Ma, Lei and Zhang, Xiaofan}, | |
| journal = {Medical Image Analysis}, | |
| volume = {97}, | |
| pages = {103289}, | |
| year = {2024}, | |
| doi = {10.1016/j.media.2024.103289} | |
| } | |
| ``` | |