Calculating frame rate per second for object detection

11 ビュー (過去 30 日間)
Abdussalam Elhanashi
Abdussalam Elhanashi 2019 年 11 月 4 日
回答済み: Wanbin Song 2019 年 11 月 10 日
Hi Guys
Kindly i want to know how to calculate framerate per second for object detection using R-CNN in the following code:-
close all
clear
clc
load('Detector.mat');
vidReader = VideoReader('vs_014_00.avi');
vidPlayer = vision.DeployableVideoPlayer;
i = 1;
results = struct('Boxes',[],'Scores',[]);
while(hasFrame(vidReader))
% GET DATA
I = readFrame(vidReader);
% PROCESS
[bboxes, scores] = detect(detector,I,'Threshold',1);
% Select strongest detection
[~,idx] = max(scores);
results(i).Boxes = bboxes;
results(i).Scores = scores;
% VISUALIZE
annotation = sprintf('%s , (Confidence = %f)',detector.ModelName,scores(idx));
I = insertObjectAnnotation(I,'rectangle',bboxes(idx,:),annotation);
step(vidPlayer,I);
i = i+1;
end
results = struct2table(results);
release(vidPlayer);

採用された回答

Wanbin Song
Wanbin Song 2019 年 11 月 10 日
You can add some of code as belows:
Declare some variables before while loop as below:
fps = 0;
avgfps = [];
Include below tic/toc commands and fps inside the loop.
tic;
[bboxes, scores] = detect(detector,I,'Threshold',1);
newt = toc;
% fps
fps = .9*fps + .1*(1/newt);
avgfps = [avgfps, fps];
Include below for fps visualization.
I = insertText(I , [1, 1], sprintf('FPS %2.2f', fps), 'FontSize', 26, 'BoxColor', 'y');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFeature Detection and Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by