OpenCV中基于HOG+SVM行人检测
2017-10-11 14:25
393 查看
使用HOGDescriptor类
另有HOGDescriptor::getDaimlerPeopleDetector(),此时hog.winSize = Size(48, 96);
The reason is that the Daimler classifier was trained using training images of that size. Only with that image size will the HOG feature vector has the correct dimensions of 1981, which can be fed into the Daimler SVM classifier.
detector = HOGDescriptor::getDaimlerPeopleDetector();
Size win_size(48, 96);
HOGDescriptor cpu_hog(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9, 1, -1, HOGDescriptor::L2Hys, 0.2, false, HOGDescriptor::DEFAULT_NLEVELS);
cpu_hog.setSVMDetector(detector);
HOGDescriptor类中的函数detectMultiScale()执行滑动窗口检测,一共有8个参数。
1.img(必需)
这个不用多解释,显然是要输入的图像。图像可以是彩色也可以是灰度的。
2.foundLocations
存取检测到的目标位置
3.hitThreshold (可选)
opencv documents的解释是特征到SVM超平面的距离的阈值(Threshold for the distance between features and SVM classifying plane)
所以说这个参数可能是控制HOG特征与SVM最优超平面间的最大距离,当距离小于阈值时则判定为目标。
默认0,越小结果越多,且越不精准
4.winStride(可选)
HoG检测窗口移动时的步长(水平及竖直)。
winStride和scale都是比较重要的参数,需要合理的设置。一个合适参数能够大大提升检测精确度,同时也不会使检测时间太长。
5.padding(可选)
在原图外围添加像素,作者在原文中提到,适当的pad可以提高检测的准确率(可能pad后能检测到边角的目标?)
常见的pad size 有(8, 8), (16, 16), (24, 24), (32, 32).
6.scale(可选)
如图是一个图像金字塔,也就是图像的多尺度表示。每层图像都被缩小尺寸并用gaussian平滑。
scale参数可以具体控制金字塔的层数,参数越小,层数越多,检测时间也长。 一下分别是1.01 1.5 1.03 时检测到的目标。 通常scale在1.01-1.5这个区间
7.finalThreshold(可选)
为了优化最后的bounding box,也叫groupThreshold (set groupThreshold to 0 to turn off the grouping completely).
8.useMeanShiftGrouping(可选)
bool 类型,决定是否应用meanshift 来消除重叠。
default为false,通常也设为false,另行应用non-maxima supperssion效果更好。
参考地址:
http://www.cnblogs.com/klitech/p/5747895.html http://answers.opencv.org/question/3232/hogdescriptor-daimlerpeopledetector-does-not-work/
HOGDescriptor hog; hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
另有HOGDescriptor::getDaimlerPeopleDetector(),此时hog.winSize = Size(48, 96);
The reason is that the Daimler classifier was trained using training images of that size. Only with that image size will the HOG feature vector has the correct dimensions of 1981, which can be fed into the Daimler SVM classifier.
detector = HOGDescriptor::getDaimlerPeopleDetector();
Size win_size(48, 96);
HOGDescriptor cpu_hog(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9, 1, -1, HOGDescriptor::L2Hys, 0.2, false, HOGDescriptor::DEFAULT_NLEVELS);
cpu_hog.setSVMDetector(detector);
HOGDescriptor类中的函数detectMultiScale()执行滑动窗口检测,一共有8个参数。
1.img(必需)
这个不用多解释,显然是要输入的图像。图像可以是彩色也可以是灰度的。
2.foundLocations
存取检测到的目标位置
3.hitThreshold (可选)
opencv documents的解释是特征到SVM超平面的距离的阈值(Threshold for the distance between features and SVM classifying plane)
所以说这个参数可能是控制HOG特征与SVM最优超平面间的最大距离,当距离小于阈值时则判定为目标。
默认0,越小结果越多,且越不精准
4.winStride(可选)
HoG检测窗口移动时的步长(水平及竖直)。
winStride和scale都是比较重要的参数,需要合理的设置。一个合适参数能够大大提升检测精确度,同时也不会使检测时间太长。
5.padding(可选)
在原图外围添加像素,作者在原文中提到,适当的pad可以提高检测的准确率(可能pad后能检测到边角的目标?)
常见的pad size 有(8, 8), (16, 16), (24, 24), (32, 32).
6.scale(可选)
如图是一个图像金字塔,也就是图像的多尺度表示。每层图像都被缩小尺寸并用gaussian平滑。
scale参数可以具体控制金字塔的层数,参数越小,层数越多,检测时间也长。 一下分别是1.01 1.5 1.03 时检测到的目标。 通常scale在1.01-1.5这个区间
7.finalThreshold(可选)
为了优化最后的bounding box,也叫groupThreshold (set groupThreshold to 0 to turn off the grouping completely).
8.useMeanShiftGrouping(可选)
bool 类型,决定是否应用meanshift 来消除重叠。
default为false,通常也设为false,另行应用non-maxima supperssion效果更好。
参考地址:
http://www.cnblogs.com/klitech/p/5747895.html http://answers.opencv.org/question/3232/hogdescriptor-daimlerpeopledetector-does-not-work/
相关文章推荐
- 【OpenCV】基于HOG与SVM的行人检测学习
- OpenCV中基于HOG特征的行人检测
- OpenCV_基于HOG特征的行人检测
- OpenCV HOG+SVM行人检测:从训练到检测
- OpenCV_基于HOG特征的行人检测
- VS+Opencv3.3下用HOG+SVM实现INRIA行人检测
- Opencv中HOG+SVM进行行人检测
- 新手学习opencv--基于Hog的视频行人检测
- OpenCV_基于HOG特征的行人检测
- HOG+SVM行人检测--OpenCV源码不完全解释
- HOG+SVM行人检测opencv版本
- 用opencv实现HOG+SVM行人检测
- OpenCV中基于HOG特征的行人检测
- 利用OpenCV中默认的SVM参数进行HOG行人检测,默认参数是根据Dalal的方法训练的。
- OpenCV Demo :行人检测(HOG+SVM)
- opencv︱opencv中实现行人检测:HOG+SVM(二)
- 自己训练SVM分类器,进行HOG行人检测。
- Hog+svm行人检测
- OpenCV读入图片序列进行HOG行人检测并保存为视频
- Opencv之HOG特征与SVM相结合的人体检测(增加自举法)