From 2e99efb27fa059e7bc776e6c79a98ad9268187ed Mon Sep 17 00:00:00 2001
From: HRan2004 <2125764918@qq.com>
Date: Mon, 12 Sep 2022 22:37:21 +0800
Subject: [PATCH] fix(utils): missing edge when resample segments (#611)

---
 utils/general.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/utils/general.py b/utils/general.py
index faf908f..6b7edb3 100644
--- a/utils/general.py
+++ b/utils/general.py
@@ -310,6 +310,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