Input to Convolution Neural Network

I am using convolution neural network on face images of the size 1024*768*3.
I want to pass these images as input to first input layer of CNN.
what should be size of the 'inputImageLayer' for CNN?
How to decide the size of First layer of CNN?

답변 (1개)

bharath pro
bharath pro 2020년 6월 29일

0 개 추천

The ImageInputLayer is used to take image inputs when designing a CNN. According to the documentation, it can be called using ImageInputLayer([h w c]), where c= number of chanels. I am assuming for you the height and width of images are 1024 and 768 respectively and c=3. So for this you would need to use ImageInputLayer([1024 768 3]) to instantiate this layer.

댓글 수: 8

AP
AP 2020년 6월 30일
Thank you bharat pro. I have tried with these dinensions but it is still giving me error ' Not enough input arguments '.
bharath pro
bharath pro 2020년 6월 30일
Is the input vector a 1*3 row vector? Can you check its dimensions?
AP
AP 2020년 6월 30일
My image has dimension height 768 width 1024 color representation sRGB.
bharath pro
bharath pro 2020년 6월 30일
What output do you get when you run size(image)? Also the row vector has to be [768 1024 3] in your case.
AP
AP 2020년 6월 30일
My output for size(image) is 768 1024 3. Still i am getting error saying 'inputArguments = iParseInputArguments(varargin{:});.
bharath pro
bharath pro 2020년 6월 30일
Can you share your code here. The problem could be in the other layers as well.
AP
AP 2020년 6월 30일
Clc;
clear all;
close all;
%read image
a = imread('tryb.jpg');
size(a)
a1 =rgb2gray(a);
%show image
figure, imshow(a1);
imageSize =[768 1024 3];
matlabroot ='D:\MY DESKTOP\IMAGE PROCESSING MATERIAL\database\for nose detect\';
Datasetpath =fullfile(matlabroot ,'cnn2','Dataset1');
Data = imageDatastore(Datasetpath,'IncludeSubfolders',true,'LabelSource','foldernames');
layers = [
imageInputLayer (imageSize)
covolution2dLayer([5 20])
reluLayer
maxPooling2dLayer(2,'stride',2)
covolution2dlayer([5 20])
reluLayer
maxPooling2dLayer(2,'stride',2)
fullyConnectedLayer(2)
softmaxLayer
ClassiifcationLayer()];
options = trainingOptions('sgdm','maxEpoch',15,'initialLearningrate , 0.001');
convnet = trainNetwork (Data,layers,options);
output = classify (convnet ,a);
change your layers to this:
layers = [
imageInputLayer(imageSize,'Normalization','none')
convolution2dLayer(5,20)
reluLayer()
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(5,20)
reluLayer()
maxPooling2dLayer(2,'Stride',2)
fullyConnectedLayer(1)
softmaxLayer
classificationLayer()];
Also your options seem to be wrong. Please change that.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Recognition, Object Detection, and Semantic Segmentation에 대해 자세히 알아보기

질문:

AP
2020년 6월 29일

댓글:

2020년 6월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by