基于视频图像的船舶航速与外形参数检测
基于视频图像的船舶航速与外形参数检测[20191214193214]
摘 要
计算机视觉以及数字图像处理技术在人类的生产生活中扮演了重要的角色,可以广泛地应用到生产生活中的各个领域。例如工业、航天事业和医疗保健方面。当前,对连续视频图像序列中运动的目标物体的分析是一个重要的研究方向之一。该方面的研究分析对于机器人导航、智能视觉监控系统、医学图像分析、工业检测、视频图像分析以及军事雷达视频信号的处理都具有重要的意义。
运动目标检测是当前研究领域的一个热点问题,也是计算机视觉研究领域的主要问题之一。它融合了图像处理、模式识别、自动控制、人工智能以及计算机等许许多多的领域的先进技术,在军事视觉制导、视频监控、医疗诊断、智能交通等方面都有广泛应用。基于视频图像的运动目标分析是一项巨大的工程,不仅通过需要视频信号的采集,同时也对图像处理的收集,以及应用程序的开发。如果需要完成某一项实验或者任务,需要研究人员自己完成所有的底层的一些算法实现,这样会在很大程度上加大研究人员的工作难度,同时也会消耗更多的时间和精力,最后得出的结果也不一定能够很好的满足我们的需求。
本文采用的工具主要是VS2010和OpenCV,挖成了船舶检测及特征提取的工作。系统主要包括:视频图像处理,运动目标检测.实验结果分析。对于运动目标的检测,本文介绍了多种基本的方法,分别分析其优势和不足,根据实际情况选择了实用又简单的帧间差分法法。本文采用了经过处理的AVI视频,将其转化成了适合后期处理的图像序列。在目标检测过程中,通过帧间差分法获取了船舶的轮廓图像。
本文在后期对多帧图像作处理,并得出了多组数据,在一定程度上增强了实验结果的可靠性。实验结果表明,用本文的检测算法足以满足实验要求,并且达到了预期的目标。
Abstract
Motion target detection is one of the main issues in computer vision, which combines advanced technologies in image processing, Pattern recognition, automatic control, artificial intelligence, computer and other relative fields. It has broadly applied in military visual missile guidance, video surveillance, medical image analysis, intelligent transportation and other fields, so this project research has important theoretical significance and practical value.
Moving target detection is one of the main problems in computer vision research, it combines image processing,a lot of pattern recognition, automatic control, artificial intelligence and other areas of advanced computer technology in the military vision-guided, video surveillance, medical diagnostics, intelligent transportation aspects of a wide range of applications. Based on analysis of video images of the moving target is a huge project, both to capture the video signal, but also the collection of image processing, but also for the development of application-specific programming. To complete an application for engineering staff, if all of the underlying algorithms have their own coding to achieve, all image processing functions to be written from scratch, resulting in a waste of both time and energy, but also difficult to guarantee stability, practicality and versatility.
The main tool used in this paper is VS2010 and OpenCV, dug into the ship detection and feature extraction work. The system includes: a video image preprocessing, moving target detection experimental results. For the detection of moving targets, this paper introduces a variety of basic methods, their advantages and disadvantages are analyzed according to the actual situation choose a practical and simple algorithm. In this paper, a processed video AVI, which was converted into a suitable post-processing the image sequence. In the target detection process through inter-frame difference method to obtain the contours of the image of the ship.
In this paper, the latter for the treatment of multi-frame image, and a plurality of sets of data obtained at a certain extent increase the reliability of the experimental results. Experimental results show that detection algorithm used herein meet the requirements of the experiment, to achieve the desired goal.
Keywords: video, moving target detection, inter-frame difference method, OpenCV
第一章 绪论 1
1.1课题研究背景及意义 1
1.2国内外研究现状 1
1.3 OpenCV概述 2
1.4本章小结 3
第二章 数字图像处理 4
2.1图像预处理 4
2.2图像灰度变换 4
2.3图像中的噪声 6
2.4平滑处理 6
2.4.1中值滤波 7
2.4.2高斯滤波 8
2.5图像二值化 9
2.6数学形态学滤波 10
2.6.1膨胀和腐蚀 11
2.6.2 开运算和闭运算 12
第三章 运动目标检测 14
3.1帧间差分法 14
3.2背景差分法 16
3.3光流法 18
第四章 运动目标检测实现与结果分析 20
4.1本文检测算法流程及实现 20
4.2最小外接矩形的截取 21
4.2.1轮廓查找 21
4.2.2截取外接矩形 22
4.3图像像素距离与实际空间距离 23
4.4实验结果及分析 23
4.5本章小结 26
第五章 总结与展望 27
5.1研究总结 27
5.2研究展望 27
参考文献 29
致 谢 31
第一章 绪论
1.1课题研究背景及意义
世界是变化的,对于运动对象的分析是人类永恒的话题。随着科技的进步,计算机技术变得日益成熟和可靠,随之产生了一个新型的学科方向与研究领域,即计算机视觉。计算机视觉是一门综合性的学科,包括计算机科学和工程,应用数学,统计学,神经生理学,信号处理等。其中对于运动目标的检测与分析是计算机视觉领域最重要最核心的技术。
基于视频图像序列的运动目标检测与分析的基本内容是从连续的视频图像序列中提取出我们需要的运动目标。其中对运动目标检测、目标识别是数字图像处理技术低层次的应用。对视频图像序列中运动目标的检测分析系统要注重实时性,通用性和可移植性。视频序列图像运动目标分析对人类的生产和生活具有重要意义,虽然到目前我们已经取得了不少的成果,为人类的生活也提供了不小的便利,但是还远远满足不了人类的需求。因此,完成一个实用的、准确的运动目标检测系统仍需要更多志同道合的人努力,这也是当前最具挑战性的课题之一。
1.2国内外研究现状
计算机视觉是研究利用计算机模拟生物外显或宏观视觉功能的科学和技术【1】。运动目标的检测是计算机视觉领域的一个重要的分支,是对目标区域内的运动目标,如船舶等的检测,并得到运动物体的相关信息。近年来,之前计算机视觉的研究重点主要是对静态图像序列的研究,但是这满足不了时代的需求,现如今研究重点已经转移到了对动态图像序列的研究。这方面的典型应用包括自动化的视频监控系统、视频MPEG编解码技术、人机交互的感知接口、军事上的制导、雷达视频图像中的目标分析【2】。
对于视频检测领域的研究,国外开始的比较早,经过十多年的发展,技术已经非常成熟,视频检测线圈检测技术得到了广泛的认同,代表了该领域未来的发展和视频检测应用方向。有一个较为成功的具有实时监测交通参数功能的商业系统AUTOSCOPE,是由美国ISS公司的开发出来的,在交通监测方面是当前国际上最具有竞争力的系统之一【2】。
相对于国外来说,国内在视频检测方面的研究起步虽然比较晚,但是发展势头很好,也取得了不少的成果。但是这些产品能够实现的功能过于单一,还不能保证在复杂多变的环境下系统的稳定性与准确性,与国外的产品相比还是有相当的差距,所以还无法推广开来。因此。我国目前还需要大力的发展视频检测领域的研究与应用,号召更多的人投入到这个领域,争取早日与国际接轨,推出真正的国产的、适合我国国情的视频检测系统。
运动目标检测的主要问题和难点有:
(1)运动目标相互遮挡,给检测带来干扰;
(2)在复杂的背景下,如何有效的进行图像分割并提高算法的实时性;
(3)相连的帧之间有很强的关联性,并且有很多的信息,如何有效的提取并利用这些信息。
1.3 OpenCV概述
OpenCV是一个开源的计算机视觉库,全称是 Open Source Computer Vision Library,于 1999 年由 Intel建立,是一个开源计算机视觉库【4】,采用C/C++编写,它包括一系列 C 函数和少量 C++类,实现包括图像处理和计算机视觉方面的很多通用算法。在 Linux系统、Windows系统 和 Mac OS 操作系统上均可以完美行。另外,OpenCV还提供了许多种语言的接口,包括Python语言、Ruby语言、MATLAB语言等等。
OpenCV 包括 500 多个 函数,覆盖了计算机视觉的许多应用领域,如工厂产品检测、医学成像、信息安全、用户界面、摄像机标定、立体视觉等【4】.它可以使用但不依赖其它的外部库。OpenCV提供了大量的图像处理算法,而且使用也非常方便,用它来做算法不仅可以省下很多的时间与精力,也极大地提高了系统的效率。
本文选取了OpenCV进行视频图像序列运动分析主要就是因为其拥有的独特特点与优势:
(1)纯C代码,源代码开放。
(2)平台无关性:利用opencv编写的函数具有很好的移植性,可以在很多的平台,如Windows等,上直接运行,不需要对源程序作任何的修改。
(3)实时性:程序运行具有实时性,代码可以生成可执行的二进制文件,这样可以大大提高程序的运行速度,节省了不少精力。
OpenCV 主体分为五个模块,分别为:
(1)CxCore,CxCore是OpenCV最重要的一个子库,该库提供了 OpenCV 运行时的一些最基本的数据结构,包括矩阵,数组的基本运算,基本绘图函数,包括出错处理的一些基本函数。例如 ,最简单的基本数据结构CvPoint、CvSize,定义矩阵结构的CvMat,绘图函数cvMinAreaRect2和 cvDrawContours ;
(2)Cv,包括计算机视觉算法的基本的图像处理,运动分析,跟踪和模式识别等。例如 cvSmooth是图像平滑函数,cvHarrDetectObjects 是检测图像中的目标;
(3)Ml(Machine learning),机器学习模块,包含许多聚类、分类和数据分析函数。例如vStatModel函数是统计模型基类;
(4)HighGUI:用户交互,包括图像和视频输入/输出功能,这是用来建立软件原型或是用于测试,不适合最终用户的应用。例如 cvCreateFileCapture、cvQueryFrame 等函数;
(5)CvAux:CvAux是OpenCV的 附加库函数,包含一些新出现的实验性的算法和函数。例如计算一对校正好的图像的视觉差的函数cvFindStereoCorrespondence
1.4本章小结
本文主要介绍了本课题的研究背景,以及当前国内外的研究的现状,包括一些热点难点问题以及所取得的一些成果。着重介绍了OpenCV的相关信息,包括OpenCV的来源、发展,和同类软件相比的一些显著优势以及其5个功能模块。
第二章 数字图像处理
2.1图像预处理
丰富的图像是我们获取信息的重要方式之一。我们通过各种不同的手段获取到了图像,这些图像可以直接或间接地对眼睛和视觉感知产生重要的作用。一般图像采集的最终结果是某种能量的样本阵列,所以图像常用矩阵或数组来表示,每个元素的坐标代表场景点的位置而元素的值代表场景点的某个特征量【5】。视频是有一帧帧图片组成的,数字图像连续的排列构成了视频,并且这些视频包含有许多的音频信息。人类可以从视频文件简单直观的获取大量的信息。视频序列中的每一张图片都被称为帧,一般来说,帧率,即视频文件运动的速率大概是每秒30到40帧。人类总是对动态的东西比较敏感,视频中的运动物体最容易引起人们的关注,而且运动的物体提供的信息也更加丰富一些。视频图像的主要特点有:它包含了极其丰富的原始数据,帧间的相关性也使得对于运动目标的检测更加容易,同时也更容易处理并得到我们需要的信息。目前,大多数的视频文件都是通过彩色CCD摄像机获取的。但是在视频采集的过程中,很容易受到外界环境如光照、阴影等的影响,使得视频文件包含了很多的噪声,可以说,人们在现实生活中获取的图像一般都含有噪声。所以在对视频或是图像处理之前,我们需要采用合适的算法减少视频或图像中包含的噪声。噪声处理是一个良好的图像处理系统必须完成的步骤。
作为图像处理的重要组成部分,图像预处理对于人们完成图像处理的目标并获取最准确的信息具有决定性的作用。顾名思义,图像预处理就是在对图像进行分析之前,对我们输入的目标图像进行特征抽取等等的处理过程。图像预处理可以有效地消除目标图像中的无关信息并恢复有用的信息,最大程度的简化我们获取需要的数据的步骤。
2.2图像灰度变换
我们常常说到“黑白图像“和”灰度图像“,在有些情况下,黑白图像和灰度图像是等价的。但是在计算机图像领域中,二者是不同的,”黑白图像“表示图像只包含有两种颜色,即黑色和白色,而”灰度图像“在黑色与白色之间还有各种不同深度的颜色。现如今,我们从生活中直接获取的图像基本上都是彩色图像,为了顺利的对数字图像作处理,必须将彩色图像进行灰度化处理。灰度化的图像有利于后续的处理效率,达到更为理想的效果。
图像的灰度变换就是将彩色图像的彩色信息全部剔除,只留下亮度信息。在计算机中,我们通常把亮度值分为266个级别(0到255),0表示黑色,而255表示全白色。常用的颜色模型有RGB模型,HSV模型,CMY模型等。本文选取RGB模型为标准,在RGB模型中,当R=G=B时,则彩色表示一种颜色,那么颜色(R,G,B)表示灰度值。按照RGB模型进行灰度变换有多种方法,常见的方法有分量法,将彩色图像的R、G、B,3个分量的亮度值当做3个图像的灰度值,然后从中选择合适的灰度图像、最大值法,将彩色图像的R、G、B,3个分量亮度的最大值作为灰度图像的灰度值、平均值法,就是讲彩色图像的R、G、B,3个分量亮度值得平均值作为灰度图像的灰度值、加权平均法,根据实际的需求,将33个分量以不同的加权值进行平均,然后以求出的平均值作为灰度图像的灰度值。但是对图像进行灰度化,采用不同的方法往往会得出结果。
综合考虑到各种情况,本文选用以下公式作灰度化处理:
Gray=0.299R+0.587G+0.114B
R=G=B=Gray
其中,Cray表示图像中像素的灰度值,R表示红色分量.G表示绿色分量,B表示蓝色分量;公式中的系数0.299、0.587、0.114是最为合理的灰度变换的权值。在OpenCV中,函数“CvtColor(const CvArr*src,CvAzT*dst,int code)可以实现图像的灰度变换,其中src表示要处理的原彩色图像,dst表示处理后的灰度图像,code为色彩空问转换方式,code为转换方式,在这里code定义为CV_RGB2GRAY。
图2.1 第184帧彩色图像以及灰度化的图像
2.3图像中的噪声
在当前的大多数数字图像处理的系统中,输入图像一般都是先利用冻结再扫描的方式将多维图像转换成为一维电信号,然后再对其进行处理、存储、传输等加工。最后往往还要在组成多维图像信号,而图像噪声也将同样受到这样的分解和合成。由于在上述的处理过程中,会有电气系统和外界的影响,这将导致对图像中的噪声进行精确的分析变得更加的复杂。另一方面,图像是视觉信息传播的媒介,理解图像信息是通过人的视觉系统确定的。当图像噪声不同,人的感觉的程度是不同的。由于人们对精确性要求的更加地严格,图像噪声的影响成为了一个不得不解决的问题,现如今针对各种不同的噪声有了各种不同的处理方法。
图像噪声根据其不同的特性或者产生方式有不同的分类方法。按照噪声产生的原因,可以讲图像噪声分为两类:外部噪声和内部噪声。所谓外部噪声,就是指外部环境通过各种渠道对系统产生影响,从而产生噪声。如:天体放电就会引起噪声。所谓内部噪声,可以分为四种,包括由光和点的基本特性所引起的噪声、电器的机械运动产生的噪声,如各种接头因抖动引起电流变化所产生的噪声、材料本身的机械运动所引起的噪声和系统内壁设备电路所引起的噪声。还可以根据声幅度随时间分布的特征来定义。如果其幅度分布是按照高斯分布的那么就称其为高斯噪声,而按照雷利分布的那么就称其为雷利噪声。
2.4平滑处理
所谓平滑处理,也称为“模糊处理”,是一项简单且使用频率很高的图像处理方法。对图像作平滑处理可以有效地减少图像上的噪声或失真,平滑处理在降低图像的噪声方面也有应用。当前,OpenCV中实现平滑处理的函数是CvSmooth()函数,该函数如下
Void cvSmooth(
const CvArr* src,
CvArr* dst,
int smoothtype =CV_GAUSSIAN,
int param1=3,
int param2=0,
double param3=0,
double param4=0,
);
src和dst分别是平滑操作的输入图像和输出的图像,cvsmooth()包含的4个参数param1,param2,param3,param4。这些参数取决于smoothtype的值。
CV_BLUE表示的是简单模糊,具体实现方法是对每个像素作param1×param2邻域求和,然后做缩放得到最后结果;
CV_BLUR_NO_SCALE表示的是简单无缩放变换的模糊,具体实现方法是对每个像素作param1×param2邻域求和;
CV_MEDLIAN表示的是中值模糊,具体实现方法是对图像进行核大小为param1×param2的中值滤波;
CV_GSUSS_IAN表示的是高斯模糊,具体实现方法是对图像进行核大小为param1×param2的高斯卷积;
CV_BILATERAL表示的是双边滤波,具体实现方法是应用双线性3×3滤波,颜色sigma=param1和空间sigma=param2。
2.4.1中值滤波
所谓中值滤波,就是基于排序统计理论的一种能有效抑制噪声的非线性信号处理技术。该滤波方法是一种类似于卷积的领域运算。但是不是通过加权求和的方法,而是用某一点的一个邻域中各点的中间值代替该点。这样的方法可以将该点领域内灰度值相对较大或是较小的点用该中值代替,从而可以消除邻域内那些孤立的噪声点,达到了良好的滤波效果。
二维中值滤波输出为:
g(x,y)= Med{f(x-k,y-l),(k,l)∈W}【6】;
其中,f(x,y),g(x,y)分别表示要处理的原图像和已经处理的图像。W表示的是二维模板,一般是3×3,5x5区域,当然,也可以是线状,圆形等各种各样的不同形状。中值滤波器在滤除叠加白噪声和长尾叠加噪声方面拥有非常好的效果,因此经常用来处理这一类的噪声。但是,该种方法也有不小的缺陷,在某些情况下如点和线比较多的图像采用中值滤波就是不可取的,达不到我们预期的效果,甚至可能会导致更加糟糕的结果。其效果如图2.2:
图2.2原始图像及中值滤波后的图像
2.4.2高斯滤波
高斯滤波是一种线性平滑滤波,在消除高斯噪声方面有很显著的作用,因此在处理图像噪声方面得到了广泛的应用。某一点的像素值与其邻域内的像素值进行加权平均后得到的结果就是该点的像素值,所以也可以说高斯滤波是对整副图像作加权平均的一个过程。高斯滤波过程的具体实现方法是:每一个像素点的值采用模板扫描的出来,该中心像素点的值用邻域内的加权平均值替换掉就可以实现高斯滤波。我们知道,获取图像时候无法避免噪声,而对图像的后期处理应用,噪声会成为干扰试验的一个重要因素,与此相关的是,对图像作高斯-拉普拉斯变换的目的是得到更好地图像边缘。
利用函数cvsmooth()对图像作高斯模糊时,函数的前面两个参数分别表示了滤波器窗口的高度还有宽度,第三个参数用来表示高斯卷积核的sigma值,该参数是可以自由选择的,可有可无。如果该参数用户没有特别指定,那么高斯核的各个参数会由系统根据窗口尺寸自动确定。公式如下:
另外,高斯滤波的opencv实现还为几个比较常见的核提供了更高更好的性能优化,比其他的核拥有更好地性能,这些核包括具有标准sigma值3×3,5×5和7×7。另外,单个通道或三个通道的8位或32位的附带呢格式图像也可以采用高斯模糊,只要利用的是in place方式实现。高斯滤波的效果图如下:
图2.3原始图像及高斯滤波后的图像
2.5图像二值化
图像分割在图像处理和计算机视觉研究领域占有重要的地位,是完成本文必不可少的步骤之一。其主要的目的是将运动目标从复杂的背景条件下提取出来,为后期的各种处理提供更好的依据。图像分割的方法也是多种多样的,其中常见的有阈值分割法、区域跟踪法还有边缘检测法等。其中,使用最为广泛的是阈值分割法,其原理也比较简单容易实现,效率比较高,其主要利用了运动目标与背景在灰度值上的差别,只要选择一个合适的阈值,就可以将运动目标和背景分割开来,即得到运动物体的二值图像,这是后续处理的基础,而且该方法可以大大简化后期的分析处理步骤。因而得到了广泛的应用。实现阈值分割的步骤如下:设定一个在0到255的任意阈值T,从而可以讲目标图像分割成为两个部分:大于阈值T的部分和小于阈值T的部分。设输入图像为f(x,y),输出图像为f,(x,y),则
或
上述就是图像的二值化处理也就是阈值分割的原理,从中可以看出,图像的阈值分割的关键是求出合适的阈值。为了方便,在实际应用的时候我们一般采用255表示背景灰度值,用0表示目标物的灰度值。
在OpenCV中,对图像的二值化处理利用函数cvThreshold(const CvArr*src,CvArr*dst,double threshold,double max_value,int threshold_type)【4】实现,该的各个参数如下所示:
src表示原始数组,即待处理的图像;
dst表示输出数组,即处理后的图像,要求其类型与src一致;
Threshold表示阈值;
max-Value表示CV—THRESH—BINARY和CVJHRESH—BINARY—INV的最大值;
Threshold_type表示阈值类型。
函数cvThreshold()对单通道数组应用固定阈值操作。threshold_type确定该函数获取阈值的方法。关于阈值的选取有多种方法,一般是单一阈值或是自适应阈值法。本文受到实际情况的制约,采取的是单一阈值的方法,实现方法是利用滚动条手动调整最适合的阈值,这个方法简单有效,而且已经能充分满足本文的要求。
2.6数学形态学滤波
在数字图像处理中,由于数学形态学算法有平滑轮廓、填充洞孔、连接断裂区域等特性,常常被用在各种图像分析的后处理操作中【7】。其基本运算有4种,包括膨胀、腐蚀、开运算和闭运算。基于这四种基本操作,也可以得到各种功能强大的处理图像的算法,用于图像增强等方面有很好的效果。在OpenCV,形态学滤波算法已被移植到多个库函数,它使用方便,可以节省时间和精力。
2.6.1膨胀和腐蚀
本文使用的形态学滤波算法主要是膨胀,应用于对船舶的二值图像的处理。膨胀指的是指将图像(或图像中的一部分区域)与核进行卷积。这里说到的核是拥有一个单独定义的、可以是任意的形状或大小的参考点。所谓膨胀就是把局部最大化的处理方式。本文要求将离散的序列点连到一起,构成一个连通域。
在OpenCV中实现膨胀的函数是
cvDilate(
IplImage* src,
IplImge *dst,
IplConvkernel* B=NULL,
int iterations=1
);
函数参数如下:src为源图像,dst为处理后的图像,参数B是核,默认值是NULL。最后一个参数Iterations表示的是迭代的次数,默认值是1。对二值化图像膨胀的效果图如下:
图2.3 船舶原图 图2.4 膨胀后的图像
腐蚀和膨胀是相反的一组操作,与膨胀相反,腐蚀处理的目的是计算核区域像素的最小值。腐蚀可以通过下面的方法生成一个新的图像:当核B与图像卷积时,计算被B覆盖的区域的最小像素值,并把这个值放到参考点上【8】。
在OpenCV实现腐蚀的函数是
Void cvErode(
IplImage* src,
IplImage* dst,
IplConvkeenel B =NULL,
Int iterations = 1
);
函数参数分别表示:src为待处理的图像,dst为处理后的图像,参数B是核,默认值是NULL。第四个参数Iterations表示迭代的次数,默认值是1。腐蚀的效果图如下:
图2.5 原始二值图像 图2.6 腐蚀后图像
2.6.2 开运算和闭运算
上文中提到,将膨胀和腐蚀的组合运算可以得出数量庞大的、更加完备的的形态学运算方式,其中最常见运算方法的就是开运算和闭运算。在开运算的情况下,我们首先将目标图像作腐蚀处理然后再进行膨胀处理。统计二值图像中的区域数目是开运算的一个重要功能。若已将显微镜载玻片上观察到的细胞图像做阈值化处理,可以使用开运算将相连的细胞分离开来,然后再计算图像中的区域(细胞)数目。在闭运算的情况下,我们首先将其膨胀再腐蚀。在多连通域中,经常使用的闭运算消除部分的噪声,然后利用开运算,以实现连通区域的目的。开运算和闭运算的处理方式几乎都是“保留区域”形式的:最显著的效果是,闭运算消除了地狱其邻近点的孤立点,而开运算是消除高于其邻近点的孤立点【9】。
2.7本章小结
本章主要介绍了数字图像处理的一些基础知识,如灰度化,二值化,形态学滤波等,重点介绍了本文将用到的处理过程及在OpenCV中实现的函数,为后期作了充分的理论准备。
第三章 运动目标检测
对于运动目标的检测是后期处理的基础,也是最为关键的部分之一,其主要的目的就是从视频图像序列中提出运动目标并获取运动目标的相关信息,如形状、轮廓等。运动目标提取的过程实际上是对移动物体的图像分割,但只有在连续的图像序列(如视频图像序列)中可以看到,对于单一的图像是无法完成对目标物体提取的。由于当物体运动时,其背景会有细微的变化,这些细微的变化就是提取运动目标的关键。关于运动目标的检测,根据视频场景所在的区域可以分为室内检测盒室外检测,根据摄像头是否随着运动物体运动,可以分为两类:基于静态背景的运动目标检测和基于运动背景的运动目标检测。目前,在多种方式用于运动目标的检测,常用的是背景差分法和光流法,帧差法,这三种方法是当前的主要方法。
3.1帧间差分法
帧间差分法(Frames Difference)是基于像素的运动目标检测方法,它通过对连续的视频图像序列中相邻帧做差分运算来提取运动区域及运动目标轮廓[10]。该方法实现简单,实时性高,而且对动态环境也有较强的自适应能力,是最常用的检测算法之一。视频序列具有连续性,在光线变化不大的情况下,相邻帧间的图像在背景上基本相似,若图像中有运动的物体,则距离上的变化将导致帧间相同位置上的像素值的显著变化,即帧差值会很大;若没有运动对象,帧差值将会保持不变或变化很小,这种情况是无法提出出运动目标的。目标物体的移动引起了灰度图像相关点的亮度值得变化,利用帧间差分法将这些变化表现出来就可以获得运动目标的二值图像,其余部分由于灰度值没有变化,作差分后其灰度值为0,为全黑色。所以,通过帧间差分法得到的是背景为全黑的运动目标的二值图像。如果考虑到图像中的噪声,在全黑的背景下,会有少数的灰度值较大的点,这些点会对后续的处理造成干扰,需要想办法将其剔除。所以说,帧间差分法是一种基于像素的运动运动检测方法,有时候收到外界条件的干扰或是为了获取更加准确的二值图像,可以采用连续的多帧图像作帧间差分,常见的方法有三帧差分法,从实际的操作效果我们可以看出,帧差法提取的主要就是运动目标的轮廓。本文采取的就是帧间差分法提取出了运动物体的轮廓。其原理图如下所示:
在OpenCV中对两帧图像作差分的函数是cvAbsDiff{frameTime1,frameTime2,frameForeground}其中的各参数依次表示第k帧图像的灰度化图像,第(k+1)帧图像的灰度化图像及两灰度图差分得出的输出图像。然后对灰度图像做二值化处理就得出了运动目标轮廓。
帧间差分法的优点是多方面的:(1)实现该算法程序比较简单;(2)对一些外界条件的变化如光线变化不是很敏感,这样就保证了程序的稳定性与适用性。但是该方法也有一些缺陷:(1)只能准确的提取出运动目标的轮廓,对于运动目标整体的提取不太理想(2)选择不同的帧间距离对实验结果影响较大。一般来说,如果运动目标的运动速度比较快的时候,只有选取较小的时间间隔才能准确的提取出运动目标的二值图像,否则可能会检测出连个分开的物体。如果运动目标的速度比较慢的时候,需要选择较大的时间间隔,这样才能提取出理想的运动目标轮廓,否则,可能无法检测到运动目标。如图所示为图像序列中两帧相连的灰度图像利用函数cvAbsDiff()作差分后的效果图,差分结果如图3.3所示:
图3.1 第184帧灰度图像 图3.2 第185帧灰度图像
图3.3 帧差法得到的灰度图
3.2背景差分法
背景差分法,也被称为背景减法的检测方法,是目标检测最常用的方法,可以被看作是一个特殊的情况下的帧间差分法。背景差分法通过输入图像和预先选定的背景图像差异对比,从而检测出运动目标。具体来说,第一步先选一个或多个图像中的平均值作为背景图像,然后将视频图像和背景图像差分运算,最后再作差分处理和阈值处理,便能够得到目标图像。在这个差分得到的图像中,选择一个合适的阈值,当像素的值大于这一与孩子,可以将该点归为运动目标,如果某点像素的值的小于该阈值,这该点就作为背景,最终得到运动目标的二值图像。用公式表示如下:
试中:T表示阈值,b(x,y)是通过背景建模得到的背景模型,f(x,y)是采集到的要处理的图像,Rk是为阈值处理后的二值化图像,背景差分法的基本原理如下图所示:
利用背景差分法检测运动目标的优点就是检测准确且易于实现,该方法的关键点就是获取合适的背景图像。然然而在实际应用中,是不容易得到的静态背景下的背景图像,为了避免这种情况,对背景重建是一个不多的方法。当然,这种方法也有着缺陷,假如运动目标在某段足够长的时间里没有发生移动,那么可能会导致该目标成为背景的一部分,这样会对整个系统造成干扰。这个问题是无法避免的,但是可以想办法抑制其影响,如:可以通过降低背景的更新率抑制。
3.3光流法
在对数字图像作处理的过程中,经常要用到一种简单、实用而且高效的图像运动的表现方法,我们称之为光流。所谓光流,是在一个图像序列中,图像亮度模式的表现运动方法,我们可以把它看做点的运动的表达方式。随着对该领域研究的深入,光流也得到了重新的定义,在1998年光流被重新定义成了动态图像在空间上的变化和在辐射度变化的表达方法,而这种表达是一种全面的表示。在图像处理领域,对光流的研究主要是研究如何有效的利用图像序列中包含的信息,特别是其像素强度数据在时域上的变化还有各图像之间的较强的相关性,利用这些信息,就可以确定图像像素的位置变化,就是要研究时域上的变化和物体结构的变化以及其运动信息的关系,通过这些关系,就能够得到我们需要的信息。在绝大多数的情况下,光流的产生是物体间的相对运动产生的,一般是相机、运动目标这两者的相对运动产生的。大致上,光流的计算方法可以分成三类:基于匹配的方法、频域的方法和梯度的方法【3】。
(1) 基于匹配的计算方法可以分为两种情况:一种是基于特征的方法,另一种是基于区域的方法。所谓基于特征的方法,关键就是要时刻抓住特征这一要素,就是要不断地定位运动目标的主要特征,并实现跟踪效果。但是该方法一般会有光流稀疏这一问题,最关键的是这会导致对目标提取特征并实现精确匹配造成不小的干扰。所谓基于区域的方法,就是首先要定位类似的区域,当区域内的物体发生了位移时,会导致光线的变化,通过计算相似区域的位移就可以实现对光流的计算。这种方法一般广泛的应用在视频编码领域,在图像处理领域基本上没什么作用,另外,这种方法计算出来的光流仍然比较稀疏。
(2) 基于频率域的方法,也被称为基于的能量的方法,使用速度可调滤波器输出的频率或相位信息。相对基于匹配的方法来说,这种方法虽然精确度很高,但实现过程比较复杂,计算机量比较大,而且难以评价其可靠性。
(3) 基于梯度的方法。这种方法实现方法是利用目标图像序列的亮度来计算出光流,也可以称之为2D速度场。基于梯度的方法得到了广泛的研究与应用,因为该方法不仅实现过程简单,计算也比较容易而且得到的结果效果也很好。但是由于可调参数的必须要人工选择、可靠性因子的选取还有图像的预处理等一些在计算光流时无法避免的步骤,将会对处理结果造成干扰,严重影响了精确度。
采用光流法检测运动目标的基本原理:对图像中的每一个像素点,都给其赋予一个速度矢量形成一个图像的运动场。在某一时刻,可以通过投影的方法将图像上的点一一投影到空间物体上的点。然后就需要对图像作动态分析,这一分析过程可以根据速度场的速度矢量完成。如果光流矢量一直是连续变化的,这就说明了目标图像中没有运动物体,相反,就有运动目标,这是因为当运动物体发生了移动时,即与背景发生了相对运动,运动目标的速度矢量与背景的速度矢量是不一样的,根据这些信息就可以检测出了运动目标,同时也获取了运动目标的位置。
光流法的优点在于其丰富的信息,包括了运动目标的信息、背景的信息,这些信息对于后续的处理过程有重要的作用,注重的是在不知道场景的信息的情况下,其他方法都无法实现对运动目标的检测,但是光流法可以实现这一点,该方法能够在不知道任何场景的条件下准确的完成对运动目标的检测。虽然光流法在运动目标检测的某些方面有很大的优势,但是考虑到大多数光流算法的计算过程比较复杂,难以实现,而且在实时性方面也是差强人意,所以在某些场合不适合采用光流法。
在日常生活应用中,对于运动目标检测系统的稳定性和准确性都有较高的要求,而摄像机一般是处于静止的状态下,这样获取的图像仅仅采用光流法是远远不够的,一般可以将光流法和其他的一些方法结合使用来实现对运动目标的检测。另外,由于物体之间的相互遮挡和噪声的影响等因素会对光流场的计算产生很大的干扰,而且光流法实现过程复杂,难以满足实时性的要求,所以一般不会采用光流法。
第四章 运动目标检测实现与结果分析
4.1本文检测算法流程及实现
与静态的目标的图像分析相比,运动目标检测要更加强调针对特定的图像序列提取出目标的运动信息。对于运动目标的检测的研究基本可分为两类:一类仅从获得的图像序列本身寻找运动线索进行检测,另一类则既有运动线索又包含了某些先验信息,如目标模板、任务需求等【10】。本文的研究是对前者的研究。在一个相对简单的背景下,对单一的运动目标,即船舶作处理,并得出有关船舶的外形参数等信息。下图为本文算法实现的流程图:
帧间差分法
本文是对已有的船舶运动AVI视频处理,求取运动船舶的实际长宽和运动速度。首先,利用OpenCV函数将视频转化成jpg格式的图像序列,考虑到实际情况,我们可以发现只有部分图像适合本文的算法及功能实现,选取合适的图像序列,按照上图的流程进行处理,最后成功提取出了运动船舶,并得到了其相关的参数信息。
4.2最小外接矩形的截取
4.2.1轮廓查找
轮廓,就是亮度突然发生变化的区域,构成了物体的边界或是图像的边框。一个轮廓一般由一系列的点构成,实际上就是一个曲线图,根据不同的情况,轮廓的表示方法也是不同的。一般采用函数cvFindContours()来查找二值图像里边的轮廓。函数cvFindContours()用来处理图像边缘,而且只能处理连通域。这些图像可以由cvCanny()函数或者是函数cvThreshold()和函数cvAdaptiveThreshold()处理得到的二值图像再作膨胀处理成联通域,然后便可以利用函数cvFindContours()查找轮廓。
cvFindContours(
IplImage* img,
cvMemStorage* storage,
CvSeq** firstContour,
int headerSize =sizeof(CvContour),
CvContourRetrievalMode mode = CV_RETE_LIST,
CvChainApproxMethod method = CV_CHAIN_APPROX_SIMPLE
);
该函数的第一个参数表示要处理的8位单通道图像,该图像需要转化成二值图像,要注意cvFindContours()处理图像时是涂改,如果原图像还有用的话需要提前保存一份。第二个参数表示内存存储器,用来存储轮廓。cvCreateMemStorage()的作用就是分配存储空间。
4.2.2截取外接矩形
根据船舶的最小外接矩形的长宽可以求出船舶的实际长宽,根据最小外接矩形的中心坐标的移动可以求出船舶的航行速度。在OpenCV中,利用连通域的轮廓,有两种方法可以得到矩形边界框。第一种方法也是最简单的方法,就是调用函数cvBoundingRect(),但是该方法返回的cvRect只能表现出一个四边水平和竖直的长方形。但是实际情况下,用这种方法截取的矩形一般不是最小外接矩形,如图4.1所示,用这种方法得出的结果与实际情况相差较大。当然如果摄像的角度是俯视的话,由于该方法相对较简单,用这种方法也是可以的。
图4.1 CvRect截取的矩形
在OpenCV中实现最小外接矩形的另外一种方法就是利用函数cvMinAreaRect2(),该函数返回一个包围轮廓的可以任意角度倾斜的最小长方形。OpenCV的数据类型CvBox2D()就是用来表述这样的长方形的。CvBox2D cvMinAreaRect2(const CvArr* points,CvMemStorage* storage=NULL);第一个参数可以是由点组成的序列,一个轮廓(CvContour*)或者一个,n×1双通道矩阵。第二个参数表示存储空间。该方法截取矩形的效果如图4.4所示。
4.3图像像素距离与实际空间距离
在图像处理中,最后求得的物体的边缘坐标是它在图像中的像素位置,很多情况下需要求得图像中的两点在实际空间中的距离[11]。
本文根据最小外接矩形的顶点(利用函数cvBoxPoints( )求得)的坐标求其长宽,只是得到了船舶长宽的图像像素距离,只有知道了该系统的图像像素距离与实际空间距离的比例关系才能求出船舶的实际长宽。关于两者之间的比例关系求法:由于我们已知实际环境下的距离,所以可选取两个已知距离的参考物,我们可以求出这二者之间的像素距离,这像素距离X与空间距离Y的转换关系K可以定义为:
4.4实验结果及分析
本文采用的视频包括了船舶进入视频区域、船舶停住等待闸门开启以及通过闸门的几个部分。该视频背景简单,而且运动目标单一,外界条件造成的干扰比较小,前期的预处理相对来说也比较简单实现,在此不再赘述。
考虑到实际的条件,本文选择了相对简单高效的帧间差分法。由于采用帧间差分法获取船舶的二值图像需要船舶发生了移动才能达到目标,部分视频基本上没有用的,根据实际要求,截取了船舶运动视频中的第176帧到186帧船舶运动图像序列进行帧间差分得到了船舶的二值图像,该方法运行效果较好,充分满足了实验的要求,船舶的二值图像如图4.2所示。
由于本文使用的轮廓查找函数vcFindContour()只能对连通域进行操作,所以需要对船舶二值图像作膨胀处理,使之成为一个连通域,如图4.3所示。
图中船舶周边的白色小点是由于噪声的干扰造成的,为了获取唯一的外接最小矩形,需要将那些白色小点剔除。我们可以根据函数vcFindContour()获取的轮廓的长度或者是面积可以将无用的部分剔除,因为船舶的轮廓是最长的,其轮廓包围的面积也是最大的,这两个方法在OpenCV中都可以利用函数实现,简单有效。对一个连通域截取其最小外接矩形的实现方法,已经在4.2.2部分具体阐述。本文由于视频角度的问题,为了得到更加精确的数据,选取了cvMinAreaRect2()截取了一个有角度倾斜的外接最小矩形,效果如图4.4所示。
图4.2:船舶的二值图像 图4.3:二值图像膨胀后的图像
图4.4:船舶的最小外接矩形
该试验输出的数据如下:
图像 图中像素距离(长,宽) 实际空间距离(米) 最小外接矩形中心坐标
第176帧 (437,170) (24,9) (220,302)
第177帧 (433,169) (24,9) (227,297)
第178帧 (429,165) (23,9) (235,293)
第179帧 (438,169) (24,9) (237,295)
第180帧 (421,169) (23,9) (251,290)
第181帧 (428,169) (23,9) (253,289)
第182帧 (413,167) (22,9) (265,284)
第183帧 (432,167) (24,9) (261,285)
第184帧 (406,164) (22,9) (276,274)
第185帧 (404,165) (22,9) (283,276)
实验输出数据都是针对图像而言的,要想求出其实际的长宽和运行速度,必须根据转化关系转化,从而得出船舶的实际长宽以及求出船舶的运行速度。想要求出船舶的实际长宽还有其运动速度,就要求出图像像素距离与实际空间距离的比例。根据实际情况,可以假设选择的两个参考物(本文选择航道边上的两个木桩)之间的距离为5米,根据两参照物的图像像距离容易求出图像像素距离与实际空间距离的比例K为18:1,从而可以将在船舶的图像中的长宽转化为实际长度和宽度,如以上表格所示。从实验数据中我们可以看出,远动目标,即船舶的实际长宽大概是23米和9米,这个结果与实际情况大致符合。对于船舶的运动速度,我们可以根据最小外接矩形的中心坐标变化可以判断船在一帧的时间内(1秒30帧)船舶的移动距离,帧间时间已知,从而可以得出船舶的运动速度。为了保证数据的可靠性和准确性,利用这多组数据,我们可以得出多组运行速度数据,将这些数据的平均值作为船舶运行速度,求出船舶的航速大概是14米/秒。当然,根据最小外接矩形的中心坐标的变化,我们也可以确定船舶移动的方向、运动轨迹等信息。
4.5本章小结
本文主要介绍了几种基本的运动目标提取方法,帧间差分法,背景相减法和光流法。然后利用了帧间差分法完成本实验,对实验的过程也作了一个简单的描述,最后得出了较为准确的船舶长宽和航速,基本达到实验的要求。
第五章 总结与展望
5.1研究总结
本文的主要研究的内容是在摄像头固定,背景相对静止的情况下对运动目标的检测算法的研究。为了研究方便,本文采用了符合上述条件的船舶运动视频,通过VS2010和OpenCV库编制程序,最终实现对视频序列图像中的运动目标的正确检测和参数提取。本文研究涉及的范围包括:数字图像处理,运动目标的检测,目标参数提取。
现将该论文的主要工作内容总结如下:
图像预处理:本文对灰度图像进行了中值滤波和高斯滤波处理,选出了更为合理、效果更好地高斯滤波。关于二值化部分,阈值的选取是通过更为简单有效的滚动条控制选择的。
运动目标检测与参数提取:由于本实验的视频背景相对简单,采用了帧间差分法便得到了很好的效果,因此不采用更为繁琐的背景相减法等方法。本阶段较好的提取出了所选取的视频段的运动船舶二值轮廓。之后利用强大的OpenCV函数获取了多组的船舶二值轮廓的最小外接矩形及其顶点坐标,根据顶点坐标便可以得出我们需要的数据,如运动船舶的长宽。
5.2研究展望
本文虽然基本上达到了实验的目标,但是仍然有很多不足,比如:
(1)本文是对一段视频作处理,得出运动目标的信息。但是实际生活中通常是采用摄像头,要求实时性。本文在实时性方面有一些缺陷,尚需完善。
(2)本文是在背景简单且静止的情况下进行的,在运动背景下的运行效果还不是很好。应进一步研究在运动背景、多船舶的情况下,检测特定的运动目标及提出其基本参数。
由于本人的研究时间和知识有限,对本领域的还不是很了解,很多相关的内容理解的也不是很好,所以仍然有许多的问题需要解决和完善,相关程序也需要改进。当前,人类对于智能化的要求越来越高,智能化在人类生产生活中也占据着越来越重要的地位,我相信OpenCV这个强大的工具和运动目标的检测的研究必将有一个光明的前景。
参考文献
[1]计算机视觉01,曹洋,2005-07
[2]基于opencv的视频道路车辆检测与跟踪 ,詹群峰,2012
[3]基于视频的运动目标检测与跟踪算法研究与应用,2011-10
[4]Learning OpenCV Computer Vision with the OpenCV Library.Gary Bradski & Adrian Keabler 著,于仕琪 刘瑞祯 译
[5]全方向M型心动图像量化效应的一种消除方法,陈海英,2012
[6]基于OpenCV的运动目标检测与跟踪,吴晓阳
[7]基于图像处理的目标跟踪系统,熊章靖
[8]基于MFC的数字图像处理系统毕业设计论文
[9]图像预处理中的数学形态学
[10]移动机器人的运动目标实时检测与跟踪,王璐,崔益安,苏虹
[11]图像像素距离与空间距离变换公式的求解,张进秋
[12]朱虹.数字图像处理基础[M].北京:科学出版社,2005.
[13]Jen-Chao Taj,Shung-Tsang Tseng.Real-time Image Tracking for Automatic Traffic Monitoring and EnforcementApplicationsVisual trackin[J].Imageand VisisonComputing 2004,22(6):640·649
[14]马桂珍,朱玲赞,段丽.基于OpenCV的视频应用程序的开发方法[J].《现代电子技术》2007.4:7¨9
[15]熊显涛,杜宝江.机器视觉工具包OpenCV开发技术.计算机与网络,2008.19
[16]M.Pe仃ou,Panagiota Bosdogianni.数字图像处理疑难解析.赖剑煌,冯国灿等译.北京:机械工业出版社,2005
[17]谢风英,赵丹培.Visual C++数字图像处理北京:电子工业出版社2008.9
[18]WANG YK,CHENS H.Robust vehicle detectionapproach[C]//Proc.IEEEConference onAdvanced Video andSignalBased Surveillance2005.IEEEPress.2005:1 17—122
[19]张玲,陈丽敏,何伟等.基于视频的改进帧差法在车流量检测中的应用.重庆大学学报(自然科学版),2004,27(5):31-33
[20]李志慧,张长海,曲昭伟,魏巍.交通流视频检测中背景初始化算法.吉林大学学报(工学版)2008.1:148-一151
[21]邱德润,朱明早,伍宗富.一种基于帧间差分与背景差分的运动目标检测新方法.湖南文理学院学报(自然科学版).2007,3.V01.19 No.1:181.86
[22]王唯合,王宏志,赵兰英.运动目标检测跟踪方法研究.长春工业大学学报(自然科学版)2007.12:41 1—一413
[23]吕常魁,姜澄宇,王宁生.一种新的运动检测及轮廓追踪方法.武汉大学学报(信息科学版).2005,8
[24]杨学超,刘文萍.视频图像序列中的运动目标检测技术.计算机应用与软件.2008.
致 谢
本文的完成首先要感谢我的导师何坤金老师,何老师渊博的知识和精益求精的科研精神给我留下了很深的印象。感谢何老师精心的指导和宝贵的意见。同时本文的完成也要感谢实验室的学长和学姐的热情帮助,正是有了他们的帮助,我的毕业设计少走了许多的弯路,才能顺利的完成。同时感谢各位同学营造了良好的学习氛围,跟他们的交流是我收益颇多,对于本文的完成起了重要作用。 最后要感谢一直关心我、鼓励我、支持我的家人朋友们,他们给了我完成论文的动力和信心。
附录:
Social behavior recognition in continuous video
Abstract
We present a novel method for analyzing social behavior. Continuous videos are segmented into action ‘bouts’by building a temporal context model that combines fea-tures from spatio-temporal energy and agent trajectories.The method is tested on an unprecedented dataset of videos of interacting pairs of mice, which was collected as part of a state-of-the-art neurophysiological study of behavior. The dataset comprises over 88 hours (8 million frames) of annotated videos. We find that our novel trajectory features, used in a discriminative framework, are more informative than widely used spatio-temporal features; furthermore, temporal context plays an important role for action recognition in continuous videos. Our approach may be seen as a baseline method on this dataset, reaching a mean recognition rate of 61.2% compared to the expert’s agreement rate of about 70%.
1. Introduction
Detecting and classifying human and animal behavior from video is one of the most interesting challenges facing computer vision researchers [28, 2, 21, 6, 29]. Applications include: video surveillance, social robotics, scene understanding, ethology, neuroscience, medicine and genetics.
Automating the analysis of behavior is challenging.First, building a vision ‘front end’ that detects, segments,classifies and tracks bodies is technically difficult. Second,a crisp definition of ‘behavior’, including a distinction between short and simple ‘movemes’ [4], medium-scale ‘actions’ and more complex ‘activities’, still eludes us.Athird obstacle is inadequate benchmark datasets to guide our
thinking and to evaluate our algorithms (see Section 2).
Studying animal behavior [17, 2, 8, 37, 3, 7, 15] is perhaps the best strategy to make progress on these issues thanks to a number of practical advantages. First, laboratory animals, typically flies and mice, are easier to detect and track than humans, thus the vision front-end is easier to build. Second, fly and mouse behavior is simpler and perhaps more objectively studied than human behavior, which makes it more likely that we will arrive sooner at a satisfactory definition of behavior. Third it is more practical and ethical to set up reproducible experiments and collect abundant video of animals, rather than humans, especially when the most interesting behaviors are concerned (e.g.courtship, aggression) and when one wants to explore the role of nature and nurture with systematic manipulations.Furthermore, expert scientists are willing to thoroughly annotate animal behavior videos in the course of their studies in ethology, ecology, neuroscience, pharmacology and genetics. Studying behavior in animals thus presents an opportunity for making progress on modeling and classifying behavior, especially social behavior, which is difficult to study in humans. We believe that knowledge gathered from studying animal models will eventually lead to progress in modeling and automating the analysis of human behavior.
The main contributions of this study are:
1 — The largest and richest behavior dataset to date. The Caltech Resident-Intruder Mouse dataset (CRIM13) consists of 237x2 videos (recorded with synchronized top and side view) of pairs of mice engaging in social behavior, catalogued into thirteen different actions. Each video lasts~10min, for a total of over 88h of video and 8M frames.A team of behavior experts annotated each video frame-by-frame using a Matlab GUI which we developed adhoc [23].Videos, annotations, mice tracks and annotation tool are all available from www.vision.caltech.edu/Video_Datasets/CRIM13/.
2 — An approach for the automatic segmentation and classification of social ‘actions’ in continuous video. Multiagent behavior poses new challenges: (a) multiple animals have to be localized and tracked even when they touch and overlap; (b) each behavior may be described with respect to multiple frames of reference: the enclosure, the agent and, the other animal; (c) social behaviors are highly variable
both in duration and in visual appearance, see Figure 1. A video example with the output of our approach is available from the project website.
3 — Novel trajectory features for behavior recognition. We generate a large pool of weak features from the position of tracked objects. The weak trajectory features outperform widely used spatio-temporal features, see Table 3.
4 — Exploring temporal context in behavior analysis. After irst computing spatio-temporal and trajectory features from video, a second level analyzes temporal context using an extension of Auto-context [35] to video. The temporal context model helps segmenting the video into action ‘bouts’improving results 8% across all behaviors.
Our method reaches a recognition rate of 61.2% on 13 categories, tested on 133 videos, see Table 3. Figure 2shows a comparison of our approach with experts agree-
ment on the 12 videos for which we have multiple expert annotations. On this smaller dataset, expert agreement is around 70%, while our method’s performance is 62.6%
However, CRIM13 still represents a serious challenge.Disagreement between human annotators lies almost entirely on the labeling of other behavior (less important),while our approach still makes mistakes between real behaviors. In fact, removing other from the confusion matrices results in a human performance of 91%, and only 66% for our approach. When counting other, our approach outperforms human agreement in 5 of the 12 behaviors (approach, chase, circle, human, walk away).
2. Related work
Datasets – What makes a good dataset? Behavior is interesting and meaningful when purposeful agents interact with each other and with objects in a given environment.The ideal behavior dataset identifies genuine agents acting freely in a well-defined scenario, and captures all spontaneous actions and activities. Filming should be continuous in order to allow a study of the structure of behavior at different scales of temporal resolution. Social behavior and agent-object interactions are of particular interest. Current most widely-used datasets for action classification, KTH [32], INRIA-XMAS [40], Weizmann [12], UCSports [30], Hollywood2 [25], YouTube [24], Olympic Sports [14] and UT videos [31] do not meet this standard:
they are segmented, they are acted, the choice of actions is often arbitrary, they are not annotated by experts and they include little social behavior. Moreover, KTH and Weizmann datasets may have reached the end of their useful life with current state of the art classification rates of 94% and 99% respectively.
One of the first approaches to continuous event recognition was proposed by [43], although only a very small set of continuous video sequences were used. Virat [27] is
the first large continuous-video dataset allowing the study of behavior in a well-defined meaningful environment. The focus of this dataset is video surveillance and contains examples of individual human behavior and of interaction of humans with objects (cars, bags), containing more than 29h of video. Another useful dataset, collected by Serre and collaborators [15] focusses on single mouse behavior in a
standard laboratory mouse enclosure. These datasets do not include instances of social behavior.
Features – Most action recognition approaches are based solely on spatio-temporal features. These features are computed in two separate stages: interest point detec-
tion and description. Popular spatio-temporal interest point detectors include Harris3D [19], Cuboids [8], and Hessian [13]. In datasets were the background contains useful
information about the scene, as is the case for the Hollywood dataset, densely sampling points instead of running an interest point detector seems to improve results. Most effectivespatio-temporalpointdescriptorsareCuboids(PCASIFT) [8], HOG/HOF [20], HOG3D [18] and eSURF [13].More recently, relationships between spatio-temporal features have been used to model the temporal structure of primitive actions [5, 31].
Other features that have shown good performance are Local Trinary Patterns [41] and motion features derived from optical flow [9, 1]. Recently, space-time locally adaptive regression kernels (3DLSK) have been shown to reach state-of-the-art recognition on the KTH dataset with only one training example [33]. Biologically-inspired hierarchies of features have also been widely used [16, 34, 42,
22]. In [22] deep learning techniques were applied to learn hierarchical invariant spatio-temporal features that achieve state-of-the-artresultson Hollywood and YouTube datasets.
Another trend is to use an indirect representation of the visual scene as input to the classification, such as silhouettes, body parts or pose [29]. These approaches are generally sensitive to noise, partial occlusions and variations in viewpoint, except in the case of small animals such as flies,where trajectory features combined with pose information and body parts segmentation has proven to work well [7, 3].
Classifiers – The most common approach to classification is to use a bag of spatio-temporal words combined with a classifier such as SVM [36] or AdaBoost [11]. Other interesting classification approaches are feature mining [10] and unsupervised latent topic models [26].
Mouse behavior – Two works focussed on actions of solitary black mice on a white background [8, 15]. We tackle the more general and challenging problem of social behavior in mice with unconstrained color.
Figure 2. Confusion matrices for comparison with expert’s annotations on the 12 videos that were annotated by more than two experts. For results on the whole dataset, see Table 3. (a) Comparison between ‘annotator1’ and a group of 4 other annotators.
(b) Comparison between ‘annotator1’ and the output of our approach. (c,d) Comparison of the segmentation of 2k frames of a video (available from project website) into behavior ‘bouts’.
3. Caltech Resident-Intruder Mouse dataset
The dataset was collected in collaboration with biologists, for a study of neurophysiological mechanisms involved in aggression and courtship [23]. The videos always start with a male ‘resident mouse’ alone in a laboratory enclosure. At some point a second mouse, the ‘intruder’, is introduced and the social interaction begins. Just before the end of the video, the intruder mouse is removed. Behavior
is categorized into 12+1 different mutually exclusive action categories, i.e. 12 behaviors and one last category, called other, used by annotator swhenno behavior of interestisoccurring. The mice will start interacting by ‘getting to know’each other (approach, circle, sniff, walk away). Once established if the intruder is a female, the resident mouse will likelycourther(copulation, chase). Iftheintruderisamale,the resident mouse will likely attack it to defend its territory. Resident mice can also choose to ignore the intruder,engaging in solitary behaviors (clean, drink, eat, up). The introduction/removal of the intruder mouse is labeled as human. Figure 1 shows video frames for each behavior in both top and side views, gives a short description of each behavior, its probability p (how often each behavior occurs), and the mean and variance duration in seconds (μ,σ).
Each scene was recorded both from top- and side-views using two fixed, synchronized cameras. Mice being nocturnal animals, near-infrared in-cage lighting was used, thus the videos are monochromatic (visually undistinguishable from grayscale). Videos typically last around 10 min, and were recorded at 25fps with a resolution of 640x480 pixels,8-bit pixel depth. The full dataset consists of 237 videos
and over 8M frames.
Every video frame is labeled with one of the thirteen action categories, resulting in a segmentation of the videos into action intervals or ‘bouts’. The beginning and end
of each bout are accurately determined since behavior instances mustbe correlated withe lectro physiological recordings at a frequency of 25Hz. Some behaviors occur more often than others, and durations (both intra-class and inter-class) vary greatly, see Figure 1.
There were 9 different human expert annotators. Exper-tiseo fannotators varied slightly; they were alltrained by the same two behavior biologists and were given the same set of instructions on how the behaviors should be annotated.Annotators used both top and side views in a video behavior annotator GUI developed in Matlab. This tool provides all the playback functionality needed to carefully analyze the videos and allows the manual annotation of behaviors into bouts (starting and ending frame). The tool is available from the project website. Each 10min video contains an average of 140 action bouts (without counting other). It typically takes an expert 7-8 times the video length to fully annotate it. The approximate time spent by experts to fully annotate the dataset was around 350 hours.
4. Proposed method
Most methods discussed in Section 2 deal with classification of pre-segmented short clips containing a single action. We approach the more complex problem of simultaneously segmenting video into single-action bouts and classifying the actions.
Our approach can be seen as an extension of Autocontext [35] to video. Auto-context has proven to perform.Well in high-level vision problems that be nefit from learning a context model. Compared with other approaches, Autocontext is much easier to train and avoids heavy algorithm design, while being significantly faster. We find that incorporating temporal context information plays a crucial role in learning to segment videos, see Table 3.
Auto-context is easily described as a multi-step process.First, local features are computed from short sliding video time-windows (see Sec. 4.1) and used to train a ‘base’ classifier, outputting for each frame the probability that it belongs to each behavior. The process is repeated, adding to the original video features new features computed from the behavior probabilities of a large number of context frames.These new features provide information on the likely classification of frames preceding and following the current frame, therefore encoding temporal context and the transition probabilities between behaviors. The frames used form context can be either near orvery far fromt he current frame,and it is up to the base classifier to select and fuse important supporting context frames together with local features. This process is repeated T times, or until convergence.
Our method uses AdaBoost [11] as the base classifier,where each weak classifier is a depth 2 tree, rather than the more common single stump. For each behavior, a binary classifier is trained by boosting on all training frames with labels indicating either the presence or absence of the behavior. Givenk = 1..K behaviortypes, eachofthek binary classifiers will output a confidence hk(i) ∈ R for that particular behavior being present in frame i2. Then, the finalmulti-label classification is achieved by assigning as final behavior type that which has the highest confidence level:? yi = argmaxkhk(i). We found that classifier outputs do not need to be calibrated. Figure 3 shows the data flow of the proposed method.
Figure 3. Overview of our approach. Two set of local features are first computed from video. Classifiers trained on these features estimate confidence levels hk tfor each behavior. Temporal context features are built from the confidence levels and used to compute new confidence estimates in a new iteration. In our case, Auto Context converges in 2 iterations.
4.1. Local features
To compute local features, sliding windows are centered at each frame and both types of local features are computed inside them. The optimal sliding window size is directly related to the duration of behaviors, as well as to the encoding of each feature type. After several experiments, we established that using a window of 9 frames (≈1/3 s) was best for spatio-temporal features, while a combination of two window sizes (75 and 615 frames, i.e. 3 and 25 s) was most discriminative for trajectory features, see Figure 5.
Spatio-temporal bag of words are first computed on each video using a sliding window centered at current frame. We benchmarked several existing approaches (Sec-
tion 5) and we finally chose Cuboids+Pca-Sift [8]. All parameters were set to its original configuration and bag words was computed using the standard procedure soutlined in [39], except for a reduced codebook size of 250, which proved to give best results (see Table 1 in Supp. Material).
Weak trajectory features are computed from the set of positions xmi(t),ymi(t) of each mouse mi∈ [1,2] for each top view video frame t, see Figure 3. These positions are computed by an unpublished tracking algorithm developed by our group, which is able to maintain identities of micetrough repeated detections.
From the positions, meaningful trajectory information is computed, such as distance between mice, movement direction, velocities and accelerations, see Figure 4(a). Then, the algorithm generates a large pool of weak features from this information, in a similar way to what is done for object detection [38]. Given a sliding window centered at current frame, the method divides it in non-overlapping regions and appliestoeachasetof6differentoperations(sum, variance,min, max, gaussian weighted sum and ‘harmonic’). After each operation, the method sums all region values, where each region can count positively (+1), negatively (-1), or be completely ignored (0). This process is repeated for all possible region combinations and for each one of the trajectory values of Figure 4(a). The ‘harmonic’ operation transposes
regions of value (-1), therefore detecting cyclic repetitions.
4.2. Temporal context features
As part of Auto-context, behaviors are first classified based only on local features, and then in subsequent iterations by adding to the feature set a list of temporal context
features, computed from confidence levels hkt?1output of the binary classifiers at the previous iteration t ? 1. Temporal context features are computed at each time sample by taking first order statistics over a time-window centered at that time sample. Design details are given in Figure 4(b).
5. Experiments
The purpose of this section is two-fold: 1) analyze all method parameters and 2) test the approach on the Caltech Resident-Intruder Mouse dataset. In Section 5.1, a metric to measure the classification error is defined. In Section 5.2, a subset of the dataset is used to optimize different method parameters and report classification results of some widely used spatio-temporal features. Finally, in Section 5.3, we report the results of our approach on CRIM13.
5.1. Error metric
Given a video, an annotation is defined by a list of behavior intervals (behavior type, starting frame, ending frame).The metric for comparing two annotations should measure both their similarity as well as their relative completeness (whetherall behaviorspresentin the firstannotationare also present in the second annotation). The second is especially important due to the highly unbalanced nature of CRIM13. In fact, a classifier that predicts all frames to be other would reach over 50% accuracy on a simple frame-by-frame comparison with ground truth (see Figure 1).
We propose to use as metric the average of the confusion matrix’s diagonal, where the confusion matrix values are the per-frame average agreement between annotations for each pair of behaviors. The average per-frame agreement, computed across all frames, measures the similarity between annotations for that pair of behaviors. Then, by taking the average of the diagonal, we favor classifiers that reach high similarity with ground truth across all behaviors.
Figure 5. Sliding window sizes for both local feature types. (a) Forspatio-temporal features, due to their encoding, a small window size gives best performance for all behaviors. Default size was set to 9 frames. (b) For trajectory features, best window size is directly related with duration of behavior: smaller window sizes detect short behaviors well, while larger detect long behaviors well.Default was set to use a combination of 2 windows of 75 and 615frames each. See Table 2 in Supp. Material for more details.
5.2. Parameter analysis
To optimize the algorithm, we analyzed all method parameters. To avoid overfitting and to speed-up the process we used a small subset of the videos: 10 top view videos each for training and testing (300k frames), randomly chosen from the training set used in Section 5.3.
5.2.1Spatio-temporal features
We chose to benchmark some of the most widely used spatio-temporal interest point detectors (Harris3D [19] and Cuboids [8]) and spatio-temporal descriptors (Cuboids PcaSift [8] , Hog/Hof [20] and Hog3D [18]) allowing all different combinations. We discarded the use of densely sampled features both because the background of our videos is uninformative, as well as computationally prohibitive. We also benchmarked the use of Local Trinary Patterns (LTP), [41],which due to its encoding should be more naturally suited for continuous behavior recognition. We used code from [8, 20, 18], extending functionality as needed to work on long videos
Once spatio-temporal features are computed for all video frames, behavior classification results are achieved using a bag of words representation and an AdaBoost multilabel classifier, as outlined in Section 4. Spatio-temporal detectors are computed at a single spatial and temporal scale (3D patch size of 13x13 pixels and 19 frames) and then bag of words is computed for each frame by looking at a window of 9 frames centered in the current frame, both best parameters, see Figure 5(a). To compute bag of words, the standard procedures outlined in [39] are used. Codebook size was benchmarked independently for each detector+descriptor combination with sizes ranging from 100 to 2000, see Table 1 Supp. Material. The best detector+descriptor combination was ran at multiple spatial and temporal scales
(σ = 2,4,8,τ = 3,5). Table 1 shows the main results of each approach.
All approaches fail to segment the test videos due to the small size of the training set and a lack of context, resulting in a drop in performance of 30-40% from training (noshown). Differences between spatio-temporal features are verysmall, asincurrentdatasets [39,41]. Detectorsseemto perform similarly, although Cuboids is much faster. As for descriptors, Pca-Siftoutperformstherest. RunningCuboids at multiple scales results in overfitting and does not improve performance at all, while also being much slower. LTP performsslightlyworsethanCuboids+Pca-Sift, althoughbeing much faster. In the light of these results, we chose to use Cuboids+Pca-Sift for the rest of this work. However, our approach is in no way directly linked to the use of a specific set of spatio-temporal features.
Figure 4. (a) Trajectory information computed from mouse tracks. Distance helps discriminate between solitary and social behaviors (micefar/close to each other), as well as to detect a transition from one to the other (approach, walk away). Velocity and acceleration helpsdetecting behaviors such as attack, chase or clean (stationary). Direction is important to distinguish between behaviors such as sniff (often head to head) with copulation or chase (head to tail). Pose estimation would clearly improve results in this aspect. (b) Temporal context features computed from confidence levels hk toutput of each k binary classifier at previous iteration t?1, given a window of size sz centered at frame i. For each frame, 1536 context features are computed, using windows of sz = 75,185,615 to combine short, medium and long term context. Some of the features are also computed only on the previous or past frames to encode behavior transition probabilities.
Table 1. Testing on a subset of CRIM13 was used to select Cuboids+Pca-Sift as the best of many state-of-the-art spatiotemporal features. Running Cuboids+Pca-Sift at multiple scales results in overfitting, with a drop of over 54% in performance from
training to testing (not shown).
Table 2. Benchmark of different number of regions for trajectory features computation. Trajectory features alone also suffer from a lack of temporal context to properly segment videos.
5.2.2Weak trajectory features
The only parameter of the trajectory features is the number of regions. We found that the optimal setting is to use the combination of 1, 2 and 3 regions, Table 2. With this setting, trajectoryfeaturesoutperformspatio-temporalfeatures in the validation set. Their versatility makes them suffer slightly less from lack of temporal context. They are also much quicker to compute, with an average 155 fps (given the tracks, available from project website).
5.2.3Classification settings
The only two parameters of the binary AdaBoost classifiers are the maximum number of weak classifiers (T) and the amount of frames sampled at each training iteration (S). To prevent overfitting and speedup training, each weak classifier is learnt using only a subset of S training frames, choosing a new subset at each iteration by randomly sampling with replacement. After evaluation, we chose T = 250 and S = 1k as optimal values, Figure 6. Note how sampling a small number of frames improves performance compared with large rnumbers. Asthenumberofframesincreases, the weak classifiers overfit, resulting in a drop in performance.
5.3. Results
We report the results of our approach on CRIM13. The 237, 10min long videos were divided in two sets, 104 for training and 133 for testing. Table 3 shows the main results. To better study the role of each feature, we tried each separately: only trajectory features (TF), only spatiotemporal features from the side or from the top, both spatiotemporal features together (STF), and all of them combined (TF + STF). First column shows the performanceof each combination of local features without context. Second column shows the results after adding temporal context features with Auto-context.
Without context, TF clearly outperforms STF, while the combination of both, TF + STF, improves classification 1% with respect to TF. The use of Auto-context improves performance 8% on the full method, 10% on average. In comparison, a simple temporal smoothing of the output labels only improves results 0.2%.Best results are achieved by the combination of both local featuresTF+STF, whichimprovesTF 3%, reachingafinalrecog-nition rate of 61.2%. The upper bound for this task is 70%,which is the average agreement rate between expert’s annotations, see Figure 2.
Although the metric used might suggest that the difference between TF and TF +STF is small, analyzing each behavior separately shows that TF + STF outperforms
TF in 7 out of the 12 behaviors (attack, copulation, chase,drink, eat, sniff, up). Also, comparing the confusion matrices of STF from the side and STF from the top shows
that the top view is best suited to detect 5 behaviors (chase,circle, clean, sniff and walk away) while the rest are best recognized from the side.
Figure 6. Role of T and S in classification. Experiments were carried on using only trajectory features (see Sec. 5.2.3).
Table 3. Method results on CRIM13.Context results were achieved after 2 Auto-Context iterations. Adding temporal context improves classification an average of 10% (14% on STF).For a comparison with experts annotations, see Figure 2.
6. Discussion and conclusions
We present CRIM13, a new video dataset for the study of behavior with an emphasis on social behavior. The videos were collected and annotated by expert-trained annotators for a neurophysiological study of behavior [23]. CRIM13 is the largest and richest behavior dataset to date, containing over 8M frames and 12+1 different behavior categoriesThe videos are not pre-segmented into action bouts, therefore classification must proceed hand-in-hand with segmentation.
We proposed an approach for the automatic segmentation and classification of spontaneous social behavior in continuous video. The approach uses spatio-temporal and trajectory features, each contributing to the correct segmentation of the videos into behavior bouts. We benchmarked everycomponentofourapproach separately. Onourdataset the combination of novel trajectory features with popular spatio-temporal features outperforms their use separately.This suggests that the study of behavior should be based on a multiplicity of heterogeneous descriptors. Also, we found that temporal context can improve classification of behavior in continuous videos. Our method’s performance is not far from that of trained human annotators (see Figure 2 and Table 3) although there is clearly still room for improvement.While disagreement between human annotators lies almostentirely on the labeling of other behavior (less important),our method confuses some real behaviors. In fact, remov-
ing other from the confusion matrices results in a human performance of 91%, and 66% for our approach.
We believe that classification performance could be improved by adding new features derived from pose and applying dynamic multi-label classifiers that can prove more robust to unbalanced data. We will also further study the use of LTP features, due to their promising results and faster speed. Although in this work we were able to deal with behaviors of different durations, an open question is whether
an explicit distinction between short and simple ‘movemes’,medium-scale ‘actions’ and longer and more complex ‘activities’ should be directly included into future models.
Acknowledgments
Authors would like to thank R. Robertson for his careful work annotating the videos, as well as Dr. A. Steele for coordinating some of the annotations. We also would like to thank Dr. M.Maire for his valuable feedback on the paper. X.P.B.A. holds a postdoctoral fellowship from the Spanish ministry of education,programa Nacional de Movilidad de Recursos Humanos del Plan Nacional de I-D+i 2008-2011. D.L. was supported by the Jane Coffin Child Memorial Foundation. P.P.andD.J.A.weresupportedby the Gordon and Betty Moore Foundation. D.J. is supported by the Howard Hughes Medical foundation. P.P. was also supported by ONR MURI Grant #N00014-10-1-0933.
References
[1] S. Ali and M. Shah. Human action recognition in videos using kinematic features and multiple instance learning. PAMI,32(2):288 –303, 2010. 3
[2] S. Belongie, K. Branson, P. Dollar, and V. Rabaud. Moni-toring animal behavior in the smart vivarium. In Workshopon Measuring Behavior, Wageningen, The Netherlands. Citeseer, 2005. 1
[3] K. Branson, A. A. Robie, J. Bender, P. Perona, and M. H.Dickinson.High-throughput ethomics in large groups of drosophila. Nature Methods, 6(6):451–457, 2009. 1, 3
[4] C. Bregler. Learning and recognizing human dynamics in video sequences. In CVPR, 1997. 1
[5] W. Brendel and S. Todorovic. Learning spatiotemporal graphs of human activities. In ICCV, 2011. 3
[6] J. Candamo, M. Shreve, D. Goldgof, D. Sapper, and R. Kas-turi.Understanding transit scenes: A survey on humanbehavior-recognition algorithms. Intelligent Transportation Systems, IEEE Transactions on, 11(1):206 –224, march2010. 1
[7] H. Dankert, L. Wang, E. D. Hoopfer, D. J. Anderson, and P. Perona. Automated monitoring and analysis of social behavior in drosophila. Nat Methods, 6(4):297–303, Apr 2009.1, 3
[8] P. Dollár, V. Rabaud, G. Cottrell, and S. Belongie. Behavior recognition via sparse spatio-temporal features. In VS-PETS,October 2005. 1, 3, 4, 5
[9] A. A. Efros, A. C. Berg, G. Mori, and J. Malik. Recognizing,action at a distance. In ICCV, pages 726–733, Nice, France,2003. 3
[10] A. Gilbert, J. Illingworth, and R. Bowden.Fast realisticmulti-action recognition using mined dense spatio-temporalfeatures. In ICCV, 2009. 3
[11] L. Gorelick, M. Blank, E. Shechtman, M. Irani, and R. Basri.A decision-theoretic generalization of on-line learning and an application to boosting. Journal of computer and system sciences, 55:119–139, 1997. 3, 4
[12] L. Gorelick, M. Blank, E. Shechtman, M. Irani, and R. Basri. Actionsasspace-timeshapes. PAMI,29(12):2247–2253, December 2007. 2
[13] G.Willems, T. Tuytelaars, and L. V. Gool. An efficient dense and scale-invariant spatio-temporal interest point detector. In ECCV, 2008. 3
[14] C.-W. C. J. C. Niebles and L. Fei-Fei. Modeling temporal structure of decomposable motion segments for activity classification. In ECCV, 2010. 2
[15] H. Jhuang, E. Garrote, X. Yu, V. Khilnani, T. Poggio,A. Steele, and T. Serre. Automated home-cage behavioural phenotyping of mice. Nature communications, 1(6):1–9,2010. 1, 3
[16] H. Jhuang, T. Serre, L. Wolf, and T. Poggio. A biologicallyinspired system for action recognition. In ICCV, 2007. 3
[17] Z. Khan, T. Balch, and F. Dellaert. A rao-blackwellized particle filter for eigentracking. In CVPR, volume 2, pages II980. IEEE, 2004. 1
[18] A. Klaser, M. Marszalek, and C. Schmid. A spatio-temporaldescriptor based on 3d gradients. In BMVC, 2008. 3, 5
[19] I. Laptev and T. Linderberg. Space-time interest points. InICCV, 2003. 3, 5
[20] I. Laptev, M. Marszalek, C. Schmid, and B. Rozenfeld.Learning realistic human actions from movies. In CVPR,2008. 3, 5
[21] G. Lavee, E. Rivlin, and M. Rudzsky. Understanding videoevents: A survey of methods for automatic interpretation of semantic occurrences in video. IEEE Transactions on Systems, Man, and Cybernetics, 39(5):489 –504, 2009. 1
[22] Q. V. Le, W. Y. Zou, S. Y. Yeung, and A. Y. Ng. Learning hierarchical invariant spatio-temporal features for action recognition with independent subspace analysis. In CVPR,2011. 3
[23] D. Lin, M. P. Boyle, P. Dollar, H. Lee, E. S. Lein, P. Perona,and D. J. Anderson. Functional identification of an aggression locus in the mouse hypothalamus. Nature, 470(1):221–227, 2011. 1, 3, 7
[24] J. Liu, J. Luo, and M. Shah. Recognizing realistic actions from videos “ in the wild ”. In CVPR, 2009. 2
[25] M. Marszalek, I. Laptev, and C. Schmid. Actions in context.In CVPR, 2009. 2
[26] J. C. Niebles, H. Wang, and L. Fei-Fei. Unsupervised learning of human action categories using spatial-temporal words.IJCV, 79:299–318, 2008. 3
[27] S. Oh and et al. A large-scale benchmark dataset for eventrecognition in surveillance video. In CVPR, 2011. 2
[28] R. Polana and R. C. Nelson. Detection and recognition of periodic, nonrigid motion. IJCV, 23(3):261–282, 1997. 1
[29] R. W. Poppe. A survey on vision-based human action recognition. Image and Vision Computing, 28(6):976–990, 20101, 3
[30] M. D. Rodriguez, J. Ahmed, and M. Shah. Action mach:a spatio-temporal maximum average correlation height filter for action recognition. In CVPR, 2008. 2
[31] M. S. Ryoo and J. K. Aggarwal. Spatio-temporal relation- ship match: Video structure comparison for recognition of complex human activities. In ICCV, 2009. 2, 3
[32] C. Schuldt, I. Laptev, and B. Caputo. Recognizing human actions: A local svm approach. In ICPR, 2004. 2
[33] H. J. Seo and P. Milanfar. Action recognition from one example. PAMI, 33(5):867 –882, may 2011. 3
[34] G. W. Taylor, R. Fergus, Y. Lecun, and C. Bregler. Convolutional learning of spatio-temporal features. In ECCV, 2010.3
[35] Z. Tu. Auto-context and its application to high-level visiontasks. In CVPR, 2008. 2, 4
[36] V. N. Vapnik.The nature of statistical learning theory.Springer-Verlag New York, Inc., New York, NY, USA, 1995.3
[37] A. Veeraraghavan, R. Chellappa, and M. Srinivasan. Shapeand-behavior encoded tracking of bee dances.PAMI,30(3):463–476, Mar 2008. 1
[38] P.ViolaandM.Jones. Rapid object detection using aboosted cascade of simple features. In CVPR, 2001. 5
[39] H. Wang, M. M. Ullah, A. Klaser, I. Laptev, and C. Schmid.Evaluation of local spatio-temporal features for action recognition. In BMVC, 2010. 4, 5, 6
[40] D. Weinland, R. Ronfard, and E. Boyer.Free viewpoint action recognition using motion history volumes.CVIU,104(2-3):249–257, 2006. 2
[41] L. Yeffet and L. Wolf. Local trinary patterns for human action recognition. In ICCV, 2009. 3, 5, 6
[42] K. Yu, S. Ji, M. Yang, and W. Xu. 3d convolutional neural networks for human action recognition. In ICML, 2010. 3
[43] L. Zelnik-Manor and M. Irani.Event-based analysis of video. In CVPR, volume 2, pages II–123. IEEE, 2001. 2
在连续视频的社交行为识别
摘要
我们提出了一种新的方法来分析社会行为。通过结合时空能量和代理轨迹的特点建设时域上下文模型,将连续的视频行为分割成行动“较量”。该方法是对的相互作用小鼠,这是收集行为的国家的最先进的神经电生理研究的一部分视频提供了一个前所未有的数据集进行测试。该数据集包括超过88小时(800万张)的注释视频。我们发现使用在一个歧视性框架的新的弹道特性比广泛应用于时空特性有更多的信息。此外,在连续视频中,时间背景在动作识别中占有重要的作用。我们的方法可以看做是一个基于此数据集的基准方法。与许多专家认同的约70%的识别效率相比,我们的方法达到了61.2%的识别效率。
一、介绍
从视频中检测和分类人类和动物的行为是计算机视觉研究人员面临的最有趣的挑战之一。主要的应用包括:视频监控,社会机器人,场景识别,动物行为学,神经科学,医学和遗传学。
自动化行为的分析是具有挑战性的。首先要建立一个可检测,分类和跟踪远景“前端”是很困难的。然后,对“行为”的一个清晰定义,包括对移动物体,中等复杂行为或更复杂的行为作出简短的分析识别,这对我们仍然是一个困扰。第三个障碍是标准数据集不足以指导我们思考和评估我们的算法(见第二节)。
在动物行为的影响这些问题上取得进步的最佳策略也许要归功于许多实用的优点。首先,实验动物,典型的有苍蝇和老鼠,这些动物比人更容易探测和跟踪,因此视觉前端更容易建立。其次,苍蝇和老鼠的行为更简单,也许比研究人类的行为更加客观,这使得关于行为的准确定义可能来的更早一些。三是更加实用的建立可重复的实验,并收集丰富的动物视频,而不是人类的,尤其是一些最有趣的行为(如:求爱,侵略)或是一个人利用系统性的操作来探索大自然的作用。此外,专家都愿意在他们的研究领域彻底诠释动物的行为视频,如:动物行为学,生态学,神经系统学,药理学和遗传学。由于在动物行为,特别是社会行为方面的建模和分类取得进展,从而提供了一个机遇。我们认为,从研究动物模型得到的数据会引起人类行为建模和自动化分析方面的进展。
本研究的主要方面有:最大最丰富的行为数据集。该加州理工学院居民—入侵者小鼠数据集(CRIM13)由237*2的视频编目成13个动作,每个视频帧持续时间约10分钟,视频共计超过88小时,有800万帧。曾有一个团队的专家利用MATLAB的GUI一帧帧的注释了每个视频,而我们把它改善成即时的。
在连续视频社会行为的自动分割和分类方法。多智能体的行为提出了新的挑战。(a)多个动物必须本地化并跟踪,即使是他们接触或是重叠的时候。(b)每个行为可参照多个帧(c)无论是在持续时间还是视觉外观,社会行为都是高度可变的,见图1,可以再项目网站上找到用我们的方法输出的视频例子。
1、新型弹道特性的行为识别。我们在跟踪目标的位置处设置了一大块的微弱特征区域。弱轨迹功能强大,广泛应用于时空特征,见表3.
2、探索时空背景下的行为分析。首先利用视频计算时空轨迹的特性,第二级使用视频的自动扩展分析时间背景,时间模型有助于将视频转换为行为“较量”,整体提升了8%。
利用我们的方法对13个类别,133个视频的测试,达到了61.2%的识别率,见表3.图2显示了用我们的方法对12个视频进行对比,有多位专家作出了比较注解。在我们这个较小的数据集,众多专家达成的协议大概是70%,而我们的方法达到了62.6%。
然而,CRIM13仍然是一个严峻的挑战。人类注释者的分歧就在于几乎完全依靠其他行为的标记,而我们的做法还是对真正的行为产生了错误。事实上,将混乱矩阵里的91%的人的表现删除,只有66%用的是我们的方法。当计数时,我们的方法占5/12的行为。
2.相关工作
数据集——什么能够创造一个好的数据集?在给定的环境中,物体相互之间的交互行为是有趣而有意义的。在一个明确的定义下,理想的行为数据收集是开放的,并能捕捉到所有的自发的行为或行动。拍摄应该是连续的,以便在不同的时间作不同程度的分析研究。社会行为和代理对象的相互作用令人非常的感兴趣。目前最广泛使用的行为数据集分类有,,KTH , INRIA-XMAS , Weizmann , UCF Sports, Hollywood2 , YouTube .Olympic Sports and UT videos 不符合这个标准:他们是分割的、运动的,行为的选择往往是随心所欲的,它们由专家注释并包括小的社会行为。此外,KTH和Weizmann数据集在当前的94%的艺术分类率和99%d识别率可能已经达到了其使用寿命。其中的一个方法是对连续事件的识别,虽然只是使用了很小的一段连续的视频序列。Virat是第一个大规模的连续视频数据集,它允许研究行为在一个良好定义的有意义的环境下进行。该数据集的重点是视频监控,包括人类和物体(如汽车),其相互作用的例子包括超过29小时的视频。另外一个有用的数据集,是由赛尔和其合作者收集的,他们的论点集中在单一的小鼠的行为。这些数据不包括社会行为的实例。
特点-大部分动作识别方法完全基于时空特性的。这些功能是计算在两个不同的阶段:兴趣点检测和描述。流行的时空兴趣点检测器包括Harris,Cuboids,和Hessian。在后台进行的数据集包含有关于场景的信息,是好莱坞数据集情况下密集的采样点可以改善结果,而不是运行兴趣点检测器。最有效的时空点描述方法是Cuboids,HOG/HOF和ESURF.最近,时空特征之间的关系已被用于时间结构模型的基本操作。
其他特征,显示出良好的性能和运动特征提取。最近,空时自适应局部回归仁(3DLSK)已被证明达到在KTH数据集的国家的最先进的识别一个训练实例。生物启发的层次特征也被广泛使用的。在深入学习技术应用到学习层次不变的时空特征实现。
另一个趋势是使用的间接表达视觉场景作为输入的分类,如轮廓,身体部位或姿势[ 29 ]。这些方法通常是对噪声敏感,部分遮挡和变化的观点,除了在小动物如苍蝇的情况,在弹道的特点结合姿态信息和身体部位分割已被证明[ 7,3 ]。
分类——对分类最常用的方法是使用一个袋子的时空结合如SVM分类AdaBoost [ 36 ]或[ 11 ]。其他有趣的分类方法的特征挖掘[ 10 ]和无监督的潜在主题模型[ 26 ]。
老鼠的行为--两项工作集中在白色背景黑色下小鼠的行动[ 8,15 ]。我们
解决更普遍的和具有挑战性的社会问题是像老鼠的行为一样无约束的。
3.加州理工学院的居民入侵者的鼠标数据集
该数据集是在与生物学家合作收集的,用于研究神经生理机制涉及侵略和求偶行为[ 23 ]。该视频开始总是雄性小鼠单独在实验室。在一些点,第二个小鼠,“入侵者”,介绍和社会交往的开始。在影片的最后,入侵者小鼠被删除。行为分为12 + 1个不同的相互排斥作用12类,即行为和最后一类,称为另外,使用注解者在没有利益的行为发生。老鼠就开始相互的了解对方(方法:嗅,走)。一旦建立,如果入侵者是一个女性,居民小鼠可能与其极爱配。如果入侵者是一个男性,老鼠可能会攻击它捍卫其领土。居民小鼠也可以选择忽略入侵者,从事孤立的行为(清洁,吃,喝,)。图1显示在每个视频帧的行为顶部和侧面的观点,给出了对每个行为一个简短的描述,其概率P(通常每个行为发生)的和的均值和方差的持续时间都在短时间内(μ,σ)。
图2。混乱矩阵上的12个视频由两个以上的专家的注释比较 。有关整个数据集的结果,见表3。(一)“annotator1”和一组4其他注释者之间的比较。 (二)“annotator1和我们的方法的输出之间的比较。一个2K帧的分割(C,D)的比较 视频(可从项目网站)到行为“较量”。
每个场景使用两个固定摄像机的从顶部和侧面视图同步记录。老鼠是夜行动物,近红外在笼照明使用,从而这个视频是单色(视觉上不明显从灰度)。视频通常持续约10分钟,记录在25fps的640x480像素的分辨率,8位像素深度。完整的数据集包括237个视频超过800万帧。
每个视频帧被标记的13动作类别之一,导致产生的视频分割行动的时间间隔或“较量”。开头和结尾 每一个回合,因为行为是准确地确定在立场必须为25Hz的频率进行关联与电生理记录。一些行为会往往比其他人发生更多 ,持续时间(包括类内和类间)差别也很大,见图1。
有9种不同的人类专家注释者。注释者的专业知识变化不大;他们由被 两个相同的行为生物学家培训过,并给予相同的一组上的行为,应如何进行注释说明。 注释者同时使用视频的顶视图和侧视图,在Matlab开发行为注释图形用户界面。此工具提供所有播放功能需要仔细分析视频,并允许行为的人工注释 成较量(开始和结束帧)。该工具可以从项目网站获取。每一个10分钟的视频中包含 平均140回合动作(不计除外)。它 通常需要一个专家7-8倍的视频长度充分 注释它。专家花费充分注释数据集花费的时间大致为350小时。
4.2提出的方法
在第2节讨论的大部分方法,包含单一动作的预分段短片的分类方法。我们的做法的同时将视频分割成单回合行动和行动的分类,这会更复杂的问题。
我们的方法可以被看作是自动上下文[35]的视频的扩展。自动上下文已经证明来执行,受益于学习韦兰高层次的一个上下文模型视力问题 。与其他方法相比,自动上下文模型更容易培养和避免重算法 设计,更显著更快。我们在学习段视频发现,时空结合上下文信息起着至关重要的作用 ,见表3。
图3。概述我们的方法。首先从视频中计算两个组的局部特征。训练这些功能分估计各行为的信心水平时间背景 特征是从置信水平构建并用于计算 新的信心,在新的迭代估计。在我们的情况下自动语境在收敛迭代2。
自动上下文中很容易被描述为一个多步骤的过程。首先,地方特色是从滑视频短片计算 时间窗口(参见4.1节),并用来训练基地分类,输出的每一帧,它属于每一个行为的概率。重复该过程,从而增加原来的视频功能从计算的新特性大量上下文帧的行为的概率。这些新功能提供对当前前面和后面的帧的可能分类信息帧,所以编码时间背景和行为之间的转移概率。用于帧上下文可以是接近或从当前帧的很远,它是由基分类来选择和重要融合支持上下文帧连同地方特色。这过程被重复的T次,或直至收敛。
我们的方法利用AdaBoost算法[11]作为基分类器,其中每个弱分类器是一个2棵树深度,而不是更常见的单蔸。对于每个问题,一个二进制分类器是通过与促进所有培训帧训练标签指示的行为或者存在或不存在。给定k=1.. K的行为类型,每种类型的k个二元的分类器将输出一个信心hk(i)∈R 满足特殊的行为存在于框架I2。然后,最后多标签分类是通过分配为最终实现 行为键入具有最高置信水平:y = arg max hk(I)。我们发现,分类器输出做并不需要进行校准。图3示出的数据流所提出的方法。
4.1局部特征
为了计算局部特征,滑动窗口居中 在每个帧与这两种类型的局部特征计算。最佳的滑动窗口的大小直接相关行为的持续时间,以及向编码每个要素类型的。经过多次实验,我们确定使用的9帧(≈1/3秒)的窗口是最适合时空的特性,另外两个窗口的大小(75和615帧,即3和25次)的组合是最歧视性的弹道特性,见图5。
时空—首先计算上使用集中在当前滑动窗口中的每个视频框架。比较几个我们现有的基准方法(第5节),我们最终选择了Cuboids+Pca-Sift[8]。所有参数都设置为原来的配置包也就是说,使用的标准程序列队计算[39],除了250的减小码本的大小,这被证明是最好的结果(见表1增刊。材料)。
弱轨迹特征是从一套计算每只小鼠 xmi(t),ymi(t)的每个顶视图视频帧t,见图3。这些位置是 我们的小组通过开发未发表的跟踪算法计算出来的,能够维持小鼠的身份槽重复检测。
从该位置上的,有意义的轨迹信息被计算,如小鼠运动方向,速度和加速度之间的距离,见图4(a)所示。然后该算法从这个信息生成的弱设有一个大型实验区,以类似的方式来为对象进行检测方法[38]。鉴于集中在当前滑动窗口帧,则该方法在不重叠的区域划分,并且适用于各一套6种不同的操作(和,方差,最小值,最大值,高斯加权和谐)该方法的每一个操作款项全部区域值,其中
每个区域可以正数(1),负(-1),或者是完全忽略(0)。这个过程不断重复,对于所有可能的组合区域和轨迹的每一个图4中的值(a)所示。在调和操作调换的值(-1)地区,因此检测循环重复。
4.2、时空背景下的功能
由于自动上下文的一部分行为分类仅基于局部特征,然后在随后的迭代中,加入到功能设置时间上下文的列表功能,从信心层面输出的计算二元分类器在上一次迭代,时空背景下的功能是通过计算每个时间样本取一个时间窗口在中心那个时候的样本一阶统计。设计细节在图4(b)给出。
5、实验
给定一个视频,注解是由行为的时间间隔(行为类型,起始帧,结束帧)的列表中定义。该指标用于比较两个注解应该测量两者的相似性,以及它们的相对完整性(不论是现存的第一注解的所有行为也目前在第二个注释)。第二个是特别由于CRIM13的高度不均衡性重要。事实上,通过简单的一帧一帧的比较,分类器预测所有的帧的准确率会超过50%(见图1)。
我们建议使用混淆矩阵的对角线为指标的平均值,其中混淆矩阵值
是注释之间的每帧平均协议
对于每一对的行为。在所有帧计算每帧的平均协议,测量该对行为之间相似性。然后,通过取对角线的平均值,我们看好该分类在所有的行为与地面实况达到很高的相似性。
5.2 参数分析
为了优化算法,我们分析了所有方法的参数。为了避免过度拟合,并加速该过程我们使用视频的一小部分:10顶视图视频每次训练和测试(30万张)。
5.2.1时空-时空特征
我们选择的基准是一些最广泛使用的时空兴趣点探测器(Harris3D[19]和
Cuboids[8])和时空描述符(长方体PcaSift[8],霍夫[20]和Hog3D[18]),允许所有不同的组合。我们放弃使用密集采样特点,一方面是因为我们的视频的背景是无意义的,另一方面是计算让我们望而却步。我们还使用本地三元模式(LTP),[41]这是由于它的编码应该更自然适合连续行为识别。我们使用代码[8,20,18],因为需要工作需要在长视频进行扩展。
一旦时空特性计算所有视频帧,行为分类结果使用实现了AdaBoost的多标记
分类器,如第4节所述。时空探测器计算在一个单一的空间和时间规模(13X13像素,19帧3Dpatch大小),然后包话通过观察窗计算每个帧的中心在当前帧9帧,即最佳参数,见图5(a)所示。为了计算包的数据在[39]所述的程序使用。码书大小为独立地为基准的每个检测器+描述符面积由100至2000的组合,见表1增刊材料。最好的探测器+描述的是在多个时空尺度(σ=2,4,8,τ=3,5)。表1示出了每个方法的主要结果。
由于训练集的规模小,缺乏上下文,所有的方法都没有段测试视频,导致30-40%的性能下降的培训(不表示出)。时空特征之间的差异是非常小的,因为在当前的数据集[39,41]。探测器似乎性能类似,虽然Cuboids的速度要快得多。至于描述符,PCA-SIFT优于其他地区。Cuboids运行在多尺度的结果过度拟合,不提高性能,同时也慢得多。 LTP的表现虽然快得多,但是比Cuboids+ PCA-SIFT略差,。在这些结果中,我们选择使用Cuboids+ PCA-SIFT处理这其余部分。
表1测试上CRIM13的一个子集被用于选择Cuboids+ PCA-SIFT作为许多国家的最先进的多时空特征。在多尺度运行的Cuboids+ PCA-SIFT 过度使用,在性能训练试验中下跌超过54%,(未示出)。
表2。不同数量基准的区域作轨迹 功能计算。单独轨迹功能也缺乏时间背景。
5.2.2弱轨迹功能
轨迹唯一的特征参数是数字。我们发现,最佳设置是使用1,2和3的区域组合,见表2。使用此设置,轨迹功能了执行中的验证组的时空特征。其多功能性使他们在时间上缺乏上下文的略少。它们也计算的更快,平均155 FPS(给定轨道可从项目网站获得)。
5.2.3分类设定
二进制的AdaBoost分类器的仅有的两个参数弱分类器(T)的最大数量和量采样在每个训练迭代(S)帧。防止过度拟合和加速训练,每个弱分类器使用S培训框架的一个子集,通过更换随机抽样选择一个新的子集,在每次迭代的经验教训。评估之后,我们选择了T =250和S=1K为最佳值,如图6所示。请注意如何取样少数帧的提高了性能与较大的数字比较。由于帧的数量增加时,弱分类器过度拟合,从而导致性能的下降。
图6。T和S在分类中的作用。实验 进行了仅使用轨迹功能(参见5.2.3)。
表3。该方法在CRIM13的结果。在结果2后实现自动上下文迭代。添加时间方面提高了分类平均为10%(对STF14%)。对于专家注释的比较,见图2。
5.3结果
我们报告CRIM13方法的结果。该237,10分钟长的视频被分为两组,104训练和133进行检测。表3示出主要结果。为了更好地研究每个功能的作用,我们每个单独尝试:仅轨迹功能(TF),仅从侧面或顶部的时空特征,两者的时空特征在一起(STF),和所有的结合(TF+ STF)。第一列显示没有上下文的每个组合的局部特征的表现。第二列显示添加时间背景后的结果功能。
在没有上下文的情况下,TF明显优于STF,而两者TF+ STF的组合,相对于TF提高了分类1%。使用自动上下文 完整方法提高了性能的8%,平均为10%。
,一个简单的时间平滑 输出标签不仅提高0.2%。最好的结果是将两者局部特征的组合来实现 TF+ STF,从而提高了TF3%,达到了最终的识别率,61.2%。这个任务的上限为70%,这是专家的注释之间的平均一致率,见图2。
尽管所使用的度量可能表明,TF和TF+ STF之间的差小,分析各行为分开显示,TF+ STF性能优于TF在7出12行为(攻击,交配,追逐,饮,多食,嗅,向上)。另外,从顶部显示侧面显示比较STF的混乱矩阵和STF该俯视图是最适合检测行为(追逐,干净,闻走开),而其余的都是最好.
6 讨论和结论
我们提出CRIM13,一个新的视频数据集的研究行为,强调社会行为。对于行为的神经生理学的研究[23],视频收集并由专业培训的注解者注解。CRIM13是世界上最大和最富有的行为数据集,包含超过800万帧和12+1不同的行为。由于视频不预先分割成行动的较量,因此,分类必须进行逐次分割。
我们提出了连续录像的自动分割和自发的社会行为分类的方法。该方法使用时空和轨迹功能,各视频的正确分割成行为的较量。我们每个单独部件的基准指四个方法。我们的数据集与流行的新型轨道组合功能时空特性优于单独使用它们。这表明行为的研究应当基于异构描述的多重性。此外,我们发现在连续视频
该时间范围内可以提高行为的分类。我们的方法的表现并不是很好从训练的人力标注器(见图2和表3)明显改进的余地。虽然人类的注释者之间的分歧就在于几乎完全依靠其他行为的标签(不太重要的),我们的方法混淆了一些真正的行为。事实上,我们的方法表现从混淆矩阵的结果除去其它的91%,66 %。
我们认为,分类性能可以从姿势派生新的功能和应用动态通过增加多标签分类,可以通过强大的不平衡数据改善。我们也将进一步研究LTP的特点,由于其有希望得到更好地结果和更快的速度。虽然在这项工作中,我们能够处理不同持续时间的行为,然而一个悬而未决的问题是,是否短期和简单的“行为”之间有明确的区别,中等规模的行动和更长,更复杂的活动应直接纳入未来的研究范围。
致 谢
我们要感谢R.罗伯逊和他的细心注释的视频,以及博士答斯蒂尔的协助。我们还要感谢M.博士迈尔提供的宝贵意见。西班牙卫生部博士后 X.P.B.A.的支持。戈登和贝蒂·摩尔基金会的支持。感谢霍华德休斯医学的D.J的支持。感谢由ONR穆里格兰特#N00014-10-1-0933的支持。
[1] S. Ali and M. Shah. Human action recognition in videos using kinematic features and multiple instance learning. PAMI,32(2):288 –303, 2010. 3
[2] S. Belongie, K. Branson, P. Dollar, and V. Rabaud. Monitoring animal behavior in the smart vivarium. In Workshop on Measuring Behavior, Wageningen, The Netherlands. Citeseer, 2005. 1
[3] K. Branson, A. A. Robie, J. Bender, P. Perona, and M. H.Dickinson.High-throughput ethomics in large groups of drosophila. Nature Methods, 6(6):451–457, 2009. 1, 3
[4] C. Bregler. Learning and recognizing human dynamics in video sequences. In CVPR, 1997. 1
[5] W. Brendel and S. Todorovic.Learning spatiotemporalgraphs of human activities. In ICCV, 2011. 3
[6] J. Candamo, M. Shreve, D. Goldgof, D. Sapper, and R. Kasturi.Understanding transit scenes: A survey on human behavior-recognition algorithms. Intelligent Transportation Systems, IEEE Transactions on, 11(1):206 –224, march2010. 1
[7] H. Dankert, L. Wang, E. D. Hoopfer, D. J. Anderson, and P. Perona. Automated monitoring and analysis of social behavior in drosophila. Nat Methods, 6(4):297–303, Apr 2009.1, 3
[8] P. Dollár, V. Rabaud, G. Cottrell, and S. Belongie. Behavior recognition via sparse spatio-temporal features. In VS-PETS,October 2005. 1, 3, 4, 5
[9] A. A. Efros, A. C. Berg, G. Mori, and J. Malik. Recognizing action at a distance. In ICCV, pages 726–733, Nice, France,2003. 3
[10] A. Gilbert, J. Illingworth, and R. Bowden.Fast realisticmulti-action recognition using mined dense spatio-temporal features. In ICCV, 2009.3
[11] L. Gorelick, M. Blank, E. Shechtman, M. Irani, and R. Basri.A decision-theoretic generalization of on-line learning and an application to boosting. Journal of computer and system sciences, 55:119–139, 1997. 3, 4
[12] L. Gorelick, M. Blank, E. Shechtman, M. Irani, and R. Basri.Actionsasspace-timeshapes. PAMI,29(12):2247–2253, De-cember 2007. 2
[13] G.Willems, T. Tuytelaars, and L. V. Gool. An efficient dense and scale-invariant spatio-temporal interest point detector. In ECCV, 2008. 3
[14] C.-W. C. J. C. Niebles and L. Fei-Fei. Modeling temporal structure of decomposable motion segments for activity classification. In ECCV, 2010. 2
[15] H. Jhuang, E. Garrote, X. Yu, V. Khilnani, T. Poggio,A. Steele, and T. Serre. Automated home-cage behaviouralphenotyping of mice.Nature communications, 1(6):1–9,2010. 1, 3
[16] H. Jhuang, T. Serre, L. Wolf, and T. Poggio. A biologically inspired system for action recognition. In ICCV, 2007. 3
[17] Z. Khan, T. Balch, and F. Dellaert. A rao-blackwellized particle filter for eigentracking. In CVPR, volume 2, pages II980. IEEE, 2004. 1
[18] A. Klaser, M. Marszalek, and C. Schmid. A spatio-temporal descriptor based on 3d gradients. In BMVC, 2008. 3, 5
[19] I. Laptev and T. Linderberg. Space-time interest points. In ICCV, 2003. 3, 5
[20] I. Laptev, M. Marszalek, C. Schmid, and B. Rozenfeld. Learning realistic human actions from movies. In CVPR,2008. 3, 5
[21] G. Lavee, E. Rivlin, and M. Rudzsky. Understanding video events: A survey of methods for automatic interpretation of semantic occurrences in video. IEEE Transactions on Sys- tems, Man, and Cybernetics, 39(5):489 –504, 2009. 1
[22] Q. V. Le, W. Y. Zou, S. Y. Yeung, and A. Y. Ng. Learning hierarchical invariant spatio-temporal features for action recognition with independent subspace analysis. In CVPR,2011. 3
[23] D. Lin, M. P. Boyle, P. Dollar, H. Lee, E. S. Lein, P. Perona,and D. J. Anderson. Functional identification of an aggression locus in the mouse hypothalamus. Nature, 470(1):221227, 2011. 1, 3, 7
[24] J. Liu, J. Luo, and M. Shah. Recognizing realistic actions from videos “ in the wild ”. In CVPR, 2009. 2
[25] M. Marszalek, I. Laptev, and C. Schmid. Actions in context.In CVPR, 2009. 2
[26] J. C. Niebles, H. Wang, and L. Fei-Fei. Unsupervised learning of human action categories using spatial-temporal words.IJCV, 79:299–318, 2008.3
[27] S. Oh and et al. A large-scale benchmark dataset for event recognition in surveillance video. In CVPR, 2011. 2
[28] R. Polana and R. C. Nelson. Detection and recognition of periodic, nonrigid motion. IJCV, 23(3):261–282, 1997. 1
[29] R. W. Poppe. A survey on vision-based human action recognition. Image and Vision Computing, 28(6):976–990, 2010.1, 3
[30] M. D. Rodriguez, J. Ahmed, and M. Shah. Action mach:a spatio-temporal maximum average correlation height filter for action recognition. In CVPR, 2008. 2
[31] M. S. Ryoo and J. K. Aggarwal. Spatio-temporal relation-ship match: Video structure comparison for recognition of complex human activities. In ICCV, 2009. 2, 3
[32] C. Schuldt, I. Laptev, and B. Caputo. Recognizing human actions: A local svm approach. In ICPR, 2004. 2
[33] H. J. Seo and P. Milanfar. Action recognition from one example. PAMI, 33(5):867 –882, may 2011. 3
[34] G. W. Taylor, R. Fergus, Y. Lecun, and C. Bregler. Convolu-tional learning of spatio-temporal features. In ECCV, 2010.3
[35] Z. Tu. Auto-context and its application to high-level vision tasks. In CVPR, 2008. 2, 4
[36] V. N. Vapnik.The nature of statistical learning theory.Springer-Verlag New York, Inc., New York, NY, USA, 1995.3
[37] A. Veeraraghavan, R. Chellappa, and M. Srinivasan. Shape-
and-behavior encoded tracking of bee dances.PAMI,30(3):463–476, Mar 2008. 1
[38] P.ViolaandM.Jones. Rapidobjectdetectionusingaboosted cascade of simple features. In CVPR, 2001. 5
[39] H. Wang, M. M. Ullah, A. Klaser, I. Laptev, and C. Schmid.Evaluation of local spatio-temporal features for action recognition. In BMVC, 2010. 4, 5, 6
[40] D. Weinland, R. Ronfard, and E. Boyer.Free viewpointaction recognition using motion history volumes.CVIU,104(2-3):249–257, 2006.2
[41] L. Yeffet and L. Wolf. Local trinary patterns for human action recognition. In ICCV, 2009. 3, 5, 6
[42] K. Yu, S. Ji, M. Yang, and W. Xu. 3d convolutional neural networks for human action recognition. In ICML, 2010. 3
[43] L. Zelnik-Manor and M. Irani.Event-based analysis ofvideo. In CVPR, volume 2, pages II–123. IEEE, 2001. 2
查看完整论文请+Q: 351916072
关键字:
目 录
参考目录
摘 要
计算机视觉以及数字图像处理技术在人类的生产生活中扮演了重要的角色,可以广泛地应用到生产生活中的各个领域。例如工业、航天事业和医疗保健方面。当前,对连续视频图像序列中运动的目标物体的分析是一个重要的研究方向之一。该方面的研究分析对于机器人导航、智能视觉监控系统、医学图像分析、工业检测、视频图像分析以及军事雷达视频信号的处理都具有重要的意义。
运动目标检测是当前研究领域的一个热点问题,也是计算机视觉研究领域的主要问题之一。它融合了图像处理、模式识别、自动控制、人工智能以及计算机等许许多多的领域的先进技术,在军事视觉制导、视频监控、医疗诊断、智能交通等方面都有广泛应用。基于视频图像的运动目标分析是一项巨大的工程,不仅通过需要视频信号的采集,同时也对图像处理的收集,以及应用程序的开发。如果需要完成某一项实验或者任务,需要研究人员自己完成所有的底层的一些算法实现,这样会在很大程度上加大研究人员的工作难度,同时也会消耗更多的时间和精力,最后得出的结果也不一定能够很好的满足我们的需求。
本文采用的工具主要是VS2010和OpenCV,挖成了船舶检测及特征提取的工作。系统主要包括:视频图像处理,运动目标检测.实验结果分析。对于运动目标的检测,本文介绍了多种基本的方法,分别分析其优势和不足,根据实际情况选择了实用又简单的帧间差分法法。本文采用了经过处理的AVI视频,将其转化成了适合后期处理的图像序列。在目标检测过程中,通过帧间差分法获取了船舶的轮廓图像。
本文在后期对多帧图像作处理,并得出了多组数据,在一定程度上增强了实验结果的可靠性。实验结果表明,用本文的检测算法足以满足实验要求,并且达到了预期的目标。
Abstract
Motion target detection is one of the main issues in computer vision, which combines advanced technologies in image processing, Pattern recognition, automatic control, artificial intelligence, computer and other relative fields. It has broadly applied in military visual missile guidance, video surveillance, medical image analysis, intelligent transportation and other fields, so this project research has important theoretical significance and practical value.
Moving target detection is one of the main problems in computer vision research, it combines image processing,a lot of pattern recognition, automatic control, artificial intelligence and other areas of advanced computer technology in the military vision-guided, video surveillance, medical diagnostics, intelligent transportation aspects of a wide range of applications. Based on analysis of video images of the moving target is a huge project, both to capture the video signal, but also the collection of image processing, but also for the development of application-specific programming. To complete an application for engineering staff, if all of the underlying algorithms have their own coding to achieve, all image processing functions to be written from scratch, resulting in a waste of both time and energy, but also difficult to guarantee stability, practicality and versatility.
The main tool used in this paper is VS2010 and OpenCV, dug into the ship detection and feature extraction work. The system includes: a video image preprocessing, moving target detection experimental results. For the detection of moving targets, this paper introduces a variety of basic methods, their advantages and disadvantages are analyzed according to the actual situation choose a practical and simple algorithm. In this paper, a processed video AVI, which was converted into a suitable post-processing the image sequence. In the target detection process through inter-frame difference method to obtain the contours of the image of the ship.
In this paper, the latter for the treatment of multi-frame image, and a plurality of sets of data obtained at a certain extent increase the reliability of the experimental results. Experimental results show that detection algorithm used herein meet the requirements of the experiment, to achieve the desired goal.
Keywords: video, moving target detection, inter-frame difference method, OpenCV
第一章 绪论 1
1.1课题研究背景及意义 1
1.2国内外研究现状 1
1.3 OpenCV概述 2
1.4本章小结 3
第二章 数字图像处理 4
2.1图像预处理 4
2.2图像灰度变换 4
2.3图像中的噪声 6
2.4平滑处理 6
2.4.1中值滤波 7
2.4.2高斯滤波 8
2.5图像二值化 9
2.6数学形态学滤波 10
2.6.1膨胀和腐蚀 11
2.6.2 开运算和闭运算 12
第三章 运动目标检测 14
3.1帧间差分法 14
3.2背景差分法 16
3.3光流法 18
第四章 运动目标检测实现与结果分析 20
4.1本文检测算法流程及实现 20
4.2最小外接矩形的截取 21
4.2.1轮廓查找 21
4.2.2截取外接矩形 22
4.3图像像素距离与实际空间距离 23
4.4实验结果及分析 23
4.5本章小结 26
第五章 总结与展望 27
5.1研究总结 27
5.2研究展望 27
参考文献 29
致 谢 31
第一章 绪论
1.1课题研究背景及意义
世界是变化的,对于运动对象的分析是人类永恒的话题。随着科技的进步,计算机技术变得日益成熟和可靠,随之产生了一个新型的学科方向与研究领域,即计算机视觉。计算机视觉是一门综合性的学科,包括计算机科学和工程,应用数学,统计学,神经生理学,信号处理等。其中对于运动目标的检测与分析是计算机视觉领域最重要最核心的技术。
基于视频图像序列的运动目标检测与分析的基本内容是从连续的视频图像序列中提取出我们需要的运动目标。其中对运动目标检测、目标识别是数字图像处理技术低层次的应用。对视频图像序列中运动目标的检测分析系统要注重实时性,通用性和可移植性。视频序列图像运动目标分析对人类的生产和生活具有重要意义,虽然到目前我们已经取得了不少的成果,为人类的生活也提供了不小的便利,但是还远远满足不了人类的需求。因此,完成一个实用的、准确的运动目标检测系统仍需要更多志同道合的人努力,这也是当前最具挑战性的课题之一。
1.2国内外研究现状
计算机视觉是研究利用计算机模拟生物外显或宏观视觉功能的科学和技术【1】。运动目标的检测是计算机视觉领域的一个重要的分支,是对目标区域内的运动目标,如船舶等的检测,并得到运动物体的相关信息。近年来,之前计算机视觉的研究重点主要是对静态图像序列的研究,但是这满足不了时代的需求,现如今研究重点已经转移到了对动态图像序列的研究。这方面的典型应用包括自动化的视频监控系统、视频MPEG编解码技术、人机交互的感知接口、军事上的制导、雷达视频图像中的目标分析【2】。
对于视频检测领域的研究,国外开始的比较早,经过十多年的发展,技术已经非常成熟,视频检测线圈检测技术得到了广泛的认同,代表了该领域未来的发展和视频检测应用方向。有一个较为成功的具有实时监测交通参数功能的商业系统AUTOSCOPE,是由美国ISS公司的开发出来的,在交通监测方面是当前国际上最具有竞争力的系统之一【2】。
相对于国外来说,国内在视频检测方面的研究起步虽然比较晚,但是发展势头很好,也取得了不少的成果。但是这些产品能够实现的功能过于单一,还不能保证在复杂多变的环境下系统的稳定性与准确性,与国外的产品相比还是有相当的差距,所以还无法推广开来。因此。我国目前还需要大力的发展视频检测领域的研究与应用,号召更多的人投入到这个领域,争取早日与国际接轨,推出真正的国产的、适合我国国情的视频检测系统。
运动目标检测的主要问题和难点有:
(1)运动目标相互遮挡,给检测带来干扰;
(2)在复杂的背景下,如何有效的进行图像分割并提高算法的实时性;
(3)相连的帧之间有很强的关联性,并且有很多的信息,如何有效的提取并利用这些信息。
1.3 OpenCV概述
OpenCV是一个开源的计算机视觉库,全称是 Open Source Computer Vision Library,于 1999 年由 Intel建立,是一个开源计算机视觉库【4】,采用C/C++编写,它包括一系列 C 函数和少量 C++类,实现包括图像处理和计算机视觉方面的很多通用算法。在 Linux系统、Windows系统 和 Mac OS 操作系统上均可以完美行。另外,OpenCV还提供了许多种语言的接口,包括Python语言、Ruby语言、MATLAB语言等等。
OpenCV 包括 500 多个 函数,覆盖了计算机视觉的许多应用领域,如工厂产品检测、医学成像、信息安全、用户界面、摄像机标定、立体视觉等【4】.它可以使用但不依赖其它的外部库。OpenCV提供了大量的图像处理算法,而且使用也非常方便,用它来做算法不仅可以省下很多的时间与精力,也极大地提高了系统的效率。
本文选取了OpenCV进行视频图像序列运动分析主要就是因为其拥有的独特特点与优势:
(1)纯C代码,源代码开放。
(2)平台无关性:利用opencv编写的函数具有很好的移植性,可以在很多的平台,如Windows等,上直接运行,不需要对源程序作任何的修改。
(3)实时性:程序运行具有实时性,代码可以生成可执行的二进制文件,这样可以大大提高程序的运行速度,节省了不少精力。
OpenCV 主体分为五个模块,分别为:
(1)CxCore,CxCore是OpenCV最重要的一个子库,该库提供了 OpenCV 运行时的一些最基本的数据结构,包括矩阵,数组的基本运算,基本绘图函数,包括出错处理的一些基本函数。例如 ,最简单的基本数据结构CvPoint、CvSize,定义矩阵结构的CvMat,绘图函数cvMinAreaRect2和 cvDrawContours ;
(2)Cv,包括计算机视觉算法的基本的图像处理,运动分析,跟踪和模式识别等。例如 cvSmooth是图像平滑函数,cvHarrDetectObjects 是检测图像中的目标;
(3)Ml(Machine learning),机器学习模块,包含许多聚类、分类和数据分析函数。例如vStatModel函数是统计模型基类;
(4)HighGUI:用户交互,包括图像和视频输入/输出功能,这是用来建立软件原型或是用于测试,不适合最终用户的应用。例如 cvCreateFileCapture、cvQueryFrame 等函数;
(5)CvAux:CvAux是OpenCV的 附加库函数,包含一些新出现的实验性的算法和函数。例如计算一对校正好的图像的视觉差的函数cvFindStereoCorrespondence
1.4本章小结
本文主要介绍了本课题的研究背景,以及当前国内外的研究的现状,包括一些热点难点问题以及所取得的一些成果。着重介绍了OpenCV的相关信息,包括OpenCV的来源、发展,和同类软件相比的一些显著优势以及其5个功能模块。
第二章 数字图像处理
2.1图像预处理
丰富的图像是我们获取信息的重要方式之一。我们通过各种不同的手段获取到了图像,这些图像可以直接或间接地对眼睛和视觉感知产生重要的作用。一般图像采集的最终结果是某种能量的样本阵列,所以图像常用矩阵或数组来表示,每个元素的坐标代表场景点的位置而元素的值代表场景点的某个特征量【5】。视频是有一帧帧图片组成的,数字图像连续的排列构成了视频,并且这些视频包含有许多的音频信息。人类可以从视频文件简单直观的获取大量的信息。视频序列中的每一张图片都被称为帧,一般来说,帧率,即视频文件运动的速率大概是每秒30到40帧。人类总是对动态的东西比较敏感,视频中的运动物体最容易引起人们的关注,而且运动的物体提供的信息也更加丰富一些。视频图像的主要特点有:它包含了极其丰富的原始数据,帧间的相关性也使得对于运动目标的检测更加容易,同时也更容易处理并得到我们需要的信息。目前,大多数的视频文件都是通过彩色CCD摄像机获取的。但是在视频采集的过程中,很容易受到外界环境如光照、阴影等的影响,使得视频文件包含了很多的噪声,可以说,人们在现实生活中获取的图像一般都含有噪声。所以在对视频或是图像处理之前,我们需要采用合适的算法减少视频或图像中包含的噪声。噪声处理是一个良好的图像处理系统必须完成的步骤。
作为图像处理的重要组成部分,图像预处理对于人们完成图像处理的目标并获取最准确的信息具有决定性的作用。顾名思义,图像预处理就是在对图像进行分析之前,对我们输入的目标图像进行特征抽取等等的处理过程。图像预处理可以有效地消除目标图像中的无关信息并恢复有用的信息,最大程度的简化我们获取需要的数据的步骤。
2.2图像灰度变换
我们常常说到“黑白图像“和”灰度图像“,在有些情况下,黑白图像和灰度图像是等价的。但是在计算机图像领域中,二者是不同的,”黑白图像“表示图像只包含有两种颜色,即黑色和白色,而”灰度图像“在黑色与白色之间还有各种不同深度的颜色。现如今,我们从生活中直接获取的图像基本上都是彩色图像,为了顺利的对数字图像作处理,必须将彩色图像进行灰度化处理。灰度化的图像有利于后续的处理效率,达到更为理想的效果。
图像的灰度变换就是将彩色图像的彩色信息全部剔除,只留下亮度信息。在计算机中,我们通常把亮度值分为266个级别(0到255),0表示黑色,而255表示全白色。常用的颜色模型有RGB模型,HSV模型,CMY模型等。本文选取RGB模型为标准,在RGB模型中,当R=G=B时,则彩色表示一种颜色,那么颜色(R,G,B)表示灰度值。按照RGB模型进行灰度变换有多种方法,常见的方法有分量法,将彩色图像的R、G、B,3个分量的亮度值当做3个图像的灰度值,然后从中选择合适的灰度图像、最大值法,将彩色图像的R、G、B,3个分量亮度的最大值作为灰度图像的灰度值、平均值法,就是讲彩色图像的R、G、B,3个分量亮度值得平均值作为灰度图像的灰度值、加权平均法,根据实际的需求,将33个分量以不同的加权值进行平均,然后以求出的平均值作为灰度图像的灰度值。但是对图像进行灰度化,采用不同的方法往往会得出结果。
综合考虑到各种情况,本文选用以下公式作灰度化处理:
Gray=0.299R+0.587G+0.114B
R=G=B=Gray
其中,Cray表示图像中像素的灰度值,R表示红色分量.G表示绿色分量,B表示蓝色分量;公式中的系数0.299、0.587、0.114是最为合理的灰度变换的权值。在OpenCV中,函数“CvtColor(const CvArr*src,CvAzT*dst,int code)可以实现图像的灰度变换,其中src表示要处理的原彩色图像,dst表示处理后的灰度图像,code为色彩空问转换方式,code为转换方式,在这里code定义为CV_RGB2GRAY。
图2.1 第184帧彩色图像以及灰度化的图像
2.3图像中的噪声
在当前的大多数数字图像处理的系统中,输入图像一般都是先利用冻结再扫描的方式将多维图像转换成为一维电信号,然后再对其进行处理、存储、传输等加工。最后往往还要在组成多维图像信号,而图像噪声也将同样受到这样的分解和合成。由于在上述的处理过程中,会有电气系统和外界的影响,这将导致对图像中的噪声进行精确的分析变得更加的复杂。另一方面,图像是视觉信息传播的媒介,理解图像信息是通过人的视觉系统确定的。当图像噪声不同,人的感觉的程度是不同的。由于人们对精确性要求的更加地严格,图像噪声的影响成为了一个不得不解决的问题,现如今针对各种不同的噪声有了各种不同的处理方法。
图像噪声根据其不同的特性或者产生方式有不同的分类方法。按照噪声产生的原因,可以讲图像噪声分为两类:外部噪声和内部噪声。所谓外部噪声,就是指外部环境通过各种渠道对系统产生影响,从而产生噪声。如:天体放电就会引起噪声。所谓内部噪声,可以分为四种,包括由光和点的基本特性所引起的噪声、电器的机械运动产生的噪声,如各种接头因抖动引起电流变化所产生的噪声、材料本身的机械运动所引起的噪声和系统内壁设备电路所引起的噪声。还可以根据声幅度随时间分布的特征来定义。如果其幅度分布是按照高斯分布的那么就称其为高斯噪声,而按照雷利分布的那么就称其为雷利噪声。
2.4平滑处理
所谓平滑处理,也称为“模糊处理”,是一项简单且使用频率很高的图像处理方法。对图像作平滑处理可以有效地减少图像上的噪声或失真,平滑处理在降低图像的噪声方面也有应用。当前,OpenCV中实现平滑处理的函数是CvSmooth()函数,该函数如下
Void cvSmooth(
const CvArr* src,
CvArr* dst,
int smoothtype =CV_GAUSSIAN,
int param1=3,
int param2=0,
double param3=0,
double param4=0,
);
src和dst分别是平滑操作的输入图像和输出的图像,cvsmooth()包含的4个参数param1,param2,param3,param4。这些参数取决于smoothtype的值。
CV_BLUE表示的是简单模糊,具体实现方法是对每个像素作param1×param2邻域求和,然后做缩放得到最后结果;
CV_BLUR_NO_SCALE表示的是简单无缩放变换的模糊,具体实现方法是对每个像素作param1×param2邻域求和;
CV_MEDLIAN表示的是中值模糊,具体实现方法是对图像进行核大小为param1×param2的中值滤波;
CV_GSUSS_IAN表示的是高斯模糊,具体实现方法是对图像进行核大小为param1×param2的高斯卷积;
CV_BILATERAL表示的是双边滤波,具体实现方法是应用双线性3×3滤波,颜色sigma=param1和空间sigma=param2。
2.4.1中值滤波
所谓中值滤波,就是基于排序统计理论的一种能有效抑制噪声的非线性信号处理技术。该滤波方法是一种类似于卷积的领域运算。但是不是通过加权求和的方法,而是用某一点的一个邻域中各点的中间值代替该点。这样的方法可以将该点领域内灰度值相对较大或是较小的点用该中值代替,从而可以消除邻域内那些孤立的噪声点,达到了良好的滤波效果。
二维中值滤波输出为:
g(x,y)= Med{f(x-k,y-l),(k,l)∈W}【6】;
其中,f(x,y),g(x,y)分别表示要处理的原图像和已经处理的图像。W表示的是二维模板,一般是3×3,5x5区域,当然,也可以是线状,圆形等各种各样的不同形状。中值滤波器在滤除叠加白噪声和长尾叠加噪声方面拥有非常好的效果,因此经常用来处理这一类的噪声。但是,该种方法也有不小的缺陷,在某些情况下如点和线比较多的图像采用中值滤波就是不可取的,达不到我们预期的效果,甚至可能会导致更加糟糕的结果。其效果如图2.2:
图2.2原始图像及中值滤波后的图像
2.4.2高斯滤波
高斯滤波是一种线性平滑滤波,在消除高斯噪声方面有很显著的作用,因此在处理图像噪声方面得到了广泛的应用。某一点的像素值与其邻域内的像素值进行加权平均后得到的结果就是该点的像素值,所以也可以说高斯滤波是对整副图像作加权平均的一个过程。高斯滤波过程的具体实现方法是:每一个像素点的值采用模板扫描的出来,该中心像素点的值用邻域内的加权平均值替换掉就可以实现高斯滤波。我们知道,获取图像时候无法避免噪声,而对图像的后期处理应用,噪声会成为干扰试验的一个重要因素,与此相关的是,对图像作高斯-拉普拉斯变换的目的是得到更好地图像边缘。
利用函数cvsmooth()对图像作高斯模糊时,函数的前面两个参数分别表示了滤波器窗口的高度还有宽度,第三个参数用来表示高斯卷积核的sigma值,该参数是可以自由选择的,可有可无。如果该参数用户没有特别指定,那么高斯核的各个参数会由系统根据窗口尺寸自动确定。公式如下:
另外,高斯滤波的opencv实现还为几个比较常见的核提供了更高更好的性能优化,比其他的核拥有更好地性能,这些核包括具有标准sigma值3×3,5×5和7×7。另外,单个通道或三个通道的8位或32位的附带呢格式图像也可以采用高斯模糊,只要利用的是in place方式实现。高斯滤波的效果图如下:
图2.3原始图像及高斯滤波后的图像
2.5图像二值化
图像分割在图像处理和计算机视觉研究领域占有重要的地位,是完成本文必不可少的步骤之一。其主要的目的是将运动目标从复杂的背景条件下提取出来,为后期的各种处理提供更好的依据。图像分割的方法也是多种多样的,其中常见的有阈值分割法、区域跟踪法还有边缘检测法等。其中,使用最为广泛的是阈值分割法,其原理也比较简单容易实现,效率比较高,其主要利用了运动目标与背景在灰度值上的差别,只要选择一个合适的阈值,就可以将运动目标和背景分割开来,即得到运动物体的二值图像,这是后续处理的基础,而且该方法可以大大简化后期的分析处理步骤。因而得到了广泛的应用。实现阈值分割的步骤如下:设定一个在0到255的任意阈值T,从而可以讲目标图像分割成为两个部分:大于阈值T的部分和小于阈值T的部分。设输入图像为f(x,y),输出图像为f,(x,y),则
或
上述就是图像的二值化处理也就是阈值分割的原理,从中可以看出,图像的阈值分割的关键是求出合适的阈值。为了方便,在实际应用的时候我们一般采用255表示背景灰度值,用0表示目标物的灰度值。
在OpenCV中,对图像的二值化处理利用函数cvThreshold(const CvArr*src,CvArr*dst,double threshold,double max_value,int threshold_type)【4】实现,该的各个参数如下所示:
src表示原始数组,即待处理的图像;
dst表示输出数组,即处理后的图像,要求其类型与src一致;
Threshold表示阈值;
max-Value表示CV—THRESH—BINARY和CVJHRESH—BINARY—INV的最大值;
Threshold_type表示阈值类型。
函数cvThreshold()对单通道数组应用固定阈值操作。threshold_type确定该函数获取阈值的方法。关于阈值的选取有多种方法,一般是单一阈值或是自适应阈值法。本文受到实际情况的制约,采取的是单一阈值的方法,实现方法是利用滚动条手动调整最适合的阈值,这个方法简单有效,而且已经能充分满足本文的要求。
2.6数学形态学滤波
在数字图像处理中,由于数学形态学算法有平滑轮廓、填充洞孔、连接断裂区域等特性,常常被用在各种图像分析的后处理操作中【7】。其基本运算有4种,包括膨胀、腐蚀、开运算和闭运算。基于这四种基本操作,也可以得到各种功能强大的处理图像的算法,用于图像增强等方面有很好的效果。在OpenCV,形态学滤波算法已被移植到多个库函数,它使用方便,可以节省时间和精力。
2.6.1膨胀和腐蚀
本文使用的形态学滤波算法主要是膨胀,应用于对船舶的二值图像的处理。膨胀指的是指将图像(或图像中的一部分区域)与核进行卷积。这里说到的核是拥有一个单独定义的、可以是任意的形状或大小的参考点。所谓膨胀就是把局部最大化的处理方式。本文要求将离散的序列点连到一起,构成一个连通域。
在OpenCV中实现膨胀的函数是
cvDilate(
IplImage* src,
IplImge *dst,
IplConvkernel* B=NULL,
int iterations=1
);
函数参数如下:src为源图像,dst为处理后的图像,参数B是核,默认值是NULL。最后一个参数Iterations表示的是迭代的次数,默认值是1。对二值化图像膨胀的效果图如下:
图2.3 船舶原图 图2.4 膨胀后的图像
腐蚀和膨胀是相反的一组操作,与膨胀相反,腐蚀处理的目的是计算核区域像素的最小值。腐蚀可以通过下面的方法生成一个新的图像:当核B与图像卷积时,计算被B覆盖的区域的最小像素值,并把这个值放到参考点上【8】。
在OpenCV实现腐蚀的函数是
Void cvErode(
IplImage* src,
IplImage* dst,
IplConvkeenel B =NULL,
Int iterations = 1
);
函数参数分别表示:src为待处理的图像,dst为处理后的图像,参数B是核,默认值是NULL。第四个参数Iterations表示迭代的次数,默认值是1。腐蚀的效果图如下:
图2.5 原始二值图像 图2.6 腐蚀后图像
2.6.2 开运算和闭运算
上文中提到,将膨胀和腐蚀的组合运算可以得出数量庞大的、更加完备的的形态学运算方式,其中最常见运算方法的就是开运算和闭运算。在开运算的情况下,我们首先将目标图像作腐蚀处理然后再进行膨胀处理。统计二值图像中的区域数目是开运算的一个重要功能。若已将显微镜载玻片上观察到的细胞图像做阈值化处理,可以使用开运算将相连的细胞分离开来,然后再计算图像中的区域(细胞)数目。在闭运算的情况下,我们首先将其膨胀再腐蚀。在多连通域中,经常使用的闭运算消除部分的噪声,然后利用开运算,以实现连通区域的目的。开运算和闭运算的处理方式几乎都是“保留区域”形式的:最显著的效果是,闭运算消除了地狱其邻近点的孤立点,而开运算是消除高于其邻近点的孤立点【9】。
2.7本章小结
本章主要介绍了数字图像处理的一些基础知识,如灰度化,二值化,形态学滤波等,重点介绍了本文将用到的处理过程及在OpenCV中实现的函数,为后期作了充分的理论准备。
第三章 运动目标检测
对于运动目标的检测是后期处理的基础,也是最为关键的部分之一,其主要的目的就是从视频图像序列中提出运动目标并获取运动目标的相关信息,如形状、轮廓等。运动目标提取的过程实际上是对移动物体的图像分割,但只有在连续的图像序列(如视频图像序列)中可以看到,对于单一的图像是无法完成对目标物体提取的。由于当物体运动时,其背景会有细微的变化,这些细微的变化就是提取运动目标的关键。关于运动目标的检测,根据视频场景所在的区域可以分为室内检测盒室外检测,根据摄像头是否随着运动物体运动,可以分为两类:基于静态背景的运动目标检测和基于运动背景的运动目标检测。目前,在多种方式用于运动目标的检测,常用的是背景差分法和光流法,帧差法,这三种方法是当前的主要方法。
3.1帧间差分法
帧间差分法(Frames Difference)是基于像素的运动目标检测方法,它通过对连续的视频图像序列中相邻帧做差分运算来提取运动区域及运动目标轮廓[10]。该方法实现简单,实时性高,而且对动态环境也有较强的自适应能力,是最常用的检测算法之一。视频序列具有连续性,在光线变化不大的情况下,相邻帧间的图像在背景上基本相似,若图像中有运动的物体,则距离上的变化将导致帧间相同位置上的像素值的显著变化,即帧差值会很大;若没有运动对象,帧差值将会保持不变或变化很小,这种情况是无法提出出运动目标的。目标物体的移动引起了灰度图像相关点的亮度值得变化,利用帧间差分法将这些变化表现出来就可以获得运动目标的二值图像,其余部分由于灰度值没有变化,作差分后其灰度值为0,为全黑色。所以,通过帧间差分法得到的是背景为全黑的运动目标的二值图像。如果考虑到图像中的噪声,在全黑的背景下,会有少数的灰度值较大的点,这些点会对后续的处理造成干扰,需要想办法将其剔除。所以说,帧间差分法是一种基于像素的运动运动检测方法,有时候收到外界条件的干扰或是为了获取更加准确的二值图像,可以采用连续的多帧图像作帧间差分,常见的方法有三帧差分法,从实际的操作效果我们可以看出,帧差法提取的主要就是运动目标的轮廓。本文采取的就是帧间差分法提取出了运动物体的轮廓。其原理图如下所示:
在OpenCV中对两帧图像作差分的函数是cvAbsDiff{frameTime1,frameTime2,frameForeground}其中的各参数依次表示第k帧图像的灰度化图像,第(k+1)帧图像的灰度化图像及两灰度图差分得出的输出图像。然后对灰度图像做二值化处理就得出了运动目标轮廓。
帧间差分法的优点是多方面的:(1)实现该算法程序比较简单;(2)对一些外界条件的变化如光线变化不是很敏感,这样就保证了程序的稳定性与适用性。但是该方法也有一些缺陷:(1)只能准确的提取出运动目标的轮廓,对于运动目标整体的提取不太理想(2)选择不同的帧间距离对实验结果影响较大。一般来说,如果运动目标的运动速度比较快的时候,只有选取较小的时间间隔才能准确的提取出运动目标的二值图像,否则可能会检测出连个分开的物体。如果运动目标的速度比较慢的时候,需要选择较大的时间间隔,这样才能提取出理想的运动目标轮廓,否则,可能无法检测到运动目标。如图所示为图像序列中两帧相连的灰度图像利用函数cvAbsDiff()作差分后的效果图,差分结果如图3.3所示:
图3.1 第184帧灰度图像 图3.2 第185帧灰度图像
图3.3 帧差法得到的灰度图
3.2背景差分法
背景差分法,也被称为背景减法的检测方法,是目标检测最常用的方法,可以被看作是一个特殊的情况下的帧间差分法。背景差分法通过输入图像和预先选定的背景图像差异对比,从而检测出运动目标。具体来说,第一步先选一个或多个图像中的平均值作为背景图像,然后将视频图像和背景图像差分运算,最后再作差分处理和阈值处理,便能够得到目标图像。在这个差分得到的图像中,选择一个合适的阈值,当像素的值大于这一与孩子,可以将该点归为运动目标,如果某点像素的值的小于该阈值,这该点就作为背景,最终得到运动目标的二值图像。用公式表示如下:
试中:T表示阈值,b(x,y)是通过背景建模得到的背景模型,f(x,y)是采集到的要处理的图像,Rk是为阈值处理后的二值化图像,背景差分法的基本原理如下图所示:
利用背景差分法检测运动目标的优点就是检测准确且易于实现,该方法的关键点就是获取合适的背景图像。然然而在实际应用中,是不容易得到的静态背景下的背景图像,为了避免这种情况,对背景重建是一个不多的方法。当然,这种方法也有着缺陷,假如运动目标在某段足够长的时间里没有发生移动,那么可能会导致该目标成为背景的一部分,这样会对整个系统造成干扰。这个问题是无法避免的,但是可以想办法抑制其影响,如:可以通过降低背景的更新率抑制。
3.3光流法
在对数字图像作处理的过程中,经常要用到一种简单、实用而且高效的图像运动的表现方法,我们称之为光流。所谓光流,是在一个图像序列中,图像亮度模式的表现运动方法,我们可以把它看做点的运动的表达方式。随着对该领域研究的深入,光流也得到了重新的定义,在1998年光流被重新定义成了动态图像在空间上的变化和在辐射度变化的表达方法,而这种表达是一种全面的表示。在图像处理领域,对光流的研究主要是研究如何有效的利用图像序列中包含的信息,特别是其像素强度数据在时域上的变化还有各图像之间的较强的相关性,利用这些信息,就可以确定图像像素的位置变化,就是要研究时域上的变化和物体结构的变化以及其运动信息的关系,通过这些关系,就能够得到我们需要的信息。在绝大多数的情况下,光流的产生是物体间的相对运动产生的,一般是相机、运动目标这两者的相对运动产生的。大致上,光流的计算方法可以分成三类:基于匹配的方法、频域的方法和梯度的方法【3】。
(1) 基于匹配的计算方法可以分为两种情况:一种是基于特征的方法,另一种是基于区域的方法。所谓基于特征的方法,关键就是要时刻抓住特征这一要素,就是要不断地定位运动目标的主要特征,并实现跟踪效果。但是该方法一般会有光流稀疏这一问题,最关键的是这会导致对目标提取特征并实现精确匹配造成不小的干扰。所谓基于区域的方法,就是首先要定位类似的区域,当区域内的物体发生了位移时,会导致光线的变化,通过计算相似区域的位移就可以实现对光流的计算。这种方法一般广泛的应用在视频编码领域,在图像处理领域基本上没什么作用,另外,这种方法计算出来的光流仍然比较稀疏。
(2) 基于频率域的方法,也被称为基于的能量的方法,使用速度可调滤波器输出的频率或相位信息。相对基于匹配的方法来说,这种方法虽然精确度很高,但实现过程比较复杂,计算机量比较大,而且难以评价其可靠性。
(3) 基于梯度的方法。这种方法实现方法是利用目标图像序列的亮度来计算出光流,也可以称之为2D速度场。基于梯度的方法得到了广泛的研究与应用,因为该方法不仅实现过程简单,计算也比较容易而且得到的结果效果也很好。但是由于可调参数的必须要人工选择、可靠性因子的选取还有图像的预处理等一些在计算光流时无法避免的步骤,将会对处理结果造成干扰,严重影响了精确度。
采用光流法检测运动目标的基本原理:对图像中的每一个像素点,都给其赋予一个速度矢量形成一个图像的运动场。在某一时刻,可以通过投影的方法将图像上的点一一投影到空间物体上的点。然后就需要对图像作动态分析,这一分析过程可以根据速度场的速度矢量完成。如果光流矢量一直是连续变化的,这就说明了目标图像中没有运动物体,相反,就有运动目标,这是因为当运动物体发生了移动时,即与背景发生了相对运动,运动目标的速度矢量与背景的速度矢量是不一样的,根据这些信息就可以检测出了运动目标,同时也获取了运动目标的位置。
光流法的优点在于其丰富的信息,包括了运动目标的信息、背景的信息,这些信息对于后续的处理过程有重要的作用,注重的是在不知道场景的信息的情况下,其他方法都无法实现对运动目标的检测,但是光流法可以实现这一点,该方法能够在不知道任何场景的条件下准确的完成对运动目标的检测。虽然光流法在运动目标检测的某些方面有很大的优势,但是考虑到大多数光流算法的计算过程比较复杂,难以实现,而且在实时性方面也是差强人意,所以在某些场合不适合采用光流法。
在日常生活应用中,对于运动目标检测系统的稳定性和准确性都有较高的要求,而摄像机一般是处于静止的状态下,这样获取的图像仅仅采用光流法是远远不够的,一般可以将光流法和其他的一些方法结合使用来实现对运动目标的检测。另外,由于物体之间的相互遮挡和噪声的影响等因素会对光流场的计算产生很大的干扰,而且光流法实现过程复杂,难以满足实时性的要求,所以一般不会采用光流法。
第四章 运动目标检测实现与结果分析
4.1本文检测算法流程及实现
与静态的目标的图像分析相比,运动目标检测要更加强调针对特定的图像序列提取出目标的运动信息。对于运动目标的检测的研究基本可分为两类:一类仅从获得的图像序列本身寻找运动线索进行检测,另一类则既有运动线索又包含了某些先验信息,如目标模板、任务需求等【10】。本文的研究是对前者的研究。在一个相对简单的背景下,对单一的运动目标,即船舶作处理,并得出有关船舶的外形参数等信息。下图为本文算法实现的流程图:
帧间差分法
本文是对已有的船舶运动AVI视频处理,求取运动船舶的实际长宽和运动速度。首先,利用OpenCV函数将视频转化成jpg格式的图像序列,考虑到实际情况,我们可以发现只有部分图像适合本文的算法及功能实现,选取合适的图像序列,按照上图的流程进行处理,最后成功提取出了运动船舶,并得到了其相关的参数信息。
4.2最小外接矩形的截取
4.2.1轮廓查找
轮廓,就是亮度突然发生变化的区域,构成了物体的边界或是图像的边框。一个轮廓一般由一系列的点构成,实际上就是一个曲线图,根据不同的情况,轮廓的表示方法也是不同的。一般采用函数cvFindContours()来查找二值图像里边的轮廓。函数cvFindContours()用来处理图像边缘,而且只能处理连通域。这些图像可以由cvCanny()函数或者是函数cvThreshold()和函数cvAdaptiveThreshold()处理得到的二值图像再作膨胀处理成联通域,然后便可以利用函数cvFindContours()查找轮廓。
cvFindContours(
IplImage* img,
cvMemStorage* storage,
CvSeq** firstContour,
int headerSize =sizeof(CvContour),
CvContourRetrievalMode mode = CV_RETE_LIST,
CvChainApproxMethod method = CV_CHAIN_APPROX_SIMPLE
);
该函数的第一个参数表示要处理的8位单通道图像,该图像需要转化成二值图像,要注意cvFindContours()处理图像时是涂改,如果原图像还有用的话需要提前保存一份。第二个参数表示内存存储器,用来存储轮廓。cvCreateMemStorage()的作用就是分配存储空间。
4.2.2截取外接矩形
根据船舶的最小外接矩形的长宽可以求出船舶的实际长宽,根据最小外接矩形的中心坐标的移动可以求出船舶的航行速度。在OpenCV中,利用连通域的轮廓,有两种方法可以得到矩形边界框。第一种方法也是最简单的方法,就是调用函数cvBoundingRect(),但是该方法返回的cvRect只能表现出一个四边水平和竖直的长方形。但是实际情况下,用这种方法截取的矩形一般不是最小外接矩形,如图4.1所示,用这种方法得出的结果与实际情况相差较大。当然如果摄像的角度是俯视的话,由于该方法相对较简单,用这种方法也是可以的。
图4.1 CvRect截取的矩形
在OpenCV中实现最小外接矩形的另外一种方法就是利用函数cvMinAreaRect2(),该函数返回一个包围轮廓的可以任意角度倾斜的最小长方形。OpenCV的数据类型CvBox2D()就是用来表述这样的长方形的。CvBox2D cvMinAreaRect2(const CvArr* points,CvMemStorage* storage=NULL);第一个参数可以是由点组成的序列,一个轮廓(CvContour*)或者一个,n×1双通道矩阵。第二个参数表示存储空间。该方法截取矩形的效果如图4.4所示。
4.3图像像素距离与实际空间距离
在图像处理中,最后求得的物体的边缘坐标是它在图像中的像素位置,很多情况下需要求得图像中的两点在实际空间中的距离[11]。
本文根据最小外接矩形的顶点(利用函数cvBoxPoints( )求得)的坐标求其长宽,只是得到了船舶长宽的图像像素距离,只有知道了该系统的图像像素距离与实际空间距离的比例关系才能求出船舶的实际长宽。关于两者之间的比例关系求法:由于我们已知实际环境下的距离,所以可选取两个已知距离的参考物,我们可以求出这二者之间的像素距离,这像素距离X与空间距离Y的转换关系K可以定义为:
4.4实验结果及分析
本文采用的视频包括了船舶进入视频区域、船舶停住等待闸门开启以及通过闸门的几个部分。该视频背景简单,而且运动目标单一,外界条件造成的干扰比较小,前期的预处理相对来说也比较简单实现,在此不再赘述。
考虑到实际的条件,本文选择了相对简单高效的帧间差分法。由于采用帧间差分法获取船舶的二值图像需要船舶发生了移动才能达到目标,部分视频基本上没有用的,根据实际要求,截取了船舶运动视频中的第176帧到186帧船舶运动图像序列进行帧间差分得到了船舶的二值图像,该方法运行效果较好,充分满足了实验的要求,船舶的二值图像如图4.2所示。
由于本文使用的轮廓查找函数vcFindContour()只能对连通域进行操作,所以需要对船舶二值图像作膨胀处理,使之成为一个连通域,如图4.3所示。
图中船舶周边的白色小点是由于噪声的干扰造成的,为了获取唯一的外接最小矩形,需要将那些白色小点剔除。我们可以根据函数vcFindContour()获取的轮廓的长度或者是面积可以将无用的部分剔除,因为船舶的轮廓是最长的,其轮廓包围的面积也是最大的,这两个方法在OpenCV中都可以利用函数实现,简单有效。对一个连通域截取其最小外接矩形的实现方法,已经在4.2.2部分具体阐述。本文由于视频角度的问题,为了得到更加精确的数据,选取了cvMinAreaRect2()截取了一个有角度倾斜的外接最小矩形,效果如图4.4所示。
图4.2:船舶的二值图像 图4.3:二值图像膨胀后的图像
图4.4:船舶的最小外接矩形
该试验输出的数据如下:
图像 图中像素距离(长,宽) 实际空间距离(米) 最小外接矩形中心坐标
第176帧 (437,170) (24,9) (220,302)
第177帧 (433,169) (24,9) (227,297)
第178帧 (429,165) (23,9) (235,293)
第179帧 (438,169) (24,9) (237,295)
第180帧 (421,169) (23,9) (251,290)
第181帧 (428,169) (23,9) (253,289)
第182帧 (413,167) (22,9) (265,284)
第183帧 (432,167) (24,9) (261,285)
第184帧 (406,164) (22,9) (276,274)
第185帧 (404,165) (22,9) (283,276)
实验输出数据都是针对图像而言的,要想求出其实际的长宽和运行速度,必须根据转化关系转化,从而得出船舶的实际长宽以及求出船舶的运行速度。想要求出船舶的实际长宽还有其运动速度,就要求出图像像素距离与实际空间距离的比例。根据实际情况,可以假设选择的两个参考物(本文选择航道边上的两个木桩)之间的距离为5米,根据两参照物的图像像距离容易求出图像像素距离与实际空间距离的比例K为18:1,从而可以将在船舶的图像中的长宽转化为实际长度和宽度,如以上表格所示。从实验数据中我们可以看出,远动目标,即船舶的实际长宽大概是23米和9米,这个结果与实际情况大致符合。对于船舶的运动速度,我们可以根据最小外接矩形的中心坐标变化可以判断船在一帧的时间内(1秒30帧)船舶的移动距离,帧间时间已知,从而可以得出船舶的运动速度。为了保证数据的可靠性和准确性,利用这多组数据,我们可以得出多组运行速度数据,将这些数据的平均值作为船舶运行速度,求出船舶的航速大概是14米/秒。当然,根据最小外接矩形的中心坐标的变化,我们也可以确定船舶移动的方向、运动轨迹等信息。
4.5本章小结
本文主要介绍了几种基本的运动目标提取方法,帧间差分法,背景相减法和光流法。然后利用了帧间差分法完成本实验,对实验的过程也作了一个简单的描述,最后得出了较为准确的船舶长宽和航速,基本达到实验的要求。
第五章 总结与展望
5.1研究总结
本文的主要研究的内容是在摄像头固定,背景相对静止的情况下对运动目标的检测算法的研究。为了研究方便,本文采用了符合上述条件的船舶运动视频,通过VS2010和OpenCV库编制程序,最终实现对视频序列图像中的运动目标的正确检测和参数提取。本文研究涉及的范围包括:数字图像处理,运动目标的检测,目标参数提取。
现将该论文的主要工作内容总结如下:
图像预处理:本文对灰度图像进行了中值滤波和高斯滤波处理,选出了更为合理、效果更好地高斯滤波。关于二值化部分,阈值的选取是通过更为简单有效的滚动条控制选择的。
运动目标检测与参数提取:由于本实验的视频背景相对简单,采用了帧间差分法便得到了很好的效果,因此不采用更为繁琐的背景相减法等方法。本阶段较好的提取出了所选取的视频段的运动船舶二值轮廓。之后利用强大的OpenCV函数获取了多组的船舶二值轮廓的最小外接矩形及其顶点坐标,根据顶点坐标便可以得出我们需要的数据,如运动船舶的长宽。
5.2研究展望
本文虽然基本上达到了实验的目标,但是仍然有很多不足,比如:
(1)本文是对一段视频作处理,得出运动目标的信息。但是实际生活中通常是采用摄像头,要求实时性。本文在实时性方面有一些缺陷,尚需完善。
(2)本文是在背景简单且静止的情况下进行的,在运动背景下的运行效果还不是很好。应进一步研究在运动背景、多船舶的情况下,检测特定的运动目标及提出其基本参数。
由于本人的研究时间和知识有限,对本领域的还不是很了解,很多相关的内容理解的也不是很好,所以仍然有许多的问题需要解决和完善,相关程序也需要改进。当前,人类对于智能化的要求越来越高,智能化在人类生产生活中也占据着越来越重要的地位,我相信OpenCV这个强大的工具和运动目标的检测的研究必将有一个光明的前景。
参考文献
[1]计算机视觉01,曹洋,2005-07
[2]基于opencv的视频道路车辆检测与跟踪 ,詹群峰,2012
[3]基于视频的运动目标检测与跟踪算法研究与应用,2011-10
[4]Learning OpenCV Computer Vision with the OpenCV Library.Gary Bradski & Adrian Keabler 著,于仕琪 刘瑞祯 译
[5]全方向M型心动图像量化效应的一种消除方法,陈海英,2012
[6]基于OpenCV的运动目标检测与跟踪,吴晓阳
[7]基于图像处理的目标跟踪系统,熊章靖
[8]基于MFC的数字图像处理系统毕业设计论文
[9]图像预处理中的数学形态学
[10]移动机器人的运动目标实时检测与跟踪,王璐,崔益安,苏虹
[11]图像像素距离与空间距离变换公式的求解,张进秋
[12]朱虹.数字图像处理基础[M].北京:科学出版社,2005.
[13]Jen-Chao Taj,Shung-Tsang Tseng.Real-time Image Tracking for Automatic Traffic Monitoring and EnforcementApplicationsVisual trackin[J].Imageand VisisonComputing 2004,22(6):640·649
[14]马桂珍,朱玲赞,段丽.基于OpenCV的视频应用程序的开发方法[J].《现代电子技术》2007.4:7¨9
[15]熊显涛,杜宝江.机器视觉工具包OpenCV开发技术.计算机与网络,2008.19
[16]M.Pe仃ou,Panagiota Bosdogianni.数字图像处理疑难解析.赖剑煌,冯国灿等译.北京:机械工业出版社,2005
[17]谢风英,赵丹培.Visual C++数字图像处理北京:电子工业出版社2008.9
[18]WANG YK,CHENS H.Robust vehicle detectionapproach[C]//Proc.IEEEConference onAdvanced Video andSignalBased Surveillance2005.IEEEPress.2005:1 17—122
[19]张玲,陈丽敏,何伟等.基于视频的改进帧差法在车流量检测中的应用.重庆大学学报(自然科学版),2004,27(5):31-33
[20]李志慧,张长海,曲昭伟,魏巍.交通流视频检测中背景初始化算法.吉林大学学报(工学版)2008.1:148-一151
[21]邱德润,朱明早,伍宗富.一种基于帧间差分与背景差分的运动目标检测新方法.湖南文理学院学报(自然科学版).2007,3.V01.19 No.1:181.86
[22]王唯合,王宏志,赵兰英.运动目标检测跟踪方法研究.长春工业大学学报(自然科学版)2007.12:41 1—一413
[23]吕常魁,姜澄宇,王宁生.一种新的运动检测及轮廓追踪方法.武汉大学学报(信息科学版).2005,8
[24]杨学超,刘文萍.视频图像序列中的运动目标检测技术.计算机应用与软件.2008.
致 谢
本文的完成首先要感谢我的导师何坤金老师,何老师渊博的知识和精益求精的科研精神给我留下了很深的印象。感谢何老师精心的指导和宝贵的意见。同时本文的完成也要感谢实验室的学长和学姐的热情帮助,正是有了他们的帮助,我的毕业设计少走了许多的弯路,才能顺利的完成。同时感谢各位同学营造了良好的学习氛围,跟他们的交流是我收益颇多,对于本文的完成起了重要作用。 最后要感谢一直关心我、鼓励我、支持我的家人朋友们,他们给了我完成论文的动力和信心。
附录:
Social behavior recognition in continuous video
Abstract
We present a novel method for analyzing social behavior. Continuous videos are segmented into action ‘bouts’by building a temporal context model that combines fea-tures from spatio-temporal energy and agent trajectories.The method is tested on an unprecedented dataset of videos of interacting pairs of mice, which was collected as part of a state-of-the-art neurophysiological study of behavior. The dataset comprises over 88 hours (8 million frames) of annotated videos. We find that our novel trajectory features, used in a discriminative framework, are more informative than widely used spatio-temporal features; furthermore, temporal context plays an important role for action recognition in continuous videos. Our approach may be seen as a baseline method on this dataset, reaching a mean recognition rate of 61.2% compared to the expert’s agreement rate of about 70%.
1. Introduction
Detecting and classifying human and animal behavior from video is one of the most interesting challenges facing computer vision researchers [28, 2, 21, 6, 29]. Applications include: video surveillance, social robotics, scene understanding, ethology, neuroscience, medicine and genetics.
Automating the analysis of behavior is challenging.First, building a vision ‘front end’ that detects, segments,classifies and tracks bodies is technically difficult. Second,a crisp definition of ‘behavior’, including a distinction between short and simple ‘movemes’ [4], medium-scale ‘actions’ and more complex ‘activities’, still eludes us.Athird obstacle is inadequate benchmark datasets to guide our
thinking and to evaluate our algorithms (see Section 2).
Studying animal behavior [17, 2, 8, 37, 3, 7, 15] is perhaps the best strategy to make progress on these issues thanks to a number of practical advantages. First, laboratory animals, typically flies and mice, are easier to detect and track than humans, thus the vision front-end is easier to build. Second, fly and mouse behavior is simpler and perhaps more objectively studied than human behavior, which makes it more likely that we will arrive sooner at a satisfactory definition of behavior. Third it is more practical and ethical to set up reproducible experiments and collect abundant video of animals, rather than humans, especially when the most interesting behaviors are concerned (e.g.courtship, aggression) and when one wants to explore the role of nature and nurture with systematic manipulations.Furthermore, expert scientists are willing to thoroughly annotate animal behavior videos in the course of their studies in ethology, ecology, neuroscience, pharmacology and genetics. Studying behavior in animals thus presents an opportunity for making progress on modeling and classifying behavior, especially social behavior, which is difficult to study in humans. We believe that knowledge gathered from studying animal models will eventually lead to progress in modeling and automating the analysis of human behavior.
The main contributions of this study are:
1 — The largest and richest behavior dataset to date. The Caltech Resident-Intruder Mouse dataset (CRIM13) consists of 237x2 videos (recorded with synchronized top and side view) of pairs of mice engaging in social behavior, catalogued into thirteen different actions. Each video lasts~10min, for a total of over 88h of video and 8M frames.A team of behavior experts annotated each video frame-by-frame using a Matlab GUI which we developed adhoc [23].Videos, annotations, mice tracks and annotation tool are all available from www.vision.caltech.edu/Video_Datasets/CRIM13/.
2 — An approach for the automatic segmentation and classification of social ‘actions’ in continuous video. Multiagent behavior poses new challenges: (a) multiple animals have to be localized and tracked even when they touch and overlap; (b) each behavior may be described with respect to multiple frames of reference: the enclosure, the agent and, the other animal; (c) social behaviors are highly variable
both in duration and in visual appearance, see Figure 1. A video example with the output of our approach is available from the project website.
3 — Novel trajectory features for behavior recognition. We generate a large pool of weak features from the position of tracked objects. The weak trajectory features outperform widely used spatio-temporal features, see Table 3.
4 — Exploring temporal context in behavior analysis. After irst computing spatio-temporal and trajectory features from video, a second level analyzes temporal context using an extension of Auto-context [35] to video. The temporal context model helps segmenting the video into action ‘bouts’improving results 8% across all behaviors.
Our method reaches a recognition rate of 61.2% on 13 categories, tested on 133 videos, see Table 3. Figure 2shows a comparison of our approach with experts agree-
ment on the 12 videos for which we have multiple expert annotations. On this smaller dataset, expert agreement is around 70%, while our method’s performance is 62.6%
However, CRIM13 still represents a serious challenge.Disagreement between human annotators lies almost entirely on the labeling of other behavior (less important),while our approach still makes mistakes between real behaviors. In fact, removing other from the confusion matrices results in a human performance of 91%, and only 66% for our approach. When counting other, our approach outperforms human agreement in 5 of the 12 behaviors (approach, chase, circle, human, walk away).
2. Related work
Datasets – What makes a good dataset? Behavior is interesting and meaningful when purposeful agents interact with each other and with objects in a given environment.The ideal behavior dataset identifies genuine agents acting freely in a well-defined scenario, and captures all spontaneous actions and activities. Filming should be continuous in order to allow a study of the structure of behavior at different scales of temporal resolution. Social behavior and agent-object interactions are of particular interest. Current most widely-used datasets for action classification, KTH [32], INRIA-XMAS [40], Weizmann [12], UCSports [30], Hollywood2 [25], YouTube [24], Olympic Sports [14] and UT videos [31] do not meet this standard:
they are segmented, they are acted, the choice of actions is often arbitrary, they are not annotated by experts and they include little social behavior. Moreover, KTH and Weizmann datasets may have reached the end of their useful life with current state of the art classification rates of 94% and 99% respectively.
One of the first approaches to continuous event recognition was proposed by [43], although only a very small set of continuous video sequences were used. Virat [27] is
the first large continuous-video dataset allowing the study of behavior in a well-defined meaningful environment. The focus of this dataset is video surveillance and contains examples of individual human behavior and of interaction of humans with objects (cars, bags), containing more than 29h of video. Another useful dataset, collected by Serre and collaborators [15] focusses on single mouse behavior in a
standard laboratory mouse enclosure. These datasets do not include instances of social behavior.
Features – Most action recognition approaches are based solely on spatio-temporal features. These features are computed in two separate stages: interest point detec-
tion and description. Popular spatio-temporal interest point detectors include Harris3D [19], Cuboids [8], and Hessian [13]. In datasets were the background contains useful
information about the scene, as is the case for the Hollywood dataset, densely sampling points instead of running an interest point detector seems to improve results. Most effectivespatio-temporalpointdescriptorsareCuboids(PCASIFT) [8], HOG/HOF [20], HOG3D [18] and eSURF [13].More recently, relationships between spatio-temporal features have been used to model the temporal structure of primitive actions [5, 31].
Other features that have shown good performance are Local Trinary Patterns [41] and motion features derived from optical flow [9, 1]. Recently, space-time locally adaptive regression kernels (3DLSK) have been shown to reach state-of-the-art recognition on the KTH dataset with only one training example [33]. Biologically-inspired hierarchies of features have also been widely used [16, 34, 42,
22]. In [22] deep learning techniques were applied to learn hierarchical invariant spatio-temporal features that achieve state-of-the-artresultson Hollywood and YouTube datasets.
Another trend is to use an indirect representation of the visual scene as input to the classification, such as silhouettes, body parts or pose [29]. These approaches are generally sensitive to noise, partial occlusions and variations in viewpoint, except in the case of small animals such as flies,where trajectory features combined with pose information and body parts segmentation has proven to work well [7, 3].
Classifiers – The most common approach to classification is to use a bag of spatio-temporal words combined with a classifier such as SVM [36] or AdaBoost [11]. Other interesting classification approaches are feature mining [10] and unsupervised latent topic models [26].
Mouse behavior – Two works focussed on actions of solitary black mice on a white background [8, 15]. We tackle the more general and challenging problem of social behavior in mice with unconstrained color.
Figure 2. Confusion matrices for comparison with expert’s annotations on the 12 videos that were annotated by more than two experts. For results on the whole dataset, see Table 3. (a) Comparison between ‘annotator1’ and a group of 4 other annotators.
(b) Comparison between ‘annotator1’ and the output of our approach. (c,d) Comparison of the segmentation of 2k frames of a video (available from project website) into behavior ‘bouts’.
3. Caltech Resident-Intruder Mouse dataset
The dataset was collected in collaboration with biologists, for a study of neurophysiological mechanisms involved in aggression and courtship [23]. The videos always start with a male ‘resident mouse’ alone in a laboratory enclosure. At some point a second mouse, the ‘intruder’, is introduced and the social interaction begins. Just before the end of the video, the intruder mouse is removed. Behavior
is categorized into 12+1 different mutually exclusive action categories, i.e. 12 behaviors and one last category, called other, used by annotator swhenno behavior of interestisoccurring. The mice will start interacting by ‘getting to know’each other (approach, circle, sniff, walk away). Once established if the intruder is a female, the resident mouse will likelycourther(copulation, chase). Iftheintruderisamale,the resident mouse will likely attack it to defend its territory. Resident mice can also choose to ignore the intruder,engaging in solitary behaviors (clean, drink, eat, up). The introduction/removal of the intruder mouse is labeled as human. Figure 1 shows video frames for each behavior in both top and side views, gives a short description of each behavior, its probability p (how often each behavior occurs), and the mean and variance duration in seconds (μ,σ).
Each scene was recorded both from top- and side-views using two fixed, synchronized cameras. Mice being nocturnal animals, near-infrared in-cage lighting was used, thus the videos are monochromatic (visually undistinguishable from grayscale). Videos typically last around 10 min, and were recorded at 25fps with a resolution of 640x480 pixels,8-bit pixel depth. The full dataset consists of 237 videos
and over 8M frames.
Every video frame is labeled with one of the thirteen action categories, resulting in a segmentation of the videos into action intervals or ‘bouts’. The beginning and end
of each bout are accurately determined since behavior instances mustbe correlated withe lectro physiological recordings at a frequency of 25Hz. Some behaviors occur more often than others, and durations (both intra-class and inter-class) vary greatly, see Figure 1.
There were 9 different human expert annotators. Exper-tiseo fannotators varied slightly; they were alltrained by the same two behavior biologists and were given the same set of instructions on how the behaviors should be annotated.Annotators used both top and side views in a video behavior annotator GUI developed in Matlab. This tool provides all the playback functionality needed to carefully analyze the videos and allows the manual annotation of behaviors into bouts (starting and ending frame). The tool is available from the project website. Each 10min video contains an average of 140 action bouts (without counting other). It typically takes an expert 7-8 times the video length to fully annotate it. The approximate time spent by experts to fully annotate the dataset was around 350 hours.
4. Proposed method
Most methods discussed in Section 2 deal with classification of pre-segmented short clips containing a single action. We approach the more complex problem of simultaneously segmenting video into single-action bouts and classifying the actions.
Our approach can be seen as an extension of Autocontext [35] to video. Auto-context has proven to perform.Well in high-level vision problems that be nefit from learning a context model. Compared with other approaches, Autocontext is much easier to train and avoids heavy algorithm design, while being significantly faster. We find that incorporating temporal context information plays a crucial role in learning to segment videos, see Table 3.
Auto-context is easily described as a multi-step process.First, local features are computed from short sliding video time-windows (see Sec. 4.1) and used to train a ‘base’ classifier, outputting for each frame the probability that it belongs to each behavior. The process is repeated, adding to the original video features new features computed from the behavior probabilities of a large number of context frames.These new features provide information on the likely classification of frames preceding and following the current frame, therefore encoding temporal context and the transition probabilities between behaviors. The frames used form context can be either near orvery far fromt he current frame,and it is up to the base classifier to select and fuse important supporting context frames together with local features. This process is repeated T times, or until convergence.
Our method uses AdaBoost [11] as the base classifier,where each weak classifier is a depth 2 tree, rather than the more common single stump. For each behavior, a binary classifier is trained by boosting on all training frames with labels indicating either the presence or absence of the behavior. Givenk = 1..K behaviortypes, eachofthek binary classifiers will output a confidence hk(i) ∈ R for that particular behavior being present in frame i2. Then, the finalmulti-label classification is achieved by assigning as final behavior type that which has the highest confidence level:? yi = argmaxkhk(i). We found that classifier outputs do not need to be calibrated. Figure 3 shows the data flow of the proposed method.
Figure 3. Overview of our approach. Two set of local features are first computed from video. Classifiers trained on these features estimate confidence levels hk tfor each behavior. Temporal context features are built from the confidence levels and used to compute new confidence estimates in a new iteration. In our case, Auto Context converges in 2 iterations.
4.1. Local features
To compute local features, sliding windows are centered at each frame and both types of local features are computed inside them. The optimal sliding window size is directly related to the duration of behaviors, as well as to the encoding of each feature type. After several experiments, we established that using a window of 9 frames (≈1/3 s) was best for spatio-temporal features, while a combination of two window sizes (75 and 615 frames, i.e. 3 and 25 s) was most discriminative for trajectory features, see Figure 5.
Spatio-temporal bag of words are first computed on each video using a sliding window centered at current frame. We benchmarked several existing approaches (Sec-
tion 5) and we finally chose Cuboids+Pca-Sift [8]. All parameters were set to its original configuration and bag words was computed using the standard procedure soutlined in [39], except for a reduced codebook size of 250, which proved to give best results (see Table 1 in Supp. Material).
Weak trajectory features are computed from the set of positions xmi(t),ymi(t) of each mouse mi∈ [1,2] for each top view video frame t, see Figure 3. These positions are computed by an unpublished tracking algorithm developed by our group, which is able to maintain identities of micetrough repeated detections.
From the positions, meaningful trajectory information is computed, such as distance between mice, movement direction, velocities and accelerations, see Figure 4(a). Then, the algorithm generates a large pool of weak features from this information, in a similar way to what is done for object detection [38]. Given a sliding window centered at current frame, the method divides it in non-overlapping regions and appliestoeachasetof6differentoperations(sum, variance,min, max, gaussian weighted sum and ‘harmonic’). After each operation, the method sums all region values, where each region can count positively (+1), negatively (-1), or be completely ignored (0). This process is repeated for all possible region combinations and for each one of the trajectory values of Figure 4(a). The ‘harmonic’ operation transposes
regions of value (-1), therefore detecting cyclic repetitions.
4.2. Temporal context features
As part of Auto-context, behaviors are first classified based only on local features, and then in subsequent iterations by adding to the feature set a list of temporal context
features, computed from confidence levels hkt?1output of the binary classifiers at the previous iteration t ? 1. Temporal context features are computed at each time sample by taking first order statistics over a time-window centered at that time sample. Design details are given in Figure 4(b).
5. Experiments
The purpose of this section is two-fold: 1) analyze all method parameters and 2) test the approach on the Caltech Resident-Intruder Mouse dataset. In Section 5.1, a metric to measure the classification error is defined. In Section 5.2, a subset of the dataset is used to optimize different method parameters and report classification results of some widely used spatio-temporal features. Finally, in Section 5.3, we report the results of our approach on CRIM13.
5.1. Error metric
Given a video, an annotation is defined by a list of behavior intervals (behavior type, starting frame, ending frame).The metric for comparing two annotations should measure both their similarity as well as their relative completeness (whetherall behaviorspresentin the firstannotationare also present in the second annotation). The second is especially important due to the highly unbalanced nature of CRIM13. In fact, a classifier that predicts all frames to be other would reach over 50% accuracy on a simple frame-by-frame comparison with ground truth (see Figure 1).
We propose to use as metric the average of the confusion matrix’s diagonal, where the confusion matrix values are the per-frame average agreement between annotations for each pair of behaviors. The average per-frame agreement, computed across all frames, measures the similarity between annotations for that pair of behaviors. Then, by taking the average of the diagonal, we favor classifiers that reach high similarity with ground truth across all behaviors.
Figure 5. Sliding window sizes for both local feature types. (a) Forspatio-temporal features, due to their encoding, a small window size gives best performance for all behaviors. Default size was set to 9 frames. (b) For trajectory features, best window size is directly related with duration of behavior: smaller window sizes detect short behaviors well, while larger detect long behaviors well.Default was set to use a combination of 2 windows of 75 and 615frames each. See Table 2 in Supp. Material for more details.
5.2. Parameter analysis
To optimize the algorithm, we analyzed all method parameters. To avoid overfitting and to speed-up the process we used a small subset of the videos: 10 top view videos each for training and testing (300k frames), randomly chosen from the training set used in Section 5.3.
5.2.1Spatio-temporal features
We chose to benchmark some of the most widely used spatio-temporal interest point detectors (Harris3D [19] and Cuboids [8]) and spatio-temporal descriptors (Cuboids PcaSift [8] , Hog/Hof [20] and Hog3D [18]) allowing all different combinations. We discarded the use of densely sampled features both because the background of our videos is uninformative, as well as computationally prohibitive. We also benchmarked the use of Local Trinary Patterns (LTP), [41],which due to its encoding should be more naturally suited for continuous behavior recognition. We used code from [8, 20, 18], extending functionality as needed to work on long videos
Once spatio-temporal features are computed for all video frames, behavior classification results are achieved using a bag of words representation and an AdaBoost multilabel classifier, as outlined in Section 4. Spatio-temporal detectors are computed at a single spatial and temporal scale (3D patch size of 13x13 pixels and 19 frames) and then bag of words is computed for each frame by looking at a window of 9 frames centered in the current frame, both best parameters, see Figure 5(a). To compute bag of words, the standard procedures outlined in [39] are used. Codebook size was benchmarked independently for each detector+descriptor combination with sizes ranging from 100 to 2000, see Table 1 Supp. Material. The best detector+descriptor combination was ran at multiple spatial and temporal scales
(σ = 2,4,8,τ = 3,5). Table 1 shows the main results of each approach.
All approaches fail to segment the test videos due to the small size of the training set and a lack of context, resulting in a drop in performance of 30-40% from training (noshown). Differences between spatio-temporal features are verysmall, asincurrentdatasets [39,41]. Detectorsseemto perform similarly, although Cuboids is much faster. As for descriptors, Pca-Siftoutperformstherest. RunningCuboids at multiple scales results in overfitting and does not improve performance at all, while also being much slower. LTP performsslightlyworsethanCuboids+Pca-Sift, althoughbeing much faster. In the light of these results, we chose to use Cuboids+Pca-Sift for the rest of this work. However, our approach is in no way directly linked to the use of a specific set of spatio-temporal features.
Figure 4. (a) Trajectory information computed from mouse tracks. Distance helps discriminate between solitary and social behaviors (micefar/close to each other), as well as to detect a transition from one to the other (approach, walk away). Velocity and acceleration helpsdetecting behaviors such as attack, chase or clean (stationary). Direction is important to distinguish between behaviors such as sniff (often head to head) with copulation or chase (head to tail). Pose estimation would clearly improve results in this aspect. (b) Temporal context features computed from confidence levels hk toutput of each k binary classifier at previous iteration t?1, given a window of size sz centered at frame i. For each frame, 1536 context features are computed, using windows of sz = 75,185,615 to combine short, medium and long term context. Some of the features are also computed only on the previous or past frames to encode behavior transition probabilities.
Table 1. Testing on a subset of CRIM13 was used to select Cuboids+Pca-Sift as the best of many state-of-the-art spatiotemporal features. Running Cuboids+Pca-Sift at multiple scales results in overfitting, with a drop of over 54% in performance from
training to testing (not shown).
Table 2. Benchmark of different number of regions for trajectory features computation. Trajectory features alone also suffer from a lack of temporal context to properly segment videos.
5.2.2Weak trajectory features
The only parameter of the trajectory features is the number of regions. We found that the optimal setting is to use the combination of 1, 2 and 3 regions, Table 2. With this setting, trajectoryfeaturesoutperformspatio-temporalfeatures in the validation set. Their versatility makes them suffer slightly less from lack of temporal context. They are also much quicker to compute, with an average 155 fps (given the tracks, available from project website).
5.2.3Classification settings
The only two parameters of the binary AdaBoost classifiers are the maximum number of weak classifiers (T) and the amount of frames sampled at each training iteration (S). To prevent overfitting and speedup training, each weak classifier is learnt using only a subset of S training frames, choosing a new subset at each iteration by randomly sampling with replacement. After evaluation, we chose T = 250 and S = 1k as optimal values, Figure 6. Note how sampling a small number of frames improves performance compared with large rnumbers. Asthenumberofframesincreases, the weak classifiers overfit, resulting in a drop in performance.
5.3. Results
We report the results of our approach on CRIM13. The 237, 10min long videos were divided in two sets, 104 for training and 133 for testing. Table 3 shows the main results. To better study the role of each feature, we tried each separately: only trajectory features (TF), only spatiotemporal features from the side or from the top, both spatiotemporal features together (STF), and all of them combined (TF + STF). First column shows the performanceof each combination of local features without context. Second column shows the results after adding temporal context features with Auto-context.
Without context, TF clearly outperforms STF, while the combination of both, TF + STF, improves classification 1% with respect to TF. The use of Auto-context improves performance 8% on the full method, 10% on average. In comparison, a simple temporal smoothing of the output labels only improves results 0.2%.Best results are achieved by the combination of both local featuresTF+STF, whichimprovesTF 3%, reachingafinalrecog-nition rate of 61.2%. The upper bound for this task is 70%,which is the average agreement rate between expert’s annotations, see Figure 2.
Although the metric used might suggest that the difference between TF and TF +STF is small, analyzing each behavior separately shows that TF + STF outperforms
TF in 7 out of the 12 behaviors (attack, copulation, chase,drink, eat, sniff, up). Also, comparing the confusion matrices of STF from the side and STF from the top shows
that the top view is best suited to detect 5 behaviors (chase,circle, clean, sniff and walk away) while the rest are best recognized from the side.
Figure 6. Role of T and S in classification. Experiments were carried on using only trajectory features (see Sec. 5.2.3).
Table 3. Method results on CRIM13.Context results were achieved after 2 Auto-Context iterations. Adding temporal context improves classification an average of 10% (14% on STF).For a comparison with experts annotations, see Figure 2.
6. Discussion and conclusions
We present CRIM13, a new video dataset for the study of behavior with an emphasis on social behavior. The videos were collected and annotated by expert-trained annotators for a neurophysiological study of behavior [23]. CRIM13 is the largest and richest behavior dataset to date, containing over 8M frames and 12+1 different behavior categoriesThe videos are not pre-segmented into action bouts, therefore classification must proceed hand-in-hand with segmentation.
We proposed an approach for the automatic segmentation and classification of spontaneous social behavior in continuous video. The approach uses spatio-temporal and trajectory features, each contributing to the correct segmentation of the videos into behavior bouts. We benchmarked everycomponentofourapproach separately. Onourdataset the combination of novel trajectory features with popular spatio-temporal features outperforms their use separately.This suggests that the study of behavior should be based on a multiplicity of heterogeneous descriptors. Also, we found that temporal context can improve classification of behavior in continuous videos. Our method’s performance is not far from that of trained human annotators (see Figure 2 and Table 3) although there is clearly still room for improvement.While disagreement between human annotators lies almostentirely on the labeling of other behavior (less important),our method confuses some real behaviors. In fact, remov-
ing other from the confusion matrices results in a human performance of 91%, and 66% for our approach.
We believe that classification performance could be improved by adding new features derived from pose and applying dynamic multi-label classifiers that can prove more robust to unbalanced data. We will also further study the use of LTP features, due to their promising results and faster speed. Although in this work we were able to deal with behaviors of different durations, an open question is whether
an explicit distinction between short and simple ‘movemes’,medium-scale ‘actions’ and longer and more complex ‘activities’ should be directly included into future models.
Acknowledgments
Authors would like to thank R. Robertson for his careful work annotating the videos, as well as Dr. A. Steele for coordinating some of the annotations. We also would like to thank Dr. M.Maire for his valuable feedback on the paper. X.P.B.A. holds a postdoctoral fellowship from the Spanish ministry of education,programa Nacional de Movilidad de Recursos Humanos del Plan Nacional de I-D+i 2008-2011. D.L. was supported by the Jane Coffin Child Memorial Foundation. P.P.andD.J.A.weresupportedby the Gordon and Betty Moore Foundation. D.J. is supported by the Howard Hughes Medical foundation. P.P. was also supported by ONR MURI Grant #N00014-10-1-0933.
References
[1] S. Ali and M. Shah. Human action recognition in videos using kinematic features and multiple instance learning. PAMI,32(2):288 –303, 2010. 3
[2] S. Belongie, K. Branson, P. Dollar, and V. Rabaud. Moni-toring animal behavior in the smart vivarium. In Workshopon Measuring Behavior, Wageningen, The Netherlands. Citeseer, 2005. 1
[3] K. Branson, A. A. Robie, J. Bender, P. Perona, and M. H.Dickinson.High-throughput ethomics in large groups of drosophila. Nature Methods, 6(6):451–457, 2009. 1, 3
[4] C. Bregler. Learning and recognizing human dynamics in video sequences. In CVPR, 1997. 1
[5] W. Brendel and S. Todorovic. Learning spatiotemporal graphs of human activities. In ICCV, 2011. 3
[6] J. Candamo, M. Shreve, D. Goldgof, D. Sapper, and R. Kas-turi.Understanding transit scenes: A survey on humanbehavior-recognition algorithms. Intelligent Transportation Systems, IEEE Transactions on, 11(1):206 –224, march2010. 1
[7] H. Dankert, L. Wang, E. D. Hoopfer, D. J. Anderson, and P. Perona. Automated monitoring and analysis of social behavior in drosophila. Nat Methods, 6(4):297–303, Apr 2009.1, 3
[8] P. Dollár, V. Rabaud, G. Cottrell, and S. Belongie. Behavior recognition via sparse spatio-temporal features. In VS-PETS,October 2005. 1, 3, 4, 5
[9] A. A. Efros, A. C. Berg, G. Mori, and J. Malik. Recognizing,action at a distance. In ICCV, pages 726–733, Nice, France,2003. 3
[10] A. Gilbert, J. Illingworth, and R. Bowden.Fast realisticmulti-action recognition using mined dense spatio-temporalfeatures. In ICCV, 2009. 3
[11] L. Gorelick, M. Blank, E. Shechtman, M. Irani, and R. Basri.A decision-theoretic generalization of on-line learning and an application to boosting. Journal of computer and system sciences, 55:119–139, 1997. 3, 4
[12] L. Gorelick, M. Blank, E. Shechtman, M. Irani, and R. Basri. Actionsasspace-timeshapes. PAMI,29(12):2247–2253, December 2007. 2
[13] G.Willems, T. Tuytelaars, and L. V. Gool. An efficient dense and scale-invariant spatio-temporal interest point detector. In ECCV, 2008. 3
[14] C.-W. C. J. C. Niebles and L. Fei-Fei. Modeling temporal structure of decomposable motion segments for activity classification. In ECCV, 2010. 2
[15] H. Jhuang, E. Garrote, X. Yu, V. Khilnani, T. Poggio,A. Steele, and T. Serre. Automated home-cage behavioural phenotyping of mice. Nature communications, 1(6):1–9,2010. 1, 3
[16] H. Jhuang, T. Serre, L. Wolf, and T. Poggio. A biologicallyinspired system for action recognition. In ICCV, 2007. 3
[17] Z. Khan, T. Balch, and F. Dellaert. A rao-blackwellized particle filter for eigentracking. In CVPR, volume 2, pages II980. IEEE, 2004. 1
[18] A. Klaser, M. Marszalek, and C. Schmid. A spatio-temporaldescriptor based on 3d gradients. In BMVC, 2008. 3, 5
[19] I. Laptev and T. Linderberg. Space-time interest points. InICCV, 2003. 3, 5
[20] I. Laptev, M. Marszalek, C. Schmid, and B. Rozenfeld.Learning realistic human actions from movies. In CVPR,2008. 3, 5
[21] G. Lavee, E. Rivlin, and M. Rudzsky. Understanding videoevents: A survey of methods for automatic interpretation of semantic occurrences in video. IEEE Transactions on Systems, Man, and Cybernetics, 39(5):489 –504, 2009. 1
[22] Q. V. Le, W. Y. Zou, S. Y. Yeung, and A. Y. Ng. Learning hierarchical invariant spatio-temporal features for action recognition with independent subspace analysis. In CVPR,2011. 3
[23] D. Lin, M. P. Boyle, P. Dollar, H. Lee, E. S. Lein, P. Perona,and D. J. Anderson. Functional identification of an aggression locus in the mouse hypothalamus. Nature, 470(1):221–227, 2011. 1, 3, 7
[24] J. Liu, J. Luo, and M. Shah. Recognizing realistic actions from videos “ in the wild ”. In CVPR, 2009. 2
[25] M. Marszalek, I. Laptev, and C. Schmid. Actions in context.In CVPR, 2009. 2
[26] J. C. Niebles, H. Wang, and L. Fei-Fei. Unsupervised learning of human action categories using spatial-temporal words.IJCV, 79:299–318, 2008. 3
[27] S. Oh and et al. A large-scale benchmark dataset for eventrecognition in surveillance video. In CVPR, 2011. 2
[28] R. Polana and R. C. Nelson. Detection and recognition of periodic, nonrigid motion. IJCV, 23(3):261–282, 1997. 1
[29] R. W. Poppe. A survey on vision-based human action recognition. Image and Vision Computing, 28(6):976–990, 20101, 3
[30] M. D. Rodriguez, J. Ahmed, and M. Shah. Action mach:a spatio-temporal maximum average correlation height filter for action recognition. In CVPR, 2008. 2
[31] M. S. Ryoo and J. K. Aggarwal. Spatio-temporal relation- ship match: Video structure comparison for recognition of complex human activities. In ICCV, 2009. 2, 3
[32] C. Schuldt, I. Laptev, and B. Caputo. Recognizing human actions: A local svm approach. In ICPR, 2004. 2
[33] H. J. Seo and P. Milanfar. Action recognition from one example. PAMI, 33(5):867 –882, may 2011. 3
[34] G. W. Taylor, R. Fergus, Y. Lecun, and C. Bregler. Convolutional learning of spatio-temporal features. In ECCV, 2010.3
[35] Z. Tu. Auto-context and its application to high-level visiontasks. In CVPR, 2008. 2, 4
[36] V. N. Vapnik.The nature of statistical learning theory.Springer-Verlag New York, Inc., New York, NY, USA, 1995.3
[37] A. Veeraraghavan, R. Chellappa, and M. Srinivasan. Shapeand-behavior encoded tracking of bee dances.PAMI,30(3):463–476, Mar 2008. 1
[38] P.ViolaandM.Jones. Rapid object detection using aboosted cascade of simple features. In CVPR, 2001. 5
[39] H. Wang, M. M. Ullah, A. Klaser, I. Laptev, and C. Schmid.Evaluation of local spatio-temporal features for action recognition. In BMVC, 2010. 4, 5, 6
[40] D. Weinland, R. Ronfard, and E. Boyer.Free viewpoint action recognition using motion history volumes.CVIU,104(2-3):249–257, 2006. 2
[41] L. Yeffet and L. Wolf. Local trinary patterns for human action recognition. In ICCV, 2009. 3, 5, 6
[42] K. Yu, S. Ji, M. Yang, and W. Xu. 3d convolutional neural networks for human action recognition. In ICML, 2010. 3
[43] L. Zelnik-Manor and M. Irani.Event-based analysis of video. In CVPR, volume 2, pages II–123. IEEE, 2001. 2
在连续视频的社交行为识别
摘要
我们提出了一种新的方法来分析社会行为。通过结合时空能量和代理轨迹的特点建设时域上下文模型,将连续的视频行为分割成行动“较量”。该方法是对的相互作用小鼠,这是收集行为的国家的最先进的神经电生理研究的一部分视频提供了一个前所未有的数据集进行测试。该数据集包括超过88小时(800万张)的注释视频。我们发现使用在一个歧视性框架的新的弹道特性比广泛应用于时空特性有更多的信息。此外,在连续视频中,时间背景在动作识别中占有重要的作用。我们的方法可以看做是一个基于此数据集的基准方法。与许多专家认同的约70%的识别效率相比,我们的方法达到了61.2%的识别效率。
一、介绍
从视频中检测和分类人类和动物的行为是计算机视觉研究人员面临的最有趣的挑战之一。主要的应用包括:视频监控,社会机器人,场景识别,动物行为学,神经科学,医学和遗传学。
自动化行为的分析是具有挑战性的。首先要建立一个可检测,分类和跟踪远景“前端”是很困难的。然后,对“行为”的一个清晰定义,包括对移动物体,中等复杂行为或更复杂的行为作出简短的分析识别,这对我们仍然是一个困扰。第三个障碍是标准数据集不足以指导我们思考和评估我们的算法(见第二节)。
在动物行为的影响这些问题上取得进步的最佳策略也许要归功于许多实用的优点。首先,实验动物,典型的有苍蝇和老鼠,这些动物比人更容易探测和跟踪,因此视觉前端更容易建立。其次,苍蝇和老鼠的行为更简单,也许比研究人类的行为更加客观,这使得关于行为的准确定义可能来的更早一些。三是更加实用的建立可重复的实验,并收集丰富的动物视频,而不是人类的,尤其是一些最有趣的行为(如:求爱,侵略)或是一个人利用系统性的操作来探索大自然的作用。此外,专家都愿意在他们的研究领域彻底诠释动物的行为视频,如:动物行为学,生态学,神经系统学,药理学和遗传学。由于在动物行为,特别是社会行为方面的建模和分类取得进展,从而提供了一个机遇。我们认为,从研究动物模型得到的数据会引起人类行为建模和自动化分析方面的进展。
本研究的主要方面有:最大最丰富的行为数据集。该加州理工学院居民—入侵者小鼠数据集(CRIM13)由237*2的视频编目成13个动作,每个视频帧持续时间约10分钟,视频共计超过88小时,有800万帧。曾有一个团队的专家利用MATLAB的GUI一帧帧的注释了每个视频,而我们把它改善成即时的。
在连续视频社会行为的自动分割和分类方法。多智能体的行为提出了新的挑战。(a)多个动物必须本地化并跟踪,即使是他们接触或是重叠的时候。(b)每个行为可参照多个帧(c)无论是在持续时间还是视觉外观,社会行为都是高度可变的,见图1,可以再项目网站上找到用我们的方法输出的视频例子。
1、新型弹道特性的行为识别。我们在跟踪目标的位置处设置了一大块的微弱特征区域。弱轨迹功能强大,广泛应用于时空特征,见表3.
2、探索时空背景下的行为分析。首先利用视频计算时空轨迹的特性,第二级使用视频的自动扩展分析时间背景,时间模型有助于将视频转换为行为“较量”,整体提升了8%。
利用我们的方法对13个类别,133个视频的测试,达到了61.2%的识别率,见表3.图2显示了用我们的方法对12个视频进行对比,有多位专家作出了比较注解。在我们这个较小的数据集,众多专家达成的协议大概是70%,而我们的方法达到了62.6%。
然而,CRIM13仍然是一个严峻的挑战。人类注释者的分歧就在于几乎完全依靠其他行为的标记,而我们的做法还是对真正的行为产生了错误。事实上,将混乱矩阵里的91%的人的表现删除,只有66%用的是我们的方法。当计数时,我们的方法占5/12的行为。
2.相关工作
数据集——什么能够创造一个好的数据集?在给定的环境中,物体相互之间的交互行为是有趣而有意义的。在一个明确的定义下,理想的行为数据收集是开放的,并能捕捉到所有的自发的行为或行动。拍摄应该是连续的,以便在不同的时间作不同程度的分析研究。社会行为和代理对象的相互作用令人非常的感兴趣。目前最广泛使用的行为数据集分类有,,KTH , INRIA-XMAS , Weizmann , UCF Sports, Hollywood2 , YouTube .Olympic Sports and UT videos 不符合这个标准:他们是分割的、运动的,行为的选择往往是随心所欲的,它们由专家注释并包括小的社会行为。此外,KTH和Weizmann数据集在当前的94%的艺术分类率和99%d识别率可能已经达到了其使用寿命。其中的一个方法是对连续事件的识别,虽然只是使用了很小的一段连续的视频序列。Virat是第一个大规模的连续视频数据集,它允许研究行为在一个良好定义的有意义的环境下进行。该数据集的重点是视频监控,包括人类和物体(如汽车),其相互作用的例子包括超过29小时的视频。另外一个有用的数据集,是由赛尔和其合作者收集的,他们的论点集中在单一的小鼠的行为。这些数据不包括社会行为的实例。
特点-大部分动作识别方法完全基于时空特性的。这些功能是计算在两个不同的阶段:兴趣点检测和描述。流行的时空兴趣点检测器包括Harris,Cuboids,和Hessian。在后台进行的数据集包含有关于场景的信息,是好莱坞数据集情况下密集的采样点可以改善结果,而不是运行兴趣点检测器。最有效的时空点描述方法是Cuboids,HOG/HOF和ESURF.最近,时空特征之间的关系已被用于时间结构模型的基本操作。
其他特征,显示出良好的性能和运动特征提取。最近,空时自适应局部回归仁(3DLSK)已被证明达到在KTH数据集的国家的最先进的识别一个训练实例。生物启发的层次特征也被广泛使用的。在深入学习技术应用到学习层次不变的时空特征实现。
另一个趋势是使用的间接表达视觉场景作为输入的分类,如轮廓,身体部位或姿势[ 29 ]。这些方法通常是对噪声敏感,部分遮挡和变化的观点,除了在小动物如苍蝇的情况,在弹道的特点结合姿态信息和身体部位分割已被证明[ 7,3 ]。
分类——对分类最常用的方法是使用一个袋子的时空结合如SVM分类AdaBoost [ 36 ]或[ 11 ]。其他有趣的分类方法的特征挖掘[ 10 ]和无监督的潜在主题模型[ 26 ]。
老鼠的行为--两项工作集中在白色背景黑色下小鼠的行动[ 8,15 ]。我们
解决更普遍的和具有挑战性的社会问题是像老鼠的行为一样无约束的。
3.加州理工学院的居民入侵者的鼠标数据集
该数据集是在与生物学家合作收集的,用于研究神经生理机制涉及侵略和求偶行为[ 23 ]。该视频开始总是雄性小鼠单独在实验室。在一些点,第二个小鼠,“入侵者”,介绍和社会交往的开始。在影片的最后,入侵者小鼠被删除。行为分为12 + 1个不同的相互排斥作用12类,即行为和最后一类,称为另外,使用注解者在没有利益的行为发生。老鼠就开始相互的了解对方(方法:嗅,走)。一旦建立,如果入侵者是一个女性,居民小鼠可能与其极爱配。如果入侵者是一个男性,老鼠可能会攻击它捍卫其领土。居民小鼠也可以选择忽略入侵者,从事孤立的行为(清洁,吃,喝,)。图1显示在每个视频帧的行为顶部和侧面的观点,给出了对每个行为一个简短的描述,其概率P(通常每个行为发生)的和的均值和方差的持续时间都在短时间内(μ,σ)。
图2。混乱矩阵上的12个视频由两个以上的专家的注释比较 。有关整个数据集的结果,见表3。(一)“annotator1”和一组4其他注释者之间的比较。 (二)“annotator1和我们的方法的输出之间的比较。一个2K帧的分割(C,D)的比较 视频(可从项目网站)到行为“较量”。
每个场景使用两个固定摄像机的从顶部和侧面视图同步记录。老鼠是夜行动物,近红外在笼照明使用,从而这个视频是单色(视觉上不明显从灰度)。视频通常持续约10分钟,记录在25fps的640x480像素的分辨率,8位像素深度。完整的数据集包括237个视频超过800万帧。
每个视频帧被标记的13动作类别之一,导致产生的视频分割行动的时间间隔或“较量”。开头和结尾 每一个回合,因为行为是准确地确定在立场必须为25Hz的频率进行关联与电生理记录。一些行为会往往比其他人发生更多 ,持续时间(包括类内和类间)差别也很大,见图1。
有9种不同的人类专家注释者。注释者的专业知识变化不大;他们由被 两个相同的行为生物学家培训过,并给予相同的一组上的行为,应如何进行注释说明。 注释者同时使用视频的顶视图和侧视图,在Matlab开发行为注释图形用户界面。此工具提供所有播放功能需要仔细分析视频,并允许行为的人工注释 成较量(开始和结束帧)。该工具可以从项目网站获取。每一个10分钟的视频中包含 平均140回合动作(不计除外)。它 通常需要一个专家7-8倍的视频长度充分 注释它。专家花费充分注释数据集花费的时间大致为350小时。
4.2提出的方法
在第2节讨论的大部分方法,包含单一动作的预分段短片的分类方法。我们的做法的同时将视频分割成单回合行动和行动的分类,这会更复杂的问题。
我们的方法可以被看作是自动上下文[35]的视频的扩展。自动上下文已经证明来执行,受益于学习韦兰高层次的一个上下文模型视力问题 。与其他方法相比,自动上下文模型更容易培养和避免重算法 设计,更显著更快。我们在学习段视频发现,时空结合上下文信息起着至关重要的作用 ,见表3。
图3。概述我们的方法。首先从视频中计算两个组的局部特征。训练这些功能分估计各行为的信心水平时间背景 特征是从置信水平构建并用于计算 新的信心,在新的迭代估计。在我们的情况下自动语境在收敛迭代2。
自动上下文中很容易被描述为一个多步骤的过程。首先,地方特色是从滑视频短片计算 时间窗口(参见4.1节),并用来训练基地分类,输出的每一帧,它属于每一个行为的概率。重复该过程,从而增加原来的视频功能从计算的新特性大量上下文帧的行为的概率。这些新功能提供对当前前面和后面的帧的可能分类信息帧,所以编码时间背景和行为之间的转移概率。用于帧上下文可以是接近或从当前帧的很远,它是由基分类来选择和重要融合支持上下文帧连同地方特色。这过程被重复的T次,或直至收敛。
我们的方法利用AdaBoost算法[11]作为基分类器,其中每个弱分类器是一个2棵树深度,而不是更常见的单蔸。对于每个问题,一个二进制分类器是通过与促进所有培训帧训练标签指示的行为或者存在或不存在。给定k=1.. K的行为类型,每种类型的k个二元的分类器将输出一个信心hk(i)∈R 满足特殊的行为存在于框架I2。然后,最后多标签分类是通过分配为最终实现 行为键入具有最高置信水平:y = arg max hk(I)。我们发现,分类器输出做并不需要进行校准。图3示出的数据流所提出的方法。
4.1局部特征
为了计算局部特征,滑动窗口居中 在每个帧与这两种类型的局部特征计算。最佳的滑动窗口的大小直接相关行为的持续时间,以及向编码每个要素类型的。经过多次实验,我们确定使用的9帧(≈1/3秒)的窗口是最适合时空的特性,另外两个窗口的大小(75和615帧,即3和25次)的组合是最歧视性的弹道特性,见图5。
时空—首先计算上使用集中在当前滑动窗口中的每个视频框架。比较几个我们现有的基准方法(第5节),我们最终选择了Cuboids+Pca-Sift[8]。所有参数都设置为原来的配置包也就是说,使用的标准程序列队计算[39],除了250的减小码本的大小,这被证明是最好的结果(见表1增刊。材料)。
弱轨迹特征是从一套计算每只小鼠 xmi(t),ymi(t)的每个顶视图视频帧t,见图3。这些位置是 我们的小组通过开发未发表的跟踪算法计算出来的,能够维持小鼠的身份槽重复检测。
从该位置上的,有意义的轨迹信息被计算,如小鼠运动方向,速度和加速度之间的距离,见图4(a)所示。然后该算法从这个信息生成的弱设有一个大型实验区,以类似的方式来为对象进行检测方法[38]。鉴于集中在当前滑动窗口帧,则该方法在不重叠的区域划分,并且适用于各一套6种不同的操作(和,方差,最小值,最大值,高斯加权和谐)该方法的每一个操作款项全部区域值,其中
每个区域可以正数(1),负(-1),或者是完全忽略(0)。这个过程不断重复,对于所有可能的组合区域和轨迹的每一个图4中的值(a)所示。在调和操作调换的值(-1)地区,因此检测循环重复。
4.2、时空背景下的功能
由于自动上下文的一部分行为分类仅基于局部特征,然后在随后的迭代中,加入到功能设置时间上下文的列表功能,从信心层面输出的计算二元分类器在上一次迭代,时空背景下的功能是通过计算每个时间样本取一个时间窗口在中心那个时候的样本一阶统计。设计细节在图4(b)给出。
5、实验
给定一个视频,注解是由行为的时间间隔(行为类型,起始帧,结束帧)的列表中定义。该指标用于比较两个注解应该测量两者的相似性,以及它们的相对完整性(不论是现存的第一注解的所有行为也目前在第二个注释)。第二个是特别由于CRIM13的高度不均衡性重要。事实上,通过简单的一帧一帧的比较,分类器预测所有的帧的准确率会超过50%(见图1)。
我们建议使用混淆矩阵的对角线为指标的平均值,其中混淆矩阵值
是注释之间的每帧平均协议
对于每一对的行为。在所有帧计算每帧的平均协议,测量该对行为之间相似性。然后,通过取对角线的平均值,我们看好该分类在所有的行为与地面实况达到很高的相似性。
5.2 参数分析
为了优化算法,我们分析了所有方法的参数。为了避免过度拟合,并加速该过程我们使用视频的一小部分:10顶视图视频每次训练和测试(30万张)。
5.2.1时空-时空特征
我们选择的基准是一些最广泛使用的时空兴趣点探测器(Harris3D[19]和
Cuboids[8])和时空描述符(长方体PcaSift[8],霍夫[20]和Hog3D[18]),允许所有不同的组合。我们放弃使用密集采样特点,一方面是因为我们的视频的背景是无意义的,另一方面是计算让我们望而却步。我们还使用本地三元模式(LTP),[41]这是由于它的编码应该更自然适合连续行为识别。我们使用代码[8,20,18],因为需要工作需要在长视频进行扩展。
一旦时空特性计算所有视频帧,行为分类结果使用实现了AdaBoost的多标记
分类器,如第4节所述。时空探测器计算在一个单一的空间和时间规模(13X13像素,19帧3Dpatch大小),然后包话通过观察窗计算每个帧的中心在当前帧9帧,即最佳参数,见图5(a)所示。为了计算包的数据在[39]所述的程序使用。码书大小为独立地为基准的每个检测器+描述符面积由100至2000的组合,见表1增刊材料。最好的探测器+描述的是在多个时空尺度(σ=2,4,8,τ=3,5)。表1示出了每个方法的主要结果。
由于训练集的规模小,缺乏上下文,所有的方法都没有段测试视频,导致30-40%的性能下降的培训(不表示出)。时空特征之间的差异是非常小的,因为在当前的数据集[39,41]。探测器似乎性能类似,虽然Cuboids的速度要快得多。至于描述符,PCA-SIFT优于其他地区。Cuboids运行在多尺度的结果过度拟合,不提高性能,同时也慢得多。 LTP的表现虽然快得多,但是比Cuboids+ PCA-SIFT略差,。在这些结果中,我们选择使用Cuboids+ PCA-SIFT处理这其余部分。
表1测试上CRIM13的一个子集被用于选择Cuboids+ PCA-SIFT作为许多国家的最先进的多时空特征。在多尺度运行的Cuboids+ PCA-SIFT 过度使用,在性能训练试验中下跌超过54%,(未示出)。
表2。不同数量基准的区域作轨迹 功能计算。单独轨迹功能也缺乏时间背景。
5.2.2弱轨迹功能
轨迹唯一的特征参数是数字。我们发现,最佳设置是使用1,2和3的区域组合,见表2。使用此设置,轨迹功能了执行中的验证组的时空特征。其多功能性使他们在时间上缺乏上下文的略少。它们也计算的更快,平均155 FPS(给定轨道可从项目网站获得)。
5.2.3分类设定
二进制的AdaBoost分类器的仅有的两个参数弱分类器(T)的最大数量和量采样在每个训练迭代(S)帧。防止过度拟合和加速训练,每个弱分类器使用S培训框架的一个子集,通过更换随机抽样选择一个新的子集,在每次迭代的经验教训。评估之后,我们选择了T =250和S=1K为最佳值,如图6所示。请注意如何取样少数帧的提高了性能与较大的数字比较。由于帧的数量增加时,弱分类器过度拟合,从而导致性能的下降。
图6。T和S在分类中的作用。实验 进行了仅使用轨迹功能(参见5.2.3)。
表3。该方法在CRIM13的结果。在结果2后实现自动上下文迭代。添加时间方面提高了分类平均为10%(对STF14%)。对于专家注释的比较,见图2。
5.3结果
我们报告CRIM13方法的结果。该237,10分钟长的视频被分为两组,104训练和133进行检测。表3示出主要结果。为了更好地研究每个功能的作用,我们每个单独尝试:仅轨迹功能(TF),仅从侧面或顶部的时空特征,两者的时空特征在一起(STF),和所有的结合(TF+ STF)。第一列显示没有上下文的每个组合的局部特征的表现。第二列显示添加时间背景后的结果功能。
在没有上下文的情况下,TF明显优于STF,而两者TF+ STF的组合,相对于TF提高了分类1%。使用自动上下文 完整方法提高了性能的8%,平均为10%。
,一个简单的时间平滑 输出标签不仅提高0.2%。最好的结果是将两者局部特征的组合来实现 TF+ STF,从而提高了TF3%,达到了最终的识别率,61.2%。这个任务的上限为70%,这是专家的注释之间的平均一致率,见图2。
尽管所使用的度量可能表明,TF和TF+ STF之间的差小,分析各行为分开显示,TF+ STF性能优于TF在7出12行为(攻击,交配,追逐,饮,多食,嗅,向上)。另外,从顶部显示侧面显示比较STF的混乱矩阵和STF该俯视图是最适合检测行为(追逐,干净,闻走开),而其余的都是最好.
6 讨论和结论
我们提出CRIM13,一个新的视频数据集的研究行为,强调社会行为。对于行为的神经生理学的研究[23],视频收集并由专业培训的注解者注解。CRIM13是世界上最大和最富有的行为数据集,包含超过800万帧和12+1不同的行为。由于视频不预先分割成行动的较量,因此,分类必须进行逐次分割。
我们提出了连续录像的自动分割和自发的社会行为分类的方法。该方法使用时空和轨迹功能,各视频的正确分割成行为的较量。我们每个单独部件的基准指四个方法。我们的数据集与流行的新型轨道组合功能时空特性优于单独使用它们。这表明行为的研究应当基于异构描述的多重性。此外,我们发现在连续视频
该时间范围内可以提高行为的分类。我们的方法的表现并不是很好从训练的人力标注器(见图2和表3)明显改进的余地。虽然人类的注释者之间的分歧就在于几乎完全依靠其他行为的标签(不太重要的),我们的方法混淆了一些真正的行为。事实上,我们的方法表现从混淆矩阵的结果除去其它的91%,66 %。
我们认为,分类性能可以从姿势派生新的功能和应用动态通过增加多标签分类,可以通过强大的不平衡数据改善。我们也将进一步研究LTP的特点,由于其有希望得到更好地结果和更快的速度。虽然在这项工作中,我们能够处理不同持续时间的行为,然而一个悬而未决的问题是,是否短期和简单的“行为”之间有明确的区别,中等规模的行动和更长,更复杂的活动应直接纳入未来的研究范围。
致 谢
我们要感谢R.罗伯逊和他的细心注释的视频,以及博士答斯蒂尔的协助。我们还要感谢M.博士迈尔提供的宝贵意见。西班牙卫生部博士后 X.P.B.A.的支持。戈登和贝蒂·摩尔基金会的支持。感谢霍华德休斯医学的D.J的支持。感谢由ONR穆里格兰特#N00014-10-1-0933的支持。
[1] S. Ali and M. Shah. Human action recognition in videos using kinematic features and multiple instance learning. PAMI,32(2):288 –303, 2010. 3
[2] S. Belongie, K. Branson, P. Dollar, and V. Rabaud. Monitoring animal behavior in the smart vivarium. In Workshop on Measuring Behavior, Wageningen, The Netherlands. Citeseer, 2005. 1
[3] K. Branson, A. A. Robie, J. Bender, P. Perona, and M. H.Dickinson.High-throughput ethomics in large groups of drosophila. Nature Methods, 6(6):451–457, 2009. 1, 3
[4] C. Bregler. Learning and recognizing human dynamics in video sequences. In CVPR, 1997. 1
[5] W. Brendel and S. Todorovic.Learning spatiotemporalgraphs of human activities. In ICCV, 2011. 3
[6] J. Candamo, M. Shreve, D. Goldgof, D. Sapper, and R. Kasturi.Understanding transit scenes: A survey on human behavior-recognition algorithms. Intelligent Transportation Systems, IEEE Transactions on, 11(1):206 –224, march2010. 1
[7] H. Dankert, L. Wang, E. D. Hoopfer, D. J. Anderson, and P. Perona. Automated monitoring and analysis of social behavior in drosophila. Nat Methods, 6(4):297–303, Apr 2009.1, 3
[8] P. Dollár, V. Rabaud, G. Cottrell, and S. Belongie. Behavior recognition via sparse spatio-temporal features. In VS-PETS,October 2005. 1, 3, 4, 5
[9] A. A. Efros, A. C. Berg, G. Mori, and J. Malik. Recognizing action at a distance. In ICCV, pages 726–733, Nice, France,2003. 3
[10] A. Gilbert, J. Illingworth, and R. Bowden.Fast realisticmulti-action recognition using mined dense spatio-temporal features. In ICCV, 2009.3
[11] L. Gorelick, M. Blank, E. Shechtman, M. Irani, and R. Basri.A decision-theoretic generalization of on-line learning and an application to boosting. Journal of computer and system sciences, 55:119–139, 1997. 3, 4
[12] L. Gorelick, M. Blank, E. Shechtman, M. Irani, and R. Basri.Actionsasspace-timeshapes. PAMI,29(12):2247–2253, De-cember 2007. 2
[13] G.Willems, T. Tuytelaars, and L. V. Gool. An efficient dense and scale-invariant spatio-temporal interest point detector. In ECCV, 2008. 3
[14] C.-W. C. J. C. Niebles and L. Fei-Fei. Modeling temporal structure of decomposable motion segments for activity classification. In ECCV, 2010. 2
[15] H. Jhuang, E. Garrote, X. Yu, V. Khilnani, T. Poggio,A. Steele, and T. Serre. Automated home-cage behaviouralphenotyping of mice.Nature communications, 1(6):1–9,2010. 1, 3
[16] H. Jhuang, T. Serre, L. Wolf, and T. Poggio. A biologically inspired system for action recognition. In ICCV, 2007. 3
[17] Z. Khan, T. Balch, and F. Dellaert. A rao-blackwellized particle filter for eigentracking. In CVPR, volume 2, pages II980. IEEE, 2004. 1
[18] A. Klaser, M. Marszalek, and C. Schmid. A spatio-temporal descriptor based on 3d gradients. In BMVC, 2008. 3, 5
[19] I. Laptev and T. Linderberg. Space-time interest points. In ICCV, 2003. 3, 5
[20] I. Laptev, M. Marszalek, C. Schmid, and B. Rozenfeld. Learning realistic human actions from movies. In CVPR,2008. 3, 5
[21] G. Lavee, E. Rivlin, and M. Rudzsky. Understanding video events: A survey of methods for automatic interpretation of semantic occurrences in video. IEEE Transactions on Sys- tems, Man, and Cybernetics, 39(5):489 –504, 2009. 1
[22] Q. V. Le, W. Y. Zou, S. Y. Yeung, and A. Y. Ng. Learning hierarchical invariant spatio-temporal features for action recognition with independent subspace analysis. In CVPR,2011. 3
[23] D. Lin, M. P. Boyle, P. Dollar, H. Lee, E. S. Lein, P. Perona,and D. J. Anderson. Functional identification of an aggression locus in the mouse hypothalamus. Nature, 470(1):221227, 2011. 1, 3, 7
[24] J. Liu, J. Luo, and M. Shah. Recognizing realistic actions from videos “ in the wild ”. In CVPR, 2009. 2
[25] M. Marszalek, I. Laptev, and C. Schmid. Actions in context.In CVPR, 2009. 2
[26] J. C. Niebles, H. Wang, and L. Fei-Fei. Unsupervised learning of human action categories using spatial-temporal words.IJCV, 79:299–318, 2008.3
[27] S. Oh and et al. A large-scale benchmark dataset for event recognition in surveillance video. In CVPR, 2011. 2
[28] R. Polana and R. C. Nelson. Detection and recognition of periodic, nonrigid motion. IJCV, 23(3):261–282, 1997. 1
[29] R. W. Poppe. A survey on vision-based human action recognition. Image and Vision Computing, 28(6):976–990, 2010.1, 3
[30] M. D. Rodriguez, J. Ahmed, and M. Shah. Action mach:a spatio-temporal maximum average correlation height filter for action recognition. In CVPR, 2008. 2
[31] M. S. Ryoo and J. K. Aggarwal. Spatio-temporal relation-ship match: Video structure comparison for recognition of complex human activities. In ICCV, 2009. 2, 3
[32] C. Schuldt, I. Laptev, and B. Caputo. Recognizing human actions: A local svm approach. In ICPR, 2004. 2
[33] H. J. Seo and P. Milanfar. Action recognition from one example. PAMI, 33(5):867 –882, may 2011. 3
[34] G. W. Taylor, R. Fergus, Y. Lecun, and C. Bregler. Convolu-tional learning of spatio-temporal features. In ECCV, 2010.3
[35] Z. Tu. Auto-context and its application to high-level vision tasks. In CVPR, 2008. 2, 4
[36] V. N. Vapnik.The nature of statistical learning theory.Springer-Verlag New York, Inc., New York, NY, USA, 1995.3
[37] A. Veeraraghavan, R. Chellappa, and M. Srinivasan. Shape-
and-behavior encoded tracking of bee dances.PAMI,30(3):463–476, Mar 2008. 1
[38] P.ViolaandM.Jones. Rapidobjectdetectionusingaboosted cascade of simple features. In CVPR, 2001. 5
[39] H. Wang, M. M. Ullah, A. Klaser, I. Laptev, and C. Schmid.Evaluation of local spatio-temporal features for action recognition. In BMVC, 2010. 4, 5, 6
[40] D. Weinland, R. Ronfard, and E. Boyer.Free viewpointaction recognition using motion history volumes.CVIU,104(2-3):249–257, 2006.2
[41] L. Yeffet and L. Wolf. Local trinary patterns for human action recognition. In ICCV, 2009. 3, 5, 6
[42] K. Yu, S. Ji, M. Yang, and W. Xu. 3d convolutional neural networks for human action recognition. In ICML, 2010. 3
[43] L. Zelnik-Manor and M. Irani.Event-based analysis ofvideo. In CVPR, volume 2, pages II–123. IEEE, 2001. 2
查看完整论文请+Q: 351916072
关键字:
目 录
参考目录
版权保护: 本文由 hbsrm.com编辑,转载请保留链接: www.hbsrm.com/dzxx/dzkxyjs/2482.html