Inputs and number of neuron

1 view (last 30 days)
Pawel Osadnik
Pawel Osadnik on 12 Jun 2018
Commented: Pawel Osadnik on 20 Jun 2018
Hello, I am preparing a NN for Road Sing Recognicon and it working but not very well. I would like to ask for some advice. I have 954 images of Road Sign, each images has 140x125 = 17500 piksels and my question is, how much i should to have neuron in my network ?
P=cell2mat(struct2cell(all)); %load my pattern
P=reshape(P,17500,954); %matrix with all inputs
% NETWORK
T=eye(3,954); %NETWORK ANSWER
net=newff(P,T,[954],{'hardlims'},'traingd','learngd','mse'); %954 neurons because it is number of my images ?

Accepted Answer

Greg Heath
Greg Heath on 12 Jun 2018
I use the concept
Number of training equations Ntrneq >> Number of unknown weights Nw
For a single layer I-H-O net with I-dimensional inputs, O-dimensional outputs and H hidden nodes,
Ntrneq = Ntrn*O % (Typically, Default Ntrn ~ 0.7*N)
Nw = (I+1)*H + (H+1)*O = O + (I+O+1)*H
Ntrn * O >> O + (I+O+1)*H
When Ntrn is too small and/or H is too large, trainlm is usually replaced by trainbr and/or other "overfitting" mitigations are available.
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 Comment
Pawel Osadnik
Pawel Osadnik on 20 Jun 2018
I have one question, you mean Ntrn ~ 0.7*N it's equal 0.7*Numer of neurons ?

Sign in to comment.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!