MIC-DKFZ / nnUNet

Apache License 2.0
5.83k stars 1.75k forks source link

nnUNetv2_plan_and_preprocess -d 066 #2218

Closed antoniaaaaaaaa closed 5 months ago

antoniaaaaaaaa commented 5 months ago

I was using a new dataset and named it 66. This error has occurred When I was trying to train a new model

Fingerprint extraction... Dataset066_MR-liver Using <class 'nnunetv2.imageio.simpleitk_reader_writer.SimpleITKIO'> as reader/writer 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 392/392 [00:22<00:00, 17.12it/s] multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/huyao/anaconda3/envs/nnUNet/lib/python3.9/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/home/huyao/anaconda3/envs/nnUNet/lib/python3.9/multiprocessing/pool.py", line 51, in starmapstar return list(itertools.starmap(args[0], args[1])) File "/home/huyao/nnUNet/nnunetv2/experiment_planning/dataset_fingerprint/fingerprint_extractor.py", line 93, in analyze_case data_cropped, seg_cropped, bbox = crop_to_nonzero(images, segmentation) File "/home/huyao/nnUNet/nnunetv2/preprocessing/cropping/cropping.py", line 43, in crop_to_nonzero seg[(seg == 0) & (~nonzero_mask)] = nonzero_label ValueError: operands could not be broadcast together with shapes (1,76,464,510) (1,84,464,510) """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/huyao/anaconda3/envs/nnUNet/bin/nnUNetv2_plan_and_preprocess", line 8, in sys.exit(plan_and_preprocess_entry()) File "/home/huyao/nnUNet/nnunetv2/experiment_planning/plan_and_preprocess_entrypoints.py", line 182, in plan_and_preprocess_entry extract_fingerprints(args.d, args.fpe, args.npfp, args.verify_dataset_integrity, args.clean, args.verbose) File "/home/huyao/nnUNet/nnunetv2/experiment_planning/plan_and_preprocess_api.py", line 46, in extract_fingerprints extract_fingerprint_dataset(d, fingerprint_extractor_class, num_processes, check_dataset_integrity, clean, File "/home/huyao/nnUNet/nnunetv2/experiment_planning/plan_and_preprocess_api.py", line 32, in extract_fingerprint_dataset return fpe.run(overwrite_existing=clean) File "/home/huyao/nnUNet/nnunetv2/experiment_planning/dataset_fingerprint/fingerprint_extractor.py", line 154, in run results = [i.get()[0] for i in r] File "/home/huyao/nnUNet/nnunetv2/experiment_planning/dataset_fingerprint/fingerprint_extractor.py", line 154, in results = [i.get()[0] for i in r] File "/home/huyao/anaconda3/envs/nnUNet/lib/python3.9/multiprocessing/pool.py", line 771, in get raise self._value ValueError: operands could not be broadcast together with shapes (1,76,464,510) (1,84,464,510)

amspsingh04 commented 5 months ago

what is the plans.json you obtained after preprocessing?

Kobalt93 commented 5 months ago

Hi antoniaaaaaaaa, Could you please run nnUNetv2_plan_and_preprocess -d 066 --verify_dataset_integrity? This should give which case is problematic.

antoniaaaaaaaa commented 5 months ago

Hi antoniaaaaaaaa, Could you please run nnUNetv2_plan_and_preprocess -d 066 --verify_dataset_integrity? This should give which case is problematic.

Warning: Origin mismatch between segmentation and corresponding images. Origin images: (0.0, 0.0, 0.0). Origin seg: (-167.0134735107422, -150.0159912109375, -131.1856231689453). Image files: ['/home/huyao/nnUNet/nnUNetFrame/DATASET/nnUNet_raw/Dataset066_MR-liver/imagesTr/MR94749_C+A_0000.nii.gz']. Seg file: /home/huyao/nnUNet/nnUNetFrame/DATASET/nnUNet_raw/Dataset066_MR-liver/labelsTr/MR94749_C+A.nii.gz

Error: Spacing mismatch between segmentation and corresponding images. Spacing images: [1.0, 1.0, 1.0]. Spacing seg: [2.999999761581421, 0.739208459854126, 0.739208459854126]. Image files: ['/home/huyao/nnUNet/nnUNetFrame/DATASET/nnUNet_raw/Dataset066_MR-liver/imagesTr/MR96745_C+A_0000.nii.gz']. Seg file: /home/huyao/nnUNet/nnUNetFrame/DATASET/nnUNet_raw/Dataset066_MR-liver/labelsTr/MR96745_C+A.nii.gz

Warning: Origin mismatch between segmentation and corresponding images. Origin images: (0.0, 0.0, 0.0). Origin seg: (-198.01629638671875, -184.9271240234375, 6.465367794036865). Image files: ['/home/huyao/nnUNet/nnUNetFrame/DATASET/nnUNet_raw/Dataset066_MR-liver/imagesTr/MR96745_C+A_0000.nii.gz']. Seg file: /home/huyao/nnUNet/nnUNetFrame/DATASET/nnUNet_raw/Dataset066_MR-liver/labelsTr/MR96745_C+A.nii.gz

Traceback (most recent call last): File "/home/huyao/anaconda3/envs/nnUNet/bin/nnUNetv2_plan_and_preprocess", line 8, in sys.exit(plan_and_preprocess_entry()) File "/home/huyao/nnUNet/nnunetv2/experiment_planning/plan_and_preprocess_entrypoints.py", line 182, in plan_and_preprocess_entry extract_fingerprints(args.d, args.fpe, args.npfp, args.verify_dataset_integrity, args.clean, args.verbose) File "/home/huyao/nnUNet/nnunetv2/experiment_planning/plan_and_preprocess_api.py", line 46, in extract_fingerprints extract_fingerprint_dataset(d, fingerprint_extractor_class, num_processes, check_dataset_integrity, clean, File "/home/huyao/nnUNet/nnunetv2/experiment_planning/plan_and_preprocess_api.py", line 29, in extract_fingerprint_dataset verify_dataset_integrity(join(nnUNet_raw, dataset_name), num_processes) File "/home/huyao/nnUNet/nnunetv2/experiment_planning/verify_dataset_integrity.py", line 220, in verify_dataset_integrity raise RuntimeError( RuntimeError: Some images have errors. Please check text output above to see which one(s) and what's going on.

Kobalt93 commented 5 months ago

Thank you. Yes, so your segmentation dimensions for those cases (origin/spacings) don't match the images. You have to correct your cases manually, the error is not related to nnUNet. Feel free to reopen this issue if you need further assistance.