最新更新
https://blog.youkuaiyun.com/baidu_40691432/article/details/121426736
电脑系统重装,在2021年的11月再次在win10系统上安装caffe进行对比实验代码运行。
注意事项:
- CPU-Only版本安装较为简单。不需要考虑cuda和cudnn相关版本适配等问题。但计算速度要比GPU版本的慢。
- python2.7配套visual studio2013进行安装,anaconda新建环境内部安装cmake。新安装环境下的各版本信息:其中,caffe版本在这里不显示。
- caffe运行的文件夹。其中,caffe是github上下载的文件夹,切到window版本。
https://github.com/BVLC/caffe/tree/windows
build_win.cmd代码如下,供参考。ninja安装的版本有点问题,withNinja = 0, CPU_only=1,vs=12
@echo off @setlocal EnableDelayedExpansion :: Default values if DEFINED APPVEYOR ( echo Setting Appveyor defaults if NOT DEFINED MSVC_VERSION set MSVC_VERSION=12 if NOT DEFINED WITH_NINJA set WITH_NINJA=0 if NOT DEFINED CPU_ONLY set CPU_ONLY=1 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=C:\Miniconda-x64 ) :: Set python 3.5 with conda as the default python if !PYTHON_VERSION! EQU 3 ( set CONDA_ROOT=C:\Miniconda35-x64 ) set PATH=!CONDA_ROOT!;!CONDA_ROOT!\Scripts;!CONDA_ROOT!\Library\bin;!PATH! :: Check that we have the right python version !PYTHON_EXE! --version :: Add the required channels conda config --add channels conda-forge conda config --add channels willyd :: Update conda conda update conda -y :: Download other required packages conda install --yes cmake ninja numpy scipy protobuf==3.1.0 six scikit-image pyyaml pydotplus graphviz if ERRORLEVEL 1 ( echo ERROR: Conda update or install failed exit /b 1 ) :: Install cuda and disable tests if needed if !WITH_CUDA! == 1 ( call %~dp0\appveyor\appveyor_install_cuda.cmd set CPU_ONLY=0 set RUN_TESTS=0 set USE_NCCL=1 ) else ( set CPU_ONLY=1 ) :: Disable the tests in debug config if "%CMAKE_CONFIG%" == "Debug" ( echo Disabling tests on appveyor with config == %CMAKE_CONFIG% set RUN_TESTS=0 ) :: Disable linting with python 3 until we find why the script fails if !PYTHON_VERSION! EQU 3 ( set RUN_LINT=0 ) ) else ( :: Change the settings here to match your setup :: Change MSVC_VERSION to 12 to use VS 2013 if NOT DEFINED MSVC_VERSION set MSVC_VERSION=12 :: Change to 1 to use Ninja generator (builds much faster) if NOT DEFINED WITH_NINJA set WITH_NINJA=0 :: Change to 1 to build caffe without CUDA support if NOT DEFINED CPU_ONLY set CPU_ONLY=1 :: Change to generate CUDA code for one of the following GPU architectures :: [Fermi Kepler Maxwell Pascal All] if NOT DEFINED CUDA_ARCH_NAME set CUDA_ARCH_NAME=Auto :: Change to Debug to build Debug. This is only relevant for the Ninja generator the Visual Studio generator will generate both Debug and Release configs if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release :: Set to 1 to use NCCL if NOT DEFINED USE_NCCL set USE_NCCL=0 :: Change to 1 to build a caffe.dll if NOT DEFINED CMAKE_BUILD_SHARED_LIBS set CMAKE_BUILD_SHARED_LIBS=0 :: Change to 3 if using python 3.5 (only 2.7 and 3.5 are supported) if NOT DEFINED PYTHON_VERSION