/Bayesian_WSS

code for our MICCAI2024 paper 'A Bayesian Approach to Weakly-supervised Laparoscopic Image Segmentation'.

Primary LanguagePython

A Bayesian Approach to Weakly-supervised Laparoscopic Image Segmentation

Introduction

This repository provides PyTorch implementation of our MICCAI2024 paper 'A Bayesian Approach to Weakly-supervised Laparoscopic Image Segmentation'.

Usage

  • Prepare the datasets
  • Download the CholecSeg8k and AutoLaparo datasets.

    Extract dataset files to form folder structures like

    Bayesian_WSS
    ├── ...
    ├── CholecSeg8k
    │   ├── ...
    │   ├── dataset
    │   │   ├── CholecSeg8k
    │   │   │   ├── video01
    │   │   │   ├── video09
    │   │   │   ├── ...
    │   │   ├── target_list.txt
    │   │   ├── val_samples_fold_1.txt
    │   │   ├── val_samples_fold_2.txt
    │   │   ├── val_samples_fold_3.txt
    │   │   ├── val_samples_fold_4.txt
    │   │   ├── val_samples_fold_5.txt
    ├── AutoLaparo
    │   ├── ...
    │   ├── dataset
    │   │   ├── AutoLaparo_Task3
    │   │   │   ├── imgs
    │   │   │   ├── masks
    │   │   ├── target_list.txt
    

  • Prepare the environment
  • Install necessary packages

    pip install -r requirements.txt

    Build extension module to apply DenseCRF loss

    cd CholecSeg8k/utils/crfloss/wrapper/bilateralfilter
    swig -python -c++ bilateralfilter.i
    python setup.py install
    cd AutoLaparo/utils/crfloss/wrapper/bilateralfilter
    swig -python -c++ bilateralfilter.i
    python setup.py install

  • Prepare weak annotations
  • For the CholecSeg8k dataset:

    cd CholecSeg8k
    python weak_label_simulation.py

    For the AutoLaparo dataset:

    cd AutoLaparo
    python weak_label_simulation.py

  • Train and test models
  • With the CholecSeg8k dataset:

    cd CholecSeg8k
    # Default parameter values are already set.
    python train.py
    python inference.py

    With the AutoLaparo dataset:

    cd AutoLaparo
    # Default parameter values are already set.
    python train.py
    python inference.py

    Acknowledgement

    We would like to express our gratitude to the following codebases:

    Note

    Contact: Zhou Zheng (zzheng@mori.m.is.nagoya-u.ac.jp)