mmdet安装遇到问题

一、前言

1、mmdet遇到的问题我分为两个模块:3090安装遇到的问题1660s/4090安装遇到的问题。

3090是上半年安装的,1660/4090这两个主机是今年刚安的。

2、本次遇到的问题是在本地安装mmdet 2.25.1遇到的,其安装过程参考:

https://blog.csdn.net/weixin_44013732/article/details/130675061icon-default.png?t=N7T8https://blog.csdn.net/weixin_44013732/article/details/130675061


二、3090安装遇到的问题

1.subprocess.CalledProcessError: Command '['cmake', '/home/zdj/spconv', '-DCMAKE_PREFIX_PATH=/home/zdj/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch', '-DPYBIND11_PYTHON_VERSION=3.7', '-DSPCONV_BuildTests=OFF', '-DPYTORCH_VERSION=10600', '-DCMAKE_CUDA_FLAGS="--expt-relaxed-constexpr" -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/zdj/spconv/build/lib.linux-x86_64-3.7/spconv', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.

解决方法:

可能1:此问题说明spconv安装缺文件,从官方下载下来的spconv1.2.1,文件夹下的third_party/pybind11是空的,需要自己手动去下载。

pybind11链接:https://github.com/pybind/pybind11/tree/3b1dbebabc801c9cf6f0953a4c20b904d444f879

可能2:电脑是30系列显卡时,需要安装CUDA11.x,属于高版本,spconv需要安装2.x。

每台主机问题多种多样,出现这种问题很多情况下是版本不适配。


2.Undifined symbol:ZN6caffe28TypeMeta21_typeMetaDataInstanceIN3c107complexINS2_4HalfEEEEEPKNS

解决方法:

可能1:torch版本太高,cuda10.1适合安装torch1.5.0-torch1.7.0。推荐使用torch1.6.0,目前没有出错,其他两个版本依旧报错。

可能2:其他第三方库版本太高或太低,例如安装mmdet时,mmcv-full安装1.6.2就会报出这样的错误,而mmcv-full==1.6.1时就不会。


3.keyEorror:[image_path]

解决方法:

数据集有问题,不符合格式,可以利用mmdet自带的createdata.py先生成一组数据集。

具体过程如下:

①进入到tools文件夹下:

/mmdetection3d-master/tools

②生成数据文件

python tools/create_data.py kitti --root-path ./data/kitti --out-dir ./data/kitti --extra-tag kitti

 

  这一步后会生成下方所示的kitti_gt_database及.pkl .json文件

# 这一步后会生成下方所示的kitti_gt_database及.pkl .json文件

kitti
├── ImageSets
│   ├── test.txt
│   ├── train.txt
│   ├── trainval.txt
│   ├── val.txt
├── testing
│   ├── calib
│   ├── image_2
│   ├── velodyne
│   ├── velodyne_reduced
├── training
│   ├── calib
│   ├── image_2
│   ├── label_2
│   ├── velodyne
│   ├── velodyne_reduced
├── kitti_gt_database
│   ├── xxxxx.bin
├── kitti_infos_train.pkl
├── kitti_infos_val.pkl
├── kitti_dbinfos_train.pkl
├── kitti_infos_test.pkl
├── kitti_infos_trainval.pkl
├── kitti_infos_train_mono3d.coco.json
├── kitti_infos_trainval_mono3d.coco.json
├── kitti_infos_test_mono3d.coco.json
├── kitti_infos_val_mono3d.coco.json

关键是下面几个json,如果不生成,就会报错“Keyerror:image_path”等错误。


4.已放弃 (核心已转储)

解决方法:

驱动启动不起来,要么重装驱动,要么重启一下机子试试看。

参考:GPU出现 “已放弃 (核心已转储)”解决办法


5.Pytorch: “KeyError: Caught KeyError in DataLoader worker process 0.“

划分训练集的之后,没有重置索引。

参考:

Pytorch: “KeyError: Caught KeyError in DataLoader worker process 0.“_迷路小书童丶的博客-CSDN博客转载:划分训练集的之后,没有重置索引。machine learning - Pytorch: "KeyError: Caught KeyError in DataLoader worker process 0." - Stack Overflowhttps://blog.csdn.net/weixin_51398304/article/details/122115632


6.[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires verion 2.6.0 of the Protocol Buffer runtime library, but the installed version is 2.5.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library.(version verification failed in “/build/mir-yHFhjH/mir-0.26.3+16.04.20170605/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc”.)

解决方法:

protobuf版本冲突,需要如上提示,按照要求进行安装。


7.AttributeError: module 'distutils' has no attribute 'version'

解决方法:

pip install setuptools==59.5.0


8.RuntimeError: No CUDA GPUs are available

解决方法:

可能1:同第四点,驱动找不到,利用指令torch.cuda.is_available()也会返回false,即使已经安装了新版本的CUDA。

可能2:安装的torch是从清华镜像源那里直接pip install torch的,这个默认下载cpu版本。你需要在torch后面加上cuda版本,例如:

pip install torch+cu111

放个torch+cu111镜像源:
https://download.pytorch.org/whl/torch_stable.htmlicon-default.png?t=N7T8https://download.pytorch.org/whl/torch_stable.html


9.E: 无法获得锁 /var/cache/apt/archives/lock。锁正由进程 4385(apt-get)持有 N: 请注意,直接移除锁文件不一定是合适的解决方案,且可能损坏您的系统。

答:

1.直接删除lock文件

 sudo rm /var/lib/dpkg/lock-frontend

 sudo rm /var/lib/dpkg/lock

2、关闭apt-get进程

报错中给出了ap-get锁的进程号,这里是4385,输入命令关闭进程

sudo kill 4385

如果不确定进程号的,可以输入ps -aux查看最后一列是apt-get的PID

原文链接

E: 无法获得锁 /var/cache/apt/archives/lock。锁正由进程 4385(apt-get)持有 N: 请注意,直接移除锁文件不一定是合适的解决方案,且可能损坏您的系统。 E:_振华OPPO的博客-CSDN博客


三、1660s/4090安装遇到的问题

1、报错:

AssertionError: MMCV==1.4.2 is used but incompatible. Please install mmcv>=1.5.2, <=1.7.0.

解决方法:
mmdet/mmdet3d版本太高,同时mmcv-full版本低,因此要降低mmdet3d的版本。

a. mmdet3d1.0.0rc4:

本地安装:https://pan.baidu.com/s/1_V0wa9ZFbtPdiFaXzpE5MA?pwd=6666icon-default.png?t=N7T8https://pan.baidu.com/s/1_V0wa9ZFbtPdiFaXzpE5MA?pwd=6666pip安装:

pip install mmdet3d==1.0.0rc6

b.升级/降低mmcv-full版本:

采用本地安装mmcv-full,镜像源地址:

https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.htmlicon-default.png?t=N7T8https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html


2、报错:

  note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

× Encountered error while generating package metadata.

╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

hint: See above for details.


3、报错:AttributeError: module 'distutils' has no attribute 'version'

解决方法:

pip install setuptools==59.5.0


4、报错:

ImportError: Could not import backend for traitsui.  Make sure you have a suitable UI toolkit like PyQt/PySide or wxPython installed.

解决方法:

安装PyQt5

pip install PyQt5

猜你喜欢

转载自blog.csdn.net/weixin_44013732/article/details/130694483