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

Function throw_invalid_box_error_message

tools/python/src/simple_object_detector.h:117–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115 }
116
117 inline void throw_invalid_box_error_message (
118 const std::string& dataset_filename,
119 const std::vector<std::vector<rectangle> >& removed,
120 const simple_object_detector_training_options& options
121 )
122 {
123
124 std::ostringstream sout;
125 // Note that the 1/16 factor is here because we will try to upsample the image
126 // 2 times to accommodate small boxes. We also take the max because we want to
127 // lower bound the size of the smallest recommended box. This is because the
128 // 8x8 HOG cells can't really deal with really small object boxes.
129 sout << "Error! An impossible set of object boxes was given for training. ";
130 sout << "All the boxes need to have a similar aspect ratio and also not be ";
131 sout << "smaller than about " << std::max<long>(20*20,options.detection_window_size/16) << " pixels in area. ";
132
133 std::ostringstream sout2;
134 if (dataset_filename.size() != 0)
135 {
136 sout << "The following images contain invalid boxes:\n";
137 image_dataset_metadata::dataset data;
138 load_image_dataset_metadata(data, dataset_filename);
139 for (unsigned long i = 0; i < removed.size(); ++i)
140 {
141 if (removed[i].size() != 0)
142 {
143 const std::string imgname = data.images[i].filename;
144 sout2 << " " << imgname << "\n";
145 }
146 }
147 }
148 throw error("\n"+wrap_string(sout.str()) + "\n" + sout2.str());
149 }
150 }
151
152// ----------------------------------------------------------------------------------------

Calls 5

errorClass · 0.85
wrap_stringFunction · 0.85
sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected