diff options
author | FinnWilliamsArm <Finn.Williams@arm.com> | 2019-05-22 14:50:55 +0100 |
---|---|---|
committer | Narumol Prangnawarat <narumol.prangnawarat@arm.com> | 2019-05-27 16:27:36 +0000 |
commit | af8b72d3a97baa0c86583b03321e8a8d3f4bc2aa (patch) | |
tree | 3b4d86842399842b852e593c3bcf131d86d3ae20 /tests/InferenceTestImage.cpp | |
parent | 43aec5886449c1b024b740fd6f4500e827bde221 (diff) | |
download | armnn-af8b72d3a97baa0c86583b03321e8a8d3f4bc2aa.tar.gz |
IVGCVSW-3129 Image pre-processing fix for TFLite
* Resized images for quantized models are now statically cast to uint8
instead of quantized
* Removed optional quantization parameters from ImagePreprocessor
constructor
* Changed mean and scale for TFLite models
Signed-off-by: FinnWilliamsArm <Finn.Williams@arm.com>
Change-Id: Id5ffdf77f3614d10c417e769bd8ffc4a4c07308b
Diffstat (limited to 'tests/InferenceTestImage.cpp')
-rw-r--r-- | tests/InferenceTestImage.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/InferenceTestImage.cpp b/tests/InferenceTestImage.cpp index b011e6ac8f..92c67ae225 100644 --- a/tests/InferenceTestImage.cpp +++ b/tests/InferenceTestImage.cpp @@ -55,6 +55,7 @@ inline void PutData(std::vector<float> & data, std::vector<float> ResizeBilinearAndNormalize(const InferenceTestImage & image, const unsigned int outputWidth, const unsigned int outputHeight, + const float scale, const std::array<float, 3>& mean, const std::array<float, 3>& stddev) { @@ -114,7 +115,7 @@ std::vector<float> ResizeBilinearAndNormalize(const InferenceTestImage & image, const float ly0 = Lerp(float(rgb_x0y0[c]), float(rgb_x1y0[c]), xw); const float ly1 = Lerp(float(rgb_x0y1[c]), float(rgb_x1y1[c]), xw); const float l = Lerp(ly0, ly1, yw); - PutData(out, outputWidth, x, y, c, ((l/255.0f) - mean[c])/stddev[c]); + PutData(out, outputWidth, x, y, c, ((l / scale) - mean[c]) / stddev[c]); } } } @@ -210,7 +211,8 @@ std::vector<float> InferenceTestImage::Resize(unsigned int newWidth, const armnn::CheckLocation& location, const ResizingMethods meth, const std::array<float, 3>& mean, - const std::array<float, 3>& stddev) + const std::array<float, 3>& stddev, + const float scale) { std::vector<float> out; if (newWidth == 0 || newHeight == 0) @@ -227,7 +229,7 @@ std::vector<float> InferenceTestImage::Resize(unsigned int newWidth, } case ResizingMethods::BilinearAndNormalized: { - out = ResizeBilinearAndNormalize(*this, newWidth, newHeight, mean, stddev); + out = ResizeBilinearAndNormalize(*this, newWidth, newHeight, scale, mean, stddev); break; } default: |