| 568 | // ---------------------------------------------------------------------------------------- |
| 569 | |
| 570 | void test_1_fine_hog ( |
| 571 | ) |
| 572 | { |
| 573 | print_spinner(); |
| 574 | dlog << LINFO << "test_1_fine_hog()"; |
| 575 | |
| 576 | typedef dlib::array<array2d<unsigned char> > grayscale_image_array_type; |
| 577 | grayscale_image_array_type images; |
| 578 | std::vector<std::vector<rectangle> > object_locations; |
| 579 | make_simple_test_data(images, object_locations); |
| 580 | |
| 581 | typedef hashed_feature_image<fine_hog_image<3,3,2,4,hog_signed_gradient> > feature_extractor_type; |
| 582 | typedef scan_image_pyramid<pyramid_down<2>, feature_extractor_type> image_scanner_type; |
| 583 | image_scanner_type scanner; |
| 584 | const rectangle object_box = compute_box_dimensions(1,35*35); |
| 585 | scanner.add_detection_template(object_box, create_grid_detection_template(object_box,2,2)); |
| 586 | setup_hashed_features(scanner, images, 9); |
| 587 | use_uniform_feature_weights(scanner); |
| 588 | structural_object_detection_trainer<image_scanner_type> trainer(scanner); |
| 589 | trainer.set_num_threads(4); |
| 590 | trainer.set_overlap_tester(test_box_overlap(0,0)); |
| 591 | object_detector<image_scanner_type> detector = trainer.train(images, object_locations); |
| 592 | |
| 593 | matrix<double> res = test_object_detection_function(detector, images, object_locations); |
| 594 | dlog << LINFO << "Test detector (precision,recall): " << res; |
| 595 | DLIB_TEST(sum(res) == 3); |
| 596 | |
| 597 | { |
| 598 | ostringstream sout; |
| 599 | serialize(detector, sout); |
| 600 | istringstream sin(sout.str()); |
| 601 | object_detector<image_scanner_type> d2; |
| 602 | deserialize(d2, sin); |
| 603 | matrix<double> res = test_object_detection_function(d2, images, object_locations); |
| 604 | dlog << LINFO << "Test detector (precision,recall): " << res; |
| 605 | DLIB_TEST(sum(res) == 3); |
| 606 | |
| 607 | validate_some_object_detector_stuff(images, detector); |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | // ---------------------------------------------------------------------------------------- |
| 612 |
no test coverage detected