마우스 제스처 인식 (입력은 각도 임)을위한 간단한 신경 네트워크를 만들었고 nprtool (생성을위한 function patternnet)을 사용했습니다. I는 네트워크의 가중치와 바이어스 저장된 :MATLAB 신경망 패턴 인식
W1=net.IW{1,1};
W2=net.LW{2,1};
b1=net.b{1,1};
b2=net.b{2,1};
및 in
가 입력되고, 여기서 계산 결과는 I tansig(W2*(tansig(W1*in+b1))+b2);
사용. 그러나 결과는 끔찍합니다 (각 숫자는 대략 0.99입니다). 추천 번호 net(in)
의 출력이 좋습니다. 내가 도대체 뭘 잘못하고있는 겁니까 ? 첫 번째 방법이 나쁘다는 것이 나에게 매우 중요합니다 (C++ 프로그램에서도 마찬가지입니다). 나는 도움을 청하고있다.
[편집] 아래에 코드가 nprtool GUI
에서 발생했다. 어쩌면 누군가 도움이 될 수도 있지만이 코드에서 내 문제에 대한 해결책을 찾지 못합니다. 숨겨진 출력 레이어와 뉴런 출력에는 tansig 활성화 함수가 사용됩니다 (MATLAB 네트워크에는 매개 변수가 있습니까?). processFcns
를 정의하는 라인을 찾습니다 - 코드에서 볼 수 있듯이
% Solve a Pattern Recognition Problem with a Neural Network
% Script generated by NPRTOOL
% Created Tue May 22 22:05:57 CEST 2012
%
% This script assumes these variables are defined:
%
% input - input data.
% target - target data.
inputs = input;
targets = target;
% Create a Pattern Recognition Network
hiddenLayerSize = 10;
net = patternnet(hiddenLayerSize);
% Choose Input and Output Pre/Post-Processing Functions
% For a list of all processing functions type: help nnprocess
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
% Setup Division of Data for Training, Validation, Testing
% For a list of all data division functions type: help nndivide
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% For help on training function 'trainlm' type: help trainlm
% For a list of all training functions type: help nntrain
net.trainFcn = 'trainlm'; % Levenberg-Marquardt
% Choose a Performance Function
% For a list of all performance functions type: help nnperformance
net.performFcn = 'mse'; % Mean squared error
% Choose Plot Functions
% For a list of all plot functions type: help nnplot
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotregression', 'plotfit'};
% Train the Network
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)
% Recalculate Training, Validation and Test Performance
trainTargets = targets .* tr.trainMask{1};
valTargets = targets .* tr.valMask{1};
testTargets = targets .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,outputs)
valPerformance = perform(net,valTargets,outputs)
testPerformance = perform(net,testTargets,outputs)
% View the Network
view(net)
% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, plotconfusion(targets,outputs)
%figure, ploterrhist(errors)
net', 우리는 매개 변수를 사용했던 것을 추측 할 수없는'생성 된 코드를 기입하십시오. 어떤 함수가 그것을 만들었는지 추측 할 필요가 없다는 것도 좋은 일일 것입니다. (네트워크) –
1 분 전에 이것을했습니다. 나는 도움에 대해 매우 감사 할 것입니다. – mydew