本文主要是介绍使用detectron2 出现 RuntimeError: object has no attribute nms 报错记录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
代码环境:
python = 3.6
torch = 1.6.0
torchvision = 0.7.0
cuda = 9.2
detectron2 = 0.4
安装torch和torchvision命令(来自pytorch官网V1.6.0)
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=9.2 -c pytorch
安装detectron2命令对应torch1.6.0版本(来自detectron2官网的installation教程)
python -m pip install detectron2 -f \https://dl.fbaipublicfiles.com/detectron2/wheels/cu92/torch1.6/index.html
遇到的问题
我对训练的模型进行评估时出现的问题,评估用的函数是detectron2.evaluation.inference_on_dataset(model, data_loader, evaluator)
RuntimeError:
object has no attribute nms:Filen "/home/scau2/anaconda2/envs/swin-t/lib/python3.6/site-packages/ops/boxes.py", line 40***return torch.ops.torchvision.nms(boxes, scores, iou_threshold)-------------------------<----HERE'nms' is being compiled since it was called from 'batched_nms'
解决方法
更新代码环境:
python = 3.6
torch = 1.7.0
torchvision = 0.8.0
cuda = 9.2
detectron2 = 0.4
安装torch和torchvision命令(来自pytorch官网V1.6.0)
conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=9.2 -c pytorch
安装detectron2命令对应torch1.7.0版本(来自detectron2官网的installation教程)
python -m pip install detectron2 -f \https://dl.fbaipublicfiles.com/detectron2/wheels/cu92/torch1.7/index.html
问题解决!!!
这篇关于使用detectron2 出现 RuntimeError: object has no attribute nms 报错记录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!