RandCropByPosNegLabeld AttributeError: 'list' object has no attribute 'keys' #1491
Replies: 4 comments 3 replies
-
Hi, what makes you think this is related to This part of the error:
implies to me that it's trying to use a dictionary-based transform on a list. I.e., |
Beta Was this translation helpful? Give feedback.
-
Hi @rijobr! You're right, I just don't understand why this is happening. I swap |
Beta Was this translation helpful? Give feedback.
-
In MONAI, there are two ways of doing transforms. You can either do them via arrays or dictionaries. An example of the array transforms is given in this notebook, whereas an example of dictionary transforms is given in this one. You are opting for the latter, which means that subjects_list[TRAINING] = []
for i, s in zip(image_filenames, segementation_filenames):
subjects_list[TRAINING].append({
"image": i,
"label": s,
}) I can't see the definition of |
Beta Was this translation helpful? Give feedback.
-
@rijobro I had a bug in the |
Beta Was this translation helpful? Give feedback.
-
Running a minimal example for a patch-based segmentation based on the spleen Lightning segmentation tutorial from here.
However, the returned training batch is a list instead of a dict. The validation bit works with no error.
Here is a print of the error:
Below is shown how the transforms, training/validation steps, and loaders are coded.
Beta Was this translation helpful? Give feedback.
All reactions