I’m loading a yolov5 model on GPU in the following way:
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
I have measured it’s performance:
start = timer()
results = model(test_image.jpg')
end = timer()
print(end - start)
It gives me around 1 second which is very slow. However, when I run it on CPU it gives me about 0.2 seconds:
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', device='cpu')
Why it is so slow on GPU and how can I boost it’s perfomance?