This repository is the official implementation of ECL (Accepted by MICCAI 2023). If you encounter any question, please feel free to contact us. You can create an issue or just send an email to me at zhangyilan@buaa.edu.com. Also welcome for any idea exchange and discussion.
video-record.mp4
[07/09/2023] Code is public.
Skin image datasets often suffer from imbalanced data distribution, exacerbating the difficulty of computer-aided skin disease diagnosis. Some recent works exploit supervised contrastive learning (SCL) for this long-tailed challenge. Despite achieving significant performance, these SCL-based methods focus more on head classes, yet ignore the utilization of information in tail classes. In this paper, we propose class-Enhancement Contrastive Learning (ECL), which enriches the information of minority classes and treats different classes equally. For information enhancement, we design a hybrid-proxy model to generate class-dependent proxies and propose a cycle update strategy for parameter optimization. A balanced-hybrid-proxy loss is designed to exploit relations between samples and proxies with different classes treated equally. Taking both "imbalanced data" and "imbalanced diagnosis difficulty" into account, we further present a balanced-weighted cross-entropy loss following the curriculum learning schedule.
- Windows/Linux both support
- python 3.8
- PyTorch 1.9.0
- torchvision 0.10.0
We conduct experiments on two public skin lesion datasets (download from ISIC Challenge): ISIC 2018 and ISIC 2019. The ISIC 2018 dataset contains 2594 images of 7 classes, and the ISIC 2019 dataset contains 25331 images of 8 classes. You can run the following code to get the splied datasets:
python ./utils/dataset/split_data.py --datapath ./data/ISIC2018/ --dataset ISIC2018
To train the model(s) in the paper, run this command:
python train.py --dataset ISIC2018 --data_path ./data/ISIC2018/ --batch_size 64 --lr 0.002 --epochs 100 --gpu 0 --model_path ./results/ISIC2018/
We upload the model weights for two datasets, run this command:
python test.py --dataset ISIC2018 --data_path ./data/ISIC2018/ --model_path ./data/ISIC2018/ --log_path <your log path>
If you find this repo useful for your research, please consider citing the paper
This project is released under the MIT license.