Zero-Shot Image Classification
OpenCLIP
English
biomedical
vision-language
contrastive-learning
image-text-retrieval
zero-shot-classification
Instructions to use Ruler138/BioCLIP with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- OpenCLIP
How to use Ruler138/BioCLIP with OpenCLIP:
import open_clip model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms('hf-hub:Ruler138/BioCLIP') tokenizer = open_clip.get_tokenizer('hf-hub:Ruler138/BioCLIP') - Notebooks
- Google Colab
- Kaggle
|
Download README.md from Ruler138/BioCLIP: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/Ruler138/BioCLIP/resolve/main/README.md
- Command line
-
hf download hf://Ruler138/BioCLIP/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/Ruler138/BioCLIP/resolve/main/README.md
2.01 kB
| language: | |
| - en | |
| library_name: open_clip | |
| pipeline_tag: zero-shot-image-classification | |
| tags: | |
| - biomedical | |
| - vision-language | |
| - contrastive-learning | |
| - image-text-retrieval | |
| - zero-shot-classification | |
| license: other | |
| # BioCLIP | |
| BioCLIP is a biomedical vision--language model with a ViT-L/14 image encoder | |
| and a BioClinical ModernBERT text encoder. It supports up to 512 text tokens. | |
| ## Repository layout | |
| ```text | |
| BioClinicalModernBERT-large-ViT-L-14-pretrained.json | |
| load_model.py | |
| checkpoints/ five released training variants | |
| evaluation/ | |
| |-- data/ BioMedFlickr and the unified 46-task validation data | |
| |-- code/ two inference entry points and metric aggregation | |
| `-- results/ released checkpoint results | |
| ``` | |
| Within the unified classification set, all benchmark files are under | |
| `evaluation/data/zero_shot_classification/datasets/`: shared payloads live in | |
| `payloads/`, while domain/dataset folders contain task definitions and any | |
| dataset-specific files. | |
| The model JSON is required by OpenCLIP to construct the architecture. The | |
| model used by `load_model.py` and both evaluation runners is the recommended | |
| checkpoint: | |
| [`checkpoints/openclip_init_10epoch_best.pt`](checkpoints/openclip_init_10epoch_best.pt) | |
| ## Evaluation | |
| Both commands download the checkpoint and the required validation data from | |
| this repository. A local data directory can also be supplied to the 46-task | |
| runner with `--data-root`. | |
| ```bash | |
| pip install -r evaluation/requirements.txt | |
| python evaluation/code/evaluate_biomedflickr.py \ | |
| --output evaluation/results/biomedflickr_reproduced.json | |
| python evaluation/code/evaluate_zero_shot_classification.py \ | |
| --output evaluation/results/unified46_reproduced.json | |
| ``` | |
| ## Results | |
| Complete checkpoint results and public-model comparisons are reported in | |
| [`evaluation/RESULTS.md`](evaluation/RESULTS.md). Machine-readable outputs are | |
| stored in [`evaluation/results/`](evaluation/results/). | |
| ## Intended use | |
| BioCLIP is intended for research and is not a clinical device. | |