why i'm getting this error?

16 ビュー (過去 30 日間)
Eswar
Eswar 2020 年 11 月 19 日
コメント済み: KSSV 2020 年 11 月 19 日
program i run
[filename,pathname]=uigetfile('*','select a X-Ray image');
filewithpath=strcat(pathname,filename);
I=imread(filewithpath);
imResized=imresize(I,[[224 224]]);
[class, score]=classify(netTransfer,imResized);
figure
imshow(imResized)
title([ 'Predclass=' char(string(class)),', ','score=',num2str(max(score)),', ','origClass=', char(string(imdsTest.Labels(1)))])
Getting this error
Error using DAGNetwork/calculatePredict>predictBatch (line 151)
Incorrect input size. The input images must have a size of [224 224 3].
Error in DAGNetwork/calculatePredict (line 17)
Y = predictBatch( ...
Error in DAGNetwork/classify (line 134)
scores = this.calculatePredict( ...
Error in newimgtesting (line 5)
[class, score]=classify(netTransfer,imResized);
  1 件のコメント
KSSV
KSSV 2020 年 11 月 19 日
You need to input a RGB image i.e. the input jas to be m*n*3 dimensions. It seems you are reading a gray image i.e. a 2D image.

サインインしてコメントする。

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 11 月 19 日
編集済み: KALYAN ACHARJYA 2020 年 11 月 19 日
Error using DAGNetwork/calculatePredict>predictBatch (line 151)
Incorrect input size. The input images must have a size of [224 224 3].
As per the error says, you have to pass the RGB images in this case to avoid this error, Although there may be others error too.

カテゴリ

Help Center および File ExchangeGet Started with Deep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by