-
Notifications
You must be signed in to change notification settings - Fork 2.7k
For Beginners
-
The
-init
parameter is by default set torandom
, though from what I have seen, most people get better results by setting it toimage
. -
I would also suggest using a
-seed
value of your choice, or a random value. The-seed
value will let you run the exact same command again, to create the exact same image. This is useful for experimenting with parameters, while ruling out changes due to the default random-seed
value that Neural-Style uses. -
Make sure to save the parameters you use in something like a text file, so that you can refer back to them and learn from them, in the future.
-
The
-save_iter
can be used to monitor the progress of Neural-Style, and to make sure your chosen parameters are working. By default, the-save_iter
command is set to output an image every 100 iterations, though I have found that setting it to output an image every 50 iterations works better for debugging. -
The final output image doesn't have to be your chosen artwork piece to share. By using the
-save_iter
command effectively, you can end up with many different variations of your output image saved at different iterations. For example, I had a nice output image that looked the best at 50 iterations, and at 400 iterations, so while the two images are a bit different, I kept them both to share. -
An interesting Neural-Style phenomenon is increasing or decreasing both content and style weight so that their ratio stays the same. Many of us know that doing that gives different results. Higher absolute weights results in higher loss which gives higher gradients which again result in larger changes per iteration (similar to a higher learning rate). Source
-
Rotating, reflecting, and/or cropping either your style or content image, will change the output image that Neural-Style produces.
-
If your style image has a lot of horizontal or vertical lines/shapes and you want the final output to match the orientation of the content image's geometry, then make 3 other copies of your style image which each copy being rotated an additional 90 degrees. Then use all 4 versions of the style image as your new style images. Feel free to experiment with different numbers of style images, and rotation values.
-
Having the same style image multiple times like for example:
-style_image style1.png,style1.png,style2.png
, will also change the output image, as you are adjusting the style blend weights in a different way than how the-style_blend_weights
command adjusts the blending weights. -
VGG-16 models seem to generally produce "smoother" results, than VGG-19 which create more fine details.
-
Depending on the style image(s) and content image, both
-optimizer adam
and-optimizer lbfgs
can create almost the same result, or very different results. Using the ADAM optimizer is generally considered to be "worse" than the L-BFGS optimizer, but I have come across situations where ADAM created the better final output.
-
Neural-Style uses a neural network to perform artistic style transfer, and as such it's easier to think of it as an AI (though neural networks are not AI and are seen as a stepping stone towards to creation of real AI). This means that in addition to your chosen parameters, the model (AI brain) you are using will affect the abilities of Neural-Style. This also means that the lighting, details, and other aspects of an image, will affect Neural-Style as well.
-
Neural-Style does not understand what "image quality" is. This means that using a low quality or low resolution style image will result in a blurry output image.
-
Normally style transfer that has extremely bright or extremely dark colors, runs into issues. But using content and style images with similar shapes/content, can alleviate these issues. These Histogram Matching Scripts also try to modify the brightest and darkest colors, and thus can be used to help alleviate the issues with dark and light colors. Histogram Matching also seems to improve the spacial coherence of the final output in terms of coloration (i.e., instead of partially blended "color spots", the color locations will be placed in a way that better matches the styled content image).
-
Style and content images seem to blend better when they share complimentary, or similar geometry and shapes (that are also similar sizes). Though this is more of a possible guideline, and it does not apply to every combination of content and style image(s).
-
Motion blur, or any other filter or lens that makes some of an image blurry, can and will be made non-blurry by the style transfer process, if the image is used as a content image.
-
Some art mediums seem to work really well as content images, though the exact mediums (realistic painting?) and the reason why, are still a mystery.
If you end up getting loss values appearing as nan
or inf
, you can try changing the -image_size
value ever so slightly to resolve the issue.
- Neural-Style scripts are essentially add-ons for Neural-Style. Though in some cases, they are actual modifications of the Neural-Style code, instead of new ways to use the normal code.