From a41c474849df630c3b64c92395bb99d1c8e3dca9 Mon Sep 17 00:00:00 2001 From: Flippchen <91947480+Flippchen@users.noreply.github.com> Date: Wed, 27 Sep 2023 01:15:37 +0200 Subject: [PATCH 1/2] Fix crash on non-quadratic segmentation masks --- csrc/segment/simple/include/yolov8-seg.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csrc/segment/simple/include/yolov8-seg.hpp b/csrc/segment/simple/include/yolov8-seg.hpp index d753088..25cb533 100644 --- a/csrc/segment/simple/include/yolov8-seg.hpp +++ b/csrc/segment/simple/include/yolov8-seg.hpp @@ -300,7 +300,7 @@ void YOLOv8_seg::postprocess( } else { cv::Mat matmulRes = (masks * protos).t(); - cv::Mat maskMat = matmulRes.reshape(indices.size(), {seg_w, seg_h}); + cv::Mat maskMat = matmulRes.reshape(indices.size(), {seg_h, seg_w}); std::vector maskChannels; cv::split(maskMat, maskChannels); From 4bf9dd15edcf8c6672a16e42259b7bd5e5deff18 Mon Sep 17 00:00:00 2001 From: Flippchen <91947480+Flippchen@users.noreply.github.com> Date: Wed, 27 Sep 2023 01:16:33 +0200 Subject: [PATCH 2/2] Fix crash on non-quadratic segmentation masks --- csrc/segment/normal/include/yolov8-seg.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csrc/segment/normal/include/yolov8-seg.hpp b/csrc/segment/normal/include/yolov8-seg.hpp index e6d8cad..a6a87b2 100644 --- a/csrc/segment/normal/include/yolov8-seg.hpp +++ b/csrc/segment/normal/include/yolov8-seg.hpp @@ -326,7 +326,7 @@ void YOLOv8_seg::postprocess( } else { cv::Mat matmulRes = (masks * protos).t(); - cv::Mat maskMat = matmulRes.reshape(indices.size(), {seg_w, seg_h}); + cv::Mat maskMat = matmulRes.reshape(indices.size(), {seg_h, seg_w}); std::vector maskChannels; cv::split(maskMat, maskChannels);