RandomCropWithMinPositivePixels¶
- class mfai.pytorch.transforms.RandomCropWithMinPositivePixels(crop_size=(512, 512), min_positive_percentage=15.0, tries=5)[source]¶
Bases:
objectRandomly crops an input image to a 512x512 image, with min 15% of positive pixels. The random crop is performed 5 times at the most, or until an image with 15% of positive pixels is found. If such an image is not found, it returns the image with the most positive pixels from the 5 images cropped.
input is a tuple sample with x and y x shape (C, H, W) y shape (1, H, W)