YOLOv5 运行错误:'Upsample' object has no attribute 'recompute_scale_factor'
运行 YOLOv5 算法时,出现错误 'Upsample' object has no attribute 'recompute_scale_factor',这是因为 PyTorch 版本过低导致的。Upsample 层在较新版本的 PyTorch 中添加了 recompute_scale_factor 属性,而旧版本没有。要解决这个问题,需要更新 PyTorch 版本。
可以使用以下命令更新 PyTorch:
pip install torch --upgrade
或者使用 conda 更新 PyTorch:
conda install pytorch torchvision torchaudio -c pytorch
更新完成后,重新运行 YOLOv5 代码即可。
原文地址: https://www.cveoy.top/t/topic/nvLh 著作权归作者所有。请勿转载和采集!