Official code for Deep Learning-based Narrow-Band Imaging Endocytoscopic Classification for Predicting Colorectal Lesions: A Retrospective Study (Nature Communications).
We present a computer-aided diagnosis (CAD) model for colorectal lesion classification using narrow-band imaging endocytoscopy (EC-NBI). Inspired by progressive pre-training strategies in large language models, our approach integrates generalized and in-domain pre-training with supervised deep clustering. Evaluated on an independent cohort, the model outperforms state-of-the-art supervised methods at both image and lesion levels, surpassing even experienced endoscopists in human–machine competitions. By enhancing diagnostic accuracy and consistency, this CAD system advances the clinical utility of EC-NBI and supports the goal of optical biopsy.
Here are the recommended hardware conditions:
Git clone the project (replaceable with SSH).
$ git clone https://github.com/CorleoneJW/EC-DL.git
Install dependencies.
$ conda env create -f environment.yml -n myenv
Prepare the data before running code.
You could acquire the checkpoints from Figshare or Google Drive.
Typical install time on a normal desktop computer: above 15 minutes.
Run python stage_pretrain.py to pretrain the model.
$ cd journalway
$ python stage_pretrain.py --data_path pretraining_data_path --finetune preload_checkpoint.pth
Parameters are transmitted through cmd (see details in get_args function).
Run python stage_finetune.py to finetune the model.
$ cd journalway
$ python stage_finetune.py --data_path finetuning_data_path --finetune preload_checkpoint.pth
You could try on the demo dataset using default config.
$ cd journalway
$ python stage_finetune.py
Based on the recommended hardware configuration, it takes 10 ms to process one EC image after the program starts running.
This project is covered under the GPL-3.0 license.
