MCPcopy Create free account
hub / github.com/ARM-software/armnn / GetTestCaseData

Method GetTestCaseData

tests/YoloDatabase.cpp:73–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73std::unique_ptr<YoloDatabase::TTestCaseData> YoloDatabase::GetTestCaseData(unsigned int testCaseId)
74{
75 testCaseId = testCaseId % armnn::numeric_cast<unsigned int>(g_PerTestCaseInputOutput.size());
76 const auto& testCaseInputOutput = g_PerTestCaseInputOutput[testCaseId];
77 const std::string imagePath = m_ImageDir + testCaseInputOutput.first;
78
79 // Loads test case input image.
80 std::vector<float> imageData;
81 try
82 {
83 InferenceTestImage image(imagePath.c_str());
84 if (YoloImageWidth != image.GetWidth() || YoloImageHeight != image.GetHeight())
85 {
86 image.Resize(YoloImageWidth, YoloImageHeight, CHECK_LOCATION());
87 }
88 imageData = GetImageDataInArmNnLayoutAsNormalizedFloats(ImageChannelLayout::Rgb, image);
89 }
90 catch (const InferenceTestImageException& e)
91 {
92 ARMNN_LOG(fatal) << "Failed to load test case " << testCaseId << " with error: " << e.what();
93 return nullptr;
94 }
95
96 // Prepares test case output.
97 std::vector<YoloDetectedObject> topObjectDetections;
98 topObjectDetections.reserve(1);
99 topObjectDetections.push_back(testCaseInputOutput.second);
100
101 return std::make_unique<YoloTestCaseData>(std::move(imageData), std::move(topObjectDetections));
102}

Callers 4

GetTestCaseMethod · 0.45
GetTestCaseMethod · 0.45
GetTestCaseMethod · 0.45
mainFunction · 0.45

Calls 9

ResizeMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45
c_strMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45
whatMethod · 0.45
reserveMethod · 0.45

Tested by 3

GetTestCaseMethod · 0.36
GetTestCaseMethod · 0.36
GetTestCaseMethod · 0.36