GithubHelp home page GithubHelp logo

freesouls / face-alignment-at-3000fps Goto Github PK

View Code? Open in Web Editor NEW
283.0 26.0 145.0 2.73 MB

The project is an C++ implementation of Face Alignment at 3000fps via Regressing Local Binary Features

C 21.19% CMake 0.35% C++ 78.46%

face-alignment-at-3000fps's Introduction

Face Alignment at 3000fps

It is an implementation of Face Alignment at 3000fps via Local Binary Features, a paper on CVPR 2014

New!!! Refactoring the code

1. Add Validation in Training Step(error is the same to the paper)

add Validation after each stage, output will be like below, now we can see how our model is fit on the validation set, much easier for parameter tuning.(Following is the output when training Helen dataset),the trained model can be DOWNLOADED from HERE, see next section for how to use.

training stage: 0 of 6
train regression error: 836.521, mean error: 0.116767
Validation at stage: 0
Validation error: 29.7611, mean error: 0.095695

training stage: 1 of 6
train regression error: 533.649, mean error: 0.0744904
Validation at stage: 1
Validation error: 22.4096, mean error: 0.0720567

training stage: 2 of 6
train regression error: 386.907, mean error: 0.0540071
Validation at stage: 2
Validation error: 19.6509, mean error: 0.0631862

training stage: 3 of 6
train regression error: 297.455, mean error: 0.0415208
Validation at stage: 3
Validation error: 18.3068, mean error: 0.0588642

training stage: 4 of 6
train regression error: 247.068, mean error: 0.0344875
Validation at stage: 4
Validation error: 17.8339, mean error: 0.0573436

training stage: 5 of 6
train regression error: 207.739, mean error: 0.0289976
Validation at stage: 5
Validation error: 17.5538, mean error: 0.0564431

2. Change to Read Parameters from Configure File

See next section for details.

In pervious versions, when setting the parameters, we have to write hard code in main.cpp, now I changed it to read from a configure file without having to recompile the codes

3. Add Helen Dataset Example for Better Understanding

in the example folder, there are some configure files. See next section for details.

Interpret the Paper's details

If you are a Chinese, you can go to my blog for more details. link

License

If you use my work, please cite my name (Binbin Xu), Thanks in advance. This project is released under the BSD 2-Clause license.

How To Use

Requirements:

  • OpenCV(I just use the basic structures of OpenCV, like cv::Mat, cv::Point)
  • cmake

