C:\Users\HJiahu\.caffe\dependencies\download\libraries_v140_x64_py35_1.1.0.tar.bz2
)編譯完caffe後將install文件夾下的include文件夾複製出來與caffe源碼(位於根目錄中src目錄下)一塊兒放在同一個文件夾caffe_src下(這樣作是爲了方便。只有編譯後的include文件夾下才有caffe.pb.h文件)。caffe_src
的結構以下:git
- caffe_src - include - caffe - layers - proto - caffe.pb.h - util ... - src - caffe - layers - solvers - util ...
I:\learn_caffe\learn_caffe\caffe_src\include
,這個就是上面提到的從install文件夾中複製出來的include目錄C:\***\.caffe\dependencies\libraries_v140_x64_py35_1.1.0\libraries\include
,這個和下面的內容源於編譯caffe時自動下載的依賴包。C:\***\.caffe\dependencies\libraries_v140_x64_py35_1.1.0\libraries\include\boost-1_61
在預處理定義中添加以下內容github
CPU_ONLY _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE USE_LMDB USE_OPENCV
C:\***\.caffe\dependencies\libraries_v140_x64_py35_1.1.0\libraries\lib
全部依賴庫文件以下所示(其實我並不知道哪些是必須的因此就把能加的都加上去了):windows
caffeproto-d.lib opencv_world320d.lib boost_chrono-vc140-mt-gd-1_61.lib boost_date_time-vc140-mt-gd-1_61.lib boost_filesystem-vc140-mt-gd-1_61.lib boost_system-vc140-mt-gd-1_61.lib boost_thread-vc140-mt-gd-1_61.lib boost_timer-vc140-mt-gd-1_61.lib libopenblas.dll.a caffehdf5_D.lib caffehdf5_cpp_D.lib caffehdf5_hl_D.lib caffehdf5_hl_cpp_D.lib caffezlibd.lib caffezlibstaticd.lib gflagsd.lib glogd.lib leveldbd.lib libboost_chrono-vc140-mt-gd-1_61.lib libboost_system-vc140-mt-gd-1_61.lib libboost_timer-vc140-mt-gd-1_61.lib libcaffehdf5_D.lib libcaffehdf5_cpp_D.lib libcaffehdf5_hl_D.lib libcaffehdf5_hl_cpp_D.lib libprotobufd.lib libprotocd.lib lmdbd.lib snappy_staticd.lib snappyd.lib ntdll.lib
boost_thread-vc140-mt-gd-1_61.lib
,在同一個文件夾中建立一個副本並從新命名爲libboost_thread-vc140-mt-gd-1_61.lib
就好了。添加一個main函數後就能夠一步一步調試caffe代碼了(我直接從源代碼tools文件夾中把caffe.cpp複製出來做爲調試入口文件)。app
編譯caffe,可參考官方文檔函數
包含目錄爲ui
G:\caffe_rel\build\libraries\include\boost-1_61 G:\caffe_rel\build\libraries\include G:\caffe_rel\build\install\include
庫目錄爲調試
G:\caffe_rel\build\lib G:\caffe_rel\build\libraries\lib C:\CNNs\opencv_with_world\x64\vc12\lib
添加兩個預處理宏code
USE_OPENCV CPU_ONLY
附加庫爲接口
opencv_world310.lib gflags.lib glog.lib libprotobuf.lib libprotoc.lib caffe.lib proto.lib
與上同,修改boost_thread-vc120-mt-1_61.lib等文件的名稱ci
先使用官網提供的方法編譯caffe
下面的庫須要加入到vs2013中
opencv_world320d.lib caffe-d.lib caffeproto-d.lib libprotobufd.lib libopenblas.dll.a gflagsd.lib glogd.lib cublas.lib cuda.lib cudnn.lib cudart.lib curand.lib caffehdf5_D.lib caffehdf5_hl_D.lib caffezlibd.lib libboost_thread-vc140-mt-gd-1_61.lib (若是是vs2013的話這裏是120,具體boost庫的名稱要按照編譯器的提示添加)