luoyetx / face-alignment-at-3000fps

C++ implementation of Face Alignment at 3000 FPS via Regressing Local Binary Features
BSD 3-Clause "New" or "Revised" License
197 stars 120 forks source link

why current_shapes[idx] = bboxes_[i].ReProject(bboxes_[k].Project(gt_shapes_[k])) ? #8

Open xiaoxiongli opened 7 years ago

xiaoxiongli commented 7 years ago

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
    }
}
luoyetx commented 7 years ago

You can init the shape with mean shape. If you want a data augment, you can also random shift the init shape. Init the shape using other face's ground truth shape is some like data augment if you use multi shapes.