code: def parse_vid(ann_base_path, args):
      """
      Format XML and save it in JSON
  
      Parameters
      ----------
      ann_base_path: str, Annotations base path
      """
      sub_sets = sorted({"a", "b", "c", "d", "e"})
      vid = []
      for sub_set in sub_sets:
          sub_set_base_path = os.path.join(ann_base_path, sub_set)
          videos = sorted(os.listdir(sub_set_base_path))
          s = []
          for vi, video in enumerate(videos):
              print(
                  "subset: {} video id: {:04d} / {:04d}".format(
                      sub_set, vi, len(videos)
                  )
              )
              v = dict()
              v["base_path"] = os.path.join(sub_set, video)
              v["frame"] = []
              video_base_path = os.path.join(sub_set_base_path, video)
              xmls = sorted(
                  glob.glob(os.path.join(video_base_path, "*.xml"))
              )
              for xml in xmls:
                  f = dict()
                  xmltree = ET.parse(xml)
                  size = xmltree.findall("size")[0]
                  frame_sz = [int(it.text) for it in size]
                  objects = xmltree.findall("object")
                  objs = []
                  for object_iter in objects:
                      trackid = int(object_iter.find("trackid").text)
                      name = (object_iter.find("name")).text
                      bndbox = object_iter.find("bndbox")
                      occluded = int(object_iter.find("occluded").text)
                      o = dict()
                      o["c"] = name
                      o["bbox"] = [
                          int(bndbox.find("xmin").text),
                          int(bndbox.find("ymin").text),
                          int(bndbox.find("xmax").text),
                          int(bndbox.find("ymax").text),
                      ]
                      o["trackid"] = trackid
                      o["occ"] = occluded
                      objs.append(o)
                  f["frame_sz"] = frame_sz
                  f["img_path"] = xml.split("/")[-1].replace(
                      "xml", "JPEG"
                  )
                  f["objs"] = objs
                  v["frame"].append(f)
              s.append(v)
          vid.append(s)
      print("save json (raw vid info), please wait 1 min~")
      json.dump(
          vid,
          open(os.path.join(args.download_dir, "vid.json"), "w"),
          indent=4,
          sort_keys=True,
      )
      print("done!")
  
file_path: gluon-cv/scripts/datasets/ilsvrc_vid.py
imports: import json
  import os
  import glob
  from concurrent import futures
  import time
  import argparse
  import tarfile
  import numpy
  from gluoncv.utils import download, makedirs
  from gluoncv.utils.filesystem import try_import_cv2
  from gluoncv.utils.data.tracking import crop_like_SiamFC, printProgress
label_desc: Use image node_id 3 for calling a global function with example usage: parse_vid(ann_base_path, args) without return types