Group Abstract Group Abstract

Message Boards Message Boards

ImageAugmentationLayer on image and target mask

Posted 7 years ago
POSTED BY: Carl Lange
4 Replies
Posted 3 years ago
POSTED BY: Massimo Fazio

We haven't added any feature to ImageAugmentationLayer, but I don't see any reason why you shouldn't be able to achieve what you want by using the "generator" syntax of NetTrain as I mentioned in my old reply. Your generator function should grab a raw image together with its mask, generate random cropping parameters, apply the same cropping to both image and mask and return the crops.

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