code: def draw_keypoints(
      img: np.ndarray,
      kps: KeyPoints,
      color: Tuple[int, int, int],
  ):
      x, y, v = kps.x, kps.y, kps.visible
  
      # calculate scaling for points and connections
      img_h, img_w, _ = img.shape
      img_area = img_h * img_w
      img = PIL.Image.fromarray(img)
      draw = PIL.ImageDraw.Draw(img)
      dynamic_size = int(0.01867599 * (img_area**0.4422045))
      dynamic_size = max(dynamic_size, 1)
  
      # draw connections
      if (
          kps.metadata is not None
          and kps.metadata.connections is not None
      ):
          for connection in kps.metadata.connections:
              if v[connection.p1] > 0 and v[connection.p2] > 0:
                  draw.line(
                      xy=(
                          (
                              int(x[connection.p1]),
                              int(y[connection.p1]),
                          ),
                          (
                              int(x[connection.p2]),
                              int(y[connection.p2]),
                          ),
                      ),
                      fill=connection.color,
                      width=dynamic_size,
                  )
  
      # draw points
      for x_c, y_c in zip(x[v > 0], y[v > 0]):
          radius = dynamic_size
          x1 = x_c - radius
          x2 = x_c + radius
          y1 = y_c - radius
          y2 = y_c + radius
          draw.ellipse(
              xy=[x1, y1, x2, y2],
              # xy=[x1, x0, y1, y0],
              fill=as_rgb_tuple(color),
              outline=None,
              width=0,
          )
  
      return np.array(img)
  
file_path: icevision/icevision/visualize/draw_data.py
imports: from icevision.imports import *
  from icevision.data import *
  from icevision.core import *
  from icevision.visualize.utils import *
  from matplotlib.colors import LinearSegmentedColormap
  from PIL import Image, ImageFont, ImageDraw
  import PIL
label_desc: Use image node_id 9 for calling a global function with example usage: draw_keypoints(img, kps, color) and returns: np