|
Download README.md from minxoy/forzenpath: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/minxoy/forzenpath/resolve/main/README.md
- Command line
-
hf download hf://minxoy/forzenpath/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/minxoy/forzenpath/resolve/main/README.md
1.08 kB
| 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 / 使用 | |
| ```bash | |
| huggingface-cli download minxoy/forzenpath --local-dir ./forzenpath --token $HF_TOKEN | |
| pip install -e ./forzenpath | |
| ``` | |
| ```python | |
| 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`): | |
| ```python | |
| model = FrozenVitlModel.from_pretrained("./forzenpath", device="cuda") | |
| ``` | |
| Requires `torch`, `torchvision`, `Pillow`. | |