Downloads · 30 days
179
48% of all-time downloads
vector-institute/open-pmc-18m-clip
open-pmc-18m-clip is a zero-shot image classification model from vector-institute. Use it for the zero-shot image classification task on the model card, and read the license before you ship it in a product. It is set up for open_clip. The card lists the license as apache-2.0.
Downloads · 30 days
179
48% of all-time downloads
All-time downloads
373
Public
Repo size
5.5 GB
Likes
0
Public
Click a slice to open those files.
.pt2.4 GB · 75%
From the Hugging Face model README
🎉 Accepted at the International Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI) 2026 🎉
<a href="https://arxiv.org/abs/2506.02738"><img src="https://img.shields.io/badge/arXiv-2506.02738-b31b1b?style=flat&logo=arxiv&logoColor=white"></a> <a href="https://github.com/VectorInstitute/pmc-data-extraction"><img src="https://img.shields.io/badge/Code-GitHub-181717?style=flat&logo=github&logoColor=white"></a>
</div>A biomedical CLIP model trained on ~18M image–text pairs (Open-PMC-18M) from PubMed Central. It uses the BiomedCLIP architecture — a ViT-B/16 image encoder and a PubMedBERT text encoder — projecting images and text into a shared 512-d space for zero-shot classification and image↔text retrieval.
timm vit_base_patch16_224), 224×224 · ~86M paramsmicrosoft/BiomedNLP-BiomedBERT-base-uncased-abstract), 256 tokens · ~110M paramspip install open_clip_torch
The model loads in one line — this builds both encoders and loads the trained weights:
from open_clip import create_model_from_pretrained, get_tokenizer
model, preprocess = create_model_from_pretrained("hf-hub:vector-institute/open-pmc-18m-clip")
tokenizer = get_tokenizer("hf-hub:vector-institute/open-pmc-18m-clip")
image_encoder = model.visual # ViT-B/16 → image → 512-d
text_encoder = model.text # PubMedBERT → text → 512-d
import torch
from PIL import Image
image = preprocess(Image.open("figure.jpg")).unsqueeze(0) # (1, 3, 224, 224)
text = tokenizer(["a chest x-ray", "a brain MRI"], context_length=256)
with torch.no_grad():
image_emb = model.encode_image(image, normalize=True) # (1, 512)
text_emb = model.encode_text(text, normalize=True) # (2, 512)
similarity = image_emb @ text_emb.T # cosine similarity
labels = ["chest x-ray", "brain MRI", "histopathology slide"]
text = tokenizer(["this is a photo of " + l for l in labels], context_length=256)
with torch.no_grad():
image_emb = model.encode_image(image, normalize=True)
text_emb = model.encode_text(text, normalize=True)
probs = (model.logit_scale.exp() * image_emb @ text_emb.T).softmax(dim=-1)
print({l: round(p, 4) for l, p in zip(labels, probs[0].tolist())})
The pmc-data-extraction repo provides the
full mmlearn benchmark suite (zero-shot retrieval on Quilt-1M / MIMIC-CXR / DeepEyeNet, and
classification). It reads the raw .pt checkpoint directly:
CKPT=/path/to/open_pmc_18m_clip.pt
mmlearn_run 'hydra.searchpath=[pkg://openpmcvl.experiment.configs]' \
+experiment=biomedclip_localckpt_retrieval job_type=eval \
[email protected]=Quilt datasets.test.quilt.split=val \
+datasets/[email protected]=biomedclip_vision_transform \
task.encoders.text.checkpoint_path="$CKPT" \
task.encoders.rgb.checkpoint_path="$CKPT"
See scripts/eval/ for ready-made retrieval and classification scripts.
| File | Description |
|---|---|
open_clip_pytorch_model.bin | Inference weights — enables the one-line hf-hub: load above. |
open_clip_config.json | OpenCLIP architecture + preprocessing config. |
open_pmc_18m_clip.pt | Full training checkpoint (weights + optimizer + epoch/step/samples_seen), for resuming training or the eval pipeline. |
Research artifact — not a medical device. Trained on published figure–caption pairs, which differ from raw clinical images and may carry publication and demographic biases. Do not use for clinical decisions.
@article{baghbanzadeh2025open,
title={Open-pmc-18m: A high-fidelity large scale medical dataset for multimodal representation learning},
author={Baghbanzadeh, Negin and Islam, Mohammed Saidul and Ashkezari, Sajad and Dolatabadi, Elham and Afkanpour, Arash},
journal={arXiv preprint arXiv:2506.02738},
year={2025}
}