回覆列表
  • 1 # ufnzf42033

    思路我們都知道在Visual Studio中使用OpenCV是非常方便的,只要配置好相關的路徑,建立一個屬性表就可以了。接觸過Caffe的可能會知道,在Caffe的例程中並沒有怎麼說如何建立一個屬性表,就能夠使用Caffe提供的一些函式去構造程式。話說一個月前剛剛在Github上幫一個老外解決了這個問題,所以這裡也寫一下我的方法。 要用Caffe,就是 include 、lib 、dll,和OpenCV一樣,搞好這三個即可,推薦大家配置Release版本的,所以在編譯Caffe的時候,換成Release模式也編譯一次。實現觀察caffe-master的第三方程式包,毫無疑問,這個與caffe-master本資料夾都需要加上去的。 所以在屬性表裡,先後需要include以下這些:(路徑請自行修改) D:\caffe-master\includeD:\NugetPackages\boost.

    1.59.0.0\lib\native\includeD:\NugetPackages\glog.0.3.3.0\build\native\includeD:\NugetPackages\gflags.

    2.1.2.1\build\native\includeD:\NugetPackages\protobuf-v120.2.6.1\build\native\includeC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\includeD:\NugetPackages\OpenBLAS.0.2.14.1\lib\native\includeD:\caffe-master\include\caffe\layersD:\NugetPackages\OpenCV.2.4.10\build\native\includeD:\NugetPackages\OpenCV.2.4.10\build\native\include\opencvD:\NugetPackages\OpenCV.2.4.10\build\native\include\opencv21234567891011我們可以看到,這個第三方程式包裡面已經有OpenCV了,所以我們沒必要把OpenCV的屬性表新增。 然後,我們需要新增lib:(路徑請自行修改)D:\NugetPackages\boost_date_time-vc120.1.59.0.0\lib\native\address-model-64\libD:\NugetPackages\boost_filesystem-vc120.1.59.0.0\lib\native\address-model-64\libD:\NugetPackages\boost_system-vc120.1.59.0.0\lib\native\address-model-64\libD:\caffe-master\Build\x64\ReleaseD:\NugetPackages\boost_thread-vc120.1.59.0.0\lib\native\address-model-64\libD:\NugetPackages\boost_chrono-vc120.1.59.0.0\lib\native\address-model-64\libD:\NugetPackages\protobuf-v120.2.6.1\build\native\lib\x64\v120\ReleaseD:\NugetPackages\OpenCV.2.4.10\build\native\lib\x64\v120\ReleaseD:\NugetPackages\glog.0.

    3.3.0\build\native\lib\x64\v120\Debug\dynamicD:\NugetPackages\gflags.2.1.2.1\build\native\x64\v120\dynamic\LibD:\NugetPackages\hdf5-v120-complete.1.8.15.2\lib\native\lib\x64D:\NugetPackages\OpenBLAS.0.2.14.1\lib\native\lib\x64C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\lib\x6412345678910111213最後一項是CUDA的配置路徑,找一下應該就可以找到。 那麼我們的附加依賴項需要新增: libcaffe.liblibprotobuf.libopencv_highgui2410.libopencv_core2410.libopencv_imgproc2410.liblibglog.libgflags.liblibopenblas.dll.ahdf5.libhdf5_hl.libcublas.libcublas_device.libcuda.libcudadevrt.libcudnn.libcudart.libcufft.libcudart_static.libcudnn_static.libcufftw.libcusparse.libcusolver.libcurand.libnppc.libOpenCL.lib12345678910111213141516171819202122232425對了,最後別忘了配置環境變數喲,配置完之後重啟一遍:D:\NugetPackages\gflags.2.1.2.1\build\native\x64\v120\dynamic\LibD:\NugetPackages\hdf5-v120-complete.1.8.15.2\lib\native\bin\x64D:\NugetPackages\glog.0.3.3.0\build\native\bin\x64\v120\Release\dynamicD:\NugetPackages\OpenBLAS.0.2.14.1\lib\native\bin\x64D:\NugetPackages\gflags.2.1.2.1\build\native\x64\v120\dynamic\LibD:\NugetPackages\OpenCV.2.4.10\build\native\bin\x64\v120\Release123456這裡還是建議大家建立一個屬性表,方便後面的程式新增,就像這樣: 那麼在做完這些之後,我們就可以在新建工程裡使用Caffe的介面了

  • 中秋節和大豐收的關聯?
  • 《低碳貝貝》歌詞?