PaddleSeg
PaddleSeg copied to clipboard
nnunet pkl文件
问题确认 Search before asking
- [X] 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.
请提出你的问题 Please ask your question
你好,如果我使用nnunet只想进行肺结节推理的话,我看需要一个flag是plan_path,这个pkl文件应该在哪下载或者生成,还是说直接忽略这个flag就好?权重文件我已经下好了。
plans.pkl这个文件基本参照了nnunet原始的设定,区别在于paddleseg把他放到了datasets初始化的时候 下面是一个示例:
%cd ~/PaddleSeg/contrib/MedicalSeg/
from nnunet.datasets import *
config = dict(
plans_name= 'nnUNetPlansv2.1_plans_3D.pkl',
dataset_root= '/',
result_dir= '/',
raw_data_dir= 'msd_lung/Task06_Lung',
decathlon_dir= 'msd_lung/Task006_Lung',
cropped_data_dir= 'msd_lung/cropped/Task006_Lung',
preprocessed_dir= 'msd_lung/preprocessed/Task006_Lung',
plan2d= True,
plan3d= False,
num_batches_per_epoch= 250,
fold= 2,
stage= 1,
unpack_data= True,
cascade= True,
mode= 'train',
)
dataset = MSDDataset(**config)
读取plan文件:
import pickle
def load_pickle(file):
with open(file, 'rb') as f:
data = pickle.load(f)
return data
load_pickle("msd_lung/preprocessed/Task006_Lung/nnUNetPlansv2.1_plans_2D.pkl")
输出结果:
{'num_stages': 1,
'num_modalities': 1,
'modalities': {0: 'CT'},
'normalization_schemes': OrderedDict([(0, 'CT')]),
'dataset_properties': {'all_sizes': [(304, 512, 512)],
'all_spacings': [array([1. , 0.69335938, 0.69335938])],
'all_classes': [1],
'modalities': {0: 'CT'},
'intensityproperties': OrderedDict([(0,
OrderedDict([('local_props',
OrderedDict([('lung_001',
OrderedDict([('median', -42.0),
('mean', -144.93015),
('sd', 201.28882),
('mn', -764.0),
('mx', 87.0),
('percentile_99_5',
84.86999999999989),
('percentile_00_5',
-682.74)]))])),
('median', -42.0),
('mean', -144.93015),
('sd', 201.28882),
('mn', -764.0),
('mx', 87.0),
('percentile_99_5', 84.86999999999989),
('percentile_00_5', -682.74)]))]),
'size_reductions': OrderedDict([('lung_001', 1.0)])},
'list_of_npz_files': ['msd_lung/cropped/Task006_Lung/lung_001.npz'],
'original_spacings': [array([1. , 0.69335938, 0.69335938])],
'original_sizes': [(304, 512, 512)],
'preprocessed_data_folder': 'msd_lung/preprocessed/Task006_Lung',
'num_classes': 1,
'all_classes': [1],
'base_num_features': 32,
'use_mask_for_norm': OrderedDict([(0, False)]),
'keep_only_largest_region': None,
'min_region_size_per_class': None,
'min_size_per_class': None,
'transpose_forward': [0, 1, 2],
'transpose_backward': [0, 1, 2],
'data_identifier': 'nnUNetData_plans_v2.1_2D',
'plans_per_stage': {0: {'batch_size': 12,
'num_pool_per_axis': [7, 7],
'patch_size': array([512, 512]),
'median_patient_size_in_voxels': array([304, 512, 512]),
'current_spacing': array([1. , 0.69335938, 0.69335938]),
'original_spacing': array([1. , 0.69335938, 0.69335938]),
'pool_op_kernel_sizes': [[2, 2],
[2, 2],
[2, 2],
[2, 2],
[2, 2],
[2, 2],
[2, 2]],
'conv_kernel_sizes': [[3, 3],
[3, 3],
[3, 3],
[3, 3],
[3, 3],
[3, 3],
[3, 3],
[3, 3]],
'do_dummy_2D_data_aug': False}},
'preprocessor_name': 'PreprocessorFor2D'}