15 #include <boost/assert.hpp> 16 #include <boost/format.hpp> 17 #include <boost/numeric/conversion/cast.hpp> 48 constexpr
auto to_underlying(E e) noexcept
50 return static_cast<std::underlying_type_t<E>
>(e);
55 using Exception::Exception;
58 using YoloInputOutput = std::pair<const char* const, YoloDetectedObject>;
60 const std::array<YoloInputOutput,1> g_PerTestCaseInputOutput =
63 "yolo_dog_448x448.png",
64 { to_underlying(YoloVocClass::Dog),
YoloBoundingBox{ 233.0f, 256.0f, 299.0f, 462.0f }, 0.5088733434677124f }
71 : m_ImageDir(imageDir)
77 testCaseId = testCaseId % boost::numeric_cast<
unsigned int>(g_PerTestCaseInputOutput.size());
78 const auto& testCaseInputOutput = g_PerTestCaseInputOutput[testCaseId];
79 const std::string imagePath = m_ImageDir + testCaseInputOutput.first;
82 std::vector<float> imageData;
94 ARMNN_LOG(fatal) <<
"Failed to load test case " << testCaseId <<
" with error: " << e.
what();
99 std::vector<YoloDetectedObject> topObjectDetections;
100 topObjectDetections.reserve(1);
101 topObjectDetections.push_back(testCaseInputOutput.second);
103 return std::make_unique<YoloTestCaseData>(std::move(imageData), std::move(topObjectDetections));
YoloDatabase(const std::string &imageDir)
#define ARMNN_LOG(severity)
std::unique_ptr< TTestCaseData > GetTestCaseData(unsigned int testCaseId)
virtual const char * what() const noexcept override
std::vector< float > GetImageDataInArmNnLayoutAsNormalizedFloats(ImageChannelLayout layout, const InferenceTestImage &image)
Base class for all ArmNN exceptions so that users can filter to just those.
constexpr unsigned int YoloImageHeight
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)
constexpr unsigned int YoloImageWidth