code: def scale_coords(img1_shape, coords, img0_shape, ratio_pad=None):
      # Rescale coords (xyxy) from img1_shape to img0_shape
      if ratio_pad is None:  # calculate from img0_shape
          gain = min(
              img1_shape[0] / img0_shape[0],
              img1_shape[1] / img0_shape[1],
          )  # gain  = old / new
          pad = (img1_shape[1] - img0_shape[1] * gain) / 2, (
              img1_shape[0] - img0_shape[0] * gain
          ) / 2  # wh padding
      else:
          assert ratio_pad[0][0] == ratio_pad[0][1]
          gain = ratio_pad[0][0]
          pad = ratio_pad[1]
  
      coords[:, [0, 2]] -= pad[0]  # x padding
      coords[:, [1, 3]] -= pad[1]  # y padding
      coords[:, :4] /= gain
      clip_coords(coords, img0_shape)
      return coords
  
imports: import os
  import time
  import json
  import copy
  import cv2
  import numpy
  import torch
  from torchmetrics.detection.mean_ap import MeanAveragePrecision
  import torchvision
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from compression.api import DataLoader, Metric
label_desc: Use image node_id 5 for calling a global function with example usage: scale_coords(img1_shape, coords, img0_shape, ratio_pad) and returns: coords