Created
July 31, 2019 06:39
-
-
Save ivder/569835c9df6f0b466607daf13fb6b35f to your computer and use it in GitHub Desktop.
Yolo Format Label to 0 converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from os import walk, getcwd | |
input_list = [] | |
for file in os.listdir("/home/ivan/darknet/data/objdamage/"): | |
input_list.append(file) | |
for filename in input_list: | |
content = open("/home/ivan/darknet/data/objdamage/"+filename, "r") | |
output_path = "/home/ivan/darknet/data/objdamageconverted/"+filename | |
output_filename = open(output_path, "a") | |
lines = content.read().splitlines() | |
for line in lines: | |
first, rest = line[:1], line[1:] | |
print first | |
print rest | |
output_filename.write("0"+rest+'\n') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment