Why my "arraystore" will change the dimension of the images data set
2 views (last 30 days)
Show older comments
I imported images data from my local file use "imread", and use "arraystore" to convert it, but when I use "read" to check it I found that the dimensions of images set have been changed.
This is my code:
---------------------------------------
files = dir(fullfile('F:\\work\\MyImageData\\','*.jpg'));
lengthFiles = length(files);
for i = 1:lengthFiles
I(:,:,:,i)= imread(strcat('F:\work\MyImageData\',files(i).name));
end
inputImage=im2double(I);
dsinputImage = arrayDatastore(inputImage);
readdsinputImage=read(dsinputImage);
----------------------------------------
The dimensions of "inputImage" are {343×344×3×200 double}, which constains 200 images with dimension [343 344 3], but the dimension of "readdsinputImage" are {1×344×3×200 double}
I want to realization the example "Train Network with Multiple Outputs" while the only different is that the images dimensions example used are [28 28 1], and my images dimensions are [343 344 3], but is seems that i get a problem at the data preparation stage
0 Comments
Accepted Answer
Simon Chan
on 13 Mar 2022
For your case where the data are images, better to use the following:
The default ReadSize is 1 and hence it reads only 1 row of the data.
IterationDimension set to 4 so that it stores an entire image each time.
dsinputImage = arrayDatastore(inputImage,'ReadSize',343,'IterationDimension',4);
3 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!