Frame per second computingfor GPU code generation

조회 수: 1 (최근 30일)
Sehairi K.
Sehairi K. 2021년 10월 5일
답변: Joss Knight 2021년 10월 10일
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

채택된 답변

Joss Knight
Joss Knight 2021년 10월 10일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with GPU Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by