Skip to content

Commit

Permalink
fix: Fixed mask computation of DBNet (#753)
Browse files Browse the repository at this point in the history
  • Loading branch information
fg-mindee committed Dec 26, 2021
1 parent e997730 commit 807a392
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doctr/models/detection/differentiable_binarization/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ def build_target(

# Draw polygon on gt if it is valid
if len(shrinked) == 0:
seg_mask[box[1]: box[3] + 1, box[0]: box[2] + 1] = False
seg_mask[idx, box[1]: box[3] + 1, box[0]: box[2] + 1] = False
continue
shrinked = np.array(shrinked[0]).reshape(-1, 2)
if shrinked.shape[0] <= 2 or not Polygon(shrinked).is_valid:
seg_mask[box[1]: box[3] + 1, box[0]: box[2] + 1] = False
seg_mask[idx, box[1]: box[3] + 1, box[0]: box[2] + 1] = False
continue
cv2.fillPoly(seg_target[idx], [shrinked.astype(np.int32)], 1)

Expand Down

0 comments on commit 807a392

Please sign in to comment.