Skip to content

MoriLabNU/DDDC-CL

Repository files navigation

DDDC-CL

Diffusion-Driven Distillation and Contrastive Learning for Class-Incremental Semantic Segmentation of Laparoscopic Images

Overview

DDDC-CL addresses class-incremental semantic segmentation (CISS) for laparoscopic images with three key components:

  1. Unconditional DDPM — generates synthetic laparoscopic images for privacy-preserving generative replay
  2. Knowledge Distillation (DADA) — dense alignment distillation across intermediate layers and output logits
  3. Contrastive Learning — image-level contrastive loss using real vs. synthetic image pairs

Requirements

  • Python 3.8+
  • PyTorch >= 1.12
  • Additional: tensorboardX, omegaconf, opencv-python, pandas, tqdm

Dataset

Dresden Surgical Anatomy Dataset (DSAD) — 13,195 annotated laparoscopic images with 11 abdominal anatomical structures.

Usage

See run_example.sh for complete command examples. Key steps:

1. Offline Baseline

python main.py --data_root /path/to/Dresden --model deeplabv3_resnet101 --gpu_id 0 \
    --lr 0.01 --batch_size 16 --train_epoch 50 --loss_type wce_loss \
    --dataset dresden --task offline --lr_policy poly --name offline-baseline

2. Incremental Training (e.g., 7-4)

python main.py --data_root /path/to/Dresden --model deeplabv3_resnet101 --gpu_id 0 \
    --lr 0.01 --batch_size 16 --train_epoch 50 --loss_type wce_loss \
    --dataset dresden --task 7-4 --overlap --lr_policy poly \
    --name exp-KDDGCL-ddpm \
    --use_KD_layer_weight --pseudo --pseudo_thresh 0.7 --KD_loss_type KD_loss \
    --generate --contrastive_learning --ddpm_root './generated-512' \
    --load_step 1 --load 'checkpoints/base_model_weight.pth'

Supported tasks: 7-2, 7-2-2, 7-4.

3. ViT/MedSAM Variant

# Edit dresden.yaml to set data_root, then:
CUDA_VISIBLE_DEVICES=0 python -m torch.distributed.launch --nproc_per_node=1 \
    main-vit.py --config ./dresden.yaml --log ./logs/vit_exp

4. Evaluation

python eval.py --data_root /path/to/Dresden --model deeplabv3_resnet101 --gpu_id 0 \
    --dataset dresden --task 7-4 --overlap --test_only \
    --ckpt 'checkpoints/your_checkpoint.pth'

License

MIT License. See LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors