code: def darknet_preprocess(x, target_size=None):
      # Refer to the following darkflow
      # https://github.com/thtrieu/darkflow/blob/master/darkflow/net/yolo/predict.py
      if (
          target_size is None
          or target_size[0] is None
          or target_size[1] is None
      ):
          y = x.copy()
      else:
          h, w = target_size
          assert cv2 is not None, "resizing requires `cv2`."
          y = np.zeros((len(x), h, w, x.shape[3]))
          for i in range(len(x)):
              y[i] = cv2.resize(
                  x[i], (w, h), interpolation=cv2.INTER_CUBIC
              )
      y = y[:, :, :, ::-1]
      y /= 255.0
      return y
  
file_path: tensornets/tensornets/preprocess.py
imports: import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: darknet_preprocess(x, target_size) and returns: y