docstr: Video matting only support the trimap-free method
docstr_tok: ["Video","matting","only","support","the","trimap-free","method"]
code: def run_video(self, video_path):
      """Video matting only support the trimap-free method"""
      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 = {}
      output_handle["alpha"] = self.predictor.get_output_handle(
          output_names[0]
      )
  
      # Build reader and writer
      reader = VideoReader(video_path, self.cfg.transforms)
      base_name = os.path.basename(video_path)
      name = os.path.splitext(base_name)[0]
      alpha_save_path = os.path.join(args.save_dir, name + "_alpha.avi")
      fg_save_path = os.path.join(args.save_dir, name + "_fg.avi")
      writer_alpha = VideoWriter(
          alpha_save_path,
          reader.fps,
          frame_size=(reader.width, reader.height),
          is_color=False,
      )
      writer_fg = VideoWriter(
          fg_save_path,
          reader.fps,
          frame_size=(reader.width, reader.height),
          is_color=True,
      )
  
      for data in tqdm.tqdm(reader):
          trans_info = data["trans_info"]
          _, h, w = data["img"].shape
  
          input_handle["img"].copy_from_cpu(
              data["img"][np.newaxis, ...]
          )
  
          self.predictor.run()
  
          alpha = output_handle["alpha"].copy_to_cpu()
  
          alpha = alpha.squeeze()
          alpha = self._postprocess(alpha, trans_info)
          self._save_frame(
              alpha,
              fg=None,
              img=data["ori_img"],
              writer_alpha=writer_alpha,
              writer_fg=writer_fg,
          )
  
      writer_alpha.release()
      writer_fg.release()
      reader.release()
  
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 9 for calling the Predictor obj's underlying member method code with example usage: obj.run_video(video_path) without return types