aboutsummaryrefslogtreecommitdiff
path: root/tests/TfLiteYoloV3Big-Armnn/NMS.cpp
diff options
context:
space:
mode:
authorRyan OShea <Ryan.OShea2@arm.com>2020-08-07 16:27:34 +0100
committerJim Flynn <jim.flynn@arm.com>2020-08-18 10:51:48 +0000
commit74af093826b77022a8b70ec2216a96044e5be7d4 (patch)
treee3e4d2bdc6e155bc6c04f1efb7848e2c1b17ab80 /tests/TfLiteYoloV3Big-Armnn/NMS.cpp
parentc83eb25255c46ccce97e705e18210f0eaf36339d (diff)
downloadarmnn-74af093826b77022a8b70ec2216a96044e5be7d4.tar.gz
IVGCVSW-5159 Add Accuracy Check for YoloV3 Big App
* Add Check Accuracy Method * Add Ability to pass in comparison file paths * Add compare_detection to yolo v3 class Signed-off-by: Ryan OShea <Ryan.OShea2@arm.com> Change-Id: I914ffe4805316263dc19d76a777fff6e35f44961
Diffstat (limited to 'tests/TfLiteYoloV3Big-Armnn/NMS.cpp')
-rw-r--r--tests/TfLiteYoloV3Big-Armnn/NMS.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/TfLiteYoloV3Big-Armnn/NMS.cpp b/tests/TfLiteYoloV3Big-Armnn/NMS.cpp
index 3ef840f875..d067f1a004 100644
--- a/tests/TfLiteYoloV3Big-Armnn/NMS.cpp
+++ b/tests/TfLiteYoloV3Big-Armnn/NMS.cpp
@@ -6,6 +6,7 @@
#include "NMS.hpp"
+#include <cmath>
#include <algorithm>
#include <cstddef>
#include <numeric>
@@ -80,6 +81,18 @@ std::vector<Detection> convert_to_detections(const NMSConfig& config,
}
} // namespace
+bool compare_detection(const yolov3::Detection& detection,
+ const std::vector<float>& expected)
+{
+ float tolerance = 0.001f;
+ return (std::fabs(detection.classes[0] - expected[0]) < tolerance &&
+ std::fabs(detection.box.xmin - expected[1]) < tolerance &&
+ std::fabs(detection.box.ymin - expected[2]) < tolerance &&
+ std::fabs(detection.box.xmax - expected[3]) < tolerance &&
+ std::fabs(detection.box.ymax - expected[4]) < tolerance &&
+ std::fabs(detection.confidence - expected[5]) < tolerance );
+}
+
void print_detection(std::ostream& os,
const std::vector<Detection>& detections)
{