29 desc.m_MaxDetections = 3;
30 desc.m_MaxClassesPerDetection = 1;
31 desc.m_DetectionsPerClass =1;
32 desc.m_NmsScoreThreshold = 0.0;
33 desc.m_NmsIouThreshold = 0.5;
34 desc.m_NumClasses = 2;
46 "DetectionPostProcess");
51 Connect(boxesLayer, detectionLayer, boxEncodingsInfo, 0, 0);
52 Connect(scoresLayer, detectionLayer, scoresInfo, 0, 1);
53 Connect(detectionLayer, detectionBoxesLayer, detectionBoxesInfo, 0, 0);
54 Connect(detectionLayer, detectionClassesLayer, detectionClassesInfo, 1, 0);
55 Connect(detectionLayer, detectionScoresLayer, detectionScoresInfo, 2, 0);
56 Connect(detectionLayer, numDetectionLayer, numDetectionInfo, 3, 0);
61 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
62 void DetectionPostProcessEndToEnd(
const std::vector<BackendId>& backends,
bool useRegularNms,
64 const std::vector<T>&
scores,
65 const std::vector<T>& anchors,
66 const std::vector<float>& expectedDetectionBoxes,
67 const std::vector<float>& expectedDetectionClasses,
68 const std::vector<float>& expectedDetectionScores,
69 const std::vector<float>& expectedNumDetections,
70 float boxScale = 1.0f,
71 int32_t boxOffset = 0,
72 float scoreScale = 1.0f,
73 int32_t scoreOffset = 0,
74 float anchorScale = 1.0f,
75 int32_t anchorOffset = 0)
92 BOOST_TEST_CHECKPOINT(
"create a network");
94 std::map<int, std::vector<T>> inputTensorData = {{ 0, boxEncodings }, { 1, scores }};
95 std::map<int, std::vector<float>> expectedOutputData = {{ 0, expectedDetectionBoxes },
96 { 1, expectedDetectionClasses },
97 { 2, expectedDetectionScores },
98 { 3, expectedNumDetections }};
100 EndToEndLayerTestImpl<ArmnnType, armnn::DataType::Float32>(
101 move(net), inputTensorData, expectedOutputData, backends);
104 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
105 void DetectionPostProcessRegularNmsEndToEnd(
const std::vector<BackendId>& backends,
106 const std::vector<T>& boxEncodings,
107 const std::vector<T>& scores,
108 const std::vector<T>& anchors,
109 float boxScale = 1.0f,
110 int32_t boxOffset = 0,
111 float scoreScale = 1.0f,
112 int32_t scoreOffset = 0,
113 float anchorScale = 1.0f,
114 int32_t anchorOffset = 0)
116 std::vector<float> expectedDetectionBoxes({
117 0.0f, 10.0f, 1.0f, 11.0f,
118 0.0f, 10.0f, 1.0f, 11.0f,
119 0.0f, 0.0f, 0.0f, 0.0f
121 std::vector<float> expectedDetectionScores({ 0.95f, 0.93f, 0.0f });
122 std::vector<float> expectedDetectionClasses({ 1.0f, 0.0f, 0.0f });
123 std::vector<float> expectedNumDetections({ 2.0f });
126 expectedDetectionBoxes, expectedDetectionClasses,
127 expectedDetectionScores, expectedNumDetections,
128 boxScale, boxOffset, scoreScale, scoreOffset,
129 anchorScale, anchorOffset);
134 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
135 void DetectionPostProcessFastNmsEndToEnd(
const std::vector<BackendId>& backends,
136 const std::vector<T>& boxEncodings,
137 const std::vector<T>& scores,
138 const std::vector<T>& anchors,
139 float boxScale = 1.0f,
140 int32_t boxOffset = 0,
141 float scoreScale = 1.0f,
142 int32_t scoreOffset = 0,
143 float anchorScale = 1.0f,
144 int32_t anchorOffset = 0)
146 std::vector<float> expectedDetectionBoxes({
147 0.0f, 10.0f, 1.0f, 11.0f,
148 0.0f, 0.0f, 1.0f, 1.0f,
149 0.0f, 100.0f, 1.0f, 101.0f
151 std::vector<float> expectedDetectionScores({ 0.95f, 0.9f, 0.3f });
152 std::vector<float> expectedDetectionClasses({ 1.0f, 0.0f, 0.0f });
153 std::vector<float> expectedNumDetections({ 3.0f });
156 expectedDetectionBoxes, expectedDetectionClasses,
157 expectedDetectionScores, expectedNumDetections,
158 boxScale, boxOffset, scoreScale, scoreOffset,
159 anchorScale, anchorOffset);
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
bool m_UseRegularNms
Use Regular NMS.
armnn::TensorInfo scoresInfo({ 1, 6, 3 }, armnn::DataType::Float32)
std::vector< float > scores({ 0.0f, 0.9f, 0.8f, 0.0f, 0.75f, 0.72f, 0.0f, 0.6f, 0.5f, 0.0f, 0.93f, 0.95f, 0.0f, 0.5f, 0.4f, 0.0f, 0.3f, 0.2f })
void SetQuantizationScale(float scale)
static INetworkPtr Create()
std::vector< float > boxEncodings({ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f })
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
std::vector< float > anchors({ 0.5f, 0.5f, 1.0f, 1.0f, 0.5f, 0.5f, 1.0f, 1.0f, 0.5f, 0.5f, 1.0f, 1.0f, 0.5f, 10.5f, 1.0f, 1.0f, 0.5f, 10.5f, 1.0f, 1.0f, 0.5f, 100.5f, 1.0f, 1.0f })
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
armnn::TensorInfo anchorsInfo({ 6, 4 }, armnn::DataType::Float32)
void SetQuantizationOffset(int32_t offset)