code: def draw_bboxes(path, annos, clsid_to_name, output_dir=None):
      if len(annos) == 0:
          return
      image = Image.open(path).convert("RGB")
      draw = ImageDraw.Draw(image)
      for anno in annos:
          x, y, w, h = anno["bbox"]
          draw.line(
              [
                  (x, y),
                  (x, int(y + h)),
                  (int(x + w), int(y + h)),
                  (int(x + w), y),
                  (x, y),
              ],
              width=2,
              fill=(255, 0, 0),
          )
          text = "class: {}".format(
              str(clsid_to_name[anno["category_id"]]["name"])
          )
          _, th = draw.textsize(text)
          draw.text((x, y - th), text)
      if output_dir and not osp.exists(output_dir):
          os.makedirs(output_dir)
      image.save(osp.join(output_dir, osp.basename(path)))
  
file_path: PaddleSeg/contrib/QualityInspector/qinspector/utils/visualizer.py
imports: import os
  import os.path
  import numpy
  from PIL import Image, ImageDraw
  import pycocotools.mask
  from ppdet.utils.colormap import colormap
label_desc: Use image node_id 2 for calling a global function with example usage: draw_bboxes(path, annos, clsid_to_name, output_dir) without return types