From cf298fb72fe4878786095bcdbe78ebfecbfd83dd Mon Sep 17 00:00:00 2001 From: HRan2004 <2125764918@qq.com> Date: Thu, 9 Jun 2022 16:52:05 +0800 Subject: [PATCH] fix(utils): missing edge when resample segments (#8092) Co-authored-by: Glenn Jocher --- utils/general.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/general.py b/utils/general.py index 7905e7258a67..9fc7349dbb6d 100755 --- a/utils/general.py +++ b/utils/general.py @@ -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