code: def run(self, imgs_path):
      if not isinstance(imgs_path, (list, tuple)):
          imgs_path = [imgs_path]
  
      input_names = self.predictor.get_input_names()
      input_handle = self.predictor.get_input_handle(input_names[0])
      output_names = self.predictor.get_output_names()
      output_handle = self.predictor.get_output_handle(output_names[0])
      results = []
      args = self.args
  
      if not os.path.exists(args.save_dir):
          os.makedirs(args.save_dir)
  
      for i in range(0, len(imgs_path), args.batch_size):
          if args.use_warmup:
              # warm up
              if i == 0 and args.benchmark:
                  for j in range(5):
                      if self.cfg.inference_helper is not None:
                          data = self.cfg.inference_helper.preprocess(
                              self.cfg, imgs_path, args.batch_size, 0
                          )
                      else:
                          data = np.array(
                              [
                                  self._preprocess(
                                      img
                                  )  # load from original
                                  for img in imgs_path[
                                      0 : args.batch_size
                                  ]
                              ]
                          )
                      input_handle.reshape(data.shape)
                      input_handle.copy_from_cpu(data)
                      self.predictor.run()
                      results = output_handle.copy_to_cpu()
                      results = self._postprocess(results)
  
          # inference
          if args.benchmark:
              self.autolog.times.start()
          if self.cfg.inference_helper is not None:
              data = self.cfg.inference_helper.preprocess(
                  self.cfg, imgs_path, args.batch_size, i
              )
          else:
              data = np.array(
                  [
                      self._preprocess(p)
                      for p in imgs_path[i : i + args.batch_size]
                  ]
              )
  
          if args.benchmark:
              self.autolog.times.stamp()
  
          if args.use_swl:
              infer_like_model = ModelLikeInfer(
                  input_handle, output_handle, self.predictor
              )
              data = paddle.to_tensor(data)
              if args.is_nhwd:
                  data = paddle.squeeze(data, axis=1)
  
              if len(args.img_shape) == 1:
                  results = sliding_window_inference(
                      data,
                      (
                          int(args.img_shape[0]),
                          int(args.img_shape[0]),
                          int(args.img_shape[0]),
                      ),
                      1,
                      infer_like_model.infer_model,
                  )
              else:
                  results = sliding_window_inference(
                      data,
                      (
                          int(args.img_shape[0]),
                          int(args.img_shape[1]),
                          int(args.img_shape[2]),
                      ),
                      1,
                      infer_like_model.infer_model,
                      "NCDHW",
                  )
  
              results = results[0]
  
          else:
              input_handle.reshape(data.shape)
              input_handle.copy_from_cpu(data)
  
              self.predictor.run()
  
              results = output_handle.copy_to_cpu()
  
          if args.benchmark:
              self.autolog.times.stamp()
          if self.cfg.inference_helper is not None:
              results = self.cfg.inference_helper.postprocess(results)
          else:
              results = self._postprocess(results)
  
          if args.benchmark:
              self.autolog.times.end(stamp=True)
          self._save_npy(results, imgs_path[i : i + args.batch_size])
      logger.info("Finish")
  
imports: import os
  import sys
  import codecs
  import warnings
  import argparse
  import yaml
  import functools
  import numpy
  from paddle.inference import create_predictor, PrecisionType
  from paddle.inference import Config
  import paddle
  import medicalseg.transforms
  from medicalseg.cvlibs import manager
  from medicalseg.utils import get_sys_env, logger, get_image_list
  from medicalseg.utils.visualize import get_pseudo_color_map
  from medicalseg.core.infer import sliding_window_inference
  from tools import HUnorm, resample
  from tools import Prep
label_desc: Use image node_id 5 for calling the Predictor obj's underlying member method code with example usage: obj.run(imgs_path) without return types