All models

CTransPath

Hybrid CNN and Swin Transformer feature extractor pretrained on histology patches with contrastive learning.

Medical imaging · 669 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (27 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
27.5M
Operations
669
Framework
PyTorch
Recurrent
No
Published
2022, Medical Image Analysis
Cited by
750 (as of 29 October 2026)
Authors
Xiyue Wang, Sen Yang, Jun Zhang and others
License
GPL-3.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m15206
Graph hash
13768ecd0806ae0bf88bcfeb5363b387679643204abc89610ecd9b7fe0801289
Skeleton hash
6cf106d6a5f743fe6bcf6f5d5facf28d0ecadb0a07ce9b69dd189a8e584d3584
Architecture hash
2ec19a3974ccf96298967689b4975cca4ad20901a4de1957c7f85f2bbe916822
Diagram SHA-256
16a0e46722f59d5e91f79a832efa2ccb62e98cb60c3aa4816eb7714a1824afb4
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

CTransPath is a feature backbone for histopathology images, a hybrid that joins a convolutional neural network (CNN) with a multi-scale Swin Transformer. The convolutional part is a custom patch embedding layer, a short convolutional stem that feeds the Swin stages.

It was pretrained with semantically-relevant contrastive learning (SRCL), a self-supervised strategy that compares relevance between instances to mine more positive pairs. Where traditional contrastive learning uses two views of one instance, SRCL aligns multiple positive instances with similar visual concepts. The weights were trained on 15M histology patches from PAIP and TCGA.

The paper tests the pretrained model on five types of downstream tasks covering nine public datasets: patch retrieval, patch classification, weakly-supervised whole-slide image classification, mitosis detection, and colorectal adenocarcinoma gland segmentation. The authors recommend extracting features at 1.0mpp first and then trying other magnifications. The code is released under the GPLv3 License for non-commercial academic purposes.

Key idea. The paper proposes semantically-relevant contrastive learning (SRCL) and uses it to pretrain CTransPath, a hybrid CNN and Swin Transformer backbone, on unlabeled histopathological images.

  • CTransPath
  • swin_tiny_patch4_window7_224.CTransPath
  • histopathology feature extractor
  • histology
  • semantically-relevant contrastive learning
  • SRCL
  • self-supervised learning
  • computational pathology
  • whole-slide image

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@article{Wang_2022, title={Transformer-based unsupervised contrastive learning for histopathological image classification}, volume={81}, ISSN={1361-8415}, url={http://dx.doi.org/10.1016/j.media.2022.102559}, DOI={10.1016/j.media.2022.102559}, journal={Medical Image Analysis}, publisher={Elsevier BV}, author={Wang, Xiyue and Yang, Sen and Zhang, Jun and Wang, Minghui and Zhang, Jing and Yang, Wei and Huang, Junzhou and Han, Xiao}, year={2022}, month=Oct, pages={102559} }