? ? ? 前兩天看到日本早稻田大學(xué)利用深度學(xué)習(xí)從原畫中提取線稿的黑科技,發(fā)布了論文,但是并沒有可以一試的源碼。但是他的另一項黑科技給黑白照片上色,可以在git上下到試用的源碼,不過,沒有訓(xùn)練的源碼。git地址:https://github.com/satoshiiizuka/siggraph2016_colorization
在開始試用之前,我們先要配置一下環(huán)境
以上都是需要安裝的,本人是在OS X下安裝的,大致步驟如下:
首先我們需要安裝torch
# in a terminal, run the commands WITHOUT sudo
git clone https://github.com/torch/distro.git ~/torch --recursive
cd~/torch; bash install-deps;
./install.sh
先是從git上下載安裝文件,下載完成后先安裝LuaJIT,LuaRocks需要的環(huán)境,再安裝LuaJIT,LuaRocks。安裝完成后還會提示你將torch添加的你的path中,運(yùn)行命令如下即可
# On Linux with bash
source~/.bashrc
# On Linux with zsh
source~/.zshrc
# On OSX or in Linux with none of the above.
source~/.profile
然后我們就可以用LuaRocks來安裝torch,nn,image以及nngraph了
luarocks install nn
luarocks install image
luarocks install nngraph
環(huán)境配置完成之后我們先要下載官方訓(xùn)練完成的模型,可以通過下面的語句來下載
sh download_model.sh
也可以直接在http://hi.cs.waseda.ac.jp/~iizuka/data/colornet.t7下載
下載完成后就可以使用了,使用方法
th colorize.lua <input_image>[<output_image>]
比如
th colorize.lua ansel_colorado_1941.png out.png
注意一下,圖片大小最好不要超過512x512px,不然會就較慢。
下面是我試玩的一些例子








從上面的例子可以看出,在風(fēng)景圖片的處理上表現(xiàn)還不錯,但在人像上還稍顯不足。