Deploying standalone executable on Apache
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I've done installing apache, setting up, tested with few algorithm given by mathworks, like mycgimagic.m. It works perfectly.
Now, I would like to deploy this algorithm, a neural network classifier to the apache web server, anyone can help with me what line i should add so that I can pass the answer correctly to the end users?
The neural network classifier,
%taking input
fn=input('Enter WAV filename : ','s');
[wave,fs]=wavread(fn);
newsampled= resample(wave,44100,fs); %resampling
t=0:1/44100:(length(newsampled)-1)/44100;
%windowing
windowed = newsampled(1:50000);
wd=windowed;
% Do a multi-level analysis to ten levels with the
% Daubechies-4 wavelet
[C,L] = wavedec(wd,10,'db4');
A1 = wrcoef('d',C,L,'db4',1); % Reconstruct the details at various levels
A2 = wrcoef('d',C,L,'db4',2);
A3 = wrcoef('d',C,L,'db4',3);
A4 = wrcoef('d',C,L,'db4',4);
A5 = wrcoef('d',C,L,'db4',5);
A6 = wrcoef('d',C,L,'db4',6);
A7 = wrcoef('d',C,L,'db4',7);
A8 = wrcoef('d',C,L,'db4',8);
A9 = wrcoef('d',C,L,'db4',9);
A10 = wrcoef('d',C,L,'db4',10);
%Feature Extraction by using sum of absolute divided by total sample
feat1 = sum(abs(wd))/50000
feat2 = sum(abs(A1))/50000
feat3 = sum(abs(A2))/50000
feat4 = sum(abs(A3))/50000
feat5 = sum(abs(A4))/50000
feat6 = sum(abs(A5))/50000
feat7 = sum(abs(A6))/50000
feat8 = sum(abs(A7))/50000
feat9 = sum(abs(A8))/50000
feat10 = sum(abs(A9))/50000
feat11 = sum(abs(A10))/50000
featset1=[feat1 feat2 feat3 feat4 feat5 feat6 feat7 feat8 feat9 feat10 feat11]
%train Neural Network
P=[ 0.0756 0.0172 0.0283 0.0638
0.0000 0.0000 0.0000 0.0000
0.0002 0.0002 0.0001 0.0001
0.0005 0.0008 0.0004 0.0005
0.0004 0.0012 0.0008 0.0007
0.0007 0.0013 0.0049 0.0023
0.0021 0.0025 0.0153 0.0105
0.0071 0.0075 0.0132 0.0363
0.0222 0.0123 0.0078 0.0454
0.0434 0.0060 0.0045 0.0109
0.0470 0.0011 0.0009 0.0027 ] %training feature set
T=eye(4)%identity matrix of 4x4
net = newff(P,T,20,{'tansig','logsig'});
net.performFcn = 'mse';%mean square error
net.trainParam.epochs = 100;
net.trainParam.mc = 0.98;%momentum coefficient
net.trainParam.lr=0.005;%Learning rate
net.trainParam.lr_inc=1.06; %Ratio to increase learning rate
net.trainParam.lr_dec=0.7; %Ratio to decrease learning rate
%train the network
net = train(net,P,T);
y = sim(net,P); %simulate again with same input
%setting featset1 as input to the neural network
Po=transpose(featset1);
newnet = net;
res1 = sim(newnet,Po);
disp('res1:');
disp(res1);
%checking the index of class
[Co,I] = max(res1);
%data comparison
if (I == 1)
disp('This is a signal of Normal Heart Sound')
elseif (I == 2)
disp('This signal is classified as illness: Mitral Stenosis')
elseif (I == 3)
disp('This signal is classified as illness: Aortic Regurgitation')
elseif (I == 4)
disp('This signal is classified as illness: Ventricle Septic Defect')
else
disp('Error: No Classification is available')
end
-My understanding is I have to add some lines for generating the header and footers before compiling with "mcc" so that it can pass the answer and show it on the web browser.
-I'm still new with programming with C/html, anyone can help me on this task? I'm in dire need of help and would very appreciate if someone can enlighten me on this.
0 Commenti
Risposta accettata
Chirag Gupta
il 21 Apr 2011
One thing to note:
I don't think you can compile (with mcc) the neural network train function. You can only use pre trained nets with compiled application.
0 Commenti
Più risposte (2)
Chirag Gupta
il 22 Apr 2011
Yes. The standalone executable will be able to communicate with the MAT file. You should compile it:
mcc -m myfunc.m -a mynetwork.mat
or just add the MAT file as an additional file in the deploytool project.
In your code, you should be able to load the file using the load command.
I don't have much idea about executing a standalone EXE from APACHE, however this can also be done using MATLAB Builder JA product (example is here):
Vedere anche
Categorie
Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!