luoyetx / JDA

C++ implementation of Joint Cascade Face Detection and Alignment.
BSD 3-Clause "New" or "Revised" License
184 stars 140 forks source link

Cann't complete training process #23

Open ardeal opened 8 years ago

ardeal commented 8 years ago

The training algorithms keeps on printing: [05/10/16 - 17:18:51] Reset current_idx and restart, reset times = 148 [05/10/16 - 17:18:51] Current augment parameters, should flip = 1, rotation angle = 0 [05/10/16 - 17:18:54] Run out of background images [05/10/16 - 17:18:54] Reset current_idx and restart, reset times = 149 [05/10/16 - 17:18:54] Current augment parameters, should flip = 1, rotation angle = 90

the code goes into this function, but cannot go out of it: nega_n += hardNegaMining(joincascador, img, imgs, scores, shapes);

in hardNegaMining function, bool is_face = joincascador.Validate(img(o), img_h(h), img_q(q), score, shape, n); if (is_face) {

pragma omp critical

      {
        imgs.push_back(img(o).clone());
        scores.push_back(score);
        shapes.push_back(shape);
      }
    }

it tries to find a face in negative samples. it seems impossible.

luoyetx commented 8 years ago

Hard negative mining is to find the false positive samples in background images. You are short of background images too badly. The reset times shouldn't be too large, usually, reset will happen if you use up the whole background images and it will reuse the images with some transforms. You should gather more background images to feed the algorithm.

ardeal commented 8 years ago

According to my knowledge, even if we have much less training samples, the algorithms can be trained correctly. The only problem should be that the classification or regression accuracy is not good. so, if I input much less samples for training, the training algorithms should be able to ended up correctly.

luoyetx commented 8 years ago

The problem here is that hard negative mining process can not generate enough negative patches from background images. This means your model trained at this time is good enough to reject negative patches, which also means the model is trained well and the algorithm can be ended. Maybe we need to stop the training and return the model as the final model, if several reset happens.

BTW, I think a small training data should feed to a small model. If you really not have many face images and background images, you should set the parameters with a small model :)