| 49 | } |
| 50 | |
| 51 | void perform_test() |
| 52 | { |
| 53 | print_spinner(); |
| 54 | dlib::array<array2d<unsigned char> > images; |
| 55 | std::vector<std::vector<full_object_detection> > objects; |
| 56 | get_test_face_landmark_dataset(images, objects); |
| 57 | |
| 58 | frontal_face_detector detector = get_frontal_face_detector(); |
| 59 | |
| 60 | print_spinner(); |
| 61 | shape_predictor_trainer trainer; |
| 62 | trainer.set_tree_depth(2); |
| 63 | trainer.set_nu(0.05); |
| 64 | //trainer.be_verbose(); |
| 65 | |
| 66 | shape_predictor sp = trainer.train(images, objects); |
| 67 | |
| 68 | print_spinner(); |
| 69 | |
| 70 | // It should have been able to perfectly fit the data |
| 71 | DLIB_TEST(test_shape_predictor(sp, images, objects) == 0); |
| 72 | |
| 73 | print_spinner(); |
| 74 | |
| 75 | // While we are here, make sure the default face detector works |
| 76 | std::vector<rectangle> dets = detector(images[0]); |
| 77 | DLIB_TEST(dets.size() == 3); |
| 78 | |
| 79 | |
| 80 | /* |
| 81 | // visualize the detections |
| 82 | std::vector<full_object_detection> shapes; |
| 83 | for (unsigned long j = 0; j < dets.size(); ++j) |
| 84 | { |
| 85 | full_object_detection shape = sp(images[0], dets[j]); |
| 86 | shapes.push_back(shape); |
| 87 | } |
| 88 | image_window win(images[0]); |
| 89 | win.add_overlay(render_face_detections(shapes)); |
| 90 | cin.get(); |
| 91 | */ |
| 92 | |
| 93 | } |
| 94 | |
| 95 | |
| 96 | // ------------------------------------------------------------------------------------ |
nothing calls this directly
no test coverage detected