1 Star 0 Fork 1

wuzhuqing/YOLOP

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
hubconf.py 887 Bytes
一键复制 编辑 原始数据 按行查看 历史
D.Wu 提交于 2021-10-28 10:35 . Update hubconf.py
# YOLOP by hustvl, MIT License
dependencies = ['torch']
import torch
from lib.utils.utils import select_device
from lib.config import cfg
from lib.models import get_net
from pathlib import Path
import os
def yolop(pretrained=True, device="cpu"):
"""Creates YOLOP model
Arguments:
pretrained (bool): load pretrained weights into the model
wieghts (int): the url of pretrained weights
device (str): cuda device i.e. 0 or 0,1,2,3 or cpu
Returns:
YOLOP pytorch model
"""
device = select_device(device = device)
model = get_net(cfg)
if pretrained:
path = os.path.join(Path(__file__).resolve().parent, "weights/End-to-end.pth")
checkpoint = torch.load(path, map_location= device)
model.load_state_dict(checkpoint['state_dict'])
model = model.to(device)
return model
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuzhuqing/YOLOP.git
git@gitee.com:wuzhuqing/YOLOP.git
wuzhuqing
YOLOP
YOLOP
main

搜索帮助