1 Star 6 Fork 5

AI Toys / RobustVideoMatting

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
hubconf.py 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
Peter Lin 提交于 2021-08-30 14:01 . Code release
"""
Loading model
model = torch.hub.load("PeterL1n/RobustVideoMatting", "mobilenetv3")
model = torch.hub.load("PeterL1n/RobustVideoMatting", "resnet50")
Converter API
convert_video = torch.hub.load("PeterL1n/RobustVideoMatting", "converter")
"""
dependencies = ['torch', 'torchvision']
import torch
from model import MattingNetwork
def mobilenetv3(pretrained: bool = True, progress: bool = True):
model = MattingNetwork('mobilenetv3')
if pretrained:
url = 'https://github.com/PeterL1n/RobustVideoMatting/releases/download/v1.0.0/rvm_mobilenetv3.pth'
model.load_state_dict(torch.hub.load_state_dict_from_url(url, map_location='cpu', progress=progress))
return model
def resnet50(pretrained: bool = True, progress: bool = True):
model = MattingNetwork('resnet50')
if pretrained:
url = 'https://github.com/PeterL1n/RobustVideoMatting/releases/download/v1.0.0/rvm_resnet50.pth'
model.load_state_dict(torch.hub.load_state_dict_from_url(url, map_location='cpu', progress=progress))
return model
def converter():
try:
from inference import convert_video
return convert_video
except ModuleNotFoundError as error:
print(error)
print('Please run "pip install av tqdm pims"')
1
https://gitee.com/ai-toys/RobustVideoMatting.git
git@gitee.com:ai-toys/RobustVideoMatting.git
ai-toys
RobustVideoMatting
RobustVideoMatting
master

搜索帮助