import numpy
def print(*args, **kwargs):# 沉默权杖
pass
# filename = 'Bird1/groundtruth_rect.txt'
def Read_RectTXT(filename):
file = open(filename, 'r')
rect = []
try:
while True:
text_line = file.readline()
if text_line:
print(type(text_line), text_line) #<class 'str'> 450,91,31,37
rect_line = str.split(text_line, sep=',')
rect.append(rect_line)
else:
break
finally:
file.close()
rect = numpy.array(rect) # list转为numpy
return rect.astype(int) # numpy数组中的元素全为int32整数型
读取groundtruth_rect.txt并转为数组
最新推荐文章于 2022-02-07 14:38:44 发布