Skip to content

Instantly share code, notes, and snippets.

@Mycenae
Created December 8, 2018 13:19
Show Gist options
  • Save Mycenae/8b476e066335416a3eb212bdc8018ce8 to your computer and use it in GitHub Desktop.
Save Mycenae/8b476e066335416a3eb212bdc8018ce8 to your computer and use it in GitHub Desktop.
Create corresponding trainval.txt for existing dataset image files
import os
path = os.getcwd()
dataAnnotated = os.listdir(path + '/JPEGImages')
dataNum = len(dataAnnotated)
ftrainval = open('trainval.txt', 'w')
info = ''
for name in dataAnnotated:
info += str(name).strip(".jpg")
info += '\n'
ftrainval.write(str(info))
ftrainval.close()
print('done!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment