autoware.ai中检测模块lidar_detector caffe

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                                             

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

你可能感兴趣的:(人工智能,caffe)