diff options
author | Isabella Gottardi <isabella.gottardi@arm.com> | 2019-01-08 13:48:44 +0000 |
---|---|---|
committer | Isabella Gottardi <isabella.gottardi@arm.com> | 2019-08-06 07:58:16 +0000 |
commit | a7acb3cbabeb66ce647684466a04c96b2963c9c9 (patch) | |
tree | 7988b75372c8ad1dfa3c8d028ab3a603a5e5a047 /src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp | |
parent | 4746326ecb075dcfa123aaa8b38de5ec3e534b60 (diff) | |
download | ComputeLibrary-a7acb3cbabeb66ce647684466a04c96b2963c9c9.tar.gz |
COMPMID-1849: Implement CPPDetectionPostProcessLayer
* Add DetectionPostProcessLayer
* Add DetectionPostProcessLayer at the graph
Change-Id: I7e56f6cffc26f112d26dfe74853085bb8ec7d849
Signed-off-by: Isabella Gottardi <isabella.gottardi@arm.com>
Reviewed-on: https://review.mlplatform.org/c/1639
Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp')
-rw-r--r-- | src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp b/src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp index a1f4e6e89c..13a34b43cd 100644 --- a/src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp +++ b/src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp @@ -166,9 +166,9 @@ void retrieve_all_conf_scores(const ITensor *input_conf, const int num, * @param[out] all_location_predictions All the location predictions. * */ -void retrieve_all_priorbox(const ITensor *input_priorbox, - const int num_priors, - std::vector<NormalizedBBox> &all_prior_bboxes, +void retrieve_all_priorbox(const ITensor *input_priorbox, + const int num_priors, + std::vector<BBox> &all_prior_bboxes, std::vector<std::array<float, 4>> &all_prior_variances) { for(int i = 0; i < num_priors; ++i) @@ -206,9 +206,9 @@ void retrieve_all_priorbox(const ITensor *input_priorbox, * @param[out] decode_bbox The decoded bboxes. * */ -void DecodeBBox(const NormalizedBBox &prior_bbox, const std::array<float, 4> &prior_variance, +void DecodeBBox(const BBox &prior_bbox, const std::array<float, 4> &prior_variance, const DetectionOutputLayerCodeType code_type, const bool variance_encoded_in_target, - const bool clip_bbox, const NormalizedBBox &bbox, NormalizedBBox &decode_bbox) + const bool clip_bbox, const BBox &bbox, BBox &decode_bbox) { // if the variance is encoded in target, we simply need to add the offset predictions // otherwise we need to scale the offset accordingly. @@ -287,7 +287,7 @@ void DecodeBBox(const NormalizedBBox &prior_bbox, const std::array<float, 4> &pr * @param[out] indices The kept indices of bboxes after nms. * */ -void ApplyNMSFast(const std::vector<NormalizedBBox> &bboxes, +void ApplyNMSFast(const std::vector<BBox> &bboxes, const std::vector<float> &scores, const float score_threshold, const float nms_threshold, const float eta, const int top_k, std::vector<int> &indices) @@ -329,7 +329,7 @@ void ApplyNMSFast(const std::vector<NormalizedBBox> &bboxes, if(keep) { // Compute the jaccard (intersection over union IoU) overlap between two bboxes. - NormalizedBBox intersect_bbox = std::array<float, 4>({ { 0, 0, 0, 0 } }); + BBox intersect_bbox = std::array<float, 4>({ 0, 0, 0, 0 }); if(bboxes[kept_idx][0] > bboxes[idx][2] || bboxes[kept_idx][2] < bboxes[idx][0] || bboxes[kept_idx][1] > bboxes[idx][3] || bboxes[kept_idx][3] < bboxes[idx][1]) { intersect_bbox = std::array<float, 4>({ { 0, 0, 0, 0 } }); @@ -466,7 +466,7 @@ void CPPDetectionOutputLayer::run() } ARM_COMPUTE_ERROR_ON_MSG(_all_location_predictions[i].find(label) == _all_location_predictions[i].end(), "Could not find location predictions for label %d.", label); - const std::vector<NormalizedBBox> &label_loc_preds = _all_location_predictions[i].find(label)->second; + const std::vector<BBox> &label_loc_preds = _all_location_predictions[i].find(label)->second; const int num_bboxes = _all_prior_bboxes.size(); ARM_COMPUTE_ERROR_ON(_all_prior_variances[i].size() != 4); @@ -499,8 +499,8 @@ void CPPDetectionOutputLayer::run() { ARM_COMPUTE_ERROR("Could not find predictions for label %d.", label); } - const std::vector<float> &scores = conf_scores.find(c)->second; - const std::vector<NormalizedBBox> &bboxes = decode_bboxes.find(label)->second; + const std::vector<float> &scores = conf_scores.find(c)->second; + const std::vector<BBox> &bboxes = decode_bboxes.find(label)->second; ApplyNMSFast(bboxes, scores, _info.confidence_threshold(), _info.nms_threshold(), _info.eta(), _info.top_k(), indices[c]); @@ -572,8 +572,8 @@ void CPPDetectionOutputLayer::run() // or there are no location predictions for current label. ARM_COMPUTE_ERROR("Could not find predictions for the label %d.", label); } - const std::vector<NormalizedBBox> &bboxes = decode_bboxes.find(loc_label)->second; - const std::vector<int> &indices = it.second; + const std::vector<BBox> &bboxes = decode_bboxes.find(loc_label)->second; + const std::vector<int> &indices = it.second; for(auto idx : indices) { |