cannot resize images in a datastore
11 ビュー (過去 30 日間)
古いコメントを表示
I was going through the Deep Learning with MATLAB course and working on the first project. I tried to resize the images to feed them into googlenet. The original datastore had 1000+ images of size [200 200 3]. I tried:
trainds = augmentedImageDatastore([224 224],original_trainds);
but when I read the first image, the size had not changed. The baffling part was that when I looked at the provided solution, it was exactly what I had thought.
trainDs = augmentedImageDatastore([224 224],trainImgs);
I don't know which step went wrong. Thanks for your help.
0 件のコメント
採用された回答
Image Analyst
2022 年 2 月 24 日
I think the image scaling happens "on the fly" when doing training. I'm pretty sure it does not save the scaled images. And you need to specify the amount to scale. Here's a snippet from my code which basically comes from the Mathworks example for SegNet
%------------------------------------------------------------------------------------------------------------------------------------------------
% Create Augmenter which applies random reflection/translation/scale
augmenter = imageDataAugmenter('RandXReflection',true,...
'RandXTranslation',[-10 10],'RandYTranslation',[-10 10],'RandXScale',[0.8 1.2]);
% create the datastore for images,labels and augmenter together
pximds = pixelLabelImageDatastore(imds,pxds,'DataAugmentation',augmenter);
%Train Front - 50 epochs and 10 Augmentations per mask
options = trainingOptions('sgdm','InitialLearnRate',1e-3, ...
'MaxEpochs',1000,'VerboseFrequency',1,'MiniBatchSize',4,'Shuffle','every-epoch','Plots','training-progress','CheckpointPath',checkpointPath );
その他の回答 (1 件)
yanqi liu
2022 年 2 月 24 日
yes,sir,may be augmentedImageDatastore process as function,such as
which cameraman.tif
imdsTrain = imageDatastore(fullfile(matlabroot,'toolbox/images/imdata'), ...
'IncludeSubfolders',true,'LabelSource','foldernames');
augimdsTrain = augmentedImageDatastore([224 224],imdsTrain,'ColorPreprocessing','gray2rgb');
img1 = readimage(imdsTrain,1);
size(img1)
db = read(augimdsTrain);
img2 = db.input{1};
size(img2)
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!