Skip to content

eridgd/PhotoWCT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhotoWCT

Unofficial implementation of "A Closed-form Solution to Photorealistic Image Stylization"

 This Project is the Unofficial implementation of "A Closed-form Solution to Photorealistic Image Stylization" which forks the project https://github.com/eridgd/WCT-TF.

 The official implementation is located in https://github.com/NVIDIA/FastPhotoStyle and this follow the TUTORIAL.md Example 3 steps.

 Paper Link: https://arxiv.org/abs/1802.06474

Try Steps:
  1\ download COCO dataset from http://cocodataset.org/ (this use coco 2017) download vgg_normalized.t7 from web (download_vgg.sh)/
  2\ This step may not be necessary if you not want to use segmentation as prior in input (with may require more times in wavelet pooling setting---use_wavelet_pooling = True in WCTModel construction), details can be seen in "" use project https://github.com/CSAILVision/semantic-segmentation-pytorch to generate some segementations for coco dataset, if you have some confusions of use weights, you can appeal to my issue comment in CSAILVision/semantic-segmentation-pytorch#116 Then you can edit dataloader in test.py to generate your own segmentations, and save them in "path/to/val2017".replace("2017", "2017_seg") or "path/to/train2017".replace("2017", "2017_seg")

  3\ Use merge_pics_segs/merge.py to merge pics and segmentations, save them in "path/to/val2017".replace("2017", "2017_with_label") or "path/to/train2017".replace("2017", "2017_with_label")

The merged conclusion can seen in path/to/simple2017/style_with_label.png or path/to/simple2017/content_with_label.png

  4\ Train model:

python train_edit.py --relu-target relu3_1 --content-path path/to/train2017_with_label --batch-size 8 --feature-weight 1 --pixel-weight 1 --tv-weight 0.0 --learning-rate 1e-4 --max-iter 50000 --val-path path/to/val2017_with_label --checkpoint path/to/ckpt/

  5\ Evaluate the conclusion:

python stylize.py --input-checkpoint C:\Coding\Python\PhotoWCT\ckpt\model.ckpt-4601 --relu-targets relu3_1 --alpha 0.8 --style-path path/to/simple2017/style_with_label.png --content-path path/to/simple2017/content_with_label.png --out-path C:\Coding\Python\WCT_tf_final\output --passes 1/

  6\ Apply Haze Removal to conclusion, online in http://tools.pfchai.com/ or with the script located in https://github.com/pfchai/Haze-Removal/blob/master/HazeRemovalWidthGuided.py /

More info can be seen in my chiness blog:
 "https://blog.csdn.net/sinat_30665603/article/details/89068390"

avatar

avatar

About

Unofficial implementation of "A Closed-form Solution to Photorealistic Image Stylization"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.2%
  • Shell 0.8%