MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / DecodeLocation

Function DecodeLocation

tensorflow/examples/multibox_detector/main.cc:214–234  ·  view source on GitHub ↗

Converts an encoded location to an actual box placement with the provided box priors.

Source from the content-addressed store, hash-verified

212// Converts an encoded location to an actual box placement with the provided
213// box priors.
214void DecodeLocation(const float* encoded_location, const float* box_priors,
215 float* decoded_location) {
216 bool non_zero = false;
217 for (int i = 0; i < 4; ++i) {
218 const float curr_encoding = encoded_location[i];
219 non_zero = non_zero || curr_encoding != 0.0f;
220
221 const float mean = box_priors[i * 2];
222 const float std_dev = box_priors[i * 2 + 1];
223
224 float currentLocation = curr_encoding * std_dev + mean;
225
226 currentLocation = std::max(currentLocation, 0.0f);
227 currentLocation = std::min(currentLocation, 1.0f);
228 decoded_location[i] = currentLocation;
229 }
230
231 if (!non_zero) {
232 LOG(WARNING) << "No non-zero encodings; check log for inference errors.";
233 }
234}
235
236float DecodeScore(float encoded_score) {
237 return 1 / (1 + std::exp(-encoded_score));

Callers 1

PrintTopDetectionsFunction · 0.85

Calls 2

maxFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected