ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RefDetectionPostProcessWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019,2021-2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "Decoders.hpp"
10 #include "Profiling.hpp"
11 #include "RefWorkloadUtils.hpp"
12 
13 namespace armnn
14 {
15 
17  const DetectionPostProcessQueueDescriptor& descriptor, const WorkloadInfo& info)
19  m_Anchors(std::make_unique<ScopedTensorHandle>(*(descriptor.m_Anchors))) {}
20 
22 {
24 }
25 
26 void RefDetectionPostProcessWorkload::Execute(std::vector<ITensorHandle*> inputs,
27  std::vector<ITensorHandle*> outputs) const
28 {
29  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefDetectionPostProcessWorkload_Execute");
30 
31  const TensorInfo& boxEncodingsInfo = GetTensorInfo(inputs[0]);
32  const TensorInfo& scoresInfo = GetTensorInfo(inputs[1]);
33  const TensorInfo& anchorsInfo = m_Anchors->GetTensorInfo();
34 
35  const TensorInfo& detectionBoxesInfo = GetTensorInfo(outputs[0]);
36  const TensorInfo& detectionClassesInfo = GetTensorInfo(outputs[1]);
37  const TensorInfo& detectionScoresInfo = GetTensorInfo(outputs[2]);
38  const TensorInfo& numDetectionsInfo = GetTensorInfo(outputs[3]);
39 
40  auto boxEncodings = MakeDecoder<float>(boxEncodingsInfo, inputs[0]->Map());
41  auto scores = MakeDecoder<float>(scoresInfo, inputs[1]->Map());
42  auto anchors = MakeDecoder<float>(anchorsInfo, m_Anchors->Map(false));
43 
44  float* detectionBoxes = reinterpret_cast<float*>(outputs[0]->Map());
45  float* detectionClasses = reinterpret_cast<float*>(outputs[1]->Map());
46  float* detectionScores = reinterpret_cast<float*>(outputs[2]->Map());
47  float* numDetections = reinterpret_cast<float*>(outputs[3]->Map());
48 
49  DetectionPostProcess(boxEncodingsInfo, scoresInfo, anchorsInfo,
50  detectionBoxesInfo, detectionClassesInfo,
51  detectionScoresInfo, numDetectionsInfo, m_Data.m_Parameters,
52  *boxEncodings, *scores, *anchors, detectionBoxes,
53  detectionClasses, detectionScores, numDetections);
54 }
55 
56 } //namespace armnn
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
QueueDescriptor m_Data
Definition: Workload.hpp:74
RefDetectionPostProcessWorkload(const DetectionPostProcessQueueDescriptor &descriptor, const WorkloadInfo &info)
void Execute() const override
Copyright (c) 2021 ARM Limited and Contributors.
void DetectionPostProcess(const TensorInfo &boxEncodingsInfo, const TensorInfo &scoresInfo, const TensorInfo &, const TensorInfo &detectionBoxesInfo, const TensorInfo &, const TensorInfo &, const TensorInfo &, const DetectionPostProcessDescriptor &desc, Decoder< float > &boxEncodings, Decoder< float > &scores, Decoder< float > &anchors, float *detectionBoxes, float *detectionClasses, float *detectionScores, float *numDetections)
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs
Contains information about TensorInfos of a layer.