Home

Awesome

[ECCV22] ConCL: Concept Contrastive Learning for Dense Prediction Pre-training in Pathology Images

This project hosts the code for the paper

ConCL: Concept Contrastive Learning for Dense Prediction Pre-training in Pathology Images,
Jiawei Yang, Hanbo Chen, Yuan Liang, Junzhou Huang, Lei He and Jianhua Yao
European Conference on Computer Vision (ECCV), 2022

Please consider citing our paper in your publications if the paper or the project helps your research.

ConCL overview

Note


This project is developed upon the open-source project OpenSelfSup, which has now chanegd to MMselfsup. Therefore we provide the full repository we used. It should be straightforward to adopt this repo to new MMselfsup. If you have any issue, please leave an issue.

Installation

Please refer to INSTALL.md for installation and dataset preparation.

Getting Started

Please see GETTING_STARTED.md for the basic usage of OpenSelfSup.

Models

pre-train methodbackbone# pre-training epochGlaS AP_bbCRAG AP_bb
SimCLRResNet-1820050.749.2
BYOLResNet-1820050.949.9
PCL-v2ResNet-1820049.451.0
MoCo-v1ResNet-1820050.047.2
MoCO-v2ResNet-1820052.350.0
DenseCLResNet-1820053.952.3
ConCLResNet-1820056.855.4
SimCLRResNet-1840051.648.9
BYOLResNet-1840050.850.3
MoCo-v1ResNet-1840050.646.7
MoCO-v2ResNet-1840054.651.7
DenseCLResNet-1840055.152.9
ConCLResNet-1840058.254.7
SimCLRResNet-1880050.648.1
BYOLResNet-1880050.249.3
MoCo-v1ResNet-1880049.847.2
MoCO-v2ResNet-1880055.251.8
DenseCLResNet-1880056.052.5
ConCLResNet-1880058.655.0

The pre-trained models are available at this link.

Usage

Training

bash tools/dist_train.sh configs/NCT_pretraining/concl/r18_bs256_ep200.py 8

Extracting Backbone Weights

WORK_DIR=work_dirs/NCT_pretraining/concl/r18_bs256_ep200/
CHECKPOINT=${WORK_DIR}/epoch_200.pth
WEIGHT_FILE=${WORK_DIR}/concl_r18_bs256_ep200.pth

python tools/extract_backbone_weights.py ${CHECKPOINT} ${WEIGHT_FILE}

Transferring to Object Detection and Instance Segmentation

Please refer to detection/README.md for transferring to dense prediction tasks in GlaS and CRAG dataset.

An example overall script is provided as below:

project_root=$PROJECT_ROOT

cd $project_root

model=concl
config=r18_bs256_ep200
epoch=200

conda activate open-mmlab

mkdir work_dirs/pretrained_models

python tools/extract_backbone_weights.py  \
    work_dirs/NCT_pretraining/$model/$config/epoch_$epoch.pth \
    work_dirs/pretrained_models/$model/$config.pth

conda activate detectron2

cd benchmarks/detection

mkdir -p work_dirs/converted_weights

python convert-pretrain-to-detectron2.py \
    ../../work_dirs/wsi_pretrains/$model/$config.pth    \
    work_dirs/converted_weights/$model/$config.pkl

# 5 independent runs of fine-tuning.
for i in {1..5}
do 
    bash run.sh configs/GlaS/GlaS_R_18_FPN_1x_moco.yaml \
        work_dirs/converted_weights/$model/$config.pkl  \
        8  \
        work_dirs/wsi_submission/GlaS/$model/$config/GlaS_R_18_FPN_1x_moco/$i
done

# 5 independent runs of fine-tuning.
for i in {1..5}
do 
    bash run.sh configs/CRAG/CRAG_R_18_FPN_1x_moco.yaml \
        work_dirs/converted_weights/$model/$config.pkl  \
        8  \
        work_dirs/wsi_submission/GlaS/$model/$config/CRAG_R_18_FPN_1x_moco/$i
done

Acknowledgement


Disclaimer

This tool is for research purpose and not approved for clinical use.

This is not an official Tencent product.

Copyright

This tool is developed in Tencent AI Lab.

The copyright holder for this project is Tencent AI Lab.

All rights reserved.