Aron Virginas-Tar | d089b74 | 2019-01-29 11:09:51 +0000 | [diff] [blame] | 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 | { |
Narumol Prangnawarat | 4628d05 | 2019-02-25 17:26:05 +0000 | [diff] [blame] | 34 | DetectedObject(float detectedClass, |
Aron Virginas-Tar | d089b74 | 2019-01-29 11:09:51 +0000 | [diff] [blame] | 35 | const BoundingBox& boundingBox, |
| 36 | float confidence) |
| 37 | : m_Class(detectedClass) |
| 38 | , m_BoundingBox(boundingBox) |
| 39 | , m_Confidence(confidence) |
| 40 | {} |
| 41 | |
Narumol Prangnawarat | 4628d05 | 2019-02-25 17:26:05 +0000 | [diff] [blame] | 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; |
Aron Virginas-Tar | d089b74 | 2019-01-29 11:09:51 +0000 | [diff] [blame] | 49 | BoundingBox m_BoundingBox; |
| 50 | float m_Confidence; |
| 51 | }; |
| 52 | |
Narumol Prangnawarat | 4628d05 | 2019-02-25 17:26:05 +0000 | [diff] [blame] | 53 | using ObjectDetectionInput = std::pair<std::string, std::vector<DetectedObject>>; |
Aron Virginas-Tar | d089b74 | 2019-01-29 11:09:51 +0000 | [diff] [blame] | 54 | |
| 55 | } // anonymous namespace |