赞
踩
大佬GitHub:https://github.com/MIC-DKFZ/nnUNet上面写得也很清楚,英文看着嫌麻烦,然后找的很棒的使用教程,最开始的入门教程看的是另一位大佬的
(四:2020.07.28)nnUNet最舒服的训练教程(让我的奶奶也会用nnUNet(上))(21.04.20更新)_花卷汤圆的博客-CSDN博客_nnunetpp简单总结一下就是:
-
- git clone https://github.com/MIC-DKFZ/nnUNet.git
- cd nnUNet
- pip install -e .
-
-
- pip install --upgrade git+https://github.com/FabianIsensee/hiddenlayer.git@more_plotted_details#egg=hiddenlayer
主要是创建DATASET那部分的文件,然后设置路径,在home目录中找到.bashrc(ctrl+h),在文件最后输入以下,然后保存退出,并在终端输入source .bashrc更新文档。
- export nnUNet_raw_data_base="/home/xx/nnUNetFrame/DATASET/nnUNet_raw"
- export nnUNet_preprocessed="/home/xx/nnUNetFrame/DATASET/nnUNet_preprocessed"
- export RESULTS_FOLDER="/home/xx/nnUNetFrame/DATASET/nnUNet_trained_models"
- from batchgenerators.utilities.file_and_folder_operations import *
- import shutil
- import nibabel as nib
- import numpy as np
- from nnunet.paths import nnUNet_raw_data
- from nnunet.dataset_conversion.utils import generate_dataset_json
-
- if __name__ == '__main__':
- # this is the data folder from the kits21 github repository, see https://github.com/neheller/kits21
- base = '/home/hannah/code/nnUNetFrame/DATASET/nnUNet_raw/nnUNet_raw_data/Task10_GJA'
-
-
- # Arbitrary task id. This is just to ensure each dataset ha a unique number. Set this to whatever ([0-999]) you
- # want
- task_id = 10
- task_name = "GJA"
- resampled_path = join(base, "labelsTr")
- nii_all = nib.load(os.path.join(resampled_path, "gja_001.nii.gz"))
- arr_all = np.array(nii_all.dataobj)
- numb = np.unique(arr_all)
- label = {}
- for i in range(len(numb)):
- label[i] = int(numb[i])
- print(label)
-
- generate_dataset_json(output_file=join(base, 'dataset.json'),
- imagesTr_dir=join(base, 'imagesTr'),
- imagesTs_dir=join(base, 'imagesTs'),
- modalities=('mri',),
- labels=label,
- dataset_name=task_name,
- license='nope',
- dataset_release='0')
- print("done!")
nnUNet_convert_decathlon_task -i /home/xx/nnUNetFrame/DATASET/nnUNet_raw/nnUNet_raw_data/Task01_brain
nnUNet_plan_and_preprocess -t 1
nnUNet_train 2d nnUNetTrainerV2 1 4
nnUNet_prodict -i /home/XX/Task001_brain/imagesTs -o /home/XX/Task001_brain/infersTs -t 1 -m 2d -f 4
后面在跑对比实验的时候,发现好多都是在nnunet上改的,包括unet++,所以如果用惯了,在这上面跑自己的模型跟数据,会很舒服
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。