Skip to content

zixuzhuang/LabelMore

Repository files navigation

LabelMore

An easy iterative segmentation tool for MRI data based on UNet.

You only need to label a small portion of the MRI dataset to segment the rest part.

If the segmentation results are not satisfactory, just Label a little bit More on top of that.

Performance

Segmentations of MRNet after 2 iterations (labeled 10 subjects + refined 10 subjects): Teaser image

Installation

This code requires PyTorch 1.1+.

Clone this repo and install the dependencies by

git clone https://github.com/zixuzhuang/LabelMore.git
cd LabelMore
pip install -r requirements.txt

Usage

0. Data preparation

The original MRI files need to be put in data/images and the segmentation files in data/segmentations. The MRI and segmentation files of the same subject must have the same name.

mkdir data 
cd data
mkdir cache && mkdir images && mkdir predictions && mkdir previews && mkdir segmentations
cd ..

At least 10 initial segmentations are recommended.

1. Convert the MRI file to .npz file

python nii2npz.py

2. Train the UNet for the first round

python train.py -c <config-file>

The parameters of the training process can be referenced in configs/mrnet.yaml.

The corresponding experiment log and model file can be found in results after training.

3. Evaluate the segmentation result

python eval.py -m <model-path> -n <evaluate-number>

This step will produce a pre-segmentation of the n unsegmented MRI files in data/predictions.

To get the segmentation result for all remaining files, set n to 0.

4. Improve the segmentation performance by labeling more

If you check the pre-segmentation results and are not satisfied with the performance, you just need to refine the pre-segmentation in data/predictions and save them in data/segmentations. Repeat step 1 to step 4 until the pre-segmentation results meet your needs.

python nii2npz.py
python train.py -c <config-file>
python eval.py -m <model-path> -n <evaluate-number>

When the pre-segmentation results meet your needs, just

python eval.py -m <model-path> -n 0

Acknowledgments

  • Thank Kai Xuan for his efficient code bases.

Citation

@article{zhuang2022knee,
  title={Knee Cartilage Defect Assessment by Graph Representation and Surface Convolution},
  author={Zhuang, Zixu and Si, Liping and Wang, Sheng and Xuan, Kai and Ouyang, Xi and Zhan, Yiqiang and Xue, Zhong and Zhang, Lichi and Shen, Dinggang and Yao, Weiwu and Wang, Qian},
  journal={arXiv preprint arXiv:2201.04318},
  year={2022}
}

About

An easy iterative segmentation tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published