-
I am using the When I am trying to train a network with a single class (e.g. hippocampus), and I am using some spatial augmentation e.g. My transforms are ordered as follows:
I think the rotation moves the hippocampus out of the image region and then RandCropByLabelClassesd fails to find any samples and divides by zero. I decided to crop at the end, since cropping before doing rotation/zooming would add "padding". Can you recommend a different ordering, or workaround?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Debugging the issue I found that the thresholded image in In summary
Workaround/fixset |
Beta Was this translation helpful? Give feedback.
Debugging the issue I found that the thresholded image in
RandCropByLabelClassesd
was responsible for my problem.In summary
image>image_threshold
(whereimage_threshold=0
) did not overlap with the mask for my labels:label_flat = img_flat & label_flat if img_flat is not None else label_flat
is ZEROmonai.transforms.utils.map_classes_to_indices
returned an empty list of indicesmonai.transforms.utils.generate_label_classes_crop_centers
then tries to sample with probabilities:classes = rand_state.choice(len(ratios_), size=num_samples, p=np.asarray(ratios_) / np.sum(ratios_))