解决在使用torch.hub.load方法加载本地yolov5模型时的报错:custom() got an unexpected keyword argument ‘path‘

        用https://github.com/ultralytics/yolov5/issues/36中的方法,使用torch.hub.load加载本地已经训练的yolov5模型时的原调用语句:

model = torch.hub.load("..", "custom", path="../weights/best.pt", source="local")

        报错:

custom() got an unexpected keyword argument ‘path‘。

        去GitHub上查了一下Issue得到这个:

https://github.com/ultralytics/yolov5/issues/4533

        非常申必的错误原因,解决方法是把 ‘path=’ 给删掉,得到以下新的语句,然后就能够正确运行了。

model = torch.hub.load("..", "custom", "../weights/best.pt", source="local")

        更加申必的是百度居然找不到这个问题。

你可能感兴趣的:(pytorch)