MATLAB Answers


U-Net and Data Augmentation

Asked by Nicholas
on 2 Oct 2018
Latest activity Edited by Nicholas
on 2 Oct 2018
Hello message board,
I have a question about data augmentation and U-net. If I create a pixelLabelImageDataStore as in the code below and pass it an imageDataAugementer what will be the mini-batch behavior during the optimization?
Will random rotations and translations be applied to every set of images that's passed in to the optimizer as a mini-batch? By adding the imageDataAugmenter am I ensuring that each image of each mini batch has some random transformation applied to it so that effectively each mini-batch looks a little different? If I wanted this code to train with an imDataStore that's 10 times larger than I really have will running 10 times as many epochs effectively produce this due to random geometric transformations at each iteration? (Ignoring that some simple random geometric transformations won't really produce ten times as much independent data).
PIXEL_LABELDIR = 'DATA/pixelLabelDataStore';
imds = imageDatastore(DATASTOREDIR);
pxds = pixelLabelDatastore(PIXEL_LABELDIR,{'Background', 'Foreground'},[0, 255]);
augmenter = imageDataAugmenter( ...
'RandRotation',[0 360], ... %%%%Degrees
'RandXTranslation', [-10 10],... %%Pixels
'RandYTranslation', [10 10] ); %%%Pixels
pximds = pixelLabelImageDatastore(imds,pxds, 'DataAugmentation', augmenter);
lgraph = unetLayers([256,256],2);
[net,info] = trainNetwork(pximds,lgraph);


Sign in to comment.

0 Answers