Speaking of deep learning frameworks, Caffe, Tensorflow, Chainer, etc. are famous, but many of them do not support Windows, so until now the environment was built on Ubuntu. (Chainer also works on Windows) But I still want to do it on Windows. So, as a result of trial and error as to whether Caffe can be built on Windows, I managed to build it, so I will note it.
That said, it's not particularly difficult, and the Windows version of Caffe has a link from the official page to the Github repository, so you can build it by following the README. https://github.com/Microsoft/caffe
However, with the above procedure, it must be cudnn3 or cudnn4, or there is no detailed explanation ...
I want to use cudnn 5.1, so I fork the Windows branch of Caffe and use the modified repository for cuDNN v5. The changes are as follows.
・ Include \ caffe \ layers \ cudnn_relu_layer.hpp ・ Include \ caffe \ layers \ cudnn_sigmoid_layer.hpp ・ Include \ caffe \ layers \ cudnn_tanh_layer.hpp ・ Include \ caffe \ util \ cudnn.hpp ・ Src \ caffe \ layers \ cudnn_conv_layer.cu ・ Src \ caffe \ layers \ cudnn_relu_layer.cu ・ Src \ caffe \ layers \ cudnn_relu_layer.cpp ・ Src \ caffe \ layers \ cudnn_sigmoid_layer.cu ・ Src \ caffe \ layers \ cudnn_sigmoid_layer.cpp ・ Src \ caffe \ layers \ cudnn_tanh_layer.cu ・ Src \ caffe \ layers \ cudnn_tanh_layer.cpp
https://github.com/yuzsh/caffe
Repository clone (I'll leave the location to you) Download the Windows version of the branch.
git clone -b windows https://github.com/yuzsh/caffe.git
Go to the caffe root directory and copy the properties file.
copy .\windows\CommonSettings.props.example .\windows\CommonSettings.props
I will omit the installation method of various libraries,
Please install CUDA and cudnn from [NVIDIA official page](https://developer.nvidia.com/cuda-gpus).
For Python, it is convenient to use [Anaconda](https://anaconda.org).
Also, the Python module requires numpy, scipy, matplotlib, scikit-image, and protobuf, so you need to install them. I did the following:
>```activate anaconda2
conda install -y numpy scipy matplotlib scikit-image pip
pip install protobuf
Open. \ Windows \ CommonSettings.props. It will be easier to see if you open it in Visual Studio. Where to check
By the way, in Debug mode, if Python is not set to false, an error will occur because Python27_d.lib does not exist.
Once this is done, I'll change it to "Treat warnings as errors: No" in the project settings, but if I cloned my repository, I've already done so, so I think it's okay.
### Build
Then open the caffe.sln file and build the solution.
It takes a lot of time.
When the build is completed successfully, the exe and dll will be created in Build \ x64 \ Release (or Build \ x64 \ Debug).
### PATH setting
Add `` `<caffe_root> \ Build \ x64 \ Release \ pycaffe``` to the environment variable PYTHONPATH.
By the way, [RapidEE](http://www.rapidee.com/en/about) is convenient for handling environment variables in windows.
### Operation check
Open a command prompt, launch python, and if import caffe passes without error, installation is complete.
Also, if you go to <CAFFE_HOME> \ Build \ x64 \ Release and execute caffe.exe and the usage message is displayed, you can confirm that the EXE has been generated without any problem.
As a supplement, samples such as MNIST are written in shell scripts, so it is necessary to prepare an environment and software that can execute this.
I set it when I put in git.
That is all.
I think it was easier than Ubuntu.
By the way, chainer can be installed only with `` `pip install chainer```.
Recommended Posts