Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesmindee committed Feb 17, 2022
1 parent bf1d53a commit 6ce142c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doctr/models/detection/linknet/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,17 @@ def build_target(
subject = [tuple(coor) for coor in poly]
padding = pyclipper.PyclipperOffset()
padding.AddPath(subject, pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON)
shrinked = padding.Execute(-distance)
shrunken = padding.Execute(-distance)

# Draw polygon on gt if it is valid
if len(shrinked) == 0:
if len(shrunken) == 0:
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:
shrunken = np.array(shrunken[0]).reshape(-1, 2)
if shrunken.shape[0] <= 2 or not Polygon(shrunken).is_valid:
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)
cv2.fillPoly(seg_target[idx], [shrunken.astype(np.int32)], 1)

# Don't forget to switch back to channel first if PyTorch is used
if not is_tf_available():
Expand Down

0 comments on commit 6ce142c

Please sign in to comment.