필터 지우기
필터 지우기

error using classify on a trained cnn: For an image input layer, the input data must be a single image, a 4-D array of images, or an imageDatastore with the correct size.

조회 수: 1 (최근 30일)
I have trained a cnn using "trainNetwork" following the workflow outlined in the "trainNetwork" documentation page: 
I would like to now use my trained network to classify images via the function "classify" (also mentioned in the example in the documentation.) When I call "classify", I get the following error: 
ERROR: Error using SeriesNetwork/predict (line 331)
For an image input layer, the input data must be a single image, a 4-D array of images, or an imageDatastore with the correct size.
Error in SeriesNetwork/classify (line 561)
scores = this.predict( X, varargin{:} );
However, I have checked my inputs to "classify" and ensured that the first input is a SeriesNetwork and the second is an ImageDatastore. What am I doing wrong?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2021년 8월 17일
편집: MathWorks Support Team 2021년 9월 27일
As per the error, make sure that imageDatastore contains images with the correct size (pertaining to the sizes of the images used to train the network.) If the sizes do not match up, "imresize" can be used to adjust the sizes of the images to be classified.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by