Abdomen-CT-Image-Segmentation icon indicating copy to clipboard operation
Abdomen-CT-Image-Segmentation copied to clipboard

Update request for requirements file: batchgenerators>=0.19.3 should be batchgenerators==0.19.3

Open davidkvcs opened this issue 2 years ago • 0 comments

I got longer error while following the readme and running python3 experiment_planning/plan_and_preprocess_task.py -t TaskXXX_Pancreas -p X. The error end with: TypeError: resize_segmentation() got an unexpected keyword argument 'cval'

Copying the full error below for reference.

Turns out the error was due to the cval argument being removed in the latest version of batchgenerators which was install since the requirements file has: batchgenerators>=0.19.3

I think this should be updated to simply: batchgenerators==0.19.3

The full error which was fixed by this change is: multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/homes/kovacs/anaconda3/envs/tureckova_dgk1/lib/python3.9/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/homes/kovacs/anaconda3/envs/tureckova_dgk1/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar return list(map(*args)) File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/preprocessing/preprocessing.py", line 270, in _run_star data, seg, properties = self.resample_and_normalize(data, target_spacing, File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/preprocessing/preprocessing.py", line 204, in resample_and_normalize data, seg = resample_patient(data, seg, np.array(properties["original_spacing"]), target_spacing, 3, 1, File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/preprocessing/preprocessing.py", line 83, in resample_patient seg_reshaped = resample_data_or_seg(seg, new_shape, True, axis, order_seg, do_separate_z, cval=cval_seg, File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/preprocessing/preprocessing.py", line 131, in resample_data_or_seg reshaped_data.append(resize_fn(data[c, slice_id], new_shape_2d, order, cval=cval, **kwargs)) TypeError: resize_segmentation() got an unexpected keyword argument 'cval' """ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/experiment_planning/plan_and_preprocess_task.py", line 236, in plan_and_preprocess(task, processes, no_preprocessing) File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/experiment_planning/plan_and_preprocess_task.py", line 136, in plan_and_preprocess exp_planner.run_preprocessing(num_threads) File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/experiment_planning/experiment_planner_baseline_3DUNet.py", line 383, in run_preprocessing preprocessor.run(target_spacings, self.folder_with_cropped_data, self.preprocessed_output_folder, File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/preprocessing/preprocessing.py", line 311, in run p.map(self._run_star, all_args) File "/homes/kovacs/anaconda3/envs/tureckova_dgk1/lib/python3.9/multiprocessing/pool.py", line 364, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/homes/kovacs/anaconda3/envs/tureckova_dgk1/lib/python3.9/multiprocessing/pool.py", line 771, in get raise self._value TypeError: resize_segmentation() got an unexpected keyword argument 'cval'

Simply did pip uninstall batchgenerators pip install batchgenerators==0.19.3

and the function stopped producing this error.

davidkvcs avatar Apr 27 '22 07:04 davidkvcs