OpenCV:提高级联检测的速度 [英] OpenCV: Improving the speed of Cascades detection

查看:315
本文介绍了OpenCV:提高级联检测的速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用OpenCV Cascades实时检测人员.目前,我正在使用OpenCV随附的经过训练的级联文件,但是稍后我将训练自己的LBP级联以提高速度.我有个问题.

I need to detect people in real time using OpenCV Cascades. Currently I am using the trained cascade files which comes with OpenCV but later I will train my own LBP Cascades to achieve more speed. I do have a question.

有什么方法可以加快级联的检测速度?例如,请观看此视频.它真的非常快,使用Haar级联并且很好.我可以做些什么来达到这种速度,特别是对于实时应用程序呢?有任何花招和技巧吗?

what are the ways to speed up the detection of cascades? For an example, have a look at this video. It is really fast, uses Haar cascades and nice. what kind of things I can do to achieve this speed, specially for a real time application? any tricks and hacks?

推荐答案

我不确定您的视频示例中的速度"是什么意思,因为很难确定在此处进行检测的速度"是多少.在计算机视觉中,当我们谈论检测的速度"时,通常是指单个或一组视频的每秒帧数(FPS)或算法的毫秒级运行时间.如果通过算法获得的FPS与输入视频的FPS相同,则称为实时或1倍处理速度.如果处理的FPS大于输入的FPS,则比实时处理要快,如果小于,则比实时处理要慢.当您说速度"时,我会假设您的意思相同.

I'm not sure what you mean by "speed" in your video example since it's hard to make out what "speed" the detections are done at there. In computer vision, when we talk about the "speed" of detections, we generally mean the frames per second (FPS) or the millisecond run-time of the algorithm for a single or set of videos. If the FPS achieved by the algorithm is same as the FPS of the input video, this is called real-time or 1x processing speed. If processing FPS is greater than the input FPS, you have faster than real-time processing and if it is smaller, then you have slower than real-time. I will assume you meant the same thing when you said "speed".

鉴于此,让我为您提供两种加快检测速度的方法.我真的建议您阅读这两篇在过去几年中确实为行人检测设定标准的文章:此处

Given this, let me give you two ways to speed up the detections. I really suggest reading these two papers that have really set the bar in pedestrian detection in the past several years: The Fastest Pedestrian Detector in the West and Pedestrian detection at 100 frames per second, both optimizing on the computation bottleneck of performing detection at multiple scales in the traditional detection setting. The latter has publicly available code here and here. But so this is one of the areas to gain improvement: scale sizes.

在OpenCV中本地实现的方法基于变体 Viola-Jones方法的扩展,该方法扩展了检测中使用的类似Haar的特征集.需要考虑的另一个改进领域是 windowing .传统的检测方法(包括在OpenCV中本地实现的检测方法)要求您在图像上按比例缩放窗口,通常是从左上角到右下角逐行滑动.解决此问题的一种经典方法称为有效的子窗口搜索(ESS),它执行分支约束优化.以此为基础进行了许多扩展,但这是一个开始并了解对象检测基础的好地方.

The method implemented natively in OpenCV is based on a variant of the Viola-Jones method that extends the Haar-like feature set used in detection. Another area of improvement to consider is called windowing. Traditional detection methods, including the one implemented natively in OpenCV, require that you slide windows at scale across the image, usually row-wise from the upper-left to the bottom-right. A classic way to get around this is called Efficient Subwindow Search (ESS) which performs branch-and-bound optimization. There have been many extensions building from this, but it's an excellent place to start and understand the basics of object detection.

现在,当然,加快检测过程的一种非常明显的方法是并行化代码,例如多线程或GPU.有几种GPU实施是公开可用的,例如使用基于支持向量机的检测器此处.

Now, of course, one very obvious way to speed-up the detection process is to parallelize your code, e.g. multi-threading or GPU. There are several GPU implementations that are publicly available, e.g. here using a support vector machine-based detector.

这篇关于OpenCV:提高级联检测的速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