MATLAB Answers

How can i extract images from locations

1 view (last 30 days)
I have 1000 images for training.
i have used imagedatastore for storing images .
after building network and diving images into testing and training. ie Xtrain,Ytrain.Xtest,Ytest where X is images with corresponding label in Y
I am unable to train.
My Xtrain Folder has locations like
ans =
5×1 cell array
{'E:\prototype\A\1.png' }
but for training this has to be image


Image Analyst
Image Analyst on 10 Aug 2020
So why does it think the PNG files are not image files?
mohebba naaz
mohebba naaz on 11 Aug 2020
Error using trainNetwork (line 170)
Invalid training data. Predictors must be a N-by-1 cell array of sequences, where N is the number of
sequences. All sequences must have the same feature dimension and at least one time step.
Error in net1code_naaz (line 105)
net = trainNetwork(XTrain,YTrain,layers,options);
this is the error i have got.
i am unable to train data with image locations

Sign in to comment.

Accepted Answer

Srivardhan Gadila
Srivardhan Gadila on 17 Aug 2020
net = trainNetwork(X,Y,layers,options)
Then X should be the numeric array which contains the predictor variables and Y should be the categorical labels or numeric responses. Hence X shouldn't be the cell array which contains image locations (like in the question above).
If you are using the datastore then the following syntax must be used:
net = trainNetwork(imds,layers,options)
where imds is the imageDatastore.
Refer to the documentation of trainNetwork for more information.


Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!