【行人检测】利用HOG+SVM训练模型步骤:
1.准备样本
2.提取hog特征
3. 训练SVM分类器
4.利用SVM训练的分类器,进行检测
1.原始数据集: INRIAPerson训练集下载:原始数据集
因为原始数据集比较乱,所以需要对原始数据集进行裁剪,下面是对原始数据集里面负例数据集裁剪图片的例程:
#include<fstream>//fstream
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/objdetect/objdetect.hpp> // hog
#include<opencv2/ml/ml.hpp> //SVM
#include<iostream>
#include<time.h>
#include<stdlib.h>
using namespace std;
using namespace cv;
//using namespace ml;
#define PosNum 614
#define NegNum 1218
#define cropNegNum 1218
//