ArmNN
 24.08
DetectionPostProcessQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

Inheritance diagram for DetectionPostProcessQueueDescriptor:
[legend]
Collaboration diagram for DetectionPostProcessQueueDescriptor:
[legend]

Public Member Functions

 DetectionPostProcessQueueDescriptor ()
 
void Validate (const WorkloadInfo &workloadInfo) const
 
- Public Member Functions inherited from QueueDescriptorWithParameters< DetectionPostProcessDescriptor >
virtual ~QueueDescriptorWithParameters ()=default
 
- Public Member Functions inherited from QueueDescriptor
virtual ~QueueDescriptor ()=default
 
void ValidateTensorNumDimensions (const TensorInfo &tensor, std::string const &descName, unsigned int numDimensions, std::string const &tensorName) const
 
void ValidateTensorNumDimNumElem (const TensorInfo &tensorInfo, unsigned int numDimension, unsigned int numElements, std::string const &tensorName) const
 
void ValidateInputsOutputs (const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
 
template<typename T >
const T * GetAdditionalInformation () const
 

Public Attributes

const ConstTensorHandlem_Anchors
 
- Public Attributes inherited from QueueDescriptorWithParameters< DetectionPostProcessDescriptor >
DetectionPostProcessDescriptor m_Parameters
 
- Public Attributes inherited from QueueDescriptor
std::vector< ITensorHandle * > m_Inputs
 
std::vector< ITensorHandle * > m_Outputs
 
void * m_AdditionalInfoObject
 
bool m_AllowExpandedDims = false
 

Additional Inherited Members

- Protected Member Functions inherited from QueueDescriptorWithParameters< DetectionPostProcessDescriptor >
 QueueDescriptorWithParameters ()=default
 
 QueueDescriptorWithParameters (QueueDescriptorWithParameters const &)=default
 
QueueDescriptorWithParametersoperator= (QueueDescriptorWithParameters const &)=default
 
- Protected Member Functions inherited from QueueDescriptor
 QueueDescriptor ()
 
 QueueDescriptor (QueueDescriptor const &)=default
 
QueueDescriptoroperator= (QueueDescriptor const &)=default
 

Detailed Description

Definition at line 239 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ DetectionPostProcessQueueDescriptor()

Definition at line 241 of file WorkloadData.hpp.

242  : m_Anchors(nullptr)
243  {
244  }

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 2831 of file WorkloadData.cpp.

2832 {
2833  const std::string& descriptorName{"DetectionPostProcessQueueDescriptor"};
2834 
2835  ValidateNumInputs(workloadInfo, descriptorName, 2);
2836 
2837  if (workloadInfo.m_OutputTensorInfos.size() != 4)
2838  {
2839  throw InvalidArgumentException(descriptorName + ": Requires exactly four outputs. " +
2840  to_string(workloadInfo.m_OutputTensorInfos.size()) + " has been provided.");
2841  }
2842 
2843  if (m_Anchors == nullptr)
2844  {
2845  throw InvalidArgumentException(descriptorName + ": Anchors tensor descriptor is missing.");
2846  }
2847 
2848  const TensorInfo& boxEncodingsInfo = workloadInfo.m_InputTensorInfos[0];
2849  const TensorInfo& scoresInfo = workloadInfo.m_InputTensorInfos[1];
2850  const TensorInfo& anchorsInfo = m_Anchors->GetTensorInfo();
2851 
2852  const TensorInfo& detectionBoxesInfo = workloadInfo.m_OutputTensorInfos[0];
2853  const TensorInfo& detectionClassesInfo = workloadInfo.m_OutputTensorInfos[1];
2854  const TensorInfo& detectionScoresInfo = workloadInfo.m_OutputTensorInfos[2];
2855  const TensorInfo& numDetectionsInfo = workloadInfo.m_OutputTensorInfos[3];
2856 
2857  ValidateTensorNumDimensions(boxEncodingsInfo, descriptorName, 3, "box encodings");
2858  ValidateTensorNumDimensions(scoresInfo, descriptorName, 3, "scores");
2859  ValidateTensorNumDimensions(anchorsInfo, descriptorName, 2, "anchors");
2860 
2861  const std::vector<DataType> supportedInputTypes =
2862  {
2869  };
2870 
2871  ValidateDataTypes(boxEncodingsInfo, supportedInputTypes, descriptorName);
2872  ValidateDataTypes(scoresInfo, supportedInputTypes, descriptorName);
2873  ValidateDataTypes(anchorsInfo, supportedInputTypes, descriptorName);
2874 
2875  ValidateTensorNumDimensions(detectionBoxesInfo, descriptorName, 3, "detection boxes");
2876  ValidateTensorNumDimensions(detectionScoresInfo, descriptorName, 2, "detection scores");
2877  ValidateTensorNumDimensions(detectionClassesInfo, descriptorName, 2, "detection classes");
2878  ValidateTensorNumDimensions(numDetectionsInfo, descriptorName, 1, "num detections");
2879 
2880  // NOTE: Output is always Float32 regardless of input type
2881  ValidateTensorDataType(detectionBoxesInfo, DataType::Float32, descriptorName, "detection boxes");
2882  ValidateTensorDataType(detectionScoresInfo, DataType::Float32, descriptorName, "detection scores");
2883  ValidateTensorDataType(detectionClassesInfo, DataType::Float32, descriptorName, "detection classes");
2884  ValidateTensorDataType(numDetectionsInfo, DataType::Float32, descriptorName, "num detections");
2885 
2887  {
2888  throw InvalidArgumentException(descriptorName + ": Intersection over union threshold "
2889  "must be positive and less than or equal to 1.");
2890  }
2891 
2892  if (scoresInfo.GetShape()[2] != m_Parameters.m_NumClasses + 1)
2893  {
2894  throw InvalidArgumentException(descriptorName + ": Number of classes with background "
2895  "should be equal to number of classes + 1.");
2896  }
2897 }

References armnn::BFloat16, armnn::Float16, armnn::Float32, TensorInfo::GetShape(), ConstTensorHandle::GetTensorInfo(), DetectionPostProcessQueueDescriptor::m_Anchors, WorkloadInfo::m_InputTensorInfos, DetectionPostProcessDescriptor::m_NmsIouThreshold, DetectionPostProcessDescriptor::m_NumClasses, WorkloadInfo::m_OutputTensorInfos, QueueDescriptorWithParameters< DetectionPostProcessDescriptor >::m_Parameters, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, and QueueDescriptor::ValidateTensorNumDimensions().

Member Data Documentation

◆ m_Anchors


The documentation for this struct was generated from the following files:
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::DataType::Float32
@ Float32
armnn::DataType::QAsymmU8
@ QAsymmU8
armnn::ConstTensorHandle::GetTensorInfo
const TensorInfo & GetTensorInfo() const
Definition: TensorHandle.hpp:40
armnn::DetectionPostProcessQueueDescriptor::m_Anchors
const ConstTensorHandle * m_Anchors
Definition: WorkloadData.hpp:246
armnn::DataType::QSymmS16
@ QSymmS16
armnn::DataType::BFloat16
@ BFloat16
armnn::DataType::Float16
@ Float16
armnn::WorkloadInfo::m_OutputTensorInfos
std::vector< TensorInfo > m_OutputTensorInfos
Definition: WorkloadInfo.hpp:19
armnn::QueueDescriptorWithParameters< DetectionPostProcessDescriptor >::m_Parameters
DetectionPostProcessDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::DetectionPostProcessDescriptor::m_NumClasses
uint32_t m_NumClasses
Number of classes.
Definition: Descriptors.hpp:755
armnn::DetectionPostProcessDescriptor::m_NmsIouThreshold
float m_NmsIouThreshold
Intersection over union threshold.
Definition: Descriptors.hpp:753
armnn::InvalidArgumentException
Definition: Exceptions.hpp:80
armnn::DataType::QAsymmS8
@ QAsymmS8
armnn::TensorInfo::GetShape
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
armnn::WorkloadInfo::m_InputTensorInfos
std::vector< TensorInfo > m_InputTensorInfos
Definition: WorkloadInfo.hpp:18
armnn::QueueDescriptor::ValidateTensorNumDimensions
void ValidateTensorNumDimensions(const TensorInfo &tensor, std::string const &descName, unsigned int numDimensions, std::string const &tensorName) const
Definition: WorkloadData.cpp:398