Home

Awesome

Boundary DoU Loss

This repo holds code for Boundary Difference Over Union Loss For Medical Image Segmentation(MICCAI 2023).

Usage

1. Download Google pre-trained ViT models

wget https://storage.googleapis.com/vit_models/imagenet21k/{MODEL_NAME}.npz &&
mkdir ../model/vit_checkpoint/imagenet21k &&
mv {MODEL_NAME}.npz ../model/vit_checkpoint/imagenet21k/{MODEL_NAME}.npz

2. Dataset

You can follow TransUnet to get and prepare the datasets.

  1. The directory structure of the whole project is as follows:
.
├── TransUNet
│   └── 
├── model
│   └── vit_checkpoint
│       └── imagenet21k
│           ├── R50+ViT-B_16.npz
│           └── *.npz
├── Synapse
│   ├── test
│   │   ├── case0001.npy.h5
│   │   └── *.npy.h5
│   ├── train
│   │   ├── case0005_slice000.npz
│   │   └── *.npz
│   └── lists_Synapse
│       ├── all.lst
│       ├── test.txt
│       └── train.txt
└── ACDC
    └── ...(same as Synapse)

2. Environment

Please prepare an environment with python=3.7, and then use the command "pip install -r requirements.txt" for the dependencies.

3. Train/Test

  1. For Synapse dataset
CUDA_VISIBLE_DEVICES=0 python train.py --dataset Synapse --vit_name R50-ViT-B_16
CUDA_VISIBLE_DEVICES=0 python test.py --dataset Synapse --vit_name R50-ViT-B_16 --is_savenii
  1. For ACDC dataset
CUDA_VISIBLE_DEVICES=0 python train.py --dataset ACDC --vit_name R50-ViT-B_16
CUDA_VISIBLE_DEVICES=0 python test.py --dataset ACDC --vit_name R50-ViT-B_16 --is_savenii

Results

Our results were trained and tested using five different seeds, with the final results being the average of the five runs. The seed settings and results for each run are shown in the table below. For example, for the ACDC dataset, we have

SeedLossmean dicemean hd95boundary IoU
1234Boundary DoU91.402.2078.71
1111Boundary DoU91.222.4178.04
2222Boundary DoU91.162.0878.75
3333Boundary DoU91.412.0078.33
4444Boundary DoU91.302.1678.47
meanBoundary DoU91.302.1778.46

In the TransUNet model, the impact of seed selection on the results varies for different datasets, and different seeds can be tried for better results.

Reference