MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / run

Method run

src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp:507–660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507void CPPDetectionOutputLayer::run()
508{
509 // Retrieve all location predictions.
510 retrieve_all_loc_predictions(_input_loc, _num, _num_priors, _info.num_loc_classes(), _info.share_location(),
511 _all_location_predictions);
512
513 // Retrieve all confidences.
514 retrieve_all_conf_scores(_input_conf, _num, _num_priors, _info.num_classes(), _all_confidence_scores);
515
516 // Retrieve all prior bboxes.
517 retrieve_all_priorbox(_input_priorbox, _num_priors, _all_prior_bboxes, _all_prior_variances);
518
519 // Decode all loc predictions to bboxes
520 const bool clip_bbox = false;
521 for (int i = 0; i < _num; ++i)
522 {
523 for (int c = 0; c < _info.num_loc_classes(); ++c)
524 {
525 const int label = _info.share_location() ? -1 : c;
526 if (label == _info.background_label_id())
527 {
528 // Ignore background class.
529 continue;
530 }
531 ARM_COMPUTE_ERROR_ON_MSG_VAR(_all_location_predictions[i].find(label) == _all_location_predictions[i].end(),
532 "Could not find location predictions for label %d.", label);
533
534 const std::vector<BBox> &label_loc_preds = _all_location_predictions[i].find(label)->second;
535
536 const int num_bboxes = _all_prior_bboxes.size();
537 ARM_COMPUTE_ERROR_ON(_all_prior_variances[i].size() != 4);
538
539 for (int j = 0; j < num_bboxes; ++j)
540 {
541 DecodeBBox(_all_prior_bboxes[j], _all_prior_variances[j], _info.code_type(),
542 _info.variance_encoded_in_target(), clip_bbox, label_loc_preds[j],
543 _all_decode_bboxes[i][label][j]);
544 }
545 }
546 }
547
548 int num_kept = 0;
549
550 for (int i = 0; i < _num; ++i)
551 {
552 const LabelBBox &decode_bboxes = _all_decode_bboxes[i];
553 const std::map<int, std::vector<float>> &conf_scores = _all_confidence_scores[i];
554
555 std::map<int, std::vector<int>> indices;
556 int num_det = 0;
557 for (int c = 0; c < _info.num_classes(); ++c)
558 {
559 if (c == _info.background_label_id())
560 {
561 // Ignore background class
562 continue;
563 }
564 const int label = _info.share_location() ? -1 : c;

Callers

nothing calls this directly

Calls 15

retrieve_all_conf_scoresFunction · 0.85
retrieve_all_priorboxFunction · 0.85
DecodeBBoxFunction · 0.85
ApplyNMSFastFunction · 0.85
ValidRegionClass · 0.85
num_loc_classesMethod · 0.80
share_locationMethod · 0.80
background_label_idMethod · 0.80
findMethod · 0.80
code_typeMethod · 0.80

Tested by

no test coverage detected