-
Notifications
You must be signed in to change notification settings - Fork 232
/
TrainModel.cpp
executable file
·36 lines (31 loc) · 1.11 KB
/
TrainModel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// TrainDemo.cpp
// myopencv
//
// Created by lequan on 1/24/15.
// Copyright (c) 2015 lequan. All rights reserved.
//
#include "LBFRegressor.h"
using namespace std;
using namespace cv;
void LoadCofwTrainData(vector<Mat_<uchar> >& images,
vector<Mat_<double> >& ground_truth_shapes,
vector<BoundingBox>& bounding_boxs);
void TrainModel(vector<string> trainDataName){
vector<Mat_<uchar> > images;
vector<Mat_<double> > ground_truth_shapes;
vector<BoundingBox> bounding_boxs;
for(int i=0;i<trainDataName.size();i++){
string path;
if(trainDataName[i]=="helen"||trainDataName[i]=="lfpw")
path = dataPath + trainDataName[i] + "/trainset/Path_Images.txt";
else
path = dataPath + trainDataName[i] + "/Path_Images.txt";
// LoadData(path, images, ground_truth_shapes, bounding_boxs);
LoadOpencvBbxData(path, images, ground_truth_shapes, bounding_boxs);
}
LBFRegressor regressor;
regressor.Train(images,ground_truth_shapes,bounding_boxs);
regressor.Save(modelPath+"LBF.model");
return;
}