code: def voc_get_coco_annotation(obj, label2id):
      label = obj.findtext("name")
      assert label in label2id, "label is not in label2id."
      category_id = label2id[label]
      bndbox = obj.find("bndbox")
      xmin = float(bndbox.findtext("xmin"))
      ymin = float(bndbox.findtext("ymin"))
      xmax = float(bndbox.findtext("xmax"))
      ymax = float(bndbox.findtext("ymax"))
      assert xmax > xmin and ymax > ymin, "Box size error."
      o_width = xmax - xmin
      o_height = ymax - ymin
      anno = {
          "area": o_width * o_height,
          "iscrowd": 0,
          "bbox": [xmin, ymin, o_width, o_height],
          "category_id": category_id,
          "ignore": 0,
      }
      return anno
  
imports: import argparse
  import glob
  import json
  import os
  import os.path
  import shutil
  import xml.etree.ElementTree
  import numpy
  import PIL.ImageDraw
  from tqdm import tqdm
  import cv2
label_desc: Use image node_id 10 for calling a global function with example usage: voc_get_coco_annotation(obj, label2id) and returns: anno