code: def run(self, imgs, trimaps=None, imgs_dir=None):
      self.imgs_dir = imgs_dir
      num = len(imgs)
      input_names = self.predictor.get_input_names()
      input_handle = {}
  
      for i in range(len(input_names)):
          input_handle[
              input_names[i]
          ] = self.predictor.get_input_handle(input_names[i])
      output_names = self.predictor.get_output_names()
      output_handle = self.predictor.get_output_handle(output_names[0])
      args = self.args
  
      for i in tqdm.tqdm(range(0, num, args.batch_size)):
          # warm up
          if i == 0 and args.benchmark:
              for _ in range(5):
                  img_inputs = []
                  if trimaps is not None:
                      trimap_inputs = []
                  trans_info = []
                  for j in range(i, i + args.batch_size):
                      img = imgs[j]
                      trimap = (
                          trimaps[j] if trimaps is not None else None
                      )
                      data = self._preprocess(img=img, trimap=trimap)
                      img_inputs.append(data["img"])
                      if trimaps is not None:
                          trimap_inputs.append(
                              data["trimap"][np.newaxis, :, :]
                          )
                      trans_info.append(data["trans_info"])
                  img_inputs = np.array(img_inputs)
                  if trimaps is not None:
                      trimap_inputs = (np.array(trimap_inputs)).astype(
                          "float32"
                      )
  
                  input_handle["img"].copy_from_cpu(img_inputs)
                  if trimaps is not None:
                      input_handle["trimap"].copy_from_cpu(
                          trimap_inputs
                      )
                  self.predictor.run()
                  results = output_handle.copy_to_cpu()
  
                  results = results.squeeze(1)
                  for j in range(args.batch_size):
                      trimap = (
                          trimap_inputs[j]
                          if trimaps is not None
                          else None
                      )
                      result = self._postprocess(
                          results[j], trans_info[j], trimap=trimap
                      )
  
          # inference
          if args.benchmark:
              self.autolog.times.start()
  
          img_inputs = []
          if trimaps is not None:
              trimap_inputs = []
          trans_info = []
          for j in range(i, i + args.batch_size):
              img = imgs[j]
              trimap = trimaps[j] if trimaps is not None else None
              data = self._preprocess(img=img, trimap=trimap)
              img_inputs.append(data["img"])
              if trimaps is not None:
                  trimap_inputs.append(data["trimap"][np.newaxis, :, :])
              trans_info.append(data["trans_info"])
          img_inputs = np.array(img_inputs)
          if trimaps is not None:
              trimap_inputs = (np.array(trimap_inputs)).astype(
                  "float32"
              )
  
          input_handle["img"].copy_from_cpu(img_inputs)
          if trimaps is not None:
              input_handle["trimap"].copy_from_cpu(trimap_inputs)
  
          if args.benchmark:
              self.autolog.times.stamp()
  
          self.predictor.run()
  
          results = output_handle.copy_to_cpu()
  
          if args.benchmark:
              self.autolog.times.stamp()
  
          results = results.squeeze(1)
          for j in range(args.batch_size):
              trimap = trimap_inputs[j] if trimaps is not None else None
              result = self._postprocess(
                  results[j], trans_info[j], trimap=trimap
              )
              self._save_imgs(result, imgs[i + j])
  
          if args.benchmark:
              self.autolog.times.end(stamp=True)
      logger.info("Finish")
  
imports: import argparse
  import codecs
  import os
  import sys
  import cv2
  import tqdm
  import yaml
  import numpy
  import paddle
  from paddle.inference import create_predictor, PrecisionType
  from paddle.inference import Config
  from paddleseg.cvlibs import manager
  from paddleseg.utils import get_sys_env, logger
  import ppmatting.transforms
  from ppmatting.utils import get_image_list, mkdir, estimate_foreground_ml, VideoReader, VideoWriter
label_desc: Use image node_id 5 for calling the Predictor obj's underlying member method code with example usage: obj.run(imgs, trimaps, imgs_dir) without return types