-
|
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
RandCropByLabelClassesdwas 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_flatis ZEROmonai.transforms.utils.map_classes_to_indicesreturned an empty list of indicesmonai.transforms.utils.generate_label_classes_crop_centersthen tries to sample with probabilities:classes = rand_state.choice(len(ratios_), size=num_samples, p=np.asarray(ratios_) / np.sum(ratios_))