code: def widerface_convert(gt_txt, img_dir, save_path):
      output_json_dict = {
          "images": [],
          "type": "instances",
          "annotations": [],
          "categories": [
              {"supercategory": "none", "id": 0, "name": "human_face"}
          ],
      }
      bnd_id = 1  # bounding box start id
      im_id = 0
      print("Start converting !")
      with open(gt_txt) as fd:
          lines = fd.readlines()
  
      i = 0
      while i < len(lines):
          image_name = lines[i].strip()
          bbox_num = int(lines[i + 1].strip())
          i += 2
          img_info = get_widerface_image_info(
              img_dir, image_name, im_id
          )
          if img_info:
              output_json_dict["images"].append(img_info)
              for j in range(i, i + bbox_num):
                  anno = get_widerface_ann_info(lines[j])
                  anno.update({"image_id": im_id, "id": bnd_id})
                  output_json_dict["annotations"].append(anno)
                  bnd_id += 1
          else:
              print(
                  "The image dose not exist: {}".format(
                      os.path.join(img_dir, image_name)
                  )
              )
          bbox_num = 1 if bbox_num == 0 else bbox_num
          i += bbox_num
          im_id += 1
      with open(save_path, "w") as f:
          output_json = json.dumps(output_json_dict)
          f.write(output_json)
  
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 13 for calling a global function with example usage: widerface_convert(gt_txt, img_dir, save_path) without return types