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

Function test_1_poly_nn_boxes

dlib/test/object_detector.cpp:751–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

749// ----------------------------------------------------------------------------------------
750
751 void test_1_poly_nn_boxes (
752 )
753 {
754 print_spinner();
755 dlog << LINFO << "test_1_poly_nn_boxes()";
756
757 typedef dlib::array<array2d<unsigned char> > grayscale_image_array_type;
758 grayscale_image_array_type images;
759 std::vector<std::vector<rectangle> > object_locations;
760 make_simple_test_data(images, object_locations);
761
762 typedef nearest_neighbor_feature_image<poly_image<5> > feature_extractor_type;
763 typedef scan_image_boxes<feature_extractor_type> image_scanner_type;
764 image_scanner_type scanner;
765
766 feature_extractor_type nnfe;
767 pyramid_down<2> pyr_down;
768 poly_image<5> polyi;
769 nnfe.set_basis(randomly_sample_image_features(images, pyr_down, polyi, 80));
770 scanner.copy_configuration(nnfe);
771
772 structural_object_detection_trainer<image_scanner_type> trainer(scanner);
773 trainer.set_num_threads(4);
774 object_detector<image_scanner_type> detector = trainer.train(images, object_locations);
775
776 matrix<double> res = test_object_detection_function(detector, images, object_locations);
777 dlog << LINFO << "Test detector (precision,recall): " << res;
778 DLIB_TEST(sum(res) == 3);
779
780 {
781 ostringstream sout;
782 serialize(detector, sout);
783 istringstream sin(sout.str());
784 object_detector<image_scanner_type> d2;
785 deserialize(d2, sin);
786 matrix<double> res = test_object_detection_function(d2, images, object_locations);
787 dlog << LINFO << "Test detector (precision,recall): " << res;
788 DLIB_TEST(sum(res) == 3);
789
790 validate_some_object_detector_stuff(images, detector);
791 }
792 }
793
794// ----------------------------------------------------------------------------------------
795

Callers 1

perform_testMethod · 0.85

Calls 13

print_spinnerFunction · 0.85
make_simple_test_dataFunction · 0.70
serializeFunction · 0.70
deserializeFunction · 0.70
sumFunction · 0.50
set_basisMethod · 0.45
copy_configurationMethod · 0.45
set_num_threadsMethod · 0.45
trainMethod · 0.45

Tested by

no test coverage detected