forzenpath / README.md
minxoy's picture
Simplify model card
45aa7ee verified
|
Raw History Blame
1.08 kB
metadata
license: other
library_name: frozen-vitl
tags:
  - pathology
  - feature-extraction
pipeline_tag: image-feature-extraction

Frozen ViT-L/14

A frozen vision encoder for pathology feature extraction.
病理图像特征提取模型。

  • Input / 输入: RGB 224×224
  • Output / 输出: CLS [B, 1024]

Usage / 使用

huggingface-cli download minxoy/forzenpath --local-dir ./forzenpath --token $HF_TOKEN
pip install -e ./forzenpath
import torch
from PIL import Image
from frozen_vitl import FrozenVitlModel, FrozenVitlImageProcessor

model = FrozenVitlModel.from_pretrained("minxoy/forzenpath", token=True, device="cuda")
processor = FrozenVitlImageProcessor(model.config)
model.eval()

x = processor(Image.open("patch.jpg")).unsqueeze(0).cuda()
with torch.no_grad():
    feat = model(x).pooler_output  # [1, 1024]

Local folder / 本地目录(含 config.json 和 model.safetensors):

model = FrozenVitlModel.from_pretrained("./forzenpath", device="cuda")

Requires torch, torchvision, Pillow.