Skip to content

Commit

Permalink
fix(utils): missing edge when resample segments (ultralytics#8092)
Browse files Browse the repository at this point in the history
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
  • Loading branch information
2 people authored and tdhooghe committed Jun 10, 2022
1 parent df7e780 commit 34d9a4b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@ def segments2boxes(segments):
def resample_segments(segments, n=1000):
# Up-sample an (n,2) segment
for i, s in enumerate(segments):
s = np.concatenate((s, s[0:1, :]), axis=0)
x = np.linspace(0, len(s) - 1, n)
xp = np.arange(len(s))
segments[i] = np.concatenate([np.interp(x, xp, s[:, i]) for i in range(2)]).reshape(2, -1).T # segment xy
Expand Down

0 comments on commit 34d9a4b

Please sign in to comment.