Skip to content

Commit 34d9a4b

Browse files
HRan2004glenn-jocher
authored andcommitted
fix(utils): missing edge when resample segments (ultralytics#8092)
Co-authored-by: Glenn Jocher <[email protected]>
1 parent df7e780 commit 34d9a4b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

utils/general.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,7 @@ def segments2boxes(segments):
739739
def resample_segments(segments, n=1000):
740740
# Up-sample an (n,2) segment
741741
for i, s in enumerate(segments):
742+
s = np.concatenate((s, s[0:1, :]), axis=0)
742743
x = np.linspace(0, len(s) - 1, n)
743744
xp = np.arange(len(s))
744745
segments[i] = np.concatenate([np.interp(x, xp, s[:, i]) for i in range(2)]).reshape(2, -1).T # segment xy

0 commit comments

Comments
 (0)