68点数据集300W的网址:http://ibug.doc.ic.ac.uk/resources/300-W_IMAVIS/
该数据集原本是每张照片对应有一个.pts格式的标注信息,而.pts不方便读取。
我的工作是:
1.用批处理文件把 .pts 改为 .txt
2. 编写脚本,整合标注信息到一个txt上面
import math
import os
def make_txt(totol_num):
temp_index = 1
while temp_index <= totol_num:
if temp_index < 10:
index = '00' + str(temp_index)
elif temp_index < 100:
index = '0' + str(temp_index)
else:
index = str(temp_index)
make_one_txt(index)
temp_index = temp_index + 1
def make_one_txt(index):
num_of_line = 1
input_path = '02_Outdoor/outdoor_%s.txt' % index
image_path = '02_Outdoor/outdoor_%s.png' % index
print('input_path:', input_path)
with open(input_path, 'r') as f:
while True:
line = f.readline()
print(line)
if num_of_line == 1:
write_txt(image_path)
write_txt('\n')
elif num_of_line > 3 and num_of_line < 72:
write_txt(line)
elif num_of_line >= 72:
break
num_of_line = num_of_line + 1
def write_txt(line):
output_file = '300w.txt'
with open(output_file, 'a') as f:
f.write(line)
if __name__ == '__main__':
print('lala')
totol_num = 300
make_txt(totol_num)
文件见我的github:https://github.com/Watebear/Annotation-file-for-300w-/