Clear Filters
Clear Filters

It is possible to use of augmentedImageDatastore for image regression?

3 views (last 30 days)
In order to train a network for classification and to reduce overfitting I prepared the following augumented data store
imageAugmenter = imageDataAugmenter('RandXTranslation',[-24 24]);
imageSize = [8 1041 1];
augimdsTrain = augmentedImageDatastore(imageSize,imdsTrain,'DataAugmentation',imageAugmenter);
Then I trained the network for classification replacing previous training command
[net, traininfo] = trainNetwork(imdsTrain,layers,opts);
[net, traininfo] = trainNetwork(augimdsTrain,layers,opts);
This worked well.
Now I want to apply the same augumentation to train a different network for regression. I prepared the augmented data store using the images XTrain and the numeric labels YTrain
augXTrain = augmentedImageDatastore(imageSize,XTrain,YTrain,'DataAugmentation',imageAugmenter);
The command that I used to train the network for regression was
[net, traininfo] = trainNetwork(XTrain,YTrain,layers,opts);
which I replaced with the command
[net, traininfo] = trainNetwork(augXTrain,layers,opts);
But it does not seem to eliminate overfitting as in the case of the image classification. I think that augmentation must be implemented in a different way in the case of image regression. Any suggestion?

Answers (1)

Sahil Jain
Sahil Jain on 15 Nov 2021
Hi Antonio, the "augmentedImageDatastore" can be used for regression as well as classification. It is difficult to determine exactly why your network is overfitting as it depends on your data and network but for starters, you can try using a smaller network for regression or adding regularization.




Community Treasure Hunt

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

Start Hunting!