3 Star 9 Fork 5

skywalk / PaddleRobustVideoMatting

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

PaddleRobustVideoMatting

稳定视频抠像 (RVM) 飞桨代码复现版

Teaser

论文原作 Robust High-Resolution Video Matting with Temporal Guidance 的官方 GitHub 库。RVM 专为稳定人物视频抠像设计。不同于现有神经网络将每一帧作为单独图片处理,RVM 使用循环神经网络,在处理视频流时有时间记忆。RVM 可在任意视频上做实时高清抠像。在 Nvidia GTX 1080Ti 上实现 4K 76FPSHD 104FPS。此研究项目来自字节跳动


更新

  • [2022.3.12日] 新增加了mobilenetv3骨干网络支持。
  • [2022.2.26日] 新加了飞桨PaddlePaddle代码实现。暂时只复现了ResNet50的推理部分。
  • [2021年11月3日] 修复了 train.py 的 bug。
  • [2021年9月16日] 代码重新以 GPL-3.0 许可发布。
  • [2021年8月25日] 公开代码和模型。
  • [2021年7月27日] 论文被 WACV 2022 收录。

展示视频

观看展示视频 (YouTube, Bilibili),了解模型能力。


Demo

  • 网页: 在浏览器里看摄像头抠像效果,展示模型内部循环记忆值。
  • Colab: 用我们的模型转换你的视频。

下载

ResNet50 和mobilenetv3的模型 。

框架 下载
飞桨rvm_resnet50.pdparams 链接: https://pan.baidu.com/s/1wfWuqA04gnPiJ4EXF4FpWw 提取码: fs1e
飞桨rvm_mobilenetv3.pdparams 链接: https://pan.baidu.com/s/1O-Z8BnpypOz5uQn39n_GDw 提取码: q3af

飞桨 范例

  1. 安装 Python 库:
pip install -r requirements_inference.txt
  1. 加载模型:
import paddle
from model import MattingNetwork

model = MattingNetwork('resnet50') 
model.set_state_dict(paddle.load("rvm_resnet50.pdparams"))
  1. 若只需要做视频抠像处理,我们提供简单的 API:
import paddle
from model import MattingNetwork
from inference import convert_video
model = MattingNetwork('resnet50') 
model.set_state_dict(paddle.load("rvm_resnet50.pdparams"))
convert_video(
    model,                           # 模型,可以加载到任何设备(cpu 或 cuda)
    input_source='dance.mp4',        # 视频文件,或图片序列文件夹
    output_type='video',             # 可选 "video"(视频)或 "png_sequence"(PNG 序列)
    output_composition='com.mp4',    # 若导出视频,提供文件路径。若导出 PNG 序列,提供文件夹路径
    output_alpha="pha.mp4",          # [可选项] 输出透明度预测
    output_foreground="fgr.mp4",     # [可选项] 输出前景预测
    output_video_mbps=4,             # 若导出视频,提供视频码率
    downsample_ratio=None,           # 下采样比,可根据具体视频调节,或 None 选择自动
    seq_chunk=1                    # 设置多帧并行计算 12
)

没有算力也没关系,上这里拍电影没有绿幕,AI给我们造!AIStudio项目地址

读万卷书,不如行万里路!大家动手进项目亲自实践检验一下吧!

项目还在继续中....

BSD 3-Clause License Copyright (c) 2022, skywalk All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

RobustVideoMatting的飞桨实现版本 展开 收起
Python
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/skywalk/paddlerobustvideomatting.git
git@gitee.com:skywalk/paddlerobustvideomatting.git
skywalk
paddlerobustvideomatting
PaddleRobustVideoMatting
master

搜索帮助