I have a trained a custom object detection model using yolov5 for 4 classes. I have downloaded the best.pt file. I am still confused about how to load this model using pytorch.
I tried running the following code to load the model as per Yolov5 official documentation
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt')
but when I tried printing model.names, I am not getting my custom class names. Is there anything I am missing?
Thank you!
force_reload=True
then try adding this:
model = torch.hub.load('ultralytics/yolov5', 'custom', path='model/best-m.pt', force_reload=True)