Imagedatastore for image regression, resize image from table
5 ビュー (過去 30 日間)
古いコメントを表示
I have used the following link to prepare imagedatasotre for Image to single value regression:
For training:
[net, info] = trainNetwork(table(ims_train.Files,Y_train),lgraph,training_options);
to add validation data:
options = trainingOptions('ValidationData',table(ims_val.Files,Y_val));
However, when I try to train the network I get the following error:
"Error using trainNetwork
The training images are of size 288×382×3 but the input layer expects images of size 256×256×3."
When I create de ImageDatastore I use the 'ReadFcn' option to resize the image.
Is there a way to keep the ReadFcn and not have to rescale all the images in their folders?
Thank you
0 件のコメント
回答 (1 件)
Neha
2023 年 5 月 29 日
Hi Iker,
I understand that you want to resize the images to train the model while retaining the original size of the images in the folder. To achieve this, there are alternatives to "ReadFcn" as explained in Preprocess images for Deep Learning. You can refer the code given below to use image augmentation to resize each image on-the-fly during training/validation.
augmenter = imageDataAugmenter();
% variable "imds": imageDataStore
augimdsTrain = augmentedImageDatastore([256,256], imds, 'DataAugmentation', augmenter);
Hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!