RuntimeError: applying transform RandCropByPosNegLabeld #1811
-
Hi :) Thank you for the great package. The detailed documentation is also very much appreciated ! I have successfully run the Spleen 3D Segmentation notebook with the provided data. I'm now trying to get it to work with my custom dataset (CT scans of hands in NIfTI format with 3 classes: background, trapezium & metacarpial bone of the thumb). My problem epoch 1/600 ValueError Traceback (most recent call last) ~\anaconda3\envs\kerimedical\lib\site-packages\monai\transforms\croppad\dictionary.py in call(self, data) ~\anaconda3\envs\kerimedical\lib\site-packages\monai\transforms\croppad\dictionary.py in randomize(self, label, fg_indices, bg_indices, image) ~\anaconda3\envs\kerimedical\lib\site-packages\monai\transforms\utils.py in map_binary_to_indices(label, image, image_threshold) ValueError: operands could not be broadcast together with shapes (778998,) (0,) The above exception was the direct cause of the following exception: RuntimeError Traceback (most recent call last) ~\anaconda3\envs\kerimedical\lib\site-packages\torch\utils\data\dataloader.py in next(self) ~\anaconda3\envs\kerimedical\lib\site-packages\torch\utils\data\dataloader.py in _next_data(self) ~\anaconda3\envs\kerimedical\lib\site-packages\torch\utils\data_utils\fetch.py in fetch(self, possibly_batched_index) ~\anaconda3\envs\kerimedical\lib\site-packages\torch\utils\data_utils\fetch.py in (.0) ~\anaconda3\envs\kerimedical\lib\site-packages\monai\data\dataset.py in getitem(self, index) ~\anaconda3\envs\kerimedical\lib\site-packages\monai\transforms\utils.py in apply_transform(transform, data, map_items) RuntimeError: applying transform <monai.transforms.croppad.dictionary.RandCropByPosNegLabeld object at 0x00000277E4C14F10> What didn't solve the problem Any help or suggestion would be greatly appreciated :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @dianemarquette , I feel it's something related to numpy version. Maybe you can update your numpy and try again? Thanks. |
Beta Was this translation helpful? Give feedback.
-
I ended up understanding the cause of this error. I'm writing it here in case it can help someone else. The problem didn't come from the code. It was the dataset. The labels of two CT scans must have been incorrectly exported. As a result, the dimensions of the labels didn't match the dimensions of the scans (for scans #6 and #10). Deleting these mislabeled scans from my dataset solved the problem :). Cheers, Diane |
Beta Was this translation helpful? Give feedback.
I ended up understanding the cause of this error. I'm writing it here in case it can help someone else.
The problem didn't come from the code. It was the dataset. The labels of two CT scans must have been incorrectly exported. As a result, the dimensions of the labels didn't match the dimensions of the scans (for scans #6 and #10).
Deleting these mislabeled scans from my dataset solved the problem :).
Cheers,
Diane