###Face Alignment
This program is a C++ reimplementation of algorithms in paper "Face Alignment by Explicit Regression"
by Cao et al. This program can be used to train models for detecting facial keypoints, and it is
extremely fast both in training and testing.
Please go to folder `FaceAlignment` to see the source files.
###Update
* Nov 13, 2014
Improve the speed of model training. Now it takes about 40 min to train a model on 1345 images with 20 initial for each on a Core i7 3.40 GHz CPU. Considering no parallel programing is used, this performance is acceptable.
###Usage
To compile the program(OpenCV required):
```
// Go to folder FaceAlignment
cmake .
make TrainDemo.out
make TestDemo.out
```
To train a new model:
``` C++
ShapeRegressor regressor;
regressor.Train(images,ground_truth_shapes,bounding_box,first_level_num,second_level_num,
candidate_pixel_num,fern_pixel_num,initial_number);
regressor.Save("./data/model.txt");
```
To predict a new input:
``` C++
ShapeRegressor regressor;
regressor.load("./data/model_cofw_2.txt");
regressor.Predict(test_images[index],bounding_box[index],initial_number);
```
For details, please see `TrainDemo.cpp` and `TestDemo.cpp`.
###Dataset
A public dataset is provided [here](https://drive.google.com/file/d/0B0tUTCaZBkccUU5hVkNJTFB0VDQ/edit?usp=sharing). The dataset contains 1345 training images, 507 testing images, and each image has 29 landmarks. You can change the path
in `TrainDemo.cpp` and `TestDemo.cpp` to train new models.
###Model
I have prepared a model trained by me on COFW dataset, and you can access it [here](https://drive.google.com/file/d/0B0tUTCaZBkccOGZTcjJNcDMwa28/edit?usp=sharing).
###FAQ
* **How to get the bounding box of an input face image?**
You can get the bounding box with a face detector, which has been implemented in OpenCV. However, do remember that, if you use the model provided by me, **you must provide a bounding box of similar measure with the training data**. Otherwise, the result will be poor. If the bounding box of training data is very small, but you provide a very big bounding box for testing data, it is certain that you will get a poor result. Here the same measure doesn't mean that they have to be the same size, but they have to be taken using the same standard, for example, the ratio between bounding box width and the two-eye distance should be the same.
* **It seems that there are still some errors when I do testing, so is there any problem?**
Generally speaking, the dataset attached is very challenging because it includes heavy occlusions and large
shape variations. You could try other standard datasets such as Helen and LFW, which should lead to better performance.
* **Format of `keypoints.txt` and `boundingbox.txt`?**
For `boundingbox.txt`, each row is in the following format, specifying the bounding box of a face in the corresponding image:
```
x // x coordinates of top-left corner
y // y coordinates of top-right corner
width
height
```
For `keypoints.txt`, each row is in the following format, specifying the ground truth of keypoints locations:
```
x_1 x_2 ... x_N y_1 y_2 ... y_N
```
###Contact
If you have any question about the code, I prefer that you create an **issue** on GitHub rather than send me emails directly, so that others can also refer to it when they have problems. I will respond to it as soon as possible.
###Sample Results
![Sample Results](https://dl.dropboxusercontent.com/u/47747425/Photo/point1.png)
###Reference papers:
[Face Alignment by Explicit Shape Regression](http://research.microsoft.com/pubs/192097/cvpr12_facealignment.pdf)
没有合适的资源?快使用搜索试试~ 我知道了~
ESR.zip
共1878个文件
jpg:1853个
cpp:7个
txt:6个
需积分: 50 47 下载量 59 浏览量
2017-01-05
16:01:40
上传
评论 5
收藏 89.79MB ZIP 举报
温馨提示
ESR人脸对齐,c++代码,包含了论文,29个点的Model,COFW数据集,训练和测试的代码都封装进去,运行环境vs2010,opencv。
资源推荐
资源详情
资源评论
收起资源包目录
ESR.zip (1878个子文件)
Fern.cpp 11KB
FernCascade.cpp 9KB
ShapeRegressor.cpp 8KB
TestDemo.cpp 5KB
Utils.cpp 5KB
TrainDemo.cpp 3KB
Demo.cpp 148B
.DS_Store 102KB
.DS_Store 42KB
ESR.vcxproj.filters 2KB
FaceAlignment.h 6KB
3.jpg 122KB
1184.jpg 116KB
859.jpg 108KB
191.jpg 108KB
1297.jpg 100KB
112.jpg 86KB
862.jpg 84KB
625.jpg 83KB
1278.jpg 80KB
309.jpg 80KB
61.jpg 79KB
1097.jpg 78KB
1246.jpg 76KB
435.jpg 73KB
1082.jpg 73KB
1323.jpg 71KB
619.jpg 71KB
620.jpg 69KB
355.jpg 67KB
257.jpg 64KB
424.jpg 64KB
658.jpg 63KB
371.jpg 61KB
1190.jpg 61KB
281.jpg 61KB
135.jpg 60KB
1111.jpg 59KB
1209.jpg 55KB
1084.jpg 55KB
370.jpg 54KB
483.jpg 53KB
208.jpg 53KB
303.jpg 52KB
635.jpg 52KB
368.jpg 52KB
302.jpg 52KB
588.jpg 52KB
249.jpg 51KB
997.jpg 51KB
49.jpg 51KB
738.jpg 51KB
67.jpg 49KB
71.jpg 49KB
473.jpg 48KB
795.jpg 48KB
642.jpg 48KB
336.jpg 48KB
632.jpg 48KB
694.jpg 48KB
1262.jpg 47KB
135.jpg 46KB
631.jpg 46KB
617.jpg 46KB
615.jpg 46KB
653.jpg 46KB
14.jpg 45KB
608.jpg 44KB
623.jpg 44KB
140.jpg 44KB
345.jpg 43KB
86.jpg 43KB
603.jpg 43KB
433.jpg 42KB
890.jpg 42KB
442.jpg 42KB
1109.jpg 42KB
1344.jpg 41KB
853.jpg 41KB
569.jpg 41KB
1164.jpg 41KB
33.jpg 40KB
1149.jpg 40KB
1026.jpg 40KB
1160.jpg 40KB
711.jpg 40KB
1174.jpg 40KB
856.jpg 40KB
1276.jpg 40KB
1325.jpg 39KB
125.jpg 39KB
448.jpg 39KB
952.jpg 39KB
177.jpg 39KB
325.jpg 39KB
1287.jpg 39KB
647.jpg 38KB
206.jpg 38KB
306.jpg 38KB
1139.jpg 38KB
共 1878 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19
资源评论
watersink
- 粉丝: 5176
- 资源: 87
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功