Generate Image Embeddings with CXR-DINO-V1
1. Installation
pip install torch torchvision pillow
pip install lightly-train
2. Embed a Folder of Images (CLI)
lightly-train embed \
data="images/" \
checkpoint="/cxr-dino-model/model.pt" \
out="embeddings.pth" \
format="torch"
- data โ folder containing images
- checkpoint โ your cxr-dino model
- out โ output file with embeddings
3. Minimal Python Example
import lightly_train
lightly_train.embed(
data="images/",
checkpoint="cxr-dino-model/model.pt",
out="embeddings.pth",
format="torch"
)
print("Saved embeddings to embeddings.pth")
4. Load Embeddings
import torch
data = torch.load("embeddings.pth")
embeddings = data["embeddings"]
paths = data["image_paths"]
print(embeddings.shape)
print(paths[:5])
Model tree for humantics/cxr-dino-v1
Base model
facebook/dinov2-small