9 #include <boost/numeric/conversion/cast.hpp> 16 : m_BinaryDirectory(binaryFileDirectory), m_RgbPack(rgbPack)
24 std::string fullpath = m_BinaryDirectory + std::string(
"test_batch.bin");
26 std::ifstream fileStream(fullpath, std::ios::binary);
27 if (!fileStream.is_open())
29 ARMNN_LOG(fatal) <<
"Failed to load " << fullpath;
34 fileStream.read(reinterpret_cast<char*>(&I[0]), g_kCifar10ImageByteSize);
36 if (!fileStream.good())
38 ARMNN_LOG(fatal) <<
"Failed to read " << fullpath;
43 std::vector<float> inputImageData;
44 inputImageData.resize(g_kCifar10ImageByteSize - 1);
47 unsigned int countR_o;
48 unsigned int countG_o;
49 unsigned int countB_o;
50 unsigned int countR = 1;
51 unsigned int countG = 1 + 32 * 32;
52 unsigned int countB = 1 + 2 * 32 * 32;
65 countB_o = 2 * 32 * 32;
69 for (
unsigned int h = 0; h < 32; h++)
71 for (
unsigned int w = 0; w < 32; w++)
73 inputImageData[countR_o] = boost::numeric_cast<
float>(I[countR++]);
74 inputImageData[countG_o] = boost::numeric_cast<
float>(I[countG++]);
75 inputImageData[countB_o] = boost::numeric_cast<
float>(I[countB++]);
83 const unsigned int label = boost::numeric_cast<
unsigned int>(I[0]);
84 return std::make_unique<TTestCaseData>(label, std::move(inputImageData));
Cifar10Database(const std::string &binaryFileDirectory, bool rgbPack=false)
std::unique_ptr< TTestCaseData > GetTestCaseData(unsigned int testCaseId)
#define ARMNN_LOG(severity)
constexpr unsigned int g_kCifar10ImageByteSize