I didn't use python, but I want to run Paints Chainer at hand! This is an article for you.
I don't know the command line! I tried to summarize the PaintsChainer environment that runs on Windows 64bit that I would like you to introduce in the direction of. https://drive.google.com/file/d/0Bxi51MbdWHVhM2pZSi1LNl9XYnc/view
I want to build the same thing myself! In that case, read this article.
Put python on your Windows 10 (64bit). There are many kinds of python, but here we use the official python.
Download the Windows version from the official website www.python.org. I'm at a loss because it is distributed in various ways. I chose python-3.5.3-amd64.exe.
I chose 3.5 instead of the latest version 3.6 because I wanted to match it with blender 2.78, but 3.6 seems to be incompatible with numpy (the library used by chainer).
Download it and run it.
I want to change the installation location, so press Customize installation (because the capacity of C: is tight).
Select an option. At first, all are checked. I did as above. Let's put pip and py.
Further options. Here, Python is added to the environment variables (environment variables). Edit the install location to suit your environment.
Has completed!
Execute cmd.exe as a matter of course. That black screen!
Make sure python (py) responds.
The package is inserted using the command pip. What you need to include is chainer (leading role) opencv-python (image processing) and pillow (image processing).
Thanks to the mechanism called wheel, I think that even official python can be easily entered.
E:\usr\src\PaintsChainer>pip install chainer
Collecting chainer
Downloading chainer-1.20.0.1.tar.gz (1.2MB)
100% |################################| 1.2MB 164kB/s
Collecting filelock (from chainer)
Downloading filelock-2.0.7.tar.gz
Collecting nose (from chainer)
Downloading nose-1.3.7-py3-none-any.whl (154kB)
100% |################################| 163kB 109kB/s
Collecting numpy>=1.9.0 (from chainer)
Downloading numpy-1.12.0-cp35-none-win_amd64.whl (7.7MB)
100% |################################| 7.7MB 61kB/s
Collecting protobuf (from chainer)
Downloading protobuf-3.1.0.post1-py2.py3-none-any.whl (347kB)
100% |################################| 348kB 240kB/s
Collecting six>=1.9.0 (from chainer)
Downloading six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in e:\python35\lib\site-packages (from protobuf->chainer)
Installing collected packages: filelock, nose, numpy, six, protobuf, chainer
Running setup.py install for filelock ... done
Running setup.py install for chainer ... done
Successfully installed chainer-1.20.0.1 filelock-2.0.7 nose-1.3.7 numpy-1.12.0 protobuf-3.1.0.post1 six-1.10.0
E:\usr\src\PaintsChainer>pip install opencv-python
Collecting opencv-python
Downloading opencv_python-3.2.0.6-cp35-cp35m-win_amd64.whl (22.1MB)
100% |################################| 22.1MB 32kB/s
Requirement already satisfied: numpy>=1.11.3 in e:\python35\lib\site-packages (from opencv-python)
Installing collected packages: opencv-python
Successfully installed opencv-python-3.2.0.6
E:\usr\src\PaintsChainer>pip install pillow
Collecting pillow
Downloading Pillow-4.0.0-cp35-cp35m-win_amd64.whl (1.5MB)
100% |################################| 1.5MB 195kB/s
Collecting olefile (from pillow)
Downloading olefile-0.44.zip (74kB)
100% |################################| 81kB 1.7MB/s
Installing collected packages: olefile, pillow
Running setup.py install for olefile ... done
Successfully installed olefile-0.44 pillow-4.0.0
E:\usr\src\PaintsChainer>pip list --format=columns
Package Version
------------- -----------
chainer 1.20.0.1
filelock 2.0.7
nose 1.3.7
numpy 1.12.0
olefile 0.44
opencv-python 3.2.0.6
Pillow 4.0.0
pip 9.0.1
protobuf 3.1.0.post1
setuptools 28.8.0
six 1.10.0
Amazing pip!
Since CUDA does not work in an environment without NVIDIA GPU (it seems that it will work if you do your best even with AMD ...), it will run on the CPU. To use the CPU, specify -g -1 when starting the web server.
E:\usr\src\PaintsChainer>py server.py -g -1
GPU: -1
start
load model
serving at localhost : 8000
After that, open http: // localhost: 8000 / static in your browser and you will see a familiar screen!
If the image of the execution result is created but the color is strange (the red and blue channels are switched), it is necessary to rewrite BGR to RGB (5 places in total).
in cgi_exe.py:
change cv2.COLOR_YUV2BGR to cv2.COLOR_YUV2RGB
in img2imgDataset.py:
change cv2.COLOR_BGR2YUV to cv2.COLOR_RGB2YUV
It seems that it depends on the version of opencv, but I'm not sure.
In any case, it's impressive to move at hand, so give it a try. If you have a server at hand, you don't have to save it one by one.
Recommended Posts