如何在 Windows 10(GPU) 中玩 Caffe 的 C++ 及 Python 範例程式

動機:想在 Windows10(GPU) 中跑 Caffe 範例碼,要如何實作呢?!

準備環境:(有關 安裝篇 請詳見~ https://davistseng.blogspot.com/2020/01/windows-10-caffeconvolutional.html)
1.OS: Windows 10 x64
2.GPU: GeForce RTX 2070 with Max-Q Design
3.CUDA: 8.0.60
4.Python 2.7.16 (Miniconda 2.7 for Windows 64-bit)
5.Conda: 4.8.1
6.Git: 2.25.0.windows.1
7.Microsoft Visual Studio Community 2015: 14.0.25431.01 Update 3

操作步驟
1.開啟 Anaconda Prompt (Miniconda2) 環境: 請 以系統管理員身分 執行(可避免一些權限問題),如下圖
2.進入 caffe-windows 目錄: 指令如下圖
3.下載 Wget: 請至 https://eternallybored.org/misc/wget/ 下載並  copy 到 C:\Windows\System32 目錄中
4.下載 Gzip: 請至 http://gnuwin32.sourceforge.net/downlinks/gzip.php 下載並安裝,但是該安裝檔不會幫你建立 PATH(環境變數),需自行建立,如下圖
5.建立下載批次檔 get_mnist.cmd: 請參攷... https://gist.github.com/dvsseed/ad0b5526ae461a29f5268a4d0afdbd83,並 copy 到 .data\mnist\ 目錄下
6.執行 MNIST C++範例:
(1).下載 mnist資料集: 請參攷...
https://gist.github.com/dvsseed/ad0b5526ae461a29f5268a4d0afdbd83,並 copy 到 .data\mnist\ 目錄中,再下執行指令如下
      (base) C:\Users\user\caffde-windows>data\mnist\get_mnist.cmd
      執行畫面如下:
(2).轉換 mdb資料: 請參攷... https://gist.github.com/dvsseed/245c25f9e23aeeb13d2e521200019ab0,並 copy 到 .examples\mnist\ 目錄中,再下執行指令如下
     (base) C:\Users\dvsse\caffe-windows>examples\mnist\create_mnist.cmd
(3).執行 LeNet模型訓練: 請參攷... https://gist.github.com/dvsseed/0b740c7e5022b00d8fda83719d29f566,並 copy 到 .examples\mnist\ 目錄中,再下執行指令如下
     (base) C:\Users\dvsse\caffe-windows>examples\mnist\train_mnist.cmd
     執行畫面如下:
(4).執行 LeNet模型測試: 請參攷... https://gist.github.com/dvsseed/8d482f995d71fd645c11da8278850a57,並 copy 到 .examples\mnist\ 目錄中,再下執行指令如下
     (base) C:\Users\dvsse\caffe-windows>examples\mnist\test_mnist.cmd
     執行畫面如下:
7.執行 ImageNet Python2範例: 請參攷... https://gist.github.com/dvsseed/6f9db80edaf3a62c6507aa338959d3fb,並 copy 到 .\ 當前目錄中,再下執行指令如下
     (base) C:\Users\dvsse\caffe-windows>python imagenet.py
     執行畫面如下:


心得Caffe的程式(C++Python)是簡單易用的,接下來就可以快速應用自己的圖檔來訓練測試了...:-)


參攷
1.Windows下caffe安装成功测试(以mnist为例), https://blog.csdn.net/liuweiyuxiang/article/details/79532073
2.caffe 下测试 MNIST数据, https://blog.csdn.net/jiandanjinxin/article/details/50408580
3.caffe训练测试(用caffe训练自己的数据), https://blog.csdn.net/qq_36492210/article/details/80430237


留言