fix the condition if masks are empty

pull/72/head
liang-zijian 2 years ago
parent 7d0f5173e7
commit d967ae6ae8
  1. 9
      csrc/jetson/segment/include/yolov8-seg.hpp
  2. 7
      csrc/segment/normal/include/yolov8-seg.hpp
  3. 8
      csrc/segment/simple/include/yolov8-seg.hpp

@ -428,7 +428,12 @@ void YOLOv8_seg::postprocess(std::vector<Object>& objs,
objs.push_back(obj);
cnt += 1;
}
if(masks.empty())
{
//masks is empty
}
else
{
cv::Mat matmulRes = (masks * protos).t();
cv::Mat maskMat = matmulRes.reshape(indices.size(), { seg_w, seg_h });
@ -457,7 +462,7 @@ void YOLOv8_seg::postprocess(std::vector<Object>& objs,
);
objs[i].boxMask = mask(objs[i].rect) > 0.5f;
}
}
}
void YOLOv8_seg::draw_objects(const cv::Mat& image,

@ -459,6 +459,12 @@ void YOLOv8_seg::postprocess(std::vector<Object>& objs,
cnt += 1;
}
if(masks.empty())
{
//masks is empty
}
else
{
cv::Mat matmulRes = (masks * protos).t();
cv::Mat maskMat = matmulRes.reshape(indices.size(), { seg_w, seg_h });
@ -487,6 +493,7 @@ void YOLOv8_seg::postprocess(std::vector<Object>& objs,
);
objs[i].boxMask = mask(objs[i].rect) > 0.5f;
}
}
}

@ -431,6 +431,12 @@ void YOLOv8_seg::postprocess(std::vector<Object>& objs,
cnt += 1;
}
if(masks.empty())
{
//masks is empty
}
else
{
cv::Mat matmulRes = (masks * protos).t();
cv::Mat maskMat = matmulRes.reshape(indices.size(), { seg_w, seg_h });
@ -459,7 +465,7 @@ void YOLOv8_seg::postprocess(std::vector<Object>& objs,
);
objs[i].boxMask = mask(objs[i].rect) > 0.5f;
}
}
}
void YOLOv8_seg::draw_objects(const cv::Mat& image,

Loading…
Cancel
Save