From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- 21.02/_inference_test_image_8cpp.xhtml | 362 +++++++++++++++++++++++++++++++++ 1 file changed, 362 insertions(+) create mode 100644 21.02/_inference_test_image_8cpp.xhtml (limited to '21.02/_inference_test_image_8cpp.xhtml') diff --git a/21.02/_inference_test_image_8cpp.xhtml b/21.02/_inference_test_image_8cpp.xhtml new file mode 100644 index 0000000000..818f2609a8 --- /dev/null +++ b/21.02/_inference_test_image_8cpp.xhtml @@ -0,0 +1,362 @@ + + + + + + + + + + + + + +ArmNN: tests/InferenceTestImage.cpp File Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
InferenceTestImage.cpp File Reference
+
+
+
#include "InferenceTestImage.hpp"
+#include <armnn/utility/Assert.hpp>
+#include <armnn/utility/IgnoreUnused.hpp>
+#include <armnn/utility/NumericCast.hpp>
+#include <fmt/format.h>
+#include <array>
+#include <stb/stb_image.h>
+#include <stb/stb_image_resize.h>
+#include <stb/stb_image_write.h>
+
+

Go to the source code of this file.

+ + + + + + + + +

+Macros

#define STB_IMAGE_IMPLEMENTATION
 
#define STB_IMAGE_RESIZE_IMPLEMENTATION
 
#define STB_IMAGE_WRITE_IMPLEMENTATION
 
+ + + + + + + + + + +

+Functions

template<typename TProcessValueCallable >
std::vector< float > GetImageDataInArmNnLayoutAsFloats (ImageChannelLayout channelLayout, const InferenceTestImage &image, TProcessValueCallable processValue)
 
std::vector< float > GetImageDataInArmNnLayoutAsNormalizedFloats (ImageChannelLayout layout, const InferenceTestImage &image)
 
std::vector< float > GetImageDataInArmNnLayoutAsFloatsSubtractingMean (ImageChannelLayout layout, const InferenceTestImage &image, const std::array< float, 3 > &mean)
 
std::vector< float > GetImageDataAsNormalizedFloats (ImageChannelLayout layout, const InferenceTestImage &image)
 
+

Macro Definition Documentation

+ +

◆ STB_IMAGE_IMPLEMENTATION

+ +
+
+ + + + +
#define STB_IMAGE_IMPLEMENTATION
+
+ +

Definition at line 15 of file InferenceTestImage.cpp.

+ +
+
+ +

◆ STB_IMAGE_RESIZE_IMPLEMENTATION

+ +
+
+ + + + +
#define STB_IMAGE_RESIZE_IMPLEMENTATION
+
+ +

Definition at line 18 of file InferenceTestImage.cpp.

+ +
+
+ +

◆ STB_IMAGE_WRITE_IMPLEMENTATION

+ +
+
+ + + + +
#define STB_IMAGE_WRITE_IMPLEMENTATION
+
+ +

Definition at line 21 of file InferenceTestImage.cpp.

+ +
+
+

Function Documentation

+ +

◆ GetImageDataAsNormalizedFloats()

+ +
+
+ + + + + + + + + + + + + + + + + + +
std::vector<float> GetImageDataAsNormalizedFloats (ImageChannelLayout layout,
const InferenceTestImageimage 
)
+
+ +

Definition at line 333 of file InferenceTestImage.cpp.

+ +

References B, G, InferenceTestImage::GetHeight(), InferenceTestImage::GetPixelAs3Channels(), InferenceTestImage::GetWidth(), and R.

+
335 {
336  std::vector<float> imageData;
337  const unsigned int h = image.GetHeight();
338  const unsigned int w = image.GetWidth();
339 
340  const unsigned int rDstIndex = GetImageChannelIndex(layout, ImageChannel::R);
341  const unsigned int gDstIndex = GetImageChannelIndex(layout, ImageChannel::G);
342  const unsigned int bDstIndex = GetImageChannelIndex(layout, ImageChannel::B);
343 
344  imageData.resize(h * w * 3);
345  unsigned int offset = 0;
346 
347  for (unsigned int j = 0; j < h; ++j)
348  {
349  for (unsigned int i = 0; i < w; ++i)
350  {
351  uint8_t r, g, b;
352  std::tie(r, g, b) = image.GetPixelAs3Channels(i, j);
353 
354  imageData[offset+rDstIndex] = float(r) / 255.0f;
355  imageData[offset+gDstIndex] = float(g) / 255.0f;
356  imageData[offset+bDstIndex] = float(b) / 255.0f;
357  offset += 3;
358  }
359  }
360 
361  return imageData;
362 }
+ + +
unsigned int GetWidth() const
+
std::tuple< uint8_t, uint8_t, uint8_t > GetPixelAs3Channels(unsigned int x, unsigned int y) const
+
unsigned int GetHeight() const
+
+
+
+ +

