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()
Video matting only support the trimap-free method
Matting/deploy/python/infer.py