| 478 | // ---------------------------------------------------------------------------------------- |
| 479 | |
| 480 | void test_1_boxes ( |
| 481 | ) |
| 482 | { |
| 483 | print_spinner(); |
| 484 | dlog << LINFO << "test_1_boxes()"; |
| 485 | |
| 486 | typedef dlib::array<array2d<unsigned char> > grayscale_image_array_type; |
| 487 | grayscale_image_array_type images; |
| 488 | std::vector<std::vector<rectangle> > object_locations; |
| 489 | make_simple_test_data(images, object_locations); |
| 490 | |
| 491 | typedef hashed_feature_image<hog_image<3,3,1,4,hog_signed_gradient,hog_full_interpolation> > feature_extractor_type; |
| 492 | typedef scan_image_boxes<feature_extractor_type> image_scanner_type; |
| 493 | image_scanner_type scanner; |
| 494 | setup_hashed_features(scanner, images, 9); |
| 495 | use_uniform_feature_weights(scanner); |
| 496 | structural_object_detection_trainer<image_scanner_type> trainer(scanner); |
| 497 | trainer.set_num_threads(4); |
| 498 | trainer.set_overlap_tester(test_box_overlap(0,0)); |
| 499 | object_detector<image_scanner_type> detector = trainer.train(images, object_locations); |
| 500 | |
| 501 | matrix<double> res = test_object_detection_function(detector, images, object_locations); |
| 502 | dlog << LINFO << "Test detector (precision,recall): " << res; |
| 503 | DLIB_TEST(sum(res) == 3); |
| 504 | |
| 505 | { |
| 506 | ostringstream sout; |
| 507 | serialize(detector, sout); |
| 508 | istringstream sin(sout.str()); |
| 509 | object_detector<image_scanner_type> d2; |
| 510 | deserialize(d2, sin); |
| 511 | matrix<double> res = test_object_detection_function(d2, images, object_locations); |
| 512 | dlog << LINFO << "Test detector (precision,recall): " << res; |
| 513 | DLIB_TEST(sum(res) == 3); |
| 514 | |
| 515 | validate_some_object_detector_stuff(images, detector); |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | // ---------------------------------------------------------------------------------------- |
| 520 |
no test coverage detected