style-transfer-pytorch icon indicating copy to clipboard operation
style-transfer-pytorch copied to clipboard

Use several style images

Open Daniel63656 opened this issue 4 years ago • 2 comments

Hello can someone tell me the syntax if i want to hand over a list of style images?

Daniel63656 avatar Oct 25 '21 10:10 Daniel63656

I don't know enough about python to fully explain this, but after finding myself unable to the use the 'content' and 'styles' arguments the way I expected, I edited lines 155 and 156 in cli.py to be the following: p.add_argument('-content', type=str, help='the content image') p.add_argument('-styles', type=str, nargs='+', metavar='style', help='the style images') (added the dash in front of both content and style).

After that, you can do command like: cw = 0.015 * 1 #this is the content weight—make it a larger number to emphasize the content !style_transfer -content 'file1.jpg' -styles 'style1.jpg' -cw $cw -s 512

Then, if you want multiple style images, you can do

!style_transfer -content afile1.jpg -styles style1.jpg style2.jpg -sw 0.5 3.75 -cw $cw -s 512

The two numbers after -sw are the weights for the two files that you specify after -styles. If you want more than two, then simply list more than 2 files after -styles, and supply the corresponding number of weights after -sw.

Apologies for any jankiness, but I hope that at least helps you get closer to what you are looking for..

terekita avatar Oct 26 '21 17:10 terekita

@Daniel63656 ,

The program uses the first file supplied as content and the rest as styles. Using the example below I have been able to run multiple styles:

./style_transfer /path/to/content.jpg /path/to/style1.jpg /path/to/style2.jpg /path/to/style3.jpg ...

Hope this helps.

meefs avatar Nov 08 '21 23:11 meefs