code: def crop_video(args, sub_set, video, crop_path, ann_base_path):
      """
      Dataset curation
  
      Parameters
      ----------
      sub_set: str , sub_set
      video: str, video number
      crop_path: str, crop_path
      ann_base_path: str, Annotations base path
      """
      cv2 = try_import_cv2()
      video_crop_base_path = os.path.join(crop_path, sub_set, video)
      if not os.path.isdir(video_crop_base_path):
          makedirs(video_crop_base_path)
      sub_set_base_path = os.path.join(ann_base_path, sub_set)
      xmls = sorted(
          glob.glob(os.path.join(sub_set_base_path, video, "*.xml"))
      )
      for xml in xmls:
          xmltree = ET.parse(xml)
          objects = xmltree.findall("object")
          objs = []
          filename = xmltree.findall("filename")[0].text
          im = cv2.imread(
              xml.replace("xml", "JPEG").replace("Annotations", "Data")
          )
          avg_chans = np.mean(im, axis=(0, 1))
          for object_iter in objects:
              trackid = int(object_iter.find("trackid").text)
              bndbox = object_iter.find("bndbox")
              bbox = [
                  int(bndbox.find("xmin").text),
                  int(bndbox.find("ymin").text),
                  int(bndbox.find("xmax").text),
                  int(bndbox.find("ymax").text),
              ]
              z, x = crop_like_SiamFC(
                  im,
                  bbox,
                  instance_size=args.instance_size,
                  padding=avg_chans,
              )
              cv2.imwrite(
                  os.path.join(
                      args.download_dir,
                      video_crop_base_path,
                      "{:06d}.{:02d}.z.jpg".format(
                          int(filename), trackid
                      ),
                  ),
                  z,
              )
              cv2.imwrite(
                  os.path.join(
                      args.download_dir,
                      video_crop_base_path,
                      "{:06d}.{:02d}.x.jpg".format(
                          int(filename), trackid
                      ),
                  ),
                  x,
              )
  
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 4 for calling a global function with example usage: crop_video(args, sub_set, video, crop_path, ann_base_path) without return types