MCPcopy Create free account
hub / github.com/davisking/dlib / test_1m_poly

Function test_1m_poly

dlib/test/object_detector.cpp:656–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

654// ----------------------------------------------------------------------------------------
655
656 void test_1m_poly (
657 )
658 {
659 print_spinner();
660 dlog << LINFO << "test_1_poly()";
661
662 typedef dlib::array<array2d<unsigned char> > grayscale_image_array_type;
663 grayscale_image_array_type images;
664 std::vector<std::vector<full_object_detection> > object_locations;
665 make_simple_test_data(images, object_locations);
666
667 typedef hashed_feature_image<poly_image<2> > feature_extractor_type;
668 typedef scan_image_pyramid<pyramid_down<3>, feature_extractor_type> image_scanner_type;
669 image_scanner_type scanner;
670 const rectangle object_box = compute_box_dimensions(1,35*35);
671 std::vector<rectangle> mboxes;
672 const int mbox_size = 20;
673 mboxes.push_back(centered_rect(0,0, mbox_size,mbox_size));
674 mboxes.push_back(centered_rect(0,0, mbox_size,mbox_size));
675 mboxes.push_back(centered_rect(0,0, mbox_size,mbox_size));
676 mboxes.push_back(centered_rect(0,0, mbox_size,mbox_size));
677 scanner.add_detection_template(object_box, create_grid_detection_template(object_box,2,2), mboxes);
678 setup_hashed_features(scanner, images, 9);
679 use_uniform_feature_weights(scanner);
680 structural_object_detection_trainer<image_scanner_type> trainer(scanner);
681 trainer.set_num_threads(4);
682 trainer.set_overlap_tester(test_box_overlap(0,0));
683 object_detector<image_scanner_type> detector = trainer.train(images, object_locations);
684
685 matrix<double> res = test_object_detection_function(detector, images, object_locations);
686 dlog << LINFO << "Test detector (precision,recall): " << res;
687 DLIB_TEST(sum(res) == 3);
688
689 {
690 ostringstream sout;
691 serialize(detector, sout);
692 istringstream sin(sout.str());
693 object_detector<image_scanner_type> d2;
694 deserialize(d2, sin);
695 matrix<double> res = test_object_detection_function(d2, images, object_locations);
696 dlog << LINFO << "Test detector (precision,recall): " << res;
697 DLIB_TEST(sum(res) == 3);
698
699 validate_some_object_detector_stuff(images, detector);
700 }
701 }
702
703// ----------------------------------------------------------------------------------------
704

Callers 1

perform_testMethod · 0.85

Calls 15

print_spinnerFunction · 0.85
compute_box_dimensionsFunction · 0.85
centered_rectFunction · 0.85
setup_hashed_featuresFunction · 0.85
set_overlap_testerMethod · 0.80
make_simple_test_dataFunction · 0.70
serializeFunction · 0.70
deserializeFunction · 0.70
test_box_overlapClass · 0.50

Tested by

no test coverage detected