Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>modifyDataloader
@@ -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 |