目标检测之LibPaBOD(a LIBrary for PArt-Based Object Detection in C++)

LibPaBOD是由Daniel Rodríguez Molina使用C++实现的DPM(P. Felzenszwalb的Discriminatively Trained Part Based Models)。代码基于opencv和MatIO实现,前者用于处理图像,后者用于读取.mat格式的训练模型文件。


1、准备工作

作者提供的windows下的可执行文件存档于\libpabod029_windows_bin\bin(LibPaBOD for MS Windows at SourceForge),包括dlls和detectobj2.exe、detectvid.exe,前者用于图片中的目标检测,后者用于视频中的目标检测。

运行程序首先需要安装hdf5:http://www.hdfgroup.org/ftp/HDF5/releases/。注意要使用shared版本,static的我尝试过没成功,所以采用的是:hdf5-1.8.13-win32-VS2008-shared.zip,然后将dll和可执行文件拷贝至相同目录:

并创建创建data目录:子目录models用于存储模型文件,子目录testimages用于存储待检测图像。


运行命令格式:

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. detectobj2 -m <model_path> -i <image_path> [-t <threshold>] [-o <detections_path>] [-d <0/1>]  
  2. detectvid -m <model_path> -v <video_path> [-t <threshold> -o <detections_path> -d <0/1>]  
-m为.mat模型文件路径,-i为待检测图像/视频路径,-t为指定的阈值,-o为输出文件路径,-d为是否显示原图像(0-不显示,1-显示,默认为1)。其中输出文件的格式为:

检测到的目标数目                                

目标矩形的坐标(x1 y1 x2 y2) 阈值

......                                                          

目标矩形的坐标(x1 y1 x2 y2) 阈值


2、使用作者训练的upper body detector检测头肩

头肩模型文件:ubf_libpabod.mat(upperbodyfrontal4libpabod.zip),该头肩模型来自作者的另一个VGG upper body项目。

命令如下,此处采用的阈值为-0.5:

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. detectobj2 -m data\models\ubf_libpabod.mat -i data\testimages\crop001007.png -t -0.5 -o ubdets.txt  

结果如下:


同样检测另外几张图片:


对应的命令:

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. detectobj2 -m data\models\ubf_libpabod.mat -i data\testimages\person_139.png -t -0.5 -o ubdets.txt  


对应的命令:

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. detectobj2 -m data\models\ubf_libpabod.mat -i data\testimages\person_269.png -t -0 -o ubdets.txt  

在实验的过程中可以看出,检测依赖于阈值的选取,检测速度较慢。对比参考LatentSVM和DPM的检测:目标检测之LatentSVM和DPM(Discriminatively Trained Part Based Models) - holybin的专栏 - 博客频道 - CSDN.NET

3、使用作者训练的人头模型检测人头

模型文件:head-gen-on-ub-4laeo.mat和head-gen-on-ub-4laeo-bmvc11.mat(laeo_head_v2.0.zip)均来自于作者的另一个项目:VGG head detector

(1)采用第一种模型,来自:

[4] M.J. Marin-Jimenez, A. Zisserman, M. Eichner and V. Ferrari. Detecting people looking at each other in videos. International Journal of Computer Vision (IJCV), 2013

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. detectobj2 -m data\models\head-gen-on-ub-4laeo.mat -i data\testimages\hlayk.jpg -t -0.82 -o ubdets.txt  

检测结果:


(2)采用第二种模型,来自:

[1] M.J. Marin-Jimenez, A. Zisserman and V. Ferrari. "Here's looking at you, kid." Detecting people looking at each other in videos. British Machine Vision Conference (BMVC), 2011.

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. detectobj2 -m data\models\head-gen-on-ub-4laeo-bmvc11.mat -i data\testimages\hlayk.jpg -t -0.8 -o ubdets.txt  


检测结果:



4、使用人体模型检测人体

第一种模型:voc-release4.01的INRIA person模型(inriaperson_final.mat

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. detectobj2 -m data\models\inriaperson_final_4.01.mat -i data\testimages\crop001007.png -t 0.5 -o ubdets.txt  
检测结果:



第二种模型:voc-release4.01的VOC2009 person模型(person_final.mat

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. detectobj2 -m data\models\person_final_4.01_VOC2009.mat -i data\testimages\crop001007.png -t 0.5 -o ubdets.txt  
检测结果:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值