这是一个video inpainting模型。输入一段视频和mask区域,对视频进行修复。
利用transfomer结构,基于STTN.进行了优化,适用深度可分离卷积替代标准卷积,同时对模型的宽度进行了瘦身。
在ModelScope框架上,提供输入视频和mask目录,即可以通过简单的Pipeline调用来使用视频编辑/修复。
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
video_inpainting = pipeline(Tasks.video_inpainting,
model='damo/cv_video-inpainting')
result_status = video_inpainting({'video_input_path':'data/test/videos/video_inpainting_test.mp4',
'mask_path':'data/test/videos/mask_dir',
'video_output_path':'out.mp4'})
result = result_status[OutputKeys.OUTPUT]
正常情况下,算法返回字符串‘Done’,如果遇到输入视频无法解码时,算法返回字符串‘decode_error’
训练数据来自互联网搜索的视频
@inproceedings{yan2020sttn,
author = {Zeng, Yanhong and Fu, Jianlong and Chao, Hongyang,
title = {Learning Joint Spatial-Temporal Transformations for Video Inpainting},
booktitle = {The Proceedings of the European Conference on Computer Vision (ECCV)},
year = {2020}
}