天天看點

記錄windows 10下編譯mobileNet ssd

1. 下載下傳MobileNet-SSD:https://github.com/eric612/MobileNet-SSD-windows。

2. 安裝依賴環境:

Requirements
Visual Studio 2013 or 2015
CMake 3.4 or higher (Visual Studio and Ninja generators are supported)
Anaconda
Optional Dependencies
Python for the pycaffe interface. Anaconda Python 2.7 or 3.5 x64 (or Miniconda)
Matlab for the matcaffe interface.
CUDA 7.5 or 8.0 (use CUDA 8 if using Visual Studio 2015)
cuDNN v5
           

3. 根據自己的配置更新編譯檔案build_win.cmd:

if NOT DEFINED MSVC_VERSION set MSVC_VERSION=14
    if NOT DEFINED WITH_NINJA set WITH_NINJA=0
    if NOT DEFINED CPU_ONLY set CPU_ONLY=0
    if NOT DEFINED CUDA_ARCH_NAME set CUDA_ARCH_NAME=Auto
    if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release
    if NOT DEFINED USE_NCCL set USE_NCCL=0
    if NOT DEFINED CMAKE_BUILD_SHARED_LIBS set CMAKE_BUILD_SHARED_LIBS=0
    if NOT DEFINED PYTHON_VERSION set PYTHON_VERSION=2
    if NOT DEFINED BUILD_PYTHON set BUILD_PYTHON=1
    if NOT DEFINED BUILD_PYTHON_LAYER set BUILD_PYTHON_LAYER=1
    if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=0
    if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python
    if NOT DEFINED RUN_TESTS set RUN_TESTS=1
    if NOT DEFINED RUN_LINT set RUN_LINT=1
    if NOT DEFINED RUN_INSTALL set RUN_INSTALL=1
    :: Set python 2.7 with conda as the default python
    if !PYTHON_VERSION! EQU 2 (
        set CONDA_ROOT=E:\Anaconda2
    )
    if !PYTHON_VERSION! EQU 3 (
        set CONDA_ROOT=E:\Anaconda2
    )
           
:: Build the install target
    if NOT DEFINED RUN_INSTALL set RUN_INSTALL=1
           

其中我采用了python27,這裡常會出現報錯:

Could not find url for MSVC version = 1900 and Python version = 3.6. Call Stack (most recent call first):   CMakeLists.txt:77 (include)

我将python2和python3的安裝位址都設定成python2的位址就不會報錯(我也是看到别人怎麼做的,原因不明。。。)

4. 編譯mobileNet ssd:

> cd $root_path/script
> build_win.cmd
           

沒有報錯就代表成功,則在$root_path/script/build/install/bin裡可以看到caffe.exe檔案。

5.測試

Running Caffe

Download SSD_300x300 deploy model and save at

$caffe_root\models\VGGNet\VOC0712\SSD_300x300\

Download deploy weights from original web and save at

$caffe_root\models\MobileNet\

> cd $caffe_root/
> dectect.cmd
           

Python Usage

> cd $caffe_root
> python examples\ssd\test_ssd.py data\VOC0712\000166.jpg models\MobileNet\MobileNetSSD_deploy.prototxt models\MobileNet\MobileNet