ArmNN
 24.08
RefDetectionPostProcessWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019,2021-2023 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 
27 {
28  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
29  Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
30 }
31 
32 void RefDetectionPostProcessWorkload::Execute(std::vector<ITensorHandle*> inputs,
33  std::vector<ITensorHandle*> outputs) const
34 {
35  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefDetectionPostProcessWorkload_Execute");
36 
37  const TensorInfo& boxEncodingsInfo = GetTensorInfo(inputs[0]);
38  const TensorInfo& scoresInfo = GetTensorInfo(inputs[1]);
39  const TensorInfo& anchorsInfo = m_Anchors->GetTensorInfo();
40 
41  const TensorInfo& detectionBoxesInfo = GetTensorInfo(outputs[0]);
42  const TensorInfo& detectionClassesInfo = GetTensorInfo(outputs[1]);
43  const TensorInfo& detectionScoresInfo = GetTensorInfo(outputs[2]);
44  const TensorInfo& numDetectionsInfo = GetTensorInfo(outputs[3]);
45 
46  auto boxEncodings = MakeDecoder<float>(boxEncodingsInfo, inputs[0]->Map());
47  auto scores = MakeDecoder<float>(scoresInfo, inputs[1]->Map());
48  auto anchors = MakeDecoder<float>(anchorsInfo, m_Anchors->Map(false));
49 
50  float* detectionBoxes = reinterpret_cast<float*>(outputs[0]->Map());
51  float* detectionClasses = reinterpret_cast<float*>(outputs[1]->Map());
52  float* detectionScores = reinterpret_cast<float*>(outputs[2]->Map());
53  float* numDetections = reinterpret_cast<float*>(outputs[3]->Map());
54 
55  DetectionPostProcess(boxEncodingsInfo, scoresInfo, anchorsInfo,
56  detectionBoxesInfo, detectionClassesInfo,
57  detectionScoresInfo, numDetectionsInfo, m_Data.m_Parameters,
58  *boxEncodings, *scores, *anchors, detectionBoxes,
59  detectionClasses, detectionScores, numDetections);
60 }
61 
62 } //namespace armnn
armnn::RefDetectionPostProcessWorkload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition: RefDetectionPostProcessWorkload.cpp:26
armnn::experimental::ExecutionData::m_Data
void * m_Data
Definition: ExecutionData.hpp:16
armnn::TensorInfo
Definition: Tensor.hpp:152
Profiling.hpp
ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: RefWorkloadUtils.hpp:22
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
armnn::DetectionPostProcessQueueDescriptor
Definition: WorkloadData.hpp:239
armnn::GetTensorInfo
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Definition: RefWorkloadUtils.hpp:33
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
RefDetectionPostProcessWorkload.hpp
RefWorkloadUtils.hpp
armnn::BaseWorkload< DetectionPostProcessQueueDescriptor >::m_Data
DetectionPostProcessQueueDescriptor m_Data
Definition: Workload.hpp:89
std
Definition: BackendId.hpp:149
Decoders.hpp
armnn::LayerType::Map
@ Map
armnn::experimental::WorkingMemDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkingMemDescriptor.hpp:20
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::experimental::WorkingMemDescriptor
Definition: WorkingMemDescriptor.hpp:18
armnn::RefDetectionPostProcessWorkload::RefDetectionPostProcessWorkload
RefDetectionPostProcessWorkload(const DetectionPostProcessQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: RefDetectionPostProcessWorkload.cpp:16
armnn::ScopedTensorHandle
Definition: TensorHandle.hpp:115
DetectionPostProcess.hpp
armnn::RefDetectionPostProcessWorkload::Execute
void Execute() const override
Definition: RefDetectionPostProcessWorkload.cpp:21
armnn::RefBaseWorkload
Definition: RefBaseWorkload.hpp:13
armnn::experimental::WorkingMemDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkingMemDescriptor.hpp:21
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26
armnn::experimental::ExecutionData
Definition: ExecutionData.hpp:14
armnn::DetectionPostProcess
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)
Definition: DetectionPostProcess.cpp:139