Downloads · 30 days
68
100% of all-time downloads
zhihuanglab/iSight-slide
iSight-slide is a machine learning model from zhihuanglab. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as other.
The image-level model of iSight, a system for automated assessment of immunohistochemistry (IHC) images and protein staining patterns. This repository carries the trained checkpoint and the training and inference code.
Downloads · 30 days
68
100% of all-time downloads
All-time downloads
68
Public
Repo size
6.9 GB
Likes
0
Public
Click a slice to open those files.
.pth1.7 GB · 100%
From the Hugging Face model README
The image-level model of iSight, a system for automated assessment of immunohistochemistry (IHC) images and protein staining patterns. This repository carries the trained checkpoint and the training and inference code.
zhihuanglab/iSight-cell (per-cell staining), zhihuanglab/iSight-target (target-cell selection)The model predicts five attributes of an IHC image at once:
| Task | Classes | Labels |
|---|---|---|
| Staining location | 4 | none, cytoplasmic/membranous, nuclear, cytoplasmic/membranous,nuclear |
| Staining intensity | 4 | negative, weak, moderate, strong |
| Staining quantity | 4 | none, <25%, 25%-75%, >75% |
The checkpoint also carries two auxiliary heads used as additional supervision while training —
tissue type (58 classes) and malignancy (2 classes) — which code/scripts/inference.py reports
alongside the three staining tasks.
CLIP ViT-L/14-336 patch encoder over all 336 px tissue patches of an image. Every patch
contributes all 576 of its ViT tokens; a gated attention module scores each token position and
softmaxes across patches at that position, so pooling is per token rather than per patch.
The pooled representation is the mean over tokens. Two conditioning signals are added to it: a
text (context) branch encoding the query (tissue, diagnosis, gene), applied with dropout during
training and off at inference, and a 39-way cell-type embedding. Linear heads produce the
outputs above. Model version v3_all_tokens.
config.json model configuration (read this first; see Downloading)
checkpoints/iSight-slide.pth trained weights (model state dict only)
code/
model/patch_encoder_with_clam.py encoder, all-token gated attention, conditioning, heads
dataset/hpadataset.py HPA10M MIL dataset, tissue-mask patching
train.py training (DDP, resumable)
config/config.ini the configuration the checkpoint was trained under
scripts/inference.py image-level inference
tissue.py tissue mask
requirements.txt
from huggingface_hub import snapshot_download
local = snapshot_download("zhihuanglab/iSight-slide") # config.json + checkpoint + code
or a single file:
from huggingface_hub import hf_hub_download
cfg = hf_hub_download("zhihuanglab/iSight-slide", "config.json")
ckpt = hf_hub_download("zhihuanglab/iSight-slide", "checkpoints/iSight-slide.pth")
Please fetch config.json alongside the checkpoint: it carries the model settings the code
reads, and it is the file the Hub uses to count downloads of this repository.
pip install -r requirements.txt
export ISIGHT_DATA_ROOT=/path/to/hpa10m # metadata, RLE masks, images
cd code
python train.py --config config/config.ini
Data locations are environment variables, not hard-coded paths:
| variable | what |
|---|---|
ISIGHT_DATA_ROOT | root for the defaults below |
ISIGHT_TRAIN_META / ISIGHT_TEST_META | HPA10M split metadata (feather) |
ISIGHT_RLE_DIR / ISIGHT_RLE_INDEX | RLE tissue masks and their index |
ISIGHT_IMAGE_DIR | images, only for the simple_downsample version |
SCHEDULER_PER_EPOCH=1 | step the LR scheduler per epoch instead of per batch |
The released configuration uses batch_size = 1, which is what the checkpoint was trained with.
PENN Academic Software License Agreement: non-commercial research use only.
Zhi Huang — [email protected]