hello, i'm want to ask about my neural network program. i have change input and output. but seems image still goes to others. can you please help me how to get it recognize correctly.
Show older comments
%%Neural network classification
% General testing for sample
% Load Input and output for training purpose
Input=load('Input.txt');
Target=load('Output.txt');
Input1=Input';
Target1=Target';
%Number of neuron
L1=10;
L2=10;
L3=10;
% Form the Feedforward neural network
net1= newff(Input1,Target1,[L1 L2 L3],{'tansig','purelin'},'trainlm');
%Load weight
Weight=load('weight.txt');
net1=setx(net1,Weight);
Simulated Sample input
Input2=load(A3);
%Target2=load('Target.txt');
Input3=Input2';
%T3=Target2';
[net,Y]=adapt(net1,Input3);
dlmwrite('Y.txt',Y','-append','precision','%.4f',...
'newline','pc','delimiter',' ');
% Classification on the stimulated result
D1=Y;
Y1=D1;
[n,m]=size(Y1);
for m=1:m
if D1(m)>0.97 && D1(m)< 1.03
% Resistor
Y1(m)=1;
elseif D1(m)>1.97 && D1(m)< 2.03
% Ceramic Capacitor
Y1(m)=2;
elseif D1(m)>2.97 && D1(m)< 3.03
% Electrolytic Capacitor
Y1(m)=3;
elseif D1(m)>3.97 && D1(m)< 4.03
% BJT Transistor
Y1(m)=4;
elseif D1(m)>4.97 && D1(m)< 5.03
% Mosfet Transistor
Y1(m)=5;
elseif D1(m)>5.97 && D1(m)< 6.03
% Rectifier Circuit
Y1(m)=6;
elseif D1(m)>6.97 && D1(m)< 7.03
% Integrated Circuit
Y1(m)=7;
elseif D1(m)>7.97 && D1(m)< 8.03
% Microphone
Y1(m)=8;
elseif D1(m)>8.97 && D1(m)< 9.03
% Switch
Y1(m)=9;
elseif D1(m)>9.97 && D1(m)< 10.03
% Variable Resistor
Y1(m)=10;
elseif D1(m)>10.97 && D1(m)< 11.03
% Capacitor
Y1(m)=11;
elseif D1(m)>11.97 && D1(m)< 12.03
% Resistor 2W
Y1(m)=12;
elseif D1(m)>12.97 && D1(m)< 13.03
% Mosfet
Y1(m)=13;
else
% Others
Y1(m)=14;
end
end
Outposition=round(Y1');
% Output of the component
dlmwrite(A4,Outposition,'-append','precision','%.4f',...
'newline','pc','delimiter',' ');
Accepted Answer
More Answers (0)
Categories
Find more on Define Shallow Neural Network Architectures in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!