Why my "arraystore" will change the dimension of the images data set

2 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Simon Chan
Simon Chan el 13 de Mzo. de 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 comentarios
Simon Chan
Simon Chan el 13 de Mzo. de 2022
Please accept the answer if you find it useful.Thank you.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by