Frame per second computingfor GPU code generation

1 vue (au cours des 30 derniers jours)
Sehairi K.
Sehairi K. le 5 Oct 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

Réponse acceptée

Joss Knight
Joss Knight le 10 Oct 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.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with GPU Coder dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by