luanfujun / deep-painterly-harmonization

Code and data for paper "Deep Painterly Harmonization": https://arxiv.org/abs/1804.03189
6.08k stars 628 forks source link

Can I train my own model? how to generate mask & mask_dilated images? #6

Open DLSeed opened 6 years ago

DLSeed commented 6 years ago

1.How can I train my model using specific style images? and how to choose weights similar to the weights in 'wikiart_output.txt'? 2.I saw mask & mask_dilated images used during process ,how to generate these?

luanfujun commented 6 years ago

Hi, Thanks for your question!

  1. Yes you can train your model. One elegant way to search good weights would be parameter sweep + user study. In our project we didn't have that much time to do so, so we discretize the weights into 3 levels. Basically assigning 1.0, 5.0, and 10.0 based on painting category. params_screenshot

  2. To create a naive compositing and a mask, I used Photoshop quick selection tool (GIMP should work too). To generate dilated mask, please use this file.

jayavanth commented 6 years ago

@luanfujun how do I run the lua scripts if I want to train the paintings and masks in data/?

SunnerLi commented 6 years ago

@jayavanth I think you can call the th interpreter directly. Just use the following command, you can work on the first example:

th neural_gram.lua  -content_image data/0_naive.jpg   -style_image   data/0_target.jpg  -tmask_image   data/0_c_mask.jpg  -mask_image    data/0_c_mask_dilated.jpg  -gpu 0 -original_colors 0 -image_size 700  -output_image  results/0_inter_res.jpg -print_iter 100 -save_iter 100 &&  th neural_paint.lua  -content_image data/0_naive.jpg  -style_image   data/0_target.jpg  -tmask_image  data/0_c_mask.jpg  -mask_image    data/0_c_mask_dilated.jpg  -cnnmrf_image  results/0_inter_res.jpg   -gpu 0 -original_colors 0 -image_size 700  -index 0 -wikiart_fn data/wikiart_output.txt  -output_image  results/0_final_res.jpg -print_iter 100 -save_iter 100  -num_iterations 1000 &

The above command will conduct neural_gram.lua script and neural_paint.lua in order. You can check the detail for more clear parameters information in gen_all.py

kaisark commented 6 years ago

Cool Project. I ran the demo for all images, but was wondering if you could put together a tutorial for creating our own images (e.g. dilated mask) using the classified styles in wikiart_output.txt or maybe another (e.g. Ukiyo-e)??? I have installed GIMP image editor to create a mask...

Ubuntu 16

deep-paint1

Ianmcmill commented 5 years ago

I also would like to know more about the difference of dilated and masked images and how to train my own style classification. But also I am not very familiar with lua and torch. A pytorch implementation would be really cool but I understand that this would be a major undertaking.