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 <[email protected]>
  • Loading branch information
HRan2004 and glenn-jocher authored Jun 9, 2022
1 parent 2dd3db0 commit cf298fb
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 @@ -738,6 +738,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 cf298fb

Please sign in to comment.