1 Star 0 Fork 6

xht666/RobustVideoMatting

forked from lifw88/RobustVideoMatting 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
hubconf.py 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
Peter 提交于 2021-08-26 12:50 . Add TorchHub support
"""
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"')
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/xht666/RobustVideoMatting.git
git@gitee.com:xht666/RobustVideoMatting.git
xht666
RobustVideoMatting
RobustVideoMatting
master

搜索帮助