【python】yolov5的torch与torchvision环境问题

1.可用环境

torch==1.7.1+cu110
torchvision==0.8.2+cu110

2.错误环境遇到的问题

(1)情况一

torch==1.7.0+cu110
torchvision==0.8.0

训练yolov5时,训练就会开始报错:

return torch.ops.torchvision.nms(boxes, scores, iou_threshold)
RuntimeError: Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. 'torchvision::nms' is only available for these backends: [CPU, BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, Tracer, Autocast, Batched, VmapMode].

torchvision版本不对。 所以升级了torchvision的版本。进入到情况二。

(2)情况二

torch==1.7.0+cu110
torchvision==0.8.1

训练第一个epoch时,不出错,但是测试第一个epoch的时候,会报错:


你可能感兴趣的:(python,#,Pytorch,目标检测,torch,torchvision)