string 坐标转为numpy格式坐标 (从txt文本中读取坐标)

f = open(datapath,"r")
a = f.readline()
x = a.split()
x = [int(x) for x in x if x]
bbox = np.stack(x).astype(np.float32)

首先,读取4位坐标(x y w h)

再把读取的坐标按空格分开

然后转为list数组

最后转为numpy格式

猜你喜欢

转载自blog.csdn.net/a362682954/article/details/84931995