IVGCVSW-5334 Remove remaining boost::numeric_cast from armnn
[platform/upstream/armnn.git] / tests / ObjectDetectionCommon.hpp
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6
7 #include <string>
8 #include <utility>
9
10 namespace
11 {
12
13 struct BoundingBox
14 {
15     BoundingBox()
16         : BoundingBox(0.0f, 0.0f, 0.0f, 0.0f)
17     {}
18
19     BoundingBox(float xMin, float yMin, float xMax, float yMax)
20         : m_XMin(xMin)
21         , m_YMin(yMin)
22         , m_XMax(xMax)
23         , m_YMax(yMax)
24     {}
25
26     float m_XMin;
27     float m_YMin;
28     float m_XMax;
29     float m_YMax;
30 };
31
32 struct DetectedObject
33 {
34     DetectedObject(float detectedClass,
35                    const BoundingBox& boundingBox,
36                    float confidence)
37         : m_Class(detectedClass)
38         , m_BoundingBox(boundingBox)
39         , m_Confidence(confidence)
40     {}
41
42     bool operator<(const DetectedObject& other) const
43     {
44         return m_Confidence < other.m_Confidence ||
45             (m_Confidence == other.m_Confidence && m_Class < other.m_Class);
46     }
47
48     float        m_Class;
49     BoundingBox  m_BoundingBox;
50     float        m_Confidence;
51 };
52
53 using ObjectDetectionInput = std::pair<std::string, std::vector<DetectedObject>>;
54
55 } // anonymous namespace