13 #include <boost/numeric/conversion/cast.hpp> 14 #include <boost/format.hpp> 20 template <
typename TDataType>
22 std::vector<float> & result)
25 const ImageSet& imageSet = m_ImageSet[testCaseId];
26 const std::string fullPath = m_BinaryDirectory + imageSet.first;
36 m_Mean, m_Stddev, m_Scale);
39 for (
unsigned int i = 1; i < m_BatchSize; i++)
41 result.insert(result.end(), result.begin(), result.begin() +
boost::numeric_cast<
int>(GetNumImageElements()));
44 if (m_DataFormat == DataFormat::NCHW)
48 std::vector<float> tempImage(result.size());
50 result.swap(tempImage);
53 return imageSet.second;
57 std::unique_ptr<ImagePreprocessor<float>::TTestCaseData>
60 std::vector<float> resized;
61 auto label = GetLabelAndResizedImageAsFloat(testCaseId, resized);
62 return std::make_unique<TTestCaseData>(label, std::move(resized));
66 std::unique_ptr<ImagePreprocessor<uint8_t>::TTestCaseData>
69 std::vector<float> resized;
70 auto label = GetLabelAndResizedImageAsFloat(testCaseId, resized);
72 size_t resizedSize = resized.size();
73 std::vector<uint8_t> quantized(resized.size());
75 for (
size_t i=0; i<resizedSize; ++i)
77 quantized[i] =
static_cast<uint8_t
>(resized[i]);
80 return std::make_unique<TTestCaseData>(label, std::move(quantized));
std::pair< const std::string, unsigned int > ImageSet
Caffe requires BGR images, not normalized, mean adjusted and resized using smooth resize of STB libra...
std::unique_ptr< TTestCaseData > GetTestCaseData(unsigned int testCaseId)
const armnn::PermutationVector NHWCToArmNN
void Permute(const armnn::TensorShape &dstShape, const armnn::PermutationVector &mappings, const void *src, void *dst, size_t dataTypeSize)
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
std::vector< float > Resize(unsigned int newWidth, unsigned int newHeight, const armnn::CheckLocation &location, const ResizingMethods meth=ResizingMethods::STB, const std::array< float, 3 > &mean={{0.0, 0.0, 0.0}}, const std::array< float, 3 > &stddev={{1.0, 1.0, 1.0}}, const float scale=255.0f)