ArmNN
 24.02
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 2827 of file WorkloadData.cpp.

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

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:397