Prepare:

  • Download helen dataset from this link: Helen Dataset
  • unzip the helen dataset and put it under example folder, the path will be like example/helen/trainset/***.jpg for an image

Training

mkdir build
cd build
cmake ..
make
./application train ../example/helen_train_config.txt

the training starts, you just need to see the output

Testing

  • testing images that have ground truth shapes

take helen testset for example.

./application test ../example/helen_test_config_images_with_ground_truth.txt
  • testing images that do not have ground truth shapes

take helen testset for example, assuming that we do not known the landmarks' annotations.

./application test ../example/helen_test_config_images_without_ground_truth.txt

Using My Simple Model

if you do not want to train a model, I provide one. You can download a model trained on helen/trainset images from HERE, test error is 0.0564244 on helen/testset

  • download helen_trained_model.zip and unzip it to example/

path will be example/helen_trained_model/helenModel_params.txt for helenModel_params.txt

  • in example/helen_test_config_images_with_ground_truth.txt

change first line helenModel to ../example/helen_trained_model/helenModel

  • run the following command
./application test ../example/helen_test_config_images_with_ground_truth.txt
  • actually, you can put the model wherever you want, just change the path accordingly in configure file

Configure Files Explanation:

1. Image List

in example/ there is a file named helen_test_images_list_with_ground_truth.txt, the content is like this:

2815405614_1.jpg 2815405614_1.pts
114530171_1.jpg 114530171_1.pts
2437904540_1.jpg 2437904540_1.pts
...

each line contains a pair of names, the first one is the image name, the second is the ground truth file name

in example/ there is a file named helen_test_images_list_without_ground_truth.txt, the content is like this:

2815405614_1.jpg
114530171_1.jpg
2437904540_1.jpg
...

after we trained a new model, we want to test new images, so just put each image's name in the image_list.txt

2. Training Configure File

helenModel  // the model name, name what you like
200         // params.local_features_num_ = 200;
68          // params.landmarks_num_per_face_ = 68;
6           // params.regressor_stages_ = 6;
5           // params.tree_depth_ = 5;
12          // params.trees_num_per_forest_ = 12;
3           // params.initial_guess_ = 5;
0.3         // params.overlap_ = 0.3;
0.29        // first stage lacal radius when samples the pixel difference feature positions
0.21        // second stage local radius 
0.16
0.12
0.08
0.04        // sixth stage local radius
2           // number of datasets for training
../example/helen/trainset/                      // root folder that contains the *.jpgs and *.pts of the first dataset
../example/helen_train_images_list.txt          // images list of the first dataset
../example/otherdataset/                        // root folder of the second dataset
../example/otherdatset_train_images_list.txt    // images list of the second dataset
1                                               // number of datasets for validation, 0 means none
../example/helen/testset/                       // root folder that contains the *.jpgs and *.pts
../example/helen_test_images_list_with_ground_truth.txt // images list

off course, you can set number of datasets for validation as 0, which means no validaion set.

When training, this configure file will be parsed, and images will be loaded. You can refer to main.cpp for details how the configure file is parsed.

the parameters setting above is just an example, you have to fine tune the parameters in training for your dataset.

off course, you can still set the parameters like this directly in main.cpp.

Parameters params;
params.local_features_num_ = 300;
params.landmarks_num_per_face_ = 68;
params.regressor_stages_ = 6;
params.local_radius_by_stage_.push_back(0.4);
params.local_radius_by_stage_.push_back(0.3);
params.local_radius_by_stage_.push_back(0.2);
params.local_radius_by_stage_.push_back(0.1);
params.local_radius_by_stage_.push_back(0.08);
params.local_radius_by_stage_.push_back(0.05);
params.tree_depth_ = 5;
params.trees_num_per_forest_ = 12;
params.initial_guess_ = 5;

3. Test Configure File

helen_test_config_images_with_ground_truth.txt

helenModel      // model name that we want to use after we have trained
1               // 1 means we know the ground_truth_shapes of the images
1               // number of datasets we want to be tested
../example/helen/testset/   // root folder for testset
../example/helen_test_images_list_with_ground_truth.txt // image list

helen_test_config_images_without_ground_truth.txt

helenModel      // model name that we want to use after we have trained
0               // 0 means we do not know the ground_truth_shapes of the images
1               // number of datasets we want to be tested
../example/helen/testset/   // root folder for testset
../example/helen_test_images_list_without_ground_truth.txt // image list

Notes

1. overlap

there is a parameter in randomforest.cpp, line 95:

double overlap = 0.3; // you can set it to 0.4, 0.25 etc

each tree in the forest will be constructed using about N*(1-overlap+overlap/T) examples, where N is the total number of images after augmentation(if your train data set size is 2000, and initial_guess_ is 5, then N = 2000*(5+1)=12000 images), T is the number of trees in each forest.

2. what are .pts files

here you can download dataset with .pts files, each .pts file contains 68 landmarks positions of each face

3. what are BoundingBox

it is just the bounding box of a face, including the center point of the box, you can just use the face rectangle detected by opencv alogrithm with a little effort calculating the center point's position yourself. Example codes are like below

BoundingBox bbox;
bbox.start_x = faceRec.x; // faceRec is a cv::Rect, containing the rectangle of the face
bbox.start_y = faceRec.y;
bbox.width = faceRec.width;
bbox.height = faceRec.height;
bbox.center_x = bbox.start_x + bbox.width / 2.0;
bbox.center_y = bbox.start_y + bbox.height / 2.0;
bboxes.push_back(bbox);

4. resize the image

If you try to resize the images, please use the codes below

if (image.cols > 2000){
    cv::resize(image, image, cv::Size(image.cols / 3, image.rows / 3), 0, 0, cv::INTER_LINEAR);
    ground_truth_shape /= 3.0;
}

DO NOT SWAP "image.cols" and "image.rows", since "image.cols" is the width of the image, the following lines are WRONG!!!

if (image.cols > 2000){
    cv::resize(image, image, cv::Size(image.rows / 3, image.cols / 3), 0, 0, cv::INTER_LINEAR);
    ground_truth_shape /= 3.0;
}

5. Customize

Re-write LoadGroundTruthShape and LoadImages in utils.cpp for your own needs since different dataset may have different data format.

Results:

1. Detect The Face

2. Use The Mean Shape As The Initial Shape:

3. Predict The Landmarks

4. Bad Case

when you test new images that do not have ground truth annotations, you may encounter problems like this, actually it is NOT Face Alignment's problem, for the code just uses OpenCV's default face detector, and I choose the first bounding box rectangle returned by OpenCV(line 345 in utils.cpp: cv::Rect faceRec = faces[0];), you can use all the bounding box by re-writing the function. And sometimes the face detector may fail to detect a face in the image.

More

  • The paper claims for 3000fps for very high frame rates for different parameters, while my implementation can achieve several hundreds frame rates. What you should be AWARE of is that we both just CALCULATE the time that predicting the landmarks, EXCLUDES the time that detecting faces.
  • If you want to use it for realtime videos, using OpenCV's face detector will achieve about 15fps, since 80% (even more time is used to get the bounding boxes of the faces in an image), so the bottleneck is the speed of face detection, not the speed of landmarks predicting. You are required to find a fast face detector(For example, libfacedetection)
  • In my project, I use the opencv face detector, you can change to what you like as long as using the same face detector in training and testing
  • it can both run under Windows(use 64bits for large datasets, 32bits may encounter memory problem) and Unix-like(preferred) systems.
  • it can reach 100~200 fps(even 300fps+, depending on the model complexity) when predicting 68 landmarks on a single i7 core with the model 5 or 6 layers deep. The speed will be much faster when you reduce 68 landmarks to 29, since it uses less(for example, only 1/4 in Global Regression, if you fix the random forest parameteres) parameters.
  • for a 68 landmarks model, the trained model file(storing all the parameters) will be around 150M, while it is 40M for a 29 landmarks model.
  • the results of the model is acceptable for me, deeper and larger random forest(you can change parameters like tree_depth, trees_num_per_forest_ and so on) will lead to better results, but with lower speed.

ToDo

  • data augmentation like flip and rotate the images.
  • go on training after loading a trained model(currently we have to re-run the previous stages when we want to train a deeper model with the same parameter setting as a already trained model)
  • I have already develop the multithread one, but the time for predicting one image is slower than sequential one, since creating and destroying threads cost more time, I will optimize it and update it later.
  • I will also develop a version on GPU, and will also upload later.

THANKS

Many thanks goes to those appreciate my work.

if you have any question, contact me at [email protected] or [email protected], THANKS.

face-alignment-at-3000fps's People

Contributors

freesouls avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

face-alignment-at-3000fps's Issues

Illegal instruction (core dumped)

When i train using your source code, I got an error...
-> Illegal instruction (core dumped)

I use this parameters: (RAM 8.0G)

local_features_num_: 300
landmarks_num_per_face_: 68
regressor_stages_: 6
tree_depth_: 5
trees_num_per_forest_: 24
overlap_: 0.3
initial_guess_: 1
local_radius_by_stages_: 0.29 0.21 0.16 0.12 0.08 0.04


Loading training dataset...
face detector loaded : 1
loading images...
[ INFO:0] Initialize OpenCL runtime...
100 images loaded
200 images loaded
300 images loaded
400 images loaded
500 images loaded
600 images loaded
700 images loaded
800 images loaded
900 images loaded
1000 images loaded
1100 images loaded
1200 images loaded
1300 images loaded
1400 images loaded
1500 images loaded
1600 images loaded
1700 images loaded
get 1798 faces in total

Loading validation dataset...
face detector loaded : 1
loading images...
100 images loaded
200 images loaded
get 219 faces in total
Start training...
augment data sets
augmented size: 3596
training stage: 0 of 6
calculate regression targets
train forest of stage:0
it will take some time to build the Random Forest, please be patient!!!
landmark: landmark: landmark: 36landmark: 12
landmark: landmark: landmark: 53
landmark: build forest of landmark: 53 of stage: 0

42build forest of landmark: 12landmark: of stage: 0
58
build forest of landmark: 58 of stage: 0
48
build forest of landmark: 48 of stage: 0
63
18build forest of landmark: 42 of stage: 0
0
build forest of landmark: 0 of stage: 0
get pixel differences

get pixel differencesbuild forest of landmark: build forest of landmark: 18 of stage: 0
landmark: 30
get pixel differencesbuild forest of landmark: 30 of stage: 0
landmark: 24
build forest of landmark: 24 of stage: 0
landmark: build forest of landmark: 6
get pixel differencesbuild forest of landmark: 6 of stage: 0
36 of stage: 0
63 of stage: 0

get pixel differences
get pixel differences
get pixel differences

get pixel differencesget pixel differences

get pixel differences
get pixel differences
get pixel differences
landmark: 43
build forest of landmark: 43 of stage: 0
get pixel differences
landmark: 25
build forest of landmark: 25 of stage: 0
get pixel differences
landmark: 54
build forest of landmark: 54 of stage: 0
get pixel differences
landmark: 49
build forest of landmark: 49 of stage: 0
get pixel differences
landmark: 13
build forest of landmark: 13 of stage: 0
get pixel differences
landmark: 19
build forest of landmark: 19 of stage: 0
get pixel differences
landmark: 37
build forest of landmark: 37 of stage: 0
get pixel differences
landmark: 1
build forest of landmark: 1 of stage: 0
get pixel differences
landmark: 59
build forest of landmark: 59 of stage: 0
get pixel differences
landmark: 64
build forest of landmark: 64 of stage: 0
get pixel differences
landmark: 31
build forest of landmark: 31 of stage: 0
get pixel differences
landmark: 7
build forest of landmark: 7 of stage: 0
get pixel differences
landmark: 44
build forest of landmark: 44 of stage: 0
get pixel differences
landmark: 55
build forest of landmark: 55 of stage: 0
get pixel differences
landmark: 26
build forest of landmark: 26 of stage: 0
get pixel differences
landmark: 50
build forest of landmark: 50 of stage: 0
get pixel differences
landmark: 20
build forest of landmark: 20 of stage: 0
get pixel differences
landmark: 60
build forest of landmark: 60 of stage: 0
get pixel differences
landmark: 2
build forest of landmark: 2 of stage: 0
get pixel differences
landmark: 38
build forest of landmark: 38 of stage: 0
get pixel differences
landmark: 65
build forest of landmark: 65 of stage: 0
get pixel differences
landmark: 14
build forest of landmark: 14 of stage: 0
get pixel differences
landmark: 8
build forest of landmark: 8 of stage: 0
get pixel differences
landmark: 32
build forest of landmark: 32 of stage: 0
get pixel differences
landmark: 45
build forest of landmark: 45 of stage: 0
get pixel differences
landmark: 27
build forest of landmark: 27 of stage: 0
get pixel differences
landmark: 61
build forest of landmark: 61 of stage: 0
get pixel differences
landmark: 51
build forest of landmark: 51 of stage: 0
get pixel differences
landmark: 56
build forest of landmark: 56 of stage: 0
get pixel differences
landmark: 39
build forest of landmark: 39 of stage: 0
get pixel differences
landmark: 21
build forest of landmark: 21 of stage: 0
get pixel differences
landmark: 3
build forest of landmark: 3 of stage: 0
get pixel differences
landmark: 66
build forest of landmark: 66 of stage: 0
get pixel differences
landmark: 15
build forest of landmark: 15 of stage: 0
get pixel differences
landmark: 9
build forest of landmark: 9 of stage: 0
get pixel differences
landmark: 33
build forest of landmark: 33 of stage: 0
get pixel differences
landmark: 46
build forest of landmark: 46 of stage: 0
get pixel differences
landmark: 40
build forest of landmark: 40 of stage: 0
get pixel differences
landmark: 62
build forest of landmark: 62 of stage: 0
get pixel differences
landmark: 28
build forest of landmark: 28 of stage: 0
get pixel differences
landmark: 52
build forest of landmark: 52 of stage: 0
get pixel differences
landmark: 57
build forest of landmark: 57 of stage: 0
get pixel differences
landmark: 22
build forest of landmark: 22 of stage: 0
get pixel differences
landmark: 4
build forest of landmark: 4 of stage: 0
get pixel differences
landmark: 67
build forest of landmark: 67 of stage: 0
get pixel differences
landmark: 10
build forest of landmark: 10 of stage: 0
get pixel differences
landmark: 34
build forest of landmark: 34 of stage: 0
get pixel differences
landmark: 16
build forest of landmark: 16 of stage: 0
get pixel differences
landmark: 41
build forest of landmark: 41 of stage: 0
get pixel differences
landmark: 47
build forest of landmark: 47 of stage: 0
get pixel differences
landmark: 23
build forest of landmark: 23 of stage: 0
get pixel differences
landmark: 5
build forest of landmark: 5 of stage: 0
get pixel differences
landmark: 29
build forest of landmark: 29 of stage: 0
get pixel differences
landmark: 11
build forest of landmark: 11 of stage: 0
get pixel differences
landmark: 17
build forest of landmark: 17 of stage: 0
get pixel differences
landmark: 35
build forest of landmark: 35 of stage: 0
get pixel differences
Get Global Binary Features

Global Regression of stage 0
it will take some time to do Linear Regression, please be patient!!!
regressing ...regressing ...048
regressing ...24

regressing ...64
regressing ...8
regressing ...32
regressing ...56
regressing ...16
regressing ...40
predict regression targets
update current shapes
train regression error: 300.942, mean error: 0.0836881
Validation at stage: 0
Validation error: 21.8489, mean error: 0.0997666
training stage: 1 of 6
calculate regression targets
train forest of stage:1
it will take some time to build the Random Forest, please be patient!!!
landmark: landmark: 036
landmark: landmark:
build forest of landmark: 36 of stage: landmark: 153
landmark: 12
build forest of landmark: 0build forest of landmark: of stage: 121 of stage:
18
1build forest of landmark: 18 of stage: 1

build forest of landmark: 53 of stage: 1
landmark: landmark: landmark: 6358

landmark: 24landmark:

build forest of landmark: 58 of stage: 1
48landmark: 30
get pixel differencesbuild forest of landmark: 48 of stage:
get pixel differencesget pixel differences
6build forest of landmark: 30 of stage: 1
get pixel differences
42

1
build forest of landmark:
6 of stage: 1
build forest of landmark: 63 of stage: 1
get pixel differences

get pixel differencesbuild forest of landmark: 42 of stage: 1

get pixel differences
get pixel differences
build forest of landmark: 24 of stage: 1
get pixel differences
get pixel differences
get pixel differences
get pixel differences
landmark: 43
build forest of landmark: 43 of stage: 1
get pixel differences
landmark: 1
build forest of landmark: 1 of stage: 1
get pixel differences
landmark: 31
build forest of landmark: 31 of stage: 1
get pixel differences
landmark: 25
build forest of landmark: 25 of stage: 1
get pixel differences
landmark: 7
build forest of landmark: 7 of stage: 1
get pixel differences
landmark: 64
build forest of landmark: 64 of stage: 1
get pixel differences
landmark: 13
build forest of landmark: 13 of stage: 1
get pixel differences
landmark: 54
build forest of landmark: 54 of stage: 1
get pixel differences
landmark: 49
build forest of landmark: 49 of stage: 1
get pixel differences
landmark: 59
build forest of landmark: 59 of stage: 1
get pixel differences
landmark: 37
build forest of landmark: 37 of stage: 1
get pixel differences
landmark: 19
build forest of landmark: 19 of stage: 1
get pixel differences
Illegal instruction (core dumped)

fps of testing

hi, do you know how fast it is when testing on one image? have you analyse its fps? Thanks!

getSimilarityTransform得到的rotation是谁对谁的?

我单独把getSimilarityTransform的程序来出来跑了一下,发现得到的rotation是
shape_to * rotation = shape_from
从代码里来看,注释写的是
// get the rotation and scale parameters by transferring shape_from to shape_to, shape_to = M*shape_from
但是regressor.cpp 108这一段:
regression_targets[i] = ProjectShape(augmented_ground_truth_shapes[i], augmented_bboxes[i])
- ProjectShape(augmented_current_shapes[i], augmented_bboxes[i]);
cv::Mat_ rotation;
double scale;
getSimilarityTransform(params_.mean_shape_, ProjectShape(augmented_current_shapes[i], augmented_bboxes[i]), rotation, scale);
cv::transpose(rotation, rotation);
regression_targets[i] = scale * regression_targets[i] * rotation;
getSimilarityTransform(ProjectShape(augmented_current_shapes[i], augmented_bboxes[i]), params_.mean_shape_, rotation, scale);
rotations_[i] = rotation;
scales_[i] = scale;
第一次调用后对求得的rotation进行了转置(求逆),去得到论文中所表示的回归目标,即rotatiaon实际上是 M的逆?而且如果对rotation进行了转置,为何scale没有对应的取倒数?
rotations_[i]对应的就是第一次调用所求得的rotation的转置,即从projectshape到mean_shape的变换矩阵,这样的话,在后续求解randomforest的时候关系就乱了?

以二进制的形式保存和载入训练结果

感谢作者的工作~~!
以helen训练结果为例,载入需要将近2分钟,在移动端时间就更长了
我发现代码中提供了一个二进制保存和载入的接口,但是好像存在问题
是否能检查一下代码?

About the output

Hey,sorry to bother you,thank you for your code. It worked fine.
Though I have a question about the output:
The output only prints mean error, our messages such as time is not printed.
I read the _README.md_file but didn't find out.
How could I change the code and print testing time per picture?
Appreciates you!

Testing Configuration

Hello I am newbie in this research and tools. I have config exactly same with the instruction. I download the model that author given, so the path is ./example/helen_trained_model/helenModel_params.txt and I have download helen dataset so the path will be ./example/helen/testset/ . After that I am using this command to test the testing data ./application test ../example/helen_test_config_images_without_ground_truth.txt . However I got the error like in the image, anybody can give suggestions?

I also want to create the runable program which just input the image path, boundingbox coordinate, and the output filename. How can I get something like that?

-Thank you-

image

#include <omp.h> On MAC ?????

Users/anthonyyuan/desktop/src/face-alignment-at-3000fps-master 2/main.cpp:10:10: fatal error:
'omp.h' file not found
#include <omp.h>
^
1 error generated.
make[2]: *** [CMakeFiles/application.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/application.dir/all] Error 2
make: *** [all] Error 2

Error doesn't decrease

Hi,

First of all, thanks for this implementation.
I ran and trained successfully the previous version (before refactoring), but now I have troubles with training. As before, I followed the instructions in README, downloaded HELEN dataset, put it in example/helen. The reported error rate is:

training stage: 0 of 6
train regression error: 1071.14, mean error: 0.149516
Validation at stage: 0
Validation error: 37.3754, mean error: 0.120178

training stage: 1 of 6
train regression error: 847.716, mean error: 0.11833
Validation at stage: 1
Validation error: 32.5232, mean error: 0.104576

training stage: 2 of 6
train regression error: 735.792, mean error: 0.102707
Validation at stage: 2
Validation error: 30.7561, mean error: 0.0988942

training stage: 3 of 6
train regression error: 803.279, mean error: 0.112127
Validation at stage: 3
Validation error: 36.0491, mean error: 0.115914

training stage: 4 of 6
train regression error: 752.986, mean error: 0.105107
Validation at stage: 4
Validation error: 35.4158, mean error: 0.113877

training stage: 5 of 6
train regression error: 791.054, mean error: 0.110421
Validation at stage: 5
Validation error: 38.1961, mean error: 0.122817

finish training, start to saving the model...
model name: helenModel
save the model successfully

Obviously, the quality is then rather poor:

landmarks

Maybe I'm doing something wrong?

modelSize

Hi the 68pts model is over 150M, i see the other luoyet-3000fps only 35M ,Why is there such a big difference

Error Computing

Hi freesouls,
I am not understand that why you calculate test error by divide the distance between eyes? Can you explain your intentions?Furthermore, is it possible to downsize the shape predicator model?Thanks!

mean shape的偏移

我训练完模型后,发现利用opencv人脸检测后的box,都成产生了向-y轴偏移,你在训练中有没有碰到过这个问题

OpenCV Error: Insufficient memory

I got this error when I train the model.
OpenCV Error: Insufficient memory (Failed to allocate 15352004 bytes) in cv::OutOfMemoryError, file C:\builds\2_4_PackSlave-win32-vc12-shared\opencv\modules\core\src\alloc.cpp, line 52
I change to use libfacedetection library. And I also use 6 cores CPU (12 threads).
Do you know why it happened?

关于特征点数量伸缩

Hi~先谢谢你的代码实现啊,很棒。

有个问题想请教一下,我打算把helen, lfpw和afw的*.pts中的特征点缩减为5个(鼻尖,两个眼睛的两端),然而训练的结果不尽如人意。
已经修改了一些地方,比如utils.cpp中的calculateError中:

double CalculateError(cv::Mat_<double>& ground_truth_shape, cv::Mat_<double>& predicted_shape){
    // ...
    //鼻尖为index 0,两个眼睛端点分别为1,2和3,4
    temp = ground_truth_shape.rowRange(1, 3)-ground_truth_shape.rowRange(3, 5); 
    //...
}

这是我用来训练的配置文件和一个缩减过的pts文件:

//train config file(没有做太多修改,正在尝试调参数)
newModel
300
5
6
5
12
3
0.3
0.29
0.21
0.16
0.12
0.08
0.04
2
./lfpw/
./lfpw.txt
./helen/
./helen.txt

//a sample pts file(afw/134212_1.pts)
version: 1
n_points: 5
{
766.366 287.332
730.676 230.253
764.738 227.763
813.433 227.625
855.689 227.233
}

这里是我做好的afw,helen和lfpw缩减为5个点的pts文件: http://pan.baidu.com/s/1nvfD9Zr
不知道代码还有哪些地方需要改,我没有注意到?或者train configure文件需要调整?谢谢解答

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.