Run Paints Chainer on CPU with official python on win10

I didn't use python, but I want to run Paints Chainer at hand! This is an article for you.

Before you start

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 3.5 in win10

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.

python-101.png I want to change the installation location, so press Customize installation (because the capacity of C: is tight).

python-102.png Select an option. At first, all are checked. I did as above. Let's put pip and py.

python-103.png Further options. Here, Python is added to the environment variables (environment variables). Edit the install location to suit your environment.

python-104.png Has completed!

Black screen

Execute cmd.exe as a matter of course. That black screen!

cmd-003.png Make sure python (py) responds.

Insert chainer opencv pillow

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!

Run Paints Chainer on CPU

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 it works but the color is strange

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

Run Paints Chainer on CPU with official python on win10
YOLO on Chainer
Run Paints Chainer on CPU with official python on win10
Implemented ESPnet on Macbook
Install Chainer 1.5.0 on Windows
Install Chainer on CentOS 6.7
OpenPose on MacBook Pro
Linux operation on Win10
Run servo with Python on ESP32 (Windows)
Run Flask on CentOS with python3.4, Gunicorn + Nginx.
Run Python with VBA
Run prepDE.py with python3
Run Blender with python
Run iperf with python
Run Openpose on Python (Windows)
Run Python with CloudFlash (arm926ej-s)
Let's run Excel with Python
Run Tensorflow 2.x on Python 3.7
Run Python CGI on CORESERVER
Run unix command on python
Run Label with tkinter [Python]
[Python] [Chainer] [Windows] Install Chainer on Windows
Run DHT22 with RasPi + Python
Run mruby with Python or Blender
Run Python on Schedule on AWS Lambda
Run TensorFlow Docker Image on Python3
Run SwitchBot on Windows 10 with Bleak
Run XGBoost with Cloud Dataflow (Python)
Run Aprili from Python with Orange
Run python3 Django1.9 with mod_wsgi (deploy)
Notes on using rstrip with python.
Until you run python with apache
Getting started with Python 3.8 on Windows
Memorandum of understanding when Python is run on EC2 with Apache
[Memo] Tweet on twitter with python
Periodically run Python on Heroku Scheduler
Don't work Python with OpenCV on AMD Ryzen CPU on WSL2 Ubuntu 18.04 And 20.04
Run a batch of Python 2.7 with nohup on Amazon Linux AMI on EC2
Rock-paper-scissors with Python Let's run on a Windows local server for beginners
Use Tabpy with Cloud Run (on GKE)
[Python] Run Flask on Google App Engine
A memo with Python2.7 and Python3 on CentOS
Map rent information on a map with python
Follow active applications on Mac with Python
[C] [python] Read with AquesTalk on Linux
Notes on doing Japanese OCR with Python
Run AzureKinect in Python on Christmas Eve.
scipy stumbles with pip install on python 2.7.8
Download files on the web with Python
Build Python environment with Anaconda on Mac
Run servomotor on Raspberry Pi 3 using python
[Python] Run Headless Chrome on AWS Lambda
Run Python code on A2019 Community Edition
Run a Python web application with Docker
Installing PIL with Python 3.x on macOS
Run Python in C ++ on Visual Studio 2017
Run Linux on ARM architecture with QEMU
Run python wsgi server on NGINX Unit
Working with GPS on Raspberry Pi 3 Python
Until you install Python with pythonbrew and run Flask on a WSGI server
Getting started with Python with 100 knocks on language processing
Periodically run a python program on AWS Lambda
Install and run Python3.5 + NumPy + SciPy on Windows 10
Put MicroPython on Windows to run ESP32 on Python
Strategy on how to monetize with Python Java
Build python environment with pyenv on EC2 (ubuntu)
Build a python environment with ansible on centos6