◆ GetImageDataInArmNnLayoutAsFloats()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
std::vector<float> GetImageDataInArmNnLayoutAsFloats (ImageChannelLayout channelLayout,
const InferenceTestImageimage,
TProcessValueCallable processValue 
)
+
+ +

Definition at line 279 of file InferenceTestImage.cpp.

+ +

References B, G, InferenceTestImage::GetHeight(), InferenceTestImage::GetPixelAs3Channels(), InferenceTestImage::GetWidth(), and R.

+ +

Referenced by GetImageDataInArmNnLayoutAsFloatsSubtractingMean(), and GetImageDataInArmNnLayoutAsNormalizedFloats().

+
282 {
283  const unsigned int h = image.GetHeight();
284  const unsigned int w = image.GetWidth();
285 
286  std::vector<float> imageData;
287  imageData.resize(h * w * 3);
288 
289  for (unsigned int j = 0; j < h; ++j)
290  {
291  for (unsigned int i = 0; i < w; ++i)
292  {
293  uint8_t r, g, b;
294  std::tie(r, g, b) = image.GetPixelAs3Channels(i, j);
295 
296  // ArmNN order: C, H, W
297  const unsigned int rDstIndex = GetImageChannelIndex(channelLayout, ImageChannel::R) * h * w + j * w + i;
298  const unsigned int gDstIndex = GetImageChannelIndex(channelLayout, ImageChannel::G) * h * w + j * w + i;
299  const unsigned int bDstIndex = GetImageChannelIndex(channelLayout, ImageChannel::B) * h * w + j * w + i;
300 
301  imageData[rDstIndex] = processValue(ImageChannel::R, float(r));
302  imageData[gDstIndex] = processValue(ImageChannel::G, float(g));
303  imageData[bDstIndex] = processValue(ImageChannel::B, float(b));
304  }
305  }
306 
307  return imageData;
308 }
+ + +
unsigned int GetWidth() const
+
std::tuple< uint8_t, uint8_t, uint8_t > GetPixelAs3Channels(unsigned int x, unsigned int y) const
+
unsigned int GetHeight() const
+
+
+
+ +

◆ GetImageDataInArmNnLayoutAsFloatsSubtractingMean()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
std::vector<float> GetImageDataInArmNnLayoutAsFloatsSubtractingMean (ImageChannelLayout layout,
const InferenceTestImageimage,
const std::array< float, 3 > & mean 
)
+
+ +

Definition at line 321 of file InferenceTestImage.cpp.

+ +

References GetImageDataInArmNnLayoutAsFloats().

+ +

Referenced by CaffePreprocessor::GetTestCaseData().

+
324 {
325  return GetImageDataInArmNnLayoutAsFloats(layout, image,
326  [layout, &mean](ImageChannel channel, float value)
327  {
328  const unsigned int channelIndex = GetImageChannelIndex(layout, channel);
329  return value - mean[channelIndex];
330  });
331 }
+
std::vector< float > GetImageDataInArmNnLayoutAsFloats(ImageChannelLayout channelLayout, const InferenceTestImage &image, TProcessValueCallable processValue)
+
+
+
+ +

◆ GetImageDataInArmNnLayoutAsNormalizedFloats()

+ +
+
+ + + + + + + + + + + + + + + + + + +
std::vector<float> GetImageDataInArmNnLayoutAsNormalizedFloats (ImageChannelLayout layout,
const InferenceTestImageimage 
)
+
+ +

Definition at line 310 of file InferenceTestImage.cpp.

+ +

References GetImageDataInArmNnLayoutAsFloats(), and armnn::IgnoreUnused().

+ +

Referenced by YoloDatabase::GetTestCaseData().

+
312 {
313  return GetImageDataInArmNnLayoutAsFloats(layout, image,
314  [](ImageChannel channel, float value)
315  {
316  armnn::IgnoreUnused(channel);
317  return value / 255.f;
318  });
319 }
void IgnoreUnused(Ts &&...)
+ +
std::vector< float > GetImageDataInArmNnLayoutAsFloats(ImageChannelLayout channelLayout, const InferenceTestImage &image, TProcessValueCallable processValue)
+
+
+
+
+
+ + + + -- cgit v1.2.1