필터 지우기
필터 지우기

Read image to trained neural network

조회 수: 6 (최근 30일)
Martin Hájek
Martin Hájek 2021년 3월 3일
답변: Nagasai Bharat 2021년 3월 8일
Hello,
I have trained neural network. I want to put there picture to see results. I have saved my trained neural network. I load it but I don't know how to pu there image to get results. My first layer is
imageInputLayer([65 100 1]) %first input layer
net = network; %how I create network
save network %how I save network
load ('network.mat'); %how I load network
I put there image but I get always this error. Images are same processed as trained images. They have same sizes. They are all in grayscale.
%Import input and put it into network
input = imread('image.png');
output = network(image(input));
%error
Error using false
Size inputs must be numeric.
Error in network>new_network (line 81)
if nargin < 4, inputConnect = false(numLayers,numInputs); end
Error in network (line 68)
net = new_network(in1);
Or if I put there it like numbers.
%Import input and put it into network
input = im2double(imread('image.png'));
output = network(input);
%error
Error using false
Size inputs must be scalar.
Error in network>new_network (line 81)
if nargin < 4, inputConnect = false(numLayers,numInputs); end
Error in network (line 68)
net = new_network(in1);
Please help I tried to put it there like array but nothing helps me.

답변 (1개)

Nagasai Bharat
Nagasai Bharat 2021년 3월 8일
Hi,
From my understanding you are trying to input an image into a trained network. The problem I think is due to the dimensions of the test images you are inputting. As you do not mention it is a Convolutional Neural Network then I suppose you need to flatten the image(row or column matrix) before passing in into the trained network.
Or something like this should also help.
I = imread("peppers.png");
inputSize = net.Layers(1).InputSize;
I = imresize(I,inputSize(1:2));

카테고리

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