code: def scale_coords(coords, input_shape, im_shape, scale_factor):
      # Note: ratio has only one value, scale_factor[0] == scale_factor[1]
      #
      # This function only used for JDE YOLOv3 or other detectors with
      # LetterBoxResize and JDEBBoxPostProcess, coords output from detector had
      # not scaled back to the origin image.
  
      ratio = scale_factor[0]
      pad_w = (input_shape[1] - int(im_shape[1])) / 2
      pad_h = (input_shape[0] - int(im_shape[0])) / 2
      coords[:, 0::2] -= pad_w
      coords[:, 1::2] -= pad_h
      coords[:, 0:4] /= ratio
      coords[:, :4] = np.clip(
          coords[:, :4], a_min=0, a_max=coords[:, :4].max()
      )
      return coords.round()
  
imports: import os
  import cv2
  import time
  import numpy
  import collections
  import math
label_desc: Use image node_id 3 for calling a global function with example usage: scale_coords(coords, input_shape, im_shape, scale_factor) and returns: coords