Filter löschen
Filter löschen

Frame per second computingfor GPU code generation

1 Ansicht (letzte 30 Tage)
Sehairi K.
Sehairi K. am 5 Okt. 2021
Beantwortet: Joss Knight am 10 Okt. 2021
Hello all
In Matlab documentation "Code Generation for Deep Learning Networks", I can not understand why they used reccurssive technique to compute frame per second, this is the code
% Connect to a camera
camera = webcam;
% The labels with top 5 prediction scores are
% mapped to corresponding labels
net = mobilenetv2();
classnames = net.Layers(end).ClassNames;
imfull = zeros(224,400,3, 'uint8');
fps = 0;
ax = axes;
while true
% Take a picture
ipicture = camera.snapshot;
% Resize and cast the picture to single
picture = imresize(ipicture,[224,224]);
% Call MEX function for MobileNet-v2 prediction
tic;
pout = mobilenetv2_predict(single(picture));
newt = toc;
% fps
fps = .9*fps + .1*(1/newt);
% top 5 scores
[top5labels, scores] = getTopFive(pout,classnames);
% display
if isvalid(ax)
dispResults(ax, imfull, picture, top5labels, scores, fps);
else
break;
end
end
end
Why they have not just used instead of the reccurssive equation
fps =1/newt;
Thanks in advance for your answers

Akzeptierte Antwort

Joss Knight
Joss Knight am 10 Okt. 2021
This is a smoothing filter to eliminate noise, to ensure it gives a good result from the first frame you could set it to 1/newt on the first iteration.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with GPU Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by