luoyetx / face-alignment-at-3000fps Goto Github PK
View Code? Open in Web Editor NEWC++ implementation of Face Alignment at 3000 FPS via Regressing Local Binary Features
License: BSD 3-Clause "New" or "Revised" License
C++ implementation of Face Alignment at 3000 FPS via Regressing Local Binary Features
License: BSD 3-Clause "New" or "Revised" License
When I try to ./FaceAlignment prepare
:
FaceAlignment: /home/bh/git/face-alignment-at-3000fps/src/prepare.cpp:49: void genTxt(const string&, const string&): Assertion `inFile && outFile' failed.
我想测试一下该算法的精度,能够分享一份已经训练好的模型吗?谢谢~!!我的邮箱[email protected]
I've tried jwyang's implementation of the algorithm. The result is quite poor. I tired it on webcam, and the points detected are always shaking. and the side face detection is also unacceptable. So what is the differences between your code and jwyang's. Any improvement on that?
Hi
thank you for your sharing code. can you provide a pre-train model?
thanks
The dataset required by this algorithm is offline (http://ibug.doc.ic.ac.uk/resources/facial-point-annotations)
Another mirror is required.
I suggest putting it on the repo.
line 49 from prepare.cpp: assert(inFile && outFile);
./FaceAlignment prepare
FaceAlignment: /home/bh/git/alignment/face1/src/prepare.cpp:49: void genTxt(const string&, const string&): Assertion `inFile && outFile' failed.
[1] 8831 abort (core dumped) ./FaceAlignment prepare
Dear luoyetx,
The code on your github could do memory Error when runing 'train' on building under X64 mode.
lbp.cpp
#define FREE_MODEL(model)
That wasn't happend on running under X86 mode.
Did that happened before?
@luoyetx
Regards!
Rui
Hi
I see in the data_augmentation function of train.cpp, there is macro SWAP. I am worried that it destroys the data integrity. May I know why this is being done ?
Thank you
Dear luoyetx,
i am reading your code, and i find that in the trian.cpp, line 180, i can not understand why we do like this? one face's initial shape is initialize by another face?
int N = imgs_.size();
int L = N*config.initShape_n;
vector<Mat> imgs(L), gt_shapes(L), current_shapes(L);
vector<BBox> bboxes(L);
RNG rng(getTickCount());
for (int i = 0; i < N; i++) {
for (int j = 0; j < config.initShape_n; j++) {
int idx = i*config.initShape_n + j;
int k = 0;
do {
//if (i < (N / 2)) k = rng.uniform(0, N / 2);
//else k = rng.uniform(N / 2, N);
k = rng.uniform(0, N);
} while (k == i);
imgs[idx] = imgs_[i];
gt_shapes[idx] = gt_shapes_[i];
bboxes[idx] = bboxes_[i];
current_shapes[idx] = bboxes_[i].ReProject(bboxes_[k].Project(gt_shapes_[k])); <----line 180
}
}
Hi, i successed in training the model using 300w which contain about 4k images.
but when i do data-argument(including rotation and offset faceRect),the images from 4K to 100k.
and when training again,it occur a error ,i find in function parseTxt(), the cpu available from 28G to 1G
after loading about 18k images.
how can i solve the problem about cpu memory.
Thanks
数据库是不是只要往Path_Images_train.txt和Path_Images_test.txt中写好.jpg和.pts的路径就好了?训练集大概需要多少张图片呢
The dataset required by this algorithm is offline.
Another mirror is required.
I suggest putting it on the repo.
in common.cpp line 210.
int pupils[][6] = { { 36, 37, 38, 39, 40, 41 }, { 42, 43, 44, 45, 46, 47 } };
but in the ibug dataset landmarks, pupils should be 37 to 42, and 43 to 48.
Hi,
I see that the calcSimilarityTransform() function always returns identity matrix for rotation and only the scale is computed which is also close to 1 in almost all the cases. Is this a bug in the function or is it how it should be ? (Mean face landmarks are always vertical because of the flipped shapes.)
Because, if you use lfpw/afw/helen datasets, there are many cases where the face is not vertical but tilted up to some degrees. It returns identity rotation in these cases as well.
Could you help me with this problem ?
Thanks
for (int i = 0; i < N; i++) {
fscanf(fd, "%s", img_path);
for (int j = 0; j < 4; j++) {
fscanf(fd, "%lf", &bbox[j]);
}
for (int j = 0; j < landmark_n; j++) {
fscanf(fd, "%lf%lf", &x[j], &y[j]);
}
Mat img = imread(img_path);
// crop img
double x_min, y_min, x_max, y_max;
x_min = *min_element(x.begin(), x.end());
x_max = *max_element(x.begin(), x.end());
y_min = *min_element(y.begin(), y.end());
y_max = *max_element(y.begin(), y.end());
x_min = max(0., x_min - bbox[2] / 2);
x_max = min(img.cols - 1., x_max + bbox[2] / 2);
y_min = max(0., y_min - bbox[3] / 2);
y_max = min(img.rows - 1., y_max + bbox[3] / 2);
double x_, y_, w_, h_;
x_ = x_min; y_ = y_min;
w_ = x_max - x_min; h_ = y_max - y_min;
BBox bbox_(bbox[0] - x_, bbox[1] - y_, bbox[2], bbox[3]);
Rect roi(x_, y_, w_, h_);
img = img(roi).clone();
Mat gray;
cvtColor(img, gray, CV_BGR2GRAY);
LOG("Run %s", img_path);
Mat shape = lbf_cascador.Predict(gray, bbox_);
img = drawShapeInImage(img, shape, bbox_);
imshow("landmark", img);
waitKey(0);
}
test的时候用到了ground truth的数据,是不是在做另外其他图像没有.pts文件就不能检测了?
luoyetx:
你的dataset挂了,能不能提供一个有效的dataset地址?
我把3000fps运行程序在i5的电脑上运行速度是4ms左右,然而将代码移植到arm-v7 的开发板上运行,运行速度是90ms 左右,正常情况下,电脑和板子的速度比是1:6;请问是什么原因呢?
$ ./FaceAlignment prepare
$ ./FaceAlignment: /home/bh/anaconda3/lib/libgomp.so.1: version `GOMP_4.0' not found (required by ./FaceAlignment)
$ ./FaceAlignment: /home/bh/anaconda3/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./FaceAlignment)
Trying to use ./FaceAlignment prepare
causes this error, related to wrong library versions.
Any tip to solve this?
I understood this code.
'double m1 = cv::mean(vec_)[0];'
'double m2 = cv::mean(vec_.mul(vec_))[0];'
'double variance = m2 - m1*m1;'
But I don't understand formula below.
'double variance_all = (calcVariance(delta_shapes.col(0)) + calcVariance(delta_shapes.col(1)))*N;'
Does 2-D variance addition each 1-dimensional variance?
What means of N?
N is count of training sample. But I don't understand why multiply N.
Could you please provide some reference material?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.