summaryrefslogtreecommitdiff
path: root/source/use_case/object_detection/include/DetectorPostProcessing.hpp
diff options
context:
space:
mode:
authorRichard Burton <richard.burton@arm.com>2022-02-14 11:55:35 +0000
committerRichard <richard.burton@arm.com>2022-02-14 15:02:26 +0000
commited35a6fea4a1604db81c56fc71f7756822fcf212 (patch)
treef04b7d41ded8b4824978c2feaf120a3b6e1be2fb /source/use_case/object_detection/include/DetectorPostProcessing.hpp
parente2da7ee5e9732ec0d1962b7d74737b8ef5463a9e (diff)
downloadml-embedded-evaluation-kit-ed35a6fea4a1604db81c56fc71f7756822fcf212.tar.gz
MLECO-2874: Move NMS out of the OD use_case
* Add ImageUtils * Move image related code from UseCaseCommonUtils to ImageUtils * Move NMS related code to ImageUtils * Delete test specific ImageUtils and use new ImageUtils Signed-off-by: Richard Burton <richard.burton@arm.com> Change-Id: Icbf5dd9c6a941b0126ecdf69a0c9d9969f22729f
Diffstat (limited to 'source/use_case/object_detection/include/DetectorPostProcessing.hpp')
-rw-r--r--source/use_case/object_detection/include/DetectorPostProcessing.hpp68
1 files changed, 3 insertions, 65 deletions
diff --git a/source/use_case/object_detection/include/DetectorPostProcessing.hpp b/source/use_case/object_detection/include/DetectorPostProcessing.hpp
index 3e9c819..5393f89 100644
--- a/source/use_case/object_detection/include/DetectorPostProcessing.hpp
+++ b/source/use_case/object_detection/include/DetectorPostProcessing.hpp
@@ -18,6 +18,7 @@
#define DETECTOR_POST_PROCESSING_HPP
#include "UseCaseCommonUtils.hpp"
+#include "ImageUtils.hpp"
#include "DetectionResult.hpp"
#include "YoloFastestModel.hpp"
@@ -45,20 +46,6 @@ namespace object_detection {
int topN;
};
-
- struct Box {
- float x;
- float y;
- float w;
- float h;
- };
-
- struct Detection {
- Box bbox;
- std::vector<float> prob;
- float objectness;
- };
-
/**
* @brief Helper class to manage tensor post-processing for "object_detection"
* output.
@@ -99,18 +86,11 @@ namespace object_detection {
int m_topN; /* TopN */
/**
- * @brief Calculate the Sigmoid function of the give value.
- * @param[in] x Value.
- * @return Sigmoid value of the input.
- **/
- float Sigmoid(float x);
-
- /**
* @brief Insert the given Detection in the list.
* @param[in] detections List of detections.
* @param[in] det Detection to be inserted.
**/
- void InsertTopNDetections(std::forward_list<Detection>& detections, Detection& det);
+ void InsertTopNDetections(std::forward_list<image::Detection>& detections, image::Detection& det);
/**
* @brief Given a Network calculate the detection boxes.
@@ -124,49 +104,7 @@ namespace object_detection {
int imageWidth,
int imageHeight,
float threshold,
- std::forward_list<Detection>& detections);
-
- /**
- * @brief Calculate the 1D overlap.
- * @param[in] x1Center First center point.
- * @param[in] width1 First width.
- * @param[in] x2Center Second center point.
- * @param[in] width2 Second width.
- * @return The overlap between the two lines.
- **/
- float Calculate1DOverlap(float x1Center, float width1, float x2Center, float width2);
-
- /**
- * @brief Calculate the intersection between the two given boxes.
- * @param[in] box1 First box.
- * @param[in] box2 Second box.
- * @return The intersection value.
- **/
- float CalculateBoxIntersect(Box& box1, Box& box2);
-
- /**
- * @brief Calculate the union between the two given boxes.
- * @param[in] box1 First box.
- * @param[in] box2 Second box.
- * @return The two given boxes union value.
- **/
- float CalculateBoxUnion(Box& box1, Box& box2);
- /**
- * @brief Calculate the intersection over union between the two given boxes.
- * @param[in] box1 First box.
- * @param[in] box2 Second box.
- * @return The intersection over union value.
- **/
- float CalculateBoxIOU(Box& box1, Box& box2);
-
- /**
- * @brief Calculate the Non-Maxima suppression on the given detection boxes.
- * @param[in] detections Detection boxes.
- * @param[in] classes Number of classes.
- * @param[in] iouThreshold Intersection over union threshold.
- * @return true or false based on execution success.
- **/
- void CalculateNMS(std::forward_list<Detection>& detections, int classes, float iouThreshold);
+ std::forward_list<image::Detection>& detections);
/**
* @brief Draw on the given image a bounding box starting at (boxX, boxY).