18 template <
typename TDataType>
20 std::vector<float> & result)
23 const ImageSet& imageSet = m_ImageSet[testCaseId];
24 const std::string fullPath = m_BinaryDirectory + imageSet.first;
34 m_Mean, m_Stddev, m_Scale);
37 for (
unsigned int i = 1; i < m_BatchSize; i++)
39 result.insert(result.end(), result.begin(), result.begin() +
armnn::numeric_cast<
int>(GetNumImageElements()));
42 if (m_DataFormat == DataFormat::NCHW)
46 std::vector<float> tempImage(result.size());
48 result.swap(tempImage);
51 return imageSet.second;
55 std::unique_ptr<ImagePreprocessor<float>::TTestCaseData>
58 std::vector<float> resized;
59 auto label = GetLabelAndResizedImageAsFloat(testCaseId, resized);
60 return std::make_unique<TTestCaseData>(label, std::move(resized));
64 std::unique_ptr<ImagePreprocessor<uint8_t>::TTestCaseData>
67 std::vector<float> resized;
68 auto label = GetLabelAndResizedImageAsFloat(testCaseId, resized);
70 size_t resizedSize = resized.size();
71 std::vector<uint8_t> quantized(resized.size());
73 for (
size_t i=0; i<resizedSize; ++i)
75 quantized[i] =
static_cast<uint8_t
>(resized[i]);
78 return std::make_unique<TTestCaseData>(label, std::move(quantized));
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::pair< const std::string, unsigned int > ImageSet
Tf requires RGB images, normalized in range [0, 1] and resized using Bilinear algorithm.
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)