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

Problem in prediction: AssertionError: Spacing length should be 3 for 3D images #2593

Open
luuciaborrego02 opened this issue Nov 9, 2024 · 1 comment
Assignees

Comments

@luuciaborrego02
Copy link

I have preprocessed the images from the Decathlon prostate database (I previously converted them) and when I train, I get the message “training done” and when I make the prediction I get this:

2024-11-09 12:10:05.694911: Training done.
2024-11-09 12:10:06.177104: Using splits from existing split file: C:\Users\lucia\Desktop\nnUNet_preprocessed\Dataset002_prostate\splits_final.json
2024-11-09 12:10:06.177104: The split file contains 5 splits.
2024-11-09 12:10:06.177104: Desired fold for training: 0
2024-11-09 12:10:06.185123: This split has 25 training and 7 validation cases.
2024-11-09 12:10:06.185123: predicting prostate_00
2024-11-09 12:10:09.071009: predicting prostate_04
2024-11-09 12:10:10.271552: predicting prostate_14
2024-11-09 12:10:11.485538: predicting prostate_20
2024-11-09 12:10:12.708740: predicting prostate_25
2024-11-09 12:10:13.947531: predicting prostate_31
label_handling False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\utilities\label_handling
default_resampling False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\preprocessing\resampling
2024-11-09 12:10:15.173128: predicting prostate_42
label_handling False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\utilities\label_handling
default_resampling False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\preprocessing\resampling
base_reader_writer False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\imageio
natural_image_reader_writer False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\imageio
nibabel_reader_writer False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\imageio
reader_writer_registry False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\imageio
Spacing: (0.6000000238418579, 0.6000003218650818, 4.000002384185791, 1.0), Length: 4
label_handling False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\utilities\label_handling
default_resampling False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\preprocessing\resampling
base_reader_writer False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\imageio
natural_image_reader_writer False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\imageio
nibabel_reader_writer False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\imageio
reader_writer_registry False
C:\Users\lucia\Desktop\nnUNet\nnunetv2\imageio
Spacing: (0.6000000238418579, 0.6000001430511475, 4.000000476837158, 1.0), Length: 4
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\Users\lucia\AppData\Local\Programs\Python\Python310\lib\multiprocessing\pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "C:\Users\lucia\AppData\Local\Programs\Python\Python310\lib\multiprocessing\pool.py", line 51, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "C:\Users\lucia\Desktop\nnUNet\nnunetv2\inference\export_prediction.py", line 105, in export_prediction_from_logits
rw.write_seg(segmentation_final, output_file_truncated + dataset_json_dict_or_file['file_ending'],
File "C:\Users\lucia\Desktop\nnUNet\nnunetv2\imageio\simpleitk_reader_writer.py", line 124, in write_seg
assert len(spacing) == 3, "Spacing length should be 3 for 3D images"
AssertionError: Spacing length should be 3 for 3D images
"""

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

Traceback (most recent call last):
File "C:\Users\lucia\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\lucia\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\lucia\nnunet_env\Scripts\nnUNetv2_train.exe_main
.py", line 7, in
sys.exit(run_training_entry())
File "C:\Users\lucia\Desktop\nnUNet\nnunetv2\run\run_training.py", line 268, in run_training_entry
run_training(args.dataset_name_or_id, args.configuration, args.fold, args.tr, args.p, args.pretrained_weights,
File "C:\Users\lucia\Desktop\nnUNet\nnunetv2\run\run_training.py", line 208, in run_training
nnunet_trainer.perform_actual_validation(export_validation_probabilities)
File "C:\Users\lucia\Desktop\nnUNet\nnunetv2\training\nnUNetTrainer\nnUNetTrainer.py", line 1248, in perform_actual_validation
_ = [r.get() for r in results]
File "C:\Users\lucia\Desktop\nnUNet\nnunetv2\training\nnUNetTrainer\nnUNetTrainer.py", line 1248, in
_ = [r.get() for r in results]
File "C:\Users\lucia\AppData\Local\Programs\Python\Python310\lib\multiprocessing\pool.py", line 774, in get
raise self._value
AssertionError: Spacing length should be 3 for 3D images

@seziegler
Copy link
Member

Hi @luuciaborrego02 ,
the spacing of prostate_31 seems to have an additional value of 1.0. Can you check that file manually and adjust the spacing?

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

2 participants