🖼️

How to install richzhang/colorization on Windows 10

2020/10/21に公開

What is this?

This document shows you how to install Colorful Image Colorization on Windows 10 and Python 3.x (3.8.6).

This feature allows you auto-colorization (autocolorization).

Steps

Step 1. Install Python on Windows

Version 3.8 of Windows x86-64 executable installer seems better:
https://www.python.org/downloads/windows/

Step 2. Install richzhang/colorization

Clone the repository

git clone https://github.com/richzhang/colorization.git

CUDA

Download and install CUDA 10.2:
https://developer.nvidia.com/cuda-downloads

PyTorch (torch)

pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

# For more details see below
# https://stackoverflow.com/questions/56859803/modulenotfounderror-no-module-named-tools-nnwrap

Others

Please note that I chose scikit-image instead of skimage.

pip install wheel scikit-image matplotlib argparse
pip install ipython

Step 3. Run

cd colorization
python demo_release.py -i imgs/ansel_adams3.jpg

screenshot of success

Congratulations!

Logs

PyTorch (torch)

Click here to see command-line logs
C:\Users\AAA>pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch===1.6.0
  Downloading https://download.pytorch.org/whl/cu102/torch-1.6.0-cp38-cp38-win_amd64.whl (1077.4 MB)
     |████████████████████████████████| 1077.4 MB 833 bytes/s
Collecting torchvision===0.7.0
  Downloading https://download.pytorch.org/whl/cu102/torchvision-0.7.0-cp38-cp38-win_amd64.whl (1.1 MB)
     |████████████████████████████████| 1.1 MB 6.8 MB/s
Collecting future
  Downloading future-0.18.2.tar.gz (829 kB)
     |████████████████████████████████| 829 kB 3.2 MB/s
Collecting numpy
  Downloading numpy-1.19.2-cp38-cp38-win_amd64.whl (13.0 MB)
     |████████████████████████████████| 13.0 MB 6.8 MB/s
Collecting pillow>=4.1.1
  Downloading Pillow-8.0.0-cp38-cp38-win_amd64.whl (2.1 MB)
     |████████████████████████████████| 2.1 MB 6.4 MB/s
Using legacy 'setup.py install' for future, since package 'wheel' is not installed.
Installing collected packages: future, numpy, torch, pillow, torchvision
    Running setup.py install for future ... done
Successfully installed future-0.18.2 numpy-1.19.2 pillow-8.0.0 torch-1.6.0 torchvision-0.7.0

Others

Click here to see command-line logs
C:\Users\AAA>pip install wheel scikit-image matplotlib argparse
Collecting wheel
  Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Collecting scikit-image
  Downloading scikit_image-0.17.2-cp38-cp38-win_amd64.whl (11.7 MB)
     |████████████████████████████████| 11.7 MB 3.3 MB/s
Collecting matplotlib
  Downloading matplotlib-3.3.2-cp38-cp38-win_amd64.whl (8.5 MB)
     |████████████████████████████████| 8.5 MB 6.4 MB/s
Collecting argparse
  Using cached argparse-1.4.0-py2.py3-none-any.whl (23 kB)
Collecting scipy>=1.0.1
  Downloading scipy-1.5.3-cp38-cp38-win_amd64.whl (31.4 MB)
     |████████████████████████████████| 31.4 MB 6.4 MB/s
Collecting imageio>=2.3.0
  Downloading imageio-2.9.0-py3-none-any.whl (3.3 MB)
     |████████████████████████████████| 3.3 MB ...
Requirement already satisfied: pillow!=7.1.0,!=7.1.1,>=4.3.0 in c:\home\sdk\python38\lib\site-packages (from scikit-image) (8.0.0)
Collecting tifffile>=2019.7.26
  Downloading tifffile-2020.10.1-py3-none-any.whl (152 kB)
     |████████████████████████████████| 152 kB 6.8 MB/s
Collecting PyWavelets>=1.1.1
  Downloading PyWavelets-1.1.1-cp38-cp38-win_amd64.whl (4.3 MB)
     |████████████████████████████████| 4.3 MB 6.8 MB/s
Requirement already satisfied: numpy>=1.15.1 in c:\home\sdk\python38\lib\site-packages (from scikit-image) (1.19.2)
Collecting networkx>=2.0
  Downloading networkx-2.5-py3-none-any.whl (1.6 MB)
     |████████████████████████████████| 1.6 MB ...
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting certifi>=2020.06.20
  Using cached certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
Collecting python-dateutil>=2.1
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting cycler>=0.10
  Using cached cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
Collecting kiwisolver>=1.0.1
  Downloading kiwisolver-1.2.0-cp38-none-win_amd64.whl (58 kB)
     |████████████████████████████████| 58 kB ...
Collecting decorator>=4.3.0
  Downloading decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting six>=1.5
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Installing collected packages: wheel, scipy, imageio, tifffile, PyWavelets, pyparsing, certifi, six, python-dateutil, cycler, kiwisolver, matplotlib, decorator, networkx, scikit-image, argparse
Successfully installed PyWavelets-1.1.1 argparse-1.4.0 certifi-2020.6.20 cycler-0.10.0 decorator-4.4.2 imageio-2.9.0 kiwisolver-1.2.0 matplotlib-3.3.2 networkx-2.5 pyparsing-2.4.7 python-dateutil-2.8.1 scikit-image-0.17.2 scipy-1.5.3 six-1.15.0 tifffile-2020.10.1 wheel-0.35.1

First run

Click here to see command-line logs
C:\home\src\colorization>python demo_release.py -i imgs/ansel_adams3.jpg
Downloading: "https://colorizers.s3.us-east-2.amazonaws.com/colorization_release_v2-9b330a0b.pth" to C:\Users\AAA/.cache\torch\hub\checkpoints\colorization_release_v2-9b330a0b.pth
100.0%
Downloading: "https://colorizers.s3.us-east-2.amazonaws.com/siggraph17-df00044c.pth" to C:\Users\AAA/.cache\torch\hub\checkpoints\siggraph17-df00044c.pth
100.0%
C:\home\sdk\python38\lib\site-packages\torch\nn\functional.py:3118: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  warnings.warn("Default upsampling behavior when mode={} is changed "
C:\home\sdk\python38\lib\site-packages\skimage\color\colorconv.py:1128: UserWarning: Color data out of range: Z < 0 in 367 pixels
  return xyz2rgb(lab2xyz(lab, illuminant, observer))
C:\home\sdk\python38\lib\site-packages\skimage\color\colorconv.py:1128: UserWarning: Color data out of range: Z < 0 in 33 pixels
  return xyz2rgb(lab2xyz(lab, illuminant, observer))![](https://storage.googleapis.com/zenn-user-upload/owfupao294w6w9z4j0wr2w813agg)

Discussion