aboutsummaryrefslogtreecommitdiff
path: root/tests/MobileNetSsdDatabase.hpp
diff options
context:
space:
mode:
authorNarumol Prangnawarat <narumol.prangnawarat@arm.com>2019-02-25 17:26:05 +0000
committerNarumol Prangnawarat <narumol.prangnawarat@arm.com>2019-02-26 17:41:15 +0000
commit4628d05455dfc179f0437913185e76888115a98a (patch)
treea8eac68ee5aee88a7071ac6f13af7932b98caa87 /tests/MobileNetSsdDatabase.hpp
parent452869973b9a45c9c44820d16f92f7dfc96e9aef (diff)
downloadarmnn-4628d05455dfc179f0437913185e76888115a98a.tar.gz
IVGCVSW-2560 Verify Inference test for TensorFlow Lite MobileNet SSD
* Assign output shape of MobileNet SSD to ArmNN network * Add m_OverridenOutputShapes to TfLiteParser to set shape in GetNetworkOutputBindingInfo * Use input quantization instead of output quantization params * Correct data and datatype in Inference test Change-Id: I01ac2e07ed08e8928ba0df33a4847399e1dd8394 Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com> Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Diffstat (limited to 'tests/MobileNetSsdDatabase.hpp')
-rw-r--r--tests/MobileNetSsdDatabase.hpp50
1 files changed, 38 insertions, 12 deletions
diff --git a/tests/MobileNetSsdDatabase.hpp b/tests/MobileNetSsdDatabase.hpp
index cac558793f..7a30f221d2 100644
--- a/tests/MobileNetSsdDatabase.hpp
+++ b/tests/MobileNetSsdDatabase.hpp
@@ -27,14 +27,17 @@ namespace
struct MobileNetSsdTestCaseData
{
MobileNetSsdTestCaseData(
- std::vector<uint8_t> inputData,
- std::vector<DetectedObject> expectedOutput)
- : m_InputData(std::move(inputData))
- , m_ExpectedOutput(std::move(expectedOutput))
+ const std::vector<uint8_t>& inputData,
+ const std::vector<DetectedObject>& expectedDetectedObject,
+ const std::vector<std::vector<float>>& expectedOutput)
+ : m_InputData(inputData)
+ , m_ExpectedDetectedObject(expectedDetectedObject)
+ , m_ExpectedOutput(expectedOutput)
{}
- std::vector<uint8_t> m_InputData;
- std::vector<DetectedObject> m_ExpectedOutput;
+ std::vector<uint8_t> m_InputData;
+ std::vector<DetectedObject> m_ExpectedDetectedObject;
+ std::vector<std::vector<float>> m_ExpectedOutput;
};
class MobileNetSsdDatabase
@@ -59,7 +62,9 @@ const std::array<ObjectDetectionInput, 1> g_PerTestCaseInput =
ObjectDetectionInput
{
"Cat.jpg",
- DetectedObject(16, BoundingBox(0.208961248f, 0.0852333307f, 0.92757535f, 0.940263629f), 0.79296875f)
+ {
+ DetectedObject(16.0f, BoundingBox(0.208961248f, 0.0852333307f, 0.92757535f, 0.940263629f), 0.79296875f)
+ }
}
};
@@ -100,12 +105,33 @@ std::unique_ptr<MobileNetSsdTestCaseData> MobileNetSsdDatabase::GetTestCaseData(
return nullptr;
}
- // Prepare test case expected output
- std::vector<DetectedObject> expectedOutput;
- expectedOutput.reserve(1);
- expectedOutput.push_back(testCaseInput.second);
+ std::vector<float> numDetections = { static_cast<float>(testCaseInput.second.size()) };
+
+ std::vector<float> detectionBoxes;
+ std::vector<float> detectionClasses;
+ std::vector<float> detectionScores;
+
+ for (DetectedObject expectedObject : testCaseInput.second)
+ {
+ detectionBoxes.push_back(expectedObject.m_BoundingBox.m_YMin);
+ detectionBoxes.push_back(expectedObject.m_BoundingBox.m_XMin);
+ detectionBoxes.push_back(expectedObject.m_BoundingBox.m_YMax);
+ detectionBoxes.push_back(expectedObject.m_BoundingBox.m_XMax);
+
+ detectionClasses.push_back(expectedObject.m_Class);
- return std::make_unique<MobileNetSsdTestCaseData>(std::move(imageData), std::move(expectedOutput));
+ detectionScores.push_back(expectedObject.m_Confidence);
+ }
+
+ // Prepare test case expected output
+ std::vector<std::vector<float>> expectedOutputs;
+ expectedOutputs.reserve(4);
+ expectedOutputs.push_back(detectionBoxes);
+ expectedOutputs.push_back(detectionClasses);
+ expectedOutputs.push_back(detectionScores);
+ expectedOutputs.push_back(numDetections);
+
+ return std::make_unique<MobileNetSsdTestCaseData>(imageData, testCaseInput.second, expectedOutputs);
}
} // anonymous namespace