フィルターのクリア

why is error happen even I write the exact code for alexnet

1 回表示 (過去 30 日間)
muhmed omer
muhmed omer 2017 年 3 月 13 日
回答済み: abdelilah mbarek 2018 年 5 月 20 日
Error using SeriesNetwork/predict (line 149)
For an image input layer, the input data for predict must a single image, a 4D array of images, or an
imageDatastore with the correct size.
Error in SeriesNetwork/classify (line 225)
scores = this.predict( X, varargin{:} );
Error in amjh (line 10)
  2 件のコメント
Walter Roberson
Walter Roberson 2017 年 3 月 13 日
We need to see more of your code.
Also, which MATLAB release are you using?
muhmed omer
muhmed omer 2017 年 3 月 13 日
編集済み: Walter Roberson 2017 年 3 月 14 日
clear all,close,clc
camera=webcam;
net= alexnet;
while true
picture=camera.snapshot;
picture= imresize(picture,[277,277]);
lable=classify(net,picture);
image(picture);
title(char,(lable));
drawnow;
end
and I am using matlab 2016b

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

回答 (3 件)

Walter Roberson
Walter Roberson 2017 年 3 月 14 日
編集済み: Walter Roberson 2017 年 3 月 14 日
Change
picture= imresize(picture,[277,277]);
to
picture= imresize(picture,[227,227]);
That gets me past that point. I run out of GPU memory eventually.
Also you need to change to
title(char(lable));

Pradeep Punniyakotti
Pradeep Punniyakotti 2018 年 3 月 24 日
To process color images in AlexNet, the input image size has to be 227 x 227 x 3.
227 x 227 indicates the height and width of the image and 3 represents the RGB intensities.
Resize your existing image using the imresize command.
To view the input layer size of AlexNet, use the command variable.Layers(1)

abdelilah mbarek
abdelilah mbarek 2018 年 5 月 20 日
Hi; in alexNet you should resize or images. you can call functions that you create it in file resizeFunction.m for example:
function I = resizeFunction(filename)
I = imread(filename);
I = imresize(I, [227 227]);
if you are using imageDatastore:
images= imageDatastore();
use this call after:
images.ReadFcn = @resizeFunction;

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by