Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postprocessing.json #17

Closed
zhangjin506 opened this issue Sep 28, 2021 · 16 comments
Closed

postprocessing.json #17

zhangjin506 opened this issue Sep 28, 2021 · 16 comments

Comments

@zhangjin506
Copy link

(nnFormer) toolman@modeling506:~/Heart_model/zhang/nnFormer/nnformer$ nnFormer_predict -i ../DATASET/nnFormer_raw/nnFormer_raw_data/Task001_ACDC/imagesTs -o ../DATASET/nnFormer_raw/nnFormer_raw_data/Task001_ACDC/inferTs/output -m 3d_fullres -f 0 -t 1 -chk model_best -tr nnFormerTrainerV2_ACDC
using model stored in /home/toolman/Heart_model/zhang/nnFormer/DATASET/nnFormer_trained_models/nnFormer/3d_fullres/Task001_ACDC/nnFormerTrainerV2_ACDC__nnFormerPlansv2.1
This model expects 1 input modalities for each image
Found 40 unique case ids, here are some examples: ['patient009_frame13_0000' 'patient095_frame12_0000'
'patient079_frame01_0000' 'patient053_frame12_0000'
'patient081_frame07_0000' 'patient081_frame07_0000'
'patient009_frame13_0000' 'patient064_frame12_0000'
'patient088_frame01_0000' 'patient003_frame15_0000']
If they don't look right, make sure to double check your filenames. They must end with _0000.nii.gz etc
number of cases: 40
number of cases that still need to be predicted: 0
emptying cuda cache
loading parameters for folds, [0]
2021-09-28 14:03:56.302944: Using dummy2d data augmentation
I am using the pre_train weight!!
using the following model files: ['/home/toolman/Heart_model/zhang/nnFormer/DATASET/nnFormer_trained_models/nnFormer/3d_fullres/Task001_ACDC/nnFormerTrainerV2_ACDC__nnFormerPlansv2.1/fold_0/model_best.model']
starting preprocessing generator
starting prediction...
inference done. Now waiting for the segmentation export to finish...
WARNING! Cannot run postprocessing because the postprocessing file is missing. Make sure to run consolidate_folds in the output folder of the model first!
The folder you need to run this in is /home/toolman/Heart_model/zhang/nnFormer/DATASET/nnFormer_trained_models/nnFormer/3d_fullres/Task001_ACDC/nnFormerTrainerV2_ACDC__nnFormerPlansv2.1

请问一下,为什么会出现上面问题?是缺少postprocessing.json文件还是我少了步骤?

@282857341
Copy link
Owner

不影响,出现这个提示是正常的,我们并没有用到后处理。

@zhangjin506
Copy link
Author

您好,但是我最后得到的dice系数结果如下:


Mean_Dice
Dice_rv nan
Dice_myo nan
Dice_lv nan


DSC:nan

我之前执行的时候,提示找不到plans.pkl文件,于是我把nnFormerPlansv2.1_ACDC_plans_3D.pkl(这是 3 Generating plan files of our network的结果)改成了plans.pkl,不知道这样对不对?

@282857341
Copy link
Owner

你好,请问是具体执行哪一步命令提示找不到plans.pkl文件的呢?

训练的时候需要读取nnFormerPlansv2.1_ACDC_plans_3D.pkl,如果更改了这个文件的名称,训练就会报错

@zhangjin506
Copy link
Author

zhangjin506 commented Sep 29, 2021 via email

@282857341
Copy link
Owner

根据你推理的信息,你应该已经完成了40个case的推理,只需要运行inference.py计算dice。
计算dice得到nan的结果,应该是对空的list做了平均,你可以检查一下test()这个函数的for循环

@zhangjin506
Copy link
Author

zhangjin506 commented Sep 29, 2021 via email

@wuliwan
Copy link

wuliwan commented Sep 29, 2021

我想问一下那个运行完nnFormer_predict -i....之后只生成了plans.pkl,没有nii.gz文件但计算DICE时需要,是我哪一步出现问题了嘛?

@zhangjin506
Copy link
Author

zhangjin506 commented Sep 29, 2021 via email

@282857341
Copy link
Owner

282857341 commented Sep 29, 2021

也有可能完成了推理,但是保存的文件目录位置错了,因为我在指令和inference.py里使用的是相对路径
我看楼主运行nnFormer_predict 后有如下的结果
number of cases: 40
number of cases that still need to be predicted: 0
程序会检查目标文件夹还有多少个case需要被预测,这里number of cases that still need to be predicted=0说明目标文件夹40个case推理已经推理完了

至于plans.pkl这个文件是在nnFormer_predict这个指令后自动生成的

@wuliwan
Copy link

wuliwan commented Sep 30, 2021

plans.pkl你是这一步之后生成的么?我那个上面提示好像是执行这一步需要这个文件…我们可以加个好友讨论讨论

------------------ Original ------------------ From: wuliwan @.> Date: Wed,Sep 29,2021 6:49 PM To: 282857341/nnFormer @.> Cc: zhangjin506 @.>, Author @.> Subject: Re: [282857341/nnFormer] postprocessing.json (#17) 我想问一下那个运行完nnFormer_predict -i....之后只生成了plans.pkl,没有nii.gz文件但计算DICE时需要,是我哪一步出现问题了嘛? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

好啊 我q:1256281294

@wuliwan
Copy link

wuliwan commented Sep 30, 2021

也有可能完成了推理,但是保存的文件目录位置错了,因为我在指令和inference.py里使用的是相对路径 我看楼主运行nnFormer_predict 后有如下的结果 number of cases: 40 number of cases that still need to be predicted: 0 程序会检查目标文件夹还有多少个case需要被预测,这里number of cases that still need to be predicted=0说明目标文件夹40个case推理已经推理完了

至于plans.pkl这个文件是在nnFormer_predict这个指令后自动生成的

我的是number of cases that still need to be predicted: 28 没有进行推理是什么原因呢

@282857341
Copy link
Owner

也有可能完成了推理,但是保存的文件目录位置错了,因为我在指令和inference.py里使用的是相对路径 我看楼主运行nnFormer_predict 后有如下的结果 number of cases: 40 number of cases that still need to be predicted: 0 程序会检查目标文件夹还有多少个case需要被预测,这里number of cases that still need to be predicted=0说明目标文件夹40个case推理已经推理完了
至于plans.pkl这个文件是在nnFormer_predict这个指令后自动生成的

我的是number of cases that still need to be predicted: 28 没有进行推理是什么原因呢

没有进行推理说明程序在哪卡住了,而nnunet的框架即使推理卡住了也不会报错。

请问是对synapse或是acdc的数据进行推理吗?因为如果对这两个数据进行推理number of cases that still need to be predicted这个数字应该是12和40。如果是对其他数据进行推理,请严格按照数据放置的格式要求。

@wuliwan
Copy link

wuliwan commented Sep 30, 2021

也有可能完成了推理,但是保存的文件目录位置错了,因为我在指令和inference.py里使用的是相对路径 我看楼主运行nnFormer_predict 后有如下的结果 number of cases: 40 number of cases that still need to be predicted: 0 程序会检查目标文件夹还有多少个case需要被预测,这里number of cases that still need to be predicted=0说明目标文件夹40个case推理已经推理完了
至于plans.pkl这个文件是在nnFormer_predict这个指令后自动生成的

我的是number of cases that still need to be predicted: 28 没有进行推理是什么原因呢

没有进行推理说明程序在哪卡住了,而nnunet的框架即使推理卡住了也不会报错。

请问是对synapse或是acdc的数据进行推理吗?因为如果对这两个数据进行推理number of cases that still need to be predicted这个数字应该是12和40。如果是对其他数据进行推理,请严格按照数据放置的格式要求。

是其他数据,后来发现是我可能用windows跑然后只能将进程设为0,遍历进程的时候没有读取到好像,不知如何解决

@zhangjin506
Copy link
Author

你好,最近我重新试了一下,没有更改之前的文件名,但是又出现了之前说的问题,就是找不到plans.pkl
问题如下:
(nnFormer) toolman@modeling506:~/Heart_model/zhang/nnFormer/nnformer$ nnFormer_predict -i ../DATASET/nnFormer_raw/nnFormer_raw_data/Task001_ACDC/imagesTs -o ../DATASET/nnFormer_raw/nnFormer_raw_data/Task001_ACDC/inferTs/output -m 3d_fullres -f 0 -t 1 -chk model_best -tr nnFormerTrainerV2_ACDC
using model stored in /home/toolman/Heart_model/zhang/nnFormer/DATASET/nnFormer_trained_models/nnFormer/3d_fullres/Task001_ACDC/nnFormerTrainerV2_ACDC__nnFormerPlansv2.1
Traceback (most recent call last):
File "/home/toolman/anaconda3/envs/nnFormer/bin/nnFormer_predict", line 33, in
sys.exit(load_entry_point('nnformer', 'console_scripts', 'nnFormer_predict')())
File "/home/toolman/Heart_model/zhang/nnFormer/nnformer/inference/predict_simple.py", line 221, in main
step_size=step_size, checkpoint_name=args.chk)
File "/home/toolman/Heart_model/zhang/nnFormer/nnformer/inference/predict.py", line 603, in predict_from_folder
shutil.copy(join(model, 'plans.pkl'), output_folder)
File "/home/toolman/anaconda3/envs/nnFormer/lib/python3.6/shutil.py", line 245, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/home/toolman/anaconda3/envs/nnFormer/lib/python3.6/shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/home/toolman/Heart_model/zhang/nnFormer/DATASET/nnFormer_trained_models/nnFormer/3d_fullres/Task001_ACDC/nnFormerTrainerV2_ACDC__nnFormerPlansv2.1/plans.pkl'

@282857341
Copy link
Owner

282857341 commented Oct 9, 2021

你好,最近我重新试了一下,没有更改之前的文件名,但是又出现了之前说的问题,就是找不到plans.pkl 问题如下: (nnFormer) toolman@modeling506:~/Heart_model/zhang/nnFormer/nnformer$ nnFormer_predict -i ../DATASET/nnFormer_raw/nnFormer_raw_data/Task001_ACDC/imagesTs -o ../DATASET/nnFormer_raw/nnFormer_raw_data/Task001_ACDC/inferTs/output -m 3d_fullres -f 0 -t 1 -chk model_best -tr nnFormerTrainerV2_ACDC using model stored in /home/toolman/Heart_model/zhang/nnFormer/DATASET/nnFormer_trained_models/nnFormer/3d_fullres/Task001_ACDC/nnFormerTrainerV2_ACDC__nnFormerPlansv2.1 Traceback (most recent call last): File "/home/toolman/anaconda3/envs/nnFormer/bin/nnFormer_predict", line 33, in sys.exit(load_entry_point('nnformer', 'console_scripts', 'nnFormer_predict')()) File "/home/toolman/Heart_model/zhang/nnFormer/nnformer/inference/predict_simple.py", line 221, in main step_size=step_size, checkpoint_name=args.chk) File "/home/toolman/Heart_model/zhang/nnFormer/nnformer/inference/predict.py", line 603, in predict_from_folder shutil.copy(join(model, 'plans.pkl'), output_folder) File "/home/toolman/anaconda3/envs/nnFormer/lib/python3.6/shutil.py", line 245, in copy copyfile(src, dst, follow_symlinks=follow_symlinks) File "/home/toolman/anaconda3/envs/nnFormer/lib/python3.6/shutil.py", line 120, in copyfile with open(src, 'rb') as fsrc: FileNotFoundError: [Errno 2] No such file or directory: '/home/toolman/Heart_model/zhang/nnFormer/DATASET/nnFormer_trained_models/nnFormer/3d_fullres/Task001_ACDC/nnFormerTrainerV2_ACDC__nnFormerPlansv2.1/plans.pkl'

import os
import shutil
if not os.path.exists(join(model_folder_name, "plans.pkl")):
plans_file = join(preprocessing_output_dir, task_name, args.plans_identifier + "_plans_3D.pkl")
shutil.copy(plans_file, join(model_folder_name, "plans.pkl"))

在文件下补充这些代码,由于我的部分代码已经做了一些修改,所以如果你clone的是今天之前的代码,就将"_plans_3D.pkl"修改为"_ACDC_plans_3D.pkl"

@zhangjin506
Copy link
Author

zhangjin506 commented Oct 9, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants