Release 18.05.02
[platform/upstream/armnn.git] / tests / ImageNetDatabase.hpp
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
4 //
5 #pragma once
6
7 #include "ClassifierTestCaseData.hpp"
8
9 #include <array>
10 #include <string>
11 #include <vector>
12 #include <memory>
13
14 using ImageSet = std::pair<const std::string, unsigned int>;
15
16 class ImageNetDatabase
17 {
18 public:
19     using TTestCaseData = ClassifierTestCaseData<float>;
20
21     explicit ImageNetDatabase(const std::string& binaryFileDirectory,
22         unsigned int width = 227,
23         unsigned int height = 227,
24         const std::vector<ImageSet>& imageSet = std::vector<ImageSet>());
25     std::unique_ptr<TTestCaseData> GetTestCaseData(unsigned int testCaseId);
26
27 private:
28     unsigned int GetNumImageElements() const { return 3 * m_Width * m_Height; }
29     unsigned int GetNumImageBytes() const { return 4 * GetNumImageElements(); }
30
31     std::string m_BinaryDirectory;
32     unsigned int m_Height;
33     unsigned int m_Width;
34     //mean value of the database [B, G, R]
35     const std::array<float, 3> m_MeanBgr = {{104.007965f, 116.669472f, 122.675102f}};
36     const std::vector<ImageSet> m_ImageSet;
37 };