Ceilinghans commited on
Commit
3f75313
·
verified ·
1 Parent(s): 3ebb1ef

Document checkpoint download and usage

Browse files
Files changed (1) hide show
  1. README.md +111 -0
README.md CHANGED
@@ -1,3 +1,114 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ library_name: pytorch
4
+ pipeline_tag: image-feature-extraction
5
+ tags:
6
+ - fluorescence-microscopy
7
+ - fish
8
+ - dinov3
9
+ - feature-extraction
10
+ - four-channel
11
  ---
12
+
13
+ # FISHPrism four-channel ViT-B/16 encoder
14
+
15
+ This private repository contains the trained checkpoint used by [FISHPrism](https://github.com/MedCAI/FISHPrism-public), a four-channel fluorescence in situ hybridization (FISH) feature-extraction pipeline. The checkpoint is a frozen DINOv3 ViT-B/16 student encoder adapted to four input channels.
16
+
17
+ ## Checkpoint
18
+
19
+ | Field | Value |
20
+ |---|---|
21
+ | File | `fishprism_dinov3_vitb16_4ch_student_epoch99.pt` |
22
+ | Architecture | DINOv3 ViT-B/16 |
23
+ | Backbone | Student |
24
+ | Input channels, in order | DAPI, ERBB2, TOP2A, CEN17 |
25
+ | Input size | 224 x 224 pixels after preprocessing |
26
+ | Output | Mean normalized patch-token embedding (768 dimensions) |
27
+ | Training state | Epoch index 99; 100 completed epochs; global step 16100 |
28
+ | File size | 343,639,055 bytes |
29
+ | SHA-256 | `42003ede7f9d10e4b071f436b83c60c1c89c6f3f947fb96796c24a5dd677994b` |
30
+
31
+ ## Install FISHPrism
32
+
33
+ ```bash
34
+ git clone https://github.com/MedCAI/FISHPrism-public.git
35
+ cd FISHPrism-public
36
+ python -m pip install -e vendor/lightly-train
37
+ python -m pip install -e ".[imaging]"
38
+ python -m pip install huggingface_hub
39
+ ```
40
+
41
+ ## Download the checkpoint
42
+
43
+ Because this repository is private, authenticate with a Hugging Face account that has access:
44
+
45
+ ```bash
46
+ hf auth login
47
+ hf download Ceilinghans/FISHPrism fishprism_dinov3_vitb16_4ch_student_epoch99.pt --local-dir weights
48
+ ```
49
+
50
+ Or download it from Python:
51
+
52
+ ```python
53
+ from huggingface_hub import hf_hub_download
54
+
55
+ checkpoint = hf_hub_download(
56
+ repo_id="Ceilinghans/FISHPrism",
57
+ filename="fishprism_dinov3_vitb16_4ch_student_epoch99.pt",
58
+ token=True,
59
+ )
60
+ print(checkpoint)
61
+ ```
62
+
63
+ ## Extract embeddings from TIFF images
64
+
65
+ FISHPrism expects four-channel TIFF images with the channel order DAPI, ERBB2, TOP2A, CEN17. Images are converted to `C x H x W`, normalized to `[0, 1]`, and resized to 224 x 224 by the package.
66
+
67
+ ```bash
68
+ fishprism extract --checkpoint weights/fishprism_dinov3_vitb16_4ch_student_epoch99.pt --images /path/to/tiff_directory --output outputs/embeddings.csv --model vitb16 --backbone student --device cuda --batch-size 8
69
+ ```
70
+
71
+ Use `--device cpu` if CUDA is not available. The output CSV contains one row per image and 768 feature columns.
72
+
73
+ Python API:
74
+
75
+ ```python
76
+ from pathlib import Path
77
+ from fishprism.embeddings import extract_csv, load_encoder
78
+
79
+ checkpoint = Path("weights/fishprism_dinov3_vitb16_4ch_student_epoch99.pt")
80
+ model = load_encoder(
81
+ checkpoint,
82
+ model_name="vitb16",
83
+ backbone="student",
84
+ device="cuda",
85
+ )
86
+
87
+ extract_csv(
88
+ model,
89
+ image_paths=sorted(Path("/path/to/tiff_directory").glob("*.tif*")),
90
+ output=Path("outputs/embeddings.csv"),
91
+ batch_size=8,
92
+ )
93
+ ```
94
+
95
+ ## Verify the file
96
+
97
+ ```python
98
+ from fishprism.embeddings import file_digest
99
+
100
+ print(file_digest("weights/fishprism_dinov3_vitb16_4ch_student_epoch99.pt"))
101
+ # 42003ede7f9d10e4b071f436b83c60c1c89c6f3f947fb96796c24a5dd677994b
102
+ ```
103
+
104
+ ## Intended use and limitations
105
+
106
+ - This checkpoint is a frozen feature encoder, not a diagnostic classifier.
107
+ - It does not contain patient images, patient identifiers, clinical labels, or decision thresholds.
108
+ - Performance depends on acquisition settings, channel mapping, normalization, and other preprocessing choices.
109
+ - Validate the full pipeline on data from the intended site and instrument before research use.
110
+ - It is not a medical device and is not intended for clinical diagnosis or treatment decisions.
111
+
112
+ ## Licensing
113
+
114
+ First-party FISHPrism source code is released under the MIT License. Bundled or upstream components, including Lightly Train and DINOv3, retain their own licenses and terms. The repository metadata does not replace those third-party terms; review the notices in the FISHPrism repository before redistribution or deployment.