code: def annotations_polygon(
      height, width, points, label, image_num, object_num, label_to_num
  ):
      annotation = {}
      annotation["segmentation"] = [list(np.asarray(points).flatten())]
      annotation["iscrowd"] = 0
      annotation["image_id"] = image_num + 1
      annotation["bbox"] = list(
          map(float, get_bbox(height, width, points))
      )
      annotation["area"] = annotation["bbox"][2] * annotation["bbox"][3]
      annotation["category_id"] = label_to_num[label]
      annotation["id"] = object_num + 1
      return annotation
  
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 5 for calling a global function with example usage: annotations_polygon(height, width, points, label, image_num, object_num, label_to_num) and returns: annotation