17 using ImageSet = std::pair<const std::string, unsigned int>;
19 template <
typename TDataType>
35 const std::vector<ImageSet>& imageSet,
37 const std::array<float, 3> mean={{0, 0, 0}},
38 const std::array<float, 3> stddev={{1, 1, 1}},
40 unsigned int batchSize=1)
41 : m_BinaryDirectory(binaryFileDirectory)
44 , m_BatchSize(batchSize)
46 , m_ImageSet(imageSet)
49 , m_DataFormat(dataFormat)
53 std::unique_ptr<TTestCaseData>
GetTestCaseData(
unsigned int testCaseId);
56 unsigned int GetNumImageElements()
const {
return 3 * m_Width * m_Height; }
57 unsigned int GetNumImageBytes()
const {
return sizeof(
DataType) * GetNumImageElements(); }
58 unsigned int GetLabelAndResizedImageAsFloat(
unsigned int testCaseId,
59 std::vector<float> & result);
61 std::string m_BinaryDirectory;
62 unsigned int m_Height;
64 unsigned int m_BatchSize;
67 const std::vector<ImageSet> m_ImageSet;
69 const std::array<float, 3> m_Mean;
70 const std::array<float, 3> m_Stddev;
ImagePreprocessor(const std::string &binaryFileDirectory, unsigned int width, unsigned int height, const std::vector< ImageSet > &imageSet, float scale=255.0f, const std::array< float, 3 > mean={{0, 0, 0}}, const std::array< float, 3 > stddev={{1, 1, 1}}, DataFormat dataFormat=DataFormat::NHWC, unsigned int batchSize=1)
std::unique_ptr< TTestCaseData > GetTestCaseData(unsigned int testCaseId)
std::pair< const std::string, unsigned int > ImageSet
Caffe requires BGR images, not normalized, mean adjusted and resized using smooth resize of STB libra...