PyTorch implementation for image harmonization.
- Pytorch
- MS COCO Dataset
- Install PyTorch and dependencies from http://pytorch.org
- Install Torch vision from the source.
git clone https://github.com/pytorch/vision
cd vision
python setup.py install
pip install visdom
pip install dominate
- To train the model, generate a harmonization dataset with MS COCO
- The harmonization dataset will be randomly generated by converting brightness, contrast, and gamma value of masked region.
cd data_gen
python data_gen.py --image_dir coco_dataset_path --save_dir directory_for_saving_images
- Train a model:
python train.py --dataroot ./datasets
- To view training results, run
python -m visdom.server
and click the URL http://localhost:8097. To see more intermediate results, check out./checkpoints/web/index.html
- Test the model:
python test.py --dataroot ./datasets
The test results will be saved to a html file here: ./results/test_latest/index.html
.