how can i convert image datastore to 4DArrayData

11 Ansichten (letzte 30 Tage)
Nagwa megahed
Nagwa megahed am 12 Dez. 2021
Beantwortet: Nagwa megahed am 17 Dez. 2021
Dear all,
i have an image datastore that load images as in the attached picture:
how can i convert the cell of images to 4DArrayData to have the same form of digitTrain4DArrayData??

Antworten (1)

Nagwa megahed
Nagwa megahed am 17 Dez. 2021
I solved the problem by trying this way :
datasetFolder = ' F:\Datasets\.......; // add the path of your images dataset
imds = imageDatastore(datasetFolder,IncludeSubfolders=true,LabelSource="foldernames");
X=readall(imds);
XTrain = reshape( cat(3,X{:}) , [105,105,1,3410]);
YTrain=imds.Labels;
dsXTrain = arrayDatastore(XTrain,'IterationDimension',4);
dsYTrain = arrayDatastore(YTrain);
dsTrain = combine(dsXTrain,dsYTrain);
and it works perfectly

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by