Created
November 25, 2018 15:22
-
-
Save alpercalisir/db580bb324e27aa7374a941f195b4a6c to your computer and use it in GitHub Desktop.
Gets VGGFace2 dataset and changes it into yolo v3 format
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 pandas as pd | |
import numpy as np | |
from lxml import etree | |
#import xmlAnnotation.etree.cElementTree as ET | |
import xml.etree.ElementTree as ET | |
fields = ['NAME_ID', 'XMIN', 'YMIN', 'W', 'H', 'XMAX', 'YMAX'] | |
df = pd.read_csv('loose_bb_test.csv', usecols=fields) | |
# Change the name of the file. | |
# This will replace the / with - | |
def nameChange(x): | |
x = x.replace("/", "-") | |
return x | |
df['NAME_ID'] = df['NAME_ID'].apply(nameChange) | |
np.savetxt(r'b.txt', df.values, fmt='%s', delimiter=',') | |
import fileinput | |
with fileinput.FileInput("b.txt", inplace=True, backup='.bak') as file: | |
for line in file: | |
print(line.replace(",", " ",1), end='') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment