I would like to confirm a few images just to understand what imageDataAugmenter does. Is there a way to visualize the augmented image data created by the imageDataAugmenter?
Kshitij Singh answered .
2025-11-20
augimds = augmentedImageDatastore(…)
ims = augimds.preview();
montage(ims{1:6,1}) % to visualize 6 images
augimds = augmentedImageDatastore(…);
numBatches = ceil(augimds.NumObservations / augimds.MiniBatchSize);
for i = 1:numBatches
ims = augimds.read();
montage(ims{:,1});
pause;
end
augimds.reset();
[XTrain,YTrain] = digitTrain4DArrayData;
imageAugmenter = imageDataAugmenter('RandRotation',[-180 180],'RandXReflection',true,'RandYReflection',true);
imageSize = [28 28 1];
datasource = augmentedImageSource(imageSize,XTrain,YTrain,'DataAugmentation',imageAugmenter);
datasource.MiniBatchSize = 16;
datasource.reset();
numBatches = ceil(datasource.NumberOfObservations / datasource.MiniBatchSize);
for i = 1:numBatches
ims = datasource.nextBatch();
montage( cat(4, ims) );
pause;
end