autoware.ai中检测模块lidar_detector caffe

文章详细描述了在使用百度Apollo的lidar_apollo_cnn_seg_detect模块时遇到的Caffe安装及依赖库问题,包括cuDNN版本、Atlas、OpenCV和CUDA的配置,以及解决编译过程中leveldb、snappy和opencv_imgcodecs缺失的步骤。
摘要由CSDN通过智能技术生成

lidar_apollo_cnn_seg_detect模块:该模块主要是调用百度apollo的目标分割。
1.需要安装caffe进行实现:
caffe安装步骤:

git clone https://github.com/BVLC/caffe
cd caffe && mdkir build && cd build
cmake ..

出现报错:

CMake Error at cmake/Cuda.cmake:227 (message):   cuDNN version >3 is required.

修改方法:

in Openpose change the cmake/cuda.cmake file and the /cmake/modules/FindCuDNN.cmake file.
Find the line that reads:
file(READ {CUDNN_INCLUDE}/cudnn.h CUDNN_VERSION_FILE_CONTENTS) change to: file(READ {CUDNN_INCLUDE}/cudnn_version.h CUDNN_VERSION_FILE_CONTENTS)

出现报错:

Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR
  Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  cmake/Modules/FindAtlas.cmake:43 (find_package_handle_standard_args)
  cmake/Dependencies.cmake:121 (find_package)
  CMakeLists.txt:49 (include)

解决方法:

sudo apt-get install libatlas-base-dev

出现报错:

Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_cublas_device_LIBRARY (ADVANCED)
    linked by target "caffe" in directory

解决方法:出现该问题是因为cmake版本不匹配:
cuda10 可以用cmake-3.14.3
cuda10.2 可以用cmake-3.17
我安装的是cuda 11.6,对应的cmake版本为cmake3.18.1,最新版本3.27.4不可用
由于安装ros后存在cmake,如果进行删除将会导致大量ros依赖被卸载,因此并未进行卸载,执行步骤为:

wget https://cmake.org/files/v3.18/cmake-3.18.1-Linux-x86_64.tar.gz
tar zxvf cmake-3.18.1-Linux-x86_64.tar.gz
mv cmake-3.18.1-Linux-x86_64 /opt/cmake-3.18.1
ln -sf /opt/cmake-3.18.1/bin/*  /usr/bin/
cmake --version  # 应该显示3.18.1

caffe 需要用make进行安装:
关于hdf5的问题:
Makefile中

LIBRARIES +=  hdf5_hl hdf5

改为

LIBRARIES += hdf5_serial_hl hdf5_serial

将Makefile.config中的路径:

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include 
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

改为

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

执行make报错:编译Caffe时遇到的错误:leveldb/db.h文件找不到

sudo apt-get update
sudo apt-get install libleveldb-dev

寻找Makefile文件

LIBRARIES += leveldb
make clean
make

/usr/bin/ld: cannot find -lleveldb
/usr/bin/ld: cannot find -lsnappy
/usr/bin/ld: cannot find -lcblas
/usr/bin/ld: cannot find -latlas

sudo apt-get install libsnappy-dev

sudo apt-get install libatlas-base-dev

注:如果不清楚自己opencv版本型号,输入下面命令产看版本

pkg-config opencv --modversion

如果opencv有报错把这个解开

改为(根据自己OpenCV版本来,我的是3.2.0):
OPENCV_VERSION :=3

CUDA_ARCH := -gencode需要改成自己型号
https://developer.nvidia.com/cuda-gpus

运行lidar_apollo_cnn_seg_detect.launch 报错:

error while loading shared libraries: libcaffe.so.1.0.0: cannot open shared object file: No such file or directory 运行时报错(caffe)

caffe安装好后lib没有配置到/usr/lib或/usr/local/lib中,需手动配置:

 export LD_LIBRARY_PATH=/path_to_your_caffe/distribute/lib/:$LD_LIBRARY_PATH

lidar_euclidean_cluster_detect模块:该模块主要是用的欧式聚类算法进行聚类
出现报错:

error while loading shared libraries: libopencv_imgcodecs.so.4.3: cannot open shared object file : No such file or directory

解决办法:

$ find ~/ -name "libopencv_imgcodecs.so.407"

结果

/home/xxx/xxx/opencv-4.7.0/build/lib/libopencv_imgcodecs.so.407

将exprot LD_LIBRARY_PATH 插在~/.bashrc最后

export LD_LIBRARY_PATH=/home/xxx/xxx/opencv-4.7.0/build/lib/libopencv_imgcodecs.so.407
export LD_LIBRARY_PATH=*******:$LD_LIBRARY_PATH                                             

*******为之前的路径

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值