SSD是Caffe的一個(gè)分支,源碼在github上:https://github.com/weiliu89/caffe/tree/ssd $ git clone https://github.com/weiliu89/caffe.git $ cd caffe $ git checkout ssd 然后編譯SSD $ cp Makefile.config.example Makefile.config $ make -j8 $ make py $ make test -j8 在這個(gè)過(guò)程中會(huì)遇到很多很多問(wèn)題,特此記錄 1、hdf5缺失解決方案官網(wǎng)下載hdf5:https://www./downloads/hdf5/source-code/ 解壓后編譯安裝 $ cd hdf5-1.10.3 $ mkdir build $ cd build $ cmake .. $ sudo make $ sudo make install 對(duì)于新版本的hdf5需要較新版本的cmake,因此需要將cmake更新至3.10以后,此處選擇3.12.0 $ cd /usr $ sudo wget https:///files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz $ sudo tar zxvf cmake-3.12.0-Linux-x86_64.tar.gz $ sudo ln -s /usr/cmake-3.12.0-Linux-x86_64/bin/* /usr/bin/ 如果提示有沖突,那么需要將原有的cmake相關(guān)可執(zhí)行文件刪除 $ sudo rm /usr/bin/cmake #以及其他如ccmake、ctest、cpack、cmake-gui #然后重新關(guān)聯(lián) $ sudo ln -s /usr/cmake-3.12.0-Linux-x86_64/bin/* /usr/bin/ $ cmake --version #檢查cmake版本,如果為3.12.0則說(shuō)明安裝成功 打開(kāi)Makefile.config,找到 # Whatever else you find you need goes here. INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib 改為 # Whatever else you find you need goes here. INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib 然后鏈接hdf5庫(kù) $ cd /usr/lib/x86_64-linux-gnu $ sudo ln -s libhdf5_serial.so.10.0.2 libhdf5.so $ sudo ln -s libhdf5_serial_hl.so.10.0.2 libhdf5_hl.so 如果還是有問(wèn)題 $ sudo ln -sf libhdf5_serial.so libhdf5.so $ sudo ln -sf libhdf5_serial_hl.so libhdf5_hl.so github上有討論帖https://github.com/BVLC/caffe/issues/4333 2、opencv3的問(wèn)題問(wèn)題如下.build_release/lib/libcaffe.so: undefined reference to 'cv::VideoCapture::set(int, double)' ... 解決方案已安裝opencv3及對(duì)應(yīng)的contrib的同學(xué)們打開(kāi)Makefile.config,找到 # OPENCV_VERSION := 3 將這句話(huà)前面的#去掉,然后打開(kāi)Makefile找到 ifeq ($(USE_OPENCV), 1) LIBRARIES = opencv_core opencv_highgui opencv_imgproc 這里空格然后加上 opencv_imgcodecs opencv_contrib opencv_videoio 3、架構(gòu)architecture compute_20的問(wèn)題問(wèn)題如下nvcc fatal : Unsupported gpu architecture 'compute_20' Makefile:596: recipe for target '.build_release/cuda/src/caffe/solvers/nesterov_solver.o' failed 解決方案打開(kāi)Makefile.config,找到 # CUDA architecture setting: going with all of them. # For CUDA < 6.0, comment the lines after *_35 for compatibility. CUDA_ARCH := -gencode arch=compute_20,code=sm_20 ? ? ? ? ? ? ?-gencode arch=compute_20,code=sm_21 ? ? ? ? ? ? ?-gencode arch=compute_30,code=sm_30 ? ? ? ? ? ? ?-gencode arch=compute_35,code=sm_35 ? ? ? ? ? ? ?-gencode arch=compute_50,code=sm_50 ? ? ? ? ? ? ?-gencode arch=compute_52,code=sm_52 ? ? ? ? ? ? ?-gencode arch=compute_61,code=sm_61 第三行和第四行中的結(jié)構(gòu)部分前面加#,改為 # CUDA architecture setting: going with all of them. # For CUDA < 6.0, comment the lines after *_35 for compatibility. CUDA_ARCH := #-gencode arch=compute_20,code=sm_20 ? ? ? ? ? ? ?#-gencode arch=compute_20,code=sm_21 -gencode arch=compute_30,code=sm_30 ? ? ? ? ? ? ?-gencode arch=compute_35,code=sm_35 ? ? ? ? ? ? ?-gencode arch=compute_50,code=sm_50 ? ? ? ? ? ? ?-gencode arch=compute_52,code=sm_52 ? ? ? ? ? ? ?-gencode arch=compute_61,code=sm_61 ? 至此基本解決安裝編譯SSD的問(wèn)題,接下來(lái)從github上下載MobileNet到examples文件夾下:https://github.com/chuanqi305/MobileNet-SSD,運(yùn)行demo.py,這時(shí)又會(huì)出現(xiàn)好幾種問(wèn)題,特做以下記錄 4、沒(méi)有安裝pycaffe問(wèn)題如下ImportError: No module named _caffe 這是沒(méi)有配置好python與caffe的接口,需要安裝pycaffe 解決方案$ cd your_caffe_path $ sudo make pycaffe 5、找不到skimage模塊問(wèn)題如下ImportError: No module named skimage.io 找不到skimage模塊,那么我們安裝此模塊 解決方案$ sudo pip install scikit-image 使用pip安裝的過(guò)程中,如果pip版本過(guò)低,有些庫(kù)是無(wú)法安裝的,因此需要用以下的命令升級(jí)到最新版的pip $ sudo pip install --upgrade pip 建議個(gè)人使用pip時(shí)安裝都加上sudo,有些文件權(quán)限會(huì)有問(wèn)題。 6、找不到protobuf模塊問(wèn)題如下ImportError: No module named google.protobuf.internal 找不到protobuf模塊,解決方案類(lèi)似于上一問(wèn)題 解決方案$ sudo pip install protobuf來(lái)源:http://www./content-3-76801.html |
|
來(lái)自: 印度阿三17 > 《開(kāi)發(fā)》