IMPaSh: ResNet-50 encoder and classifier

Weights for IMPaSh: A Novel Domain-shift Resistant Representation for Colorectal Cancer Tissue Classification (T.T.L. Vuong, Q.D. Vu, M. Jahanifar, S. Graham, J.T. Kwak, N. Rajpoot, ECCV 2022 Workshops) · arXiv:2208.11052 · code: github.com/trinhvg/IMPash

IMPaSh pre-trains a ResNet-50 with self-supervised contrastive learning that combines InfoMin augmentations with PatchShuffling, using a momentum encoder for each branch. A linear classifier is then trained on the frozen features. Trained on K19 (NCT-CRC-HE-100K) and tested on K16 (Kather 2016) as an unseen target domain.

Files

File Size Contents
impash_resnet50_k19.pth 130 MB Use this. model (encoder g + projectors p1, p2), classifier (Linear(128 → 9)), config (classes, input, training flags)
original/encoder_ckpt_epoch_200.pth 457 MB Original pre-training checkpoint (epoch 200): model, model_ema (momentum encoder), contrast (two 65536×128 queues), optimizer. Only needed to resume pre-training
original/classifier_ckpt_epoch_40.pth 11 KB Original linear classifier checkpoint (epoch 40)

The bundle is built from the two original checkpoints and gives identical outputs.

Usage

Needs the model code from the GitHub repo (networks/build_backbone.py).

import torch
from huggingface_hub import hf_hub_download
from networks.build_backbone import RGBMultiHeadsStitch   # from github.com/trinhvg/IMPash

ckpt = torch.load(hf_hub_download('trinhvg/IMPaSh', 'impash_resnet50_k19.pth'), map_location='cpu')
model = RGBMultiHeadsStitch('resnet50', head='mlp', feat_dim=128)
model.load_state_dict(ckpt['model'])
clf = torch.nn.Linear(128, 9)
clf.load_state_dict(ckpt['classifier'])
model.eval()

# x: (B, 3, 224, 224) RGB, normalised with ImageNet mean/std
with torch.no_grad():
    feat = model(x, mode=1)   # p1(g(x)): 128-d, L2-normalised
    logits = clf(feat)        # 9 classes
classes = ckpt['config']['classes']   # ADI, BACK, DEB, LYM, MUC, MUS, NORM, STR, TUM

Results

Trained on K19, tested on K16 (unseen domain). The 9 K19 classes are mapped to the 7 shared K16 classes (MUC → DEB, MUS → STR, COMPLEX removed), and Re / Pre / F1 are macro averages.

Acc Re Pre F1
Paper (Table 1) 0.868 0.868 0.887 0.865
These weights, re-run 2026-10-12 0.8674 0.8674 0.8867 0.8645

The re-run gets 3795 instead of 3796 of 4375 images right; the difference comes from image resizing in newer library versions.

Training setup

  • Pre-training: ResNet-50 from random init, 200 epochs on K19, SGD (lr 0.03, cosine schedule, momentum 0.9, weight decay 1e-4), batch 256 on 4 GPUs, 65536 negatives per queue, Ï„ = 0.15.
    • Views: InfoMin augmentation, and PatchShuffling (a 3×3 grid of random 64 px crops from a 255 px image, shuffled and stitched into 192×192).
    • Code flags: --method InfoMin --jigsaw_stitch --jigsaw_ema --jig_version V0 --cosine.
  • Classifier: Linear(128 → 9) on the frozen p1(g(x)) features, trained with SGD (lr 30, ×0.2 at epoch 30) and RandAugment; the epoch-40 checkpoint is used.
    • Code flags: --keephead head --aug_linear RA.

The full configuration is in the GitHub README.

Citation

@inproceedings{vuong2022impash,
  title     = {IMPaSh: A Novel Domain-shift Resistant Representation for Colorectal Cancer Tissue Classification},
  author    = {Vuong, Trinh Thi Le and Vu, Quoc Dang and Jahanifar, Mostafa and Graham, Simon and Kwak, Jin Tae and Rajpoot, Nasir},
  booktitle = {Computer Vision -- ECCV 2022 Workshops},
  year      = {2022}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for trinhvg/IMPaSh