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

Function test_object_detection_function

dlib/dnn/validation.h:33–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 typename image_array_type
32 >
33 const matrix<double,1,3> test_object_detection_function (
34 loss_mmod<SUBNET>& detector,
35 const image_array_type& images,
36 const std::vector<std::vector<mmod_rect>>& truth_dets,
37 const test_box_overlap& overlap_tester = test_box_overlap(),
38 const double adjust_threshold = 0,
39 const test_box_overlap& overlaps_ignore_tester = test_box_overlap()
40 )
41 {
42 // make sure requires clause is not broken
43 DLIB_CASSERT( is_learning_problem(images,truth_dets) == true ,
44 "\t matrix test_object_detection_function()"
45 << "\n\t invalid inputs were given to this function"
46 << "\n\t is_learning_problem(images,truth_dets): " << is_learning_problem(images,truth_dets)
47 << "\n\t images.size(): " << images.size()
48 );
49
50
51
52 double correct_hits = 0;
53 double total_true_targets = 0;
54
55 std::vector<std::pair<double,bool> > all_dets;
56 unsigned long missing_detections = 0;
57
58 resizable_tensor temp;
59
60 for (unsigned long i = 0; i < images.size(); ++i)
61 {
62 std::vector<mmod_rect> hits;
63 detector.to_tensor(&images[i], &images[i]+1, temp);
64 detector.subnet().forward(temp);
65 detector.loss_details().to_label(temp, detector.subnet(), &hits, adjust_threshold);
66
67
68 for (auto& label : impl::get_labels(truth_dets[i], hits))
69 {
70 std::vector<full_object_detection> truth_boxes;
71 std::vector<rectangle> ignore;
72 std::vector<std::pair<double,rectangle>> boxes;
73 // copy hits and truth_dets into the above three objects
74 for (auto&& b : truth_dets[i])
75 {
76 if (b.ignore)
77 {
78 ignore.push_back(b);
79 }
80 else if (b.label == label)
81 {
82 truth_boxes.push_back(full_object_detection(b.rect));
83 ++total_true_targets;
84 }
85 }
86 for (auto&& b : hits)
87 {
88 if (b.label == label)
89 boxes.push_back(std::make_pair(b.detection_confidence, b.rect));
90 }

Callers 15

test_fhog_pyramidFunction · 0.50
test_1Function · 0.50
test_1_boxesFunction · 0.50
test_1mFunction · 0.50
test_1_fine_hogFunction · 0.50
test_1_polyFunction · 0.50
test_1m_polyFunction · 0.50
test_1_poly_nnFunction · 0.50
test_1_poly_nn_boxesFunction · 0.50
test_2Function · 0.50
test_3Function · 0.50

Calls 13

is_learning_problemFunction · 0.85
get_labelsFunction · 0.85
number_of_truth_hitsFunction · 0.85
average_precisionFunction · 0.85
rbeginMethod · 0.80
rendMethod · 0.80
test_box_overlapClass · 0.50
sizeMethod · 0.45
to_tensorMethod · 0.45
forwardMethod · 0.45
to_labelMethod · 0.45

Tested by

no test coverage detected