text: import cv2
  import numpy as np
  import os
  def preprocess_for_onnx_mobilenetv2(image_path):
  
  
      # read the image using openCV
      img = cv2.imread(image_path)
  
      # convert to RGB
      img = img[:, :, ::-1]
  
      # Most of the onnx models are trained using
      # 224x224 images. The general rule of thumb
      # is to scale the input image while preserving
      # the original aspect ratio so that the
      # short edge is 256 pixels, and then
      # center-crop the scaled image to 224x224
      orig_height, orig_width, _ = img.shape
      short_edge = min(img.shape[:2])
      new_height = (orig_height * 256) // short_edge
      new_width = (orig_width * 256) // short_edge
      img = cv2.resize(img, (new_width, new_height), interpolation=cv2.INTER_CUBIC)
  
      startx = new_width // 2 - (224 // 2)
      starty = new_height // 2 - (224 // 2)
      img = img[starty:starty + 224, startx:startx + 224]
  
      # apply scaling and mean subtraction.
      # if your model is built with an input
      # normalization layer, then you might
      # need to skip this
      img = img.astype('float32')
      for mean, scale, ch in zip([123.675, 116.28, 103.53], [0.017125, 0.017507, 0.017429], range(img.shape[2])):
          img[:, :, ch] = ((img.astype('float32')[:, :, ch] - mean) * scale)
  
      # convert HWC to NCHW
      img = np.expand_dims(np.transpose(img, (2, 0, 1)), axis=0)
  
      return img
  
  
  def preprocess_for_onnx_pp(npy_files):
      feat_val = np.load(npy_files)
      return feat_val
  
  def preprocess_for_onnx_pp_all(npy_files):
      root='/home/mayank_sati/Documents/pfn_conv'
      npy_files=root+"/"+npy_files
      feat_val = np.load(npy_files)
      return feat_val
  
  if __name__ == '__main__':
      model_input_name = 'input.1'
      # @@@@@@@@@@@@@@@@@@@@@@@@@@@@
      # calib_files = ['/home/mayank_sati/Downloads/ti-processor-sdk-rtos-j721e-evm-07_02_00_06/tidl_j7_01_04_00_08/ti_dl/test/testvecs/input/airshow.jpg',
      #                '/home/mayank_sati/Downloads/ti-processor-sdk-rtos-j721e-evm-07_02_00_06/tidl_j7_01_04_00_08/ti_dl/test/testvecs/input/ADE_val_00001801.jpg']
      #
      # calib_images = list(map(preprocess_for_onnx_mobilenetv2, calib_files))
      # calib_input_list = [{model_input_name: img} for img in calib_images]
      # print(calib_input_list)
  
  ##################################################
      # my_vals=np.load("/home/mayank_sati/codebase/python/lidar/second.pytorch/second/mayank_scripts/geekfile.npy")
      # calib_files=['/home/mayank_sati/Documents/first.npy','/home/mayank_sati/Documents/second.npy']
      #
      # calib_images = list(map(preprocess_for_onnx_pp, calib_files))
      # calib_input_list = [{model_input_name: img} for img in calib_images]
      # print(calib_input_list)
      ###############################################################################3
      input_folder = "/home/mayank_sati/Documents/pfn_conv"
      # input_folder="/home/mayank_sati/Documents/point_clouds/KITTI_DATASET_ROOT/training/velodyne_reduced"
      for root, _, filenames in os.walk(input_folder):
          # if (len(filenames) == 0):
          #     print("Input folder is empty")
              # return 1
          # filenames = natsort.natsorted(filenames, reverse=False)
  
          # time_start = time.time()
          # for filename in filenames:
              # try:
              # filename = input_folder + '/' + filename
          calib_files=filenames
          calib_images = list(map(preprocess_for_onnx_pp_all ,calib_files))
          calib_input_list = [{model_input_name: img} for img in calib_images]
          print(calib_input_list)
  
  
  