这里简单谈一下复现这篇文章所遇到的几个问题:
①在我将tracking/run_tracker.py里的文件路径全部改完并运行之后,报了这个错误:
RuntimeError: view size is not compatible with input tensor’s size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(…) instead.
解决办法:
这是因为view()需要Tensor中的元素地址是连续的,但可能出现Tensor不连续的情况,所以先用 .contiguous() 将其在内存中变成连续分布,故而将:
feat = feat.view(feat.size(0),-1)
改为:
feat = feat.contiguous().view(feat.size()[0], -1)
即可
参考博客:RuntimeError: view size is not compatible with input tensor‘s size and stride
测试时的截图:
我有点不清楚这是什么意思,有明白的同学,请给我说一下,万分感谢!
run_tracker.py:116: UserWarning: torch.nn.utils.clip_grad_norm is now deprecated in favor of torch.nn.utils.clip_grad_norm_.
torch.nn.utils.clip_grad_norm(model.parameters(), opts['grad_clip'])