LoginSignup
12

More than 5 years have passed since last update.

白黒写真の色付けについて(2/2)

Last updated at Posted at 2016-11-07

前編 白黒写真の色付けについて(1/2)の続き

Colorful Image Colorization

三番目はUC Berkeleyの研究です。

モデル

net_diagram.jpg

We embrace the underlying uncertainty of the problem by posing it as a classification task and use class-rebalancing at training time to increase the diversity of colors in the result.
...
the loss function is dominated by desaturated ab values. We account for the classimbalance problem by reweighting the loss of each pixel at train time based on the pixel color rarity.

論文を読まないと、あまり理解できないですが(読んでも、理解できないかも。笑)、ab valueの重みの再計算により、クラス調整で結果はカラフルしやすくなります。

結果

とりあえず、論文中の結果を見ましょう。
teaser3111.jpg
確かにカラフルになりますが、色付けない部分も結構ありますね。

実際にやってみます。
依存ライブラリは前編ですでにインストールしたCaffeです。
本体をダウンロードします。
git clone -b master --single-branch https://github.com/richzhang/colorization.git

デモはjupyterで実行します。
CPU onlyなので、コードを修正しなければなりません。

gpu_id = 0
caffe.set_mode_gpu()
caffe.set_device(gpu_id)

caffe.set_mode_cpu()

に書き換えます。

test1.jpg out3.png
test2.jpg out3-2.png

とりあえず、速いです。
色付け結果も素晴らしいです。

オンラインデモもあります。

まとめ

Satoshi Iizuka:
test1_out.jpg test2_out.jpg
Gustav Larsson:
test1_out2.jpg test2_out2.jpg
Richard Zhang:
out3.png out3-2.png

Satoshi Iizuka Gustav Larsson Richard Zhang
Speed   Middle(1分以内) Slow(しかもメモリは4G以上が必要) Fast(10秒前後)
Result 普通(変な色付けもある) やや不十分? カラフル(一番いいかも?)

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12