nnUNet_att_position_correction README

The project's README from github.com/qpuchen/nnUNet_att_position_correction. As one markdown file: README.md.

Semi-Supervised 3D Tooth Segmentation Using nn-UNet with Axial Attention and Positional Correction

Official PyTorch implementation of Semi-Supervised 3D Tooth Segmentation Using nn-UNet with Axial Attention and Positional Correction (MICCAI 2023 STS).

In the final ranking on unseen test data, this solution ranked 5th with a score of 81.47%.

Environments and Requirements:

Install nnU-Net as below. You should meet the requirements of nnUNet, our method does not need any additional requirements. For more details, please refer to https://github.com/MIC-DKFZ/nnUNet/tree/v1.7.1

git clone https://github.com/MIC-DKFZ/nnUNet.git
cd nnUNet
pip install -e .

1. Training nnUNet for Labeled Data

1.1. Prepare Labeled Data of MICCAI 2023 Challenge

Following nnUNet, give a TaskID (e.g. Task001) to the labeled data and organize them folowing the requirement of nnUNet.

nnUNet_raw_data_base/nnUNet_raw_data/Task01_Tooth/
├── dataset.json
├── imagesTr
├── imagesTs
└── labelsTr

1.2. Conduct automatic preprocessing using nnUNet.

Here we do use the default setting.

nnUNet_plan_and_preprocess -t 1 --verify_dataset_integrity

1.3. Training nnUNet by 5-fold Cross Validation

for FOLD in 0 1 2 3 4
do
CUDA_VISIBLE_DEVICES=0,1 nnUNet_train_DP 3d_fullres nnUNetTrainerV2_DP 1 $FOLD -gpus 2 -c --npz
done

2. Generate Pseudo Labels for Unlabeled Data

2.1. Generate Pseudo Labels

nnUNet_predict -i $INPUTS_FOLDER -o $OUTPUTS_FOLDER -t 2 -m 3d_fullres --save_npz

2.2. Iteratively Train Models and Generate Pseudo Labels

2.3. Filter Low-quality Pseudo Labels

We compare Pseudo Labels in different rounds and filter out the labels with high variants.

select_pseudo_label.ipynb

3. Training nnUNet-att by 5-fold Cross Validation

3.1. Copy the following files in this repo to your nnUNet environment.

./nnunet/network_architecture/generic_UNet.py

3.2. Training nnUNet-att by 5-fold Cross Validation

for FOLD in 0 1 2 3 4
do
CUDA_VISIBLE_DEVICES=0,1 nnUNet_train_DP 3d_fullres nnUNetTrainerV2_DP 3 $FOLD -gpus 2 -c --npz
done

3.3. Add the '_000' suffix to the file name of the testset data

pyhton add_suffix.py

3.4. Do Efficient Inference with nnUNet-att

We modify the generic_UNet.py of nnunet source code for efficiency. Please make sure the code backup is done and then copy the whole repo to your nnunet environment.

nnUNet_predict -i $INPUTS_FOLDER -o $OUTPUTS_FOLDER -t 3 -m 3d_fullres --save_npz

4. Correction of abnormal segmentation points through position correction module

python position_correction.py

nnUNet_att_position_correction (qpuchen/nnUNet_att_position_correction)

Searching Database…

What is this?This is the official PyTorch code for the MICCAI 2023 STS Challenge (3D tooth segmentation from CBCT scans) by team sdkxd, which extends nn-UNet with axial attention and a positional correction module to clean up abnormal segmentation points.
Is this a standalone tool or does it extend nn-UNet?It is not a standalone application: it's a set of modified files and scripts you copy into an existing nn-UNet installation (e.g. a patched genericUNet.py) to add the attention and correction modules.
How do I get the pipeline running?First install nn-UNet and organize your labeled CBCT data into its required Task folder structure (dataset.json, imagesTr, imagesTs, labelsTr), run nn-UNet's automatic preprocessing, then train with 5-fold cross validation before moving on to pseudo-labeling and nnUNet-att training.
Do I need nn-UNet installed before using this?Yes, this code is built entirely on top of nn-UNet and assumes you already have it installed and meeting its requirements; no extra dependencies beyond that are needed.
Is this a one-command pipeline?No, it's a multi-stage manual workflow: train on labeled data, generate pseudo labels for unlabeled data, iteratively retrain and filter low-quality pseudo labels, then train nnUNet-att and finally run the position correction step on the predictions.
How well did this solution perform in the challenge?On the final unseen test set, team sdkxd's solution ranked 5th overall with a score of 81.47%.
What does the positional correction module do?It's a post-processing step that detects and fixes abnormal segmentation points in the predicted tooth masks after inference.
Why bother generating pseudo labels?The challenge has far more unlabeled CBCT scans than labeled ones, so the pipeline trains on labeled data first, then iteratively generates and filters pseudo labels on unlabeled scans to expand the training set semi-supervised style.
What is nnUNet-att?It's the nn-UNet architecture modified with axial attention layers (via a patched genericUNet.py) and trained with 5-fold cross validation on the combined labeled plus filtered pseudo-labeled data.
Creator
qpuchen
Size
0.5 MB
Stars
354
Updated
CommitOct 12
Age
3y
Commits · 90 Days