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 Center および File ExchangeGet 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