IVGCVSW-4512 Add BFloat16 Debug Workload
[platform/upstream/armnn.git] / tests / YoloDatabase.hpp
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6
7 #include "ClassifierTestCaseData.hpp"
8
9 #include <array>
10 #include <string>
11 #include <memory>
12
13 struct YoloBoundingBox
14 {
15     float m_X;
16     float m_Y;
17     float m_W;
18     float m_H;
19 };
20
21 struct YoloDetectedObject
22 {
23     YoloDetectedObject(unsigned int yoloClass,
24         const YoloBoundingBox& box,
25         float confidence)
26      : m_Class(yoloClass)
27      , m_Box(box)
28      , m_Confidence(confidence)
29     {}
30
31     unsigned int m_Class;
32     YoloBoundingBox m_Box;
33     float m_Confidence;
34 };
35
36 class YoloTestCaseData
37 {
38 public:
39     YoloTestCaseData(std::vector<float> inputImage,
40         std::vector<YoloDetectedObject> topObjectDetections)
41      : m_InputImage(std::move(inputImage))
42      , m_TopObjectDetections(std::move(topObjectDetections))
43     {
44     }
45
46     std::vector<float> m_InputImage;
47     std::vector<YoloDetectedObject> m_TopObjectDetections;
48 };
49
50 constexpr unsigned int YoloImageWidth = 448;
51 constexpr unsigned int YoloImageHeight = 448;
52
53 class YoloDatabase
54 {
55 public:
56     using TTestCaseData = YoloTestCaseData;
57
58     explicit YoloDatabase(const std::string& imageDir);
59     std::unique_ptr<TTestCaseData> GetTestCaseData(unsigned int testCaseId);
60
61 private:
62     std::string m_ImageDir;
63 };