记录配置mmpose出现的cuda报错RuntimeError: CUDA error: invalid device function

记录配置mmpose出现的cuda报错

在Ubuntu环境下配置mmpose,按照mmpose工程下的install.md文件配置,创建虚拟环境,

1、conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab

2、安装pytorch1.5,cudatoolkit10.1和cudadnn7.6

3、安装mmcv-full,直接使用命令 pip install mmcv-full

4、下载mmpose源码
git clone [email protected]:open-mmlab/mmpose.git
cd mmpose

5、pip install -r requirements.txt
python setup.py develop

一顿操作猛如虎,搞定配置环境之后,运行demo代码,

python demo/top_down_video_demo_with_mmdet.py \
    demo/mmdetection_cfg/faster_rcnn_r50_fpn_1x_coco.py \
    http://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \
    configs/top_down/hrnet/coco/hrnet_w48_coco_256x192.py \
    https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w48_coco_256x192-b9e0b3ab_20200708.pth \
    --video-path demo/demo.mp4 \
    --out-video-root vis_results

程序出现错误

RuntimeError: CUDA error: invalid device function

网上搜了很多,大部分人说的是cuda版本和pytorch版本不对,导致这个错误,后来经过多次尝试,发现是mmcv-full这个库在作怪。解决办法:
卸载mmcv-full
pip uninstall mmcv-full

然后重装mmcv-full:
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.5.0/index.html
加粗处是根据自己的配置环境来设置,这样操作之后,问题解决。

Supongo que te gusta

Origin blog.csdn.net/weixin_42280271/article/details/114581249
Recomendado
Clasificación