Browse Source

fix(utils): missing edge when resample segments (#8092)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
modifyDataloader
HRan2004 GitHub 2 years ago
parent
commit
cf298fb72f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      utils/general.py

+ 1
- 0
utils/general.py View File

def resample_segments(segments, n=1000): def resample_segments(segments, n=1000):
# Up-sample an (n,2) segment # Up-sample an (n,2) segment
for i, s in enumerate(segments): for i, s in enumerate(segments):
s = np.concatenate((s, s[0:1, :]), axis=0)
x = np.linspace(0, len(s) - 1, n) x = np.linspace(0, len(s) - 1, n)
xp = np.arange(len(s)) 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 segments[i] = np.concatenate([np.interp(x, xp, s[:, i]) for i in range(2)]).reshape(2, -1).T # segment xy

Loading…
Cancel
Save