Frame per second computingfor GPU code generation
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File 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!