• autoware.ai中检测模块lidar_detector caffe


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

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

    出现报错:

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

    修改方法:

    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)
    
    • 1
    • 2
    • 3

    出现报错:

    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)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    解决方法:

    sudo apt-get install libatlas-base-dev
    
    • 1

    出现报错:

    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
    
    • 1
    • 2
    • 3

    解决方法:出现该问题是因为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
    
    • 1
    • 2
    • 3
    • 4
    • 5

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

    LIBRARIES +=  hdf5_hl hdf5
    
    • 1

    改为

    LIBRARIES += hdf5_serial_hl hdf5_serial
    
    • 1

    将Makefile.config中的路径:

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

    改为

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

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

    sudo apt-get update
    sudo apt-get install libleveldb-dev
    
    • 1
    • 2

    寻找Makefile文件

    LIBRARIES += leveldb
    
    • 1
    make clean
    make
    
    • 1
    • 2

    /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
    
    • 1
    • 2
    • 3

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

    pkg-config opencv --modversion
    
    • 1

    如果opencv有报错把这个解开

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

    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)
    
    • 1

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

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

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

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

    解决办法:

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

    结果

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

    将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                                             
    
    • 1
    • 2

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

  • 相关阅读:
    报错:To see the full stack trace of the errors, re-run Maven with the -e switch.
    网络安全(黑客)自学
    RabbitMQ入门
    编译链接(Compile Link)
    2.【远程调用框架】Feign远程调用
    作用域和作用域链
    附近商户-实现附近商户功能
    Spring事务的实现方式
    基于SSM的罪犯信息管理系统
    git 合并多次提交记录(commit)
  • 原文地址:https://blog.csdn.net/lsyhaoshuai/article/details/132859623