Group Abstract Group Abstract

Message Boards Message Boards

ImageAugmentationLayer on image and target mask

Posted 7 years ago

Hi, I'd like to use ImageAugmentationLayer in my binary image segmentation neural network. However, it seems like I can't get the ImageSegmentationLayer to do exactly the same transform on my input image as on my target mask. Is there a hidden way to do this that's not mentioned in the docs? It seems like every invocation of the layer will use a new random crop, but I need to do the exact same random crop on pairs of images. Cheers!

POSTED BY: Carl Lange
4 Replies
Posted 3 years ago

@Matteo - was this limitation overcome in the latest versions? I can't find a way to lock the random cropping so that I can augment input and output images of the same random crop. Neither outside training as a pre-processing step. BlockRandom does not seem to lock the random crop parameters. Thanks

POSTED BY: Massimo Fazio
Posted 7 years ago

In the meantime I'm using this function to do it.

randomCrop[is_, sz_] := 
 Module[{x = RandomReal[{-1, 1}], y = RandomReal[{-1, 1}]},
  ImageCrop[#, sz, {x, y}] & /@ is
  ]
POSTED BY: Carl Lange
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard