代码拉取完成,页面将自动刷新
# 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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。