Most of us have observed the power of generalizaton of gans from tasks like pix2pix. In their work pix2pix had tried edges to photo(like binary to color) but showed it on cases like bags and cats but here we tried it in broader way i.e., from Binarized Images to Color Images.Some examples are shown here below:-
Left Image is Binarized Image
Middle Image is binary to color networks output
Right Image is Ground Truth
Left Image is Color Image
Middle Image is color to binary network's output
We have prepared the dataset for this task by using voting technique for every pixel by Otsu's, Kittler, Niblack and Sauvola binarized images.Original Images are taken from BSDS300.
- Linux or OSX
- NVIDIA GPU + CUDA CuDNN (CPU mode and CUDA without CuDNN may work with minimal modification, but untested)
Binary to Color A->B
Color to Binary B->A
- Install torch and dependencies from https://github.com/torch/distro
- Install torch packages
nngraph
anddisplay
luarocks install nngraph
luarocks install https://raw.githubusercontent.com/szym/display/master/display-scm-0.rockspec
Unzip the files in binarization folder.
python scripts/combine_A_and_B.py --fold_A datasets/binarization/A --fold_B datasets/binarization/B --fold_AB datasets/binarization
- Train the model from A to B
DATA_ROOT=datasets/binarization name=binary_color which_direction=AtoB th train.lua
DATA_ROOT=datasets/binarization name=binary_color which_direction=AtoB phase=val th test.lua
For pretrained models you can look at checkpoint
Code borrows heavily from Image-to-Image Translation with Conditional Adversarial Networks (pix2pix)