Skip to content

Instantly share code, notes, and snippets.

@tsycnh
Created December 23, 2017 06:42
Show Gist options
  • Save tsycnh/177bbf7d93adc6207242fd334ce3bb60 to your computer and use it in GitHub Desktop.
Save tsycnh/177bbf7d93adc6207242fd334ce3bb60 to your computer and use it in GitHub Desktop.
给17类的牛津花朵数据集,增加label
file_a = open('/Users/shidanlifuhetian/All/data/flowers17/files.txt',mode='r')
text = file_a.readlines()
file_a.close()
file_b = open('./newtesx.txt',mode='a')
for i,item in enumerate(text):
if i%80 ==0:
class_num = str(i//80)
t = item.split('\n')
newtext = t[0]+' '+class_num+'\n'
print(newtext)
file_b.write(newtext)
file_b.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment