未验证 提交 50a20e1d 编写于 作者: B Bubbliiiing 提交者: GitHub

Update yolo.py

上级 968b754e
......@@ -67,8 +67,9 @@ class YOLO(object):
# 加快模型训练的效率
print('Loading weights into state dict...')
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
state_dict = torch.load(self.model_path)
self.net.load_state_dict(state_dict)
self.net.load_state_dict(state_dict, map_location=device)
if self.cuda:
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册