From 8560be24be60fc78ddd5c1e953840df786f17be9 Mon Sep 17 00:00:00 2001 From: buptlihang <18801481780@163.com> Date: Wed, 21 Apr 2021 00:56:15 +0800 Subject: [PATCH] add PolygonScoreAcc to improve polygon detect --- deploy/cpp_infer/include/postprocess_op.h | 1 + deploy/cpp_infer/src/postprocess_op.cpp | 35 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/deploy/cpp_infer/include/postprocess_op.h b/deploy/cpp_infer/include/postprocess_op.h index 44ca3531..a600ea6d 100644 --- a/deploy/cpp_infer/include/postprocess_op.h +++ b/deploy/cpp_infer/include/postprocess_op.h @@ -51,6 +51,7 @@ public: float &ssid); float BoxScoreFast(std::vector> box_array, cv::Mat pred); + float PolygonScoreAcc(std::vector contour, cv::Mat pred); std::vector>> BoxesFromBitmap(const cv::Mat pred, const cv::Mat bitmap, diff --git a/deploy/cpp_infer/src/postprocess_op.cpp b/deploy/cpp_infer/src/postprocess_op.cpp index 8c44a54a..1c13f8aa 100644 --- a/deploy/cpp_infer/src/postprocess_op.cpp +++ b/deploy/cpp_infer/src/postprocess_op.cpp @@ -159,6 +159,39 @@ std::vector> PostProcessor::GetMiniBoxes(cv::RotatedRect box, return array; } +float PostProcessor::PolygonScoreAcc(std::vector contour, + cv::Mat pred){ + int width = pred.cols; + int height = pred.rows; + std::vector box_x; + std::vector box_y; + for(int i=0; i> box_array, cv::Mat pred) { auto array = box_array; @@ -235,6 +268,8 @@ PostProcessor::BoxesFromBitmap(const cv::Mat pred, const cv::Mat bitmap, float score; score = BoxScoreFast(array, pred); + /* compute using polygon*/ + // score = PolygonScoreAcc(contours[_i], pred); if (score < box_thresh) continue; -- GitLab