I want to resize all images in folder [224 224 3].
aug_imds = augmentedImageDatastore([224 224 3], imdsTrain,'ColorPreprocessing', 'rgb2gray');
layers = [
imageInputLayer([224 224 3])
convolution2dLayer(3, 8, 'Padding', 'same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2, 'Stride', 2)
convolution2dLayer(3, 16, 'Padding', 'same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2, 'Stride', 2)
convolution2dLayer(3, 32, 'Padding', 'same')
batchNormalizationLayer
reluLayer
fullyConnectedLayer(8)
softmaxLayer
classificationLayer];
After augmentedImageDataStore, resizing image its returning new file [224 224 3] but after rg2gray image size changed to '224 224 1'
Error:
Error using trainNetwork
The training images are of size 224×224×1 but the input layer expects images of size 224×224×3.
Error in training (line 49)
net = trainNetwork(aug_imds, layers, options);
Tried multiple ways still dimension changed to 1. I want to resize, grayscale image and size should be [224 224 3]
Thanks in advance!
augmentedImageDatastore is designed for more simple augmentations. For more flexibility, you can always use transform/combine to define your augmentation. I think what is below is close to what you're looking for.
I would note that it seems like an easier + more efficient strategy would be to just grayscale convert your images to [224,224,1] and define your input layer to accept [224,224,1] data.