ArmNN
 24.08
DetectionPostProcessLayer.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
9 
10 namespace armnn
11 {
12 
13 class ScopedTensorHandle;
14 
15 /// This layer represents a detection postprocess operator.
16 class DetectionPostProcessLayer : public LayerWithParameters<DetectionPostProcessDescriptor>
17 {
18 public:
19  /// A unique pointer to store Anchor values.
20  std::shared_ptr<ConstTensorHandle> m_Anchors;
21 
22  /// Makes a workload for the DetectionPostProcess type.
23  /// @param [in] graph The graph where this layer can be found.
24  /// @param [in] factory The workload factory which will create the workload.
25  /// @return A pointer to the created workload, or nullptr if not created.
26  virtual std::unique_ptr<IWorkload> CreateWorkload(const IWorkloadFactory& factory) const override;
27 
28  /// Creates a dynamically-allocated copy of this layer.
29  /// @param [in] graph The graph into which this layer is being cloned.
30  DetectionPostProcessLayer* Clone(Graph& graph) const override;
31 
32  /// Check if the input tensor shape(s)
33  /// will lead to a valid configuration of @ref DetectionPostProcessLayer.
34  /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
35  void ValidateTensorShapesFromInputs() override;
36 
37  /// The model does not specify the output shapes. The output shapes are calculated from the max_detection and
38  /// max_classes_per_detection parameters in the DetectionPostProcessDescriptor.
39  /// @param [in] inputShapes The input shapes layer has. These are ignored for DetectionPostProcessLayer.
40  /// @return A vector to the inferred output shape.
41  std::vector<TensorShape> InferOutputShapes(const std::vector<TensorShape>& inputShapes) const override;
42 
43  void ExecuteStrategy(IStrategy& strategy) const override;
44 
45 protected:
46  /// Constructor to create a DetectionPostProcessLayer.
47  /// @param [in] param DetectionPostProcessDescriptor to configure the detection postprocess.
48  /// @param [in] name Optional name for the layer.
49  DetectionPostProcessLayer(const DetectionPostProcessDescriptor& param, const char* name);
50 
51  /// Default destructor
52  ~DetectionPostProcessLayer() = default;
53 
54  /// Retrieve the handles to the constant values stored by the layer.
55  /// @return A vector of the constant tensors stored by this layer.
57 };
58 
59 } // namespace armnn
60 
armnn::DetectionPostProcessLayer::CreateWorkload
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the DetectionPostProcess type.
Definition: DetectionPostProcessLayer.cpp:23
armnn::DetectionPostProcessLayer::InferOutputShapes
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
The model does not specify the output shapes.
Definition: DetectionPostProcessLayer.cpp:94
armnn::DetectionPostProcessLayer::GetConstantTensorsByRef
ImmutableConstantTensors GetConstantTensorsByRef() const override
Retrieve the handles to the constant values stored by the layer.
Definition: DetectionPostProcessLayer.cpp:106
armnn::IStrategy
Definition: IStrategy.hpp:16
armnn::LayerWithParameters
Definition: LayerWithParameters.hpp:14
armnn::IConnectableLayer::ImmutableConstantTensors
std::vector< std::reference_wrapper< const std::shared_ptr< ConstTensorHandle > >> ImmutableConstantTensors
Definition: INetwork.hpp:141
armnn::IWorkloadFactory
Definition: WorkloadFactory.hpp:22
armnn::DetectionPostProcessLayer::ValidateTensorShapesFromInputs
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of DetectionPostProcessLayer.
Definition: DetectionPostProcessLayer.cpp:39
armnn::DetectionPostProcessLayer::m_Anchors
std::shared_ptr< ConstTensorHandle > m_Anchors
A unique pointer to store Anchor values.
Definition: DetectionPostProcessLayer.hpp:20
LayerWithParameters.hpp
armnn::DetectionPostProcessLayer::ExecuteStrategy
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
Definition: DetectionPostProcessLayer.cpp:112
armnn::DetectionPostProcessLayer::~DetectionPostProcessLayer
~DetectionPostProcessLayer()=default
Default destructor.
armnn::DetectionPostProcessLayer::Clone
DetectionPostProcessLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
Definition: DetectionPostProcessLayer.cpp:32
armnn::DetectionPostProcessLayer::DetectionPostProcessLayer
DetectionPostProcessLayer(const DetectionPostProcessDescriptor &param, const char *name)
Constructor to create a DetectionPostProcessLayer.
Definition: DetectionPostProcessLayer.cpp:18
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::DetectionPostProcessLayer
This layer represents a detection postprocess operator.
Definition: DetectionPostProcessLayer.hpp:16
armnn::DetectionPostProcessDescriptor
Definition: Descriptors.hpp:713
armnn::Graph
Definition: Graph.hpp:30