How can i extract images from locations

조회 수: 2 (최근 30일)
mohebba naaz
mohebba naaz 2020년 8월 10일
답변: Srivardhan Gadila 2020년 8월 17일
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' }
{'E:\prototype\A\10.png'}
{'E:\prototype\A\11.png'}
{'E:\prototype\A\12.png'}
{'E:\prototype\A\17.png'}
but for training this has to be image
  댓글 수: 2
Image Analyst
Image Analyst 2020년 8월 10일
So why does it think the PNG files are not image files?
mohebba naaz
mohebba naaz 2020년 8월 11일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Srivardhan Gadila
Srivardhan Gadila 2020년 8월 17일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by