フィルターのクリア

error in test the retrain image

1 回表示 (過去 30 日間)
siti aminah
siti aminah 2019 年 4 月 2 日
編集済み: KALYAN ACHARJYA 2019 年 4 月 2 日
hi . i have done training image using googlenet and now i want to test weather the name of image is right or wrong . here is my coding and i got some error. someone please help me to solve the error.
function [label] = classifier(img)%codegen
load myNet;
img = imresize(img, [224, 224]);
label = classify(myNet, img);
end
the error is:
>> classifier
Not enough input arguments.
Error in classifier (line 5)
img = imresize(img, [224, 224]);
and here other coding to test the image
clear all;
clc;
%-------------------------------------------------------------------------%
%reading the picture
picture = imread('5.jpg');
%reading the function
[label] = classifier(picture);
%showing the label
imshow(picture);
title(char(label));

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 4 月 2 日
編集済み: KALYAN ACHARJYA 2019 年 4 月 2 日
As you have use the following assignment inn function file
img = imresize(img, [224, 224]);
This way applies to grayscale image.
But in main script, you pass the color image
picture = imread('5.jpg');
%reading the function
[label] = classifier(picture);
Either pass gray image to the function or change the imresize statement in function file, which may applicable for color image. You can easily do that check here.
Hope it Helps!

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by