Hi guys, I have a problem when I load my model:
import torch
import cv2
path = ‘C:/…/best.pt’
model = torch.hub.load(‘ultralytics/yolov5’, ‘custom’, path , force_reload=True)
img = cv2.imread(‘C:/…/123111.jpg’)
result = model(img)
results.print()
results.show()
problem:
cannot instantiate 'PosixPath' on your system. Cache may be out of date, try `force_reload=True` or see https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading for help.
File "C:\Users\.........................\ultralytics_yolov5_master\hubconf.py", line 50, in _create
model = DetectMultiBackend(path, device=device, fuse=autoshape) # detection model
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\.................................\hub\ultralytics_yolov5_master\models\common.py", line 467, in __init__
model = attempt_load(weights if isinstance(weights, list) else w, device=device, inplace=True, fuse=fuse)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.
.
.
.
.
Exception: cannot instantiate 'PosixPath' on your system. Cache may be out of date, try `force_reload=True` or see https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading for help.