Skip to content

Bboxes and Masks have different sizes #1270

Answered by lvhan028
FHarhammer asked this question in Q&A
Discussion options

You must be logged in to vote

I think boxes = boxes_and_scores[:,:-1].astype(np.int32) is not precisely in your code.

Refer to

void ProcessMasks(Detections& result, Tensor cpu_masks, int img_w, int img_h) const {
, you can find the following codes to get the bbox [x0, y0, x1, y1] of a mask.

  auto x0 = std::max(std::floor(bbox[0]) - 1, 0.f);
  auto y0 = std::max(std::floor(bbox[1]) - 1, 0.f);
  auto x1 = std::min(std::ceil(bbox[2]) + 1, (float)img_w);
  auto y1 = std::min(std::ceil(bbox[3]) + 1, (float)img_h);
  auto width = static_cast<int>(x1 - x0);
  auto height = static_cast<int>(y1 - y0);

@lzhangzz can it be guaran…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@FHarhammer
Comment options

@grimoire
Comment options

@FHarhammer
Comment options

Comment options

You must be logged in to vote
2 replies
@lzhangzz
Comment options

@FHarhammer
Comment options

Answer selected by lvhan028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants