You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to change the xml file of the dataset of the aihub site to csv by slightly changing the code.
The code is as follows.
import os
import glob
import pandas as pd
import xml.etree.ElementTree as ET
def xml_to_csv(path):
xml_list = []
for xml_file in glob.glob(path + '/*.xml'):
tree = ET.parse(xml_file)
root = tree.getroot()
for img in root.findall('image'):
for bbox in img.findall('box'):
value = (img.attrib['name'],
img.attrib['width'], img.attrib['height'],
bbox.attrib['label'].replace("_", "-"),
bbox.attrib['xtl'],
bbox.attrib['ytl'],
bbox.attrib['xbr'],
bbox.attrib['ybr']
)
xml_list.append(value)
column_name = ['filename', 'width', 'height', 'class', 'xtl', 'ytl', 'xbr', 'ybr']
xml_df = pd.DataFrame(xml_list, columns=column_name)
return xml_df
def main():
os.getcwd()
os.chdir('/project/Liberty/aihub_pedestrian')
# image_path = os.path.join(os.getcwd(), '/Bbox_1_new', '/Bbox_0001')
image_path = '/project/Liberty/aihub_pedestrian/Bbox_1_new/Bbox_0002'
xml_df = xml_to_csv(image_path)
xml_df.to_csv('bbox_0002_2.csv', index=None)
print('Successfully converted xml to csv', image_path)
main()
then, I created a tfrecord file and checked it using the code that reads the tfrecord, but there was an error that the parameter was empty. I would appreciate it if anyone could let me know if there is an error in the code.
The text was updated successfully, but these errors were encountered:
I tried to change the xml file of the dataset of the aihub site to csv by slightly changing the code.
The code is as follows.
then, I created a tfrecord file and checked it using the code that reads the tfrecord, but there was an error that the parameter was empty. I would appreciate it if anyone could let me know if there is an error in the code.
The text was updated successfully, but these errors were encountered: