code: def crop_xml(args, xml, sub_set_crop_path, instance_size=511):
      """
      Dataset curation
  
      Parameters
      ----------
      xml: str , xml
      sub_set_crop_path: str, xml crop path
      instance_size: int, instance_size
      """
      cv2 = try_import_cv2()
      xmltree = ET.parse(xml)
      objects = xmltree.findall("object")
  
      frame_crop_base_path = os.path.join(
          sub_set_crop_path, xml.split("/")[-1].split(".")[0]
      )
      if not os.path.isdir(frame_crop_base_path):
          makedirs(frame_crop_base_path)
      img_path = xml.replace("xml", "JPEG").replace(
          "Annotations", "Data"
      )
      im = cv2.imread(img_path)
      avg_chans = np.mean(im, axis=(0, 1))
  
      for id, object_iter in enumerate(objects):
          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=instance_size, padding=avg_chans
          )
          cv2.imwrite(
              os.path.join(
                  args.download_dir,
                  frame_crop_base_path,
                  "{:06d}.{:02d}.z.jpg".format(0, id),
              ),
              z,
          )
          cv2.imwrite(
              os.path.join(
                  args.download_dir,
                  frame_crop_base_path,
                  "{:06d}.{:02d}.x.jpg".format(0, id),
              ),
              x,
          )
  
file_path: gluon-cv/scripts/datasets/ilsvrc_det.py
imports: import argparse
  import tarfile
  import os
  import glob
  import json
  import time
  from concurrent import futures
  import numpy
  from gluoncv.utils.filesystem import try_import_cv2
  from gluoncv.utils import download, makedirs
  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: crop_xml(args, xml, sub_set_crop_path, instance_size) without return types