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

Function test_1_boxes

dlib/test/object_detector.cpp:480–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

perform_testMethod · 0.85

Calls 14

print_spinnerFunction · 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
sumFunction · 0.50
set_num_threadsMethod · 0.45

Tested by

no test coverage detected