问题描述
我是python的新手。 我创建了一个代码来计算YOLO批注中包含了多少个类,我遇到了此错误。
我真的不熟悉此编码错误。 '_' 我进行了很多搜索,但是没有针对“ 0xc4”的解决方案。
mid_num = 4000
total_num = 13485 #총 이미지 개수
dir = '/media/aicar/Seagate Backup Plus Drive/최종_데이터셋_cone/labels/' #어노테이션이 있는 위치
# dir = '/home/aicar/labelImg-master/data/'
cone = 0
stick = 0
crossline = 0
stopline = 0
red_light = 0
yellow_light = 0
green_light = 0
str_and_left = 0
left_turn = 0
drum = 0
for idx in range(1,mid_num+1):
# filename = dir + str(idx) + '.txt'
filename = dir + 'corn_' + str(idx) + '.txt'
# f = open(filename,'r')
col_2=[]
with open(filename) as f:
for line in f:
chars=[]
line=line.split(' ')
for char in line:
if char not in ['',' ']:
chars.append(char)
col_2.append(chars[0])
f.close()
# print(col_2)
if '0' in col_2:
cone = cone +1
if '1' in col_2:
stick = stick +1
if '2' in col_2:
crossline = crossline +1
if '3' in col_2:
stopline = stopline +1
if '4' in col_2:
red_light = red_light +1
if '5' in col_2:
yellow_light = yellow_light +1
if '6' in col_2:
green_light = green_light +1
if '7' in col_2:
str_and_left = str_and_left +1
if '8' in col_2:
left_turn = left_turn +1
if '9' in col_2:
drum = drum +1
print('cone : ' + str(cone))
print('stick : ' + str(stick))
print('crossline : ' + str(crossline))
print('stopline : ' + str(red_light))
print('red_light : ' + str(red_light))
print('yellow_light : ' + str(yellow_light))
print('green_light : ' + str(green_light))
print('str_and_left : ' + str(str_and_left))
print('left_turn : ' + str(left_turn))
print('drum : ' + str(drum))
我拥有的锡的总数为13,485,这在'total_num'的第5行中显示。
如果我在13,485个注释上运行此代码,则会出现UnicodeDecodeError,并且如果我运行约1,000个,则它可以正常工作。
下图是仅打开1000个注释时的终端窗口。
我需要专家的帮助。 谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)