MATLAB Answers

How to check number of augmented images from imageDataAugmenter

조회 수: 13(최근 30일)
Gent Ymeri
Gent Ymeri 26 Mar 2019
답변: Kenta 14 Jul 2020
Hi, I am new to matlab and wanted to ask if there is a way to know the number of output images after augmentation from imageDataAugmenter.
As I have a high number of imbalanced classes, I wanted to know the class distribution after augmentation. Thanks in advance! This is how I augment the images:
imageAugmenter = imageDataAugmenter('RandRotation',[-180 180],'RandXReflection', true, 'RandYReflection', true, 'RandXShear', [-90, 90], 'RandYShear', [-90, 90]);
imageSize = [50 50 3];
datasource = augmentedImageSource(imageSize,imds70,'DataAugmentation',imageAugmenter);

  댓글 수: 0

댓글을 달려면 로그인하십시오.

답변(2개)

Mahmoud Afifi
Mahmoud Afifi 7 May 2020
ImageDataAugmenter does the augmentation during image loading, which means it doesn’t rebalance your data. It applies the selected augmentation on the fly.
If you would like to rebalance your data, you need to apply the augmentation offline and adjust the number of augmented samples accordingly. You can design your own custom function to do that. I refer you to our WB augmenter here .
Another option is to use a weighted loss func that penalizes more for mistakes in the classes that have lower training examples.

  댓글 수: 0

댓글을 달려면 로그인하십시오.


Kenta
Kenta 14 Jul 2020
Hi, you can rebalance the number of images per class using the following sample. Just using the image augmenter as you mentioned does not compensate the class imbalance. Hope this helps.

  댓글 수: 0

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by