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
first I write this according to your guide:
xml_list_path = os.path.join(sys.path[1],"dataset/label/annotation2021")
convert("xmllist.txt", xml_list_path, "output.json")
and raise a error:FileNotFoundError: [Errno 2] No such file or directory
my xmllist contains all the xml file such as 000001.xml 000002.xml... and each line contains one filename
Second I want to understand your code for fix this error
def convert(xml_list, xml_dir, json_file):
list_fp = open(xml_list, 'r')
json_dict = {"images":[], "type": "instances", "annotations": [],
"categories": []}
categories = PRE_DEFINE_CATEGORIES
bnd_id = START_BOUNDING_BOX_ID
for line in list_fp:
line = line.strip()
print("line:"+line)
print("Processing %s"%(line))
xml_f = os.path.join(xml_dir, line)
print("xml_f:"+xml_f)
tree = ET.parse(xml_f)
root = tree.getroot()
print(type(root))
path = get(root, 'path')
.......
what this 'path' mean? And this script
The text was updated successfully, but these errors were encountered:
first I write this according to your guide:
xml_list_path = os.path.join(sys.path[1],"dataset/label/annotation2021")
convert("xmllist.txt", xml_list_path, "output.json")
and raise a error:FileNotFoundError: [Errno 2] No such file or directory
my xmllist contains all the xml file such as 000001.xml 000002.xml... and each line contains one filename
Second I want to understand your code for fix this error
def convert(xml_list, xml_dir, json_file):
list_fp = open(xml_list, 'r')
json_dict = {"images":[], "type": "instances", "annotations": [],
"categories": []}
categories = PRE_DEFINE_CATEGORIES
bnd_id = START_BOUNDING_BOX_ID
for line in list_fp:
line = line.strip()
print("line:"+line)
print("Processing %s"%(line))
xml_f = os.path.join(xml_dir, line)
print("xml_f:"+xml_f)
tree = ET.parse(xml_f)
root = tree.getroot()
print(type(root))
path = get(root, 'path')
.......
what this 'path' mean? And this script
The text was updated successfully, but these errors were encountered: