deep_sort_pytorch icon indicating copy to clipboard operation
deep_sort_pytorch copied to clipboard

RuntimeError: Attempting to deserialize object on CUDA device 2 but torch.cuda.device_count() is 1.

Open anhminh3105 opened this issue 5 years ago • 1 comments

Hi, I am trying to run the demo_yolov3_deepsort.py with the original_ckpt.t7 model but received this following error as it's not the case for the ckpt.t7 model, do you have any idea? RuntimeError: Attempting to deserialize object on CUDA device 2 but torch.cuda.device_count() is 1. Please use torch.load with map_location to map your storages to an existing device. I am doing this because I noticed that the tracking performance is not as good as the official implementation in TF. Specifically, the ID switching problem is more noticeable.

anhminh3105 avatar Sep 05 '19 11:09 anhminh3105

@anhminh3105

Faced the same issue but was able to resolve it by using map_location while loading the weights:

checkpoint = torch.load("original_ckpt.t7", map_location='cuda:0')
net_dict = checkpoint['net_dict']
net.load_state_dict(net_dict)
net.eval()

Hope it helps!

Tandon-A avatar Jul 28 '21 10:07 Tandon-A