by machrisaa

machrisaa / stylenet

Neural Network with Style Synthesis

201 Stars 40 Forks Last release: Not found 13 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


This is a Tensorflow project of neural network with the style synthesis algorithm modified from 2 major methods Gram Matrix and Markov Random Fields. By given a content and style image, the style and pattern can be synthesised into the content. This project also support region mapping. We have added several modifications in the Markov Random Fields cost functions. See belows for the detail.

The visual network is make use of the Tensorflow VGG19 network (Original Caffe implementation is in here and here).

Here are some sample result generated by this algorithm.

Basic synthesis

Content Style Result

See the intermediate results in this video

Synthesis with region mapping

Content Style
Content Region Map Style Region Map Result

Modification of Algorithm

There are 2 modifications of the algorithm from the original Markov Random Field in the paper.

  • We added the blur filtering in the convariant matrix before calculate the max argument in order to reduce the different of the convariant score in a local neighbouthood. This can make the result image look more natural. (Yellow part in the diagram)

  • The second modification is to replace the cost function of the piecwise square difference between all patches and the slices of the image. We replaced the function to a single averaged patch tensor in order greatly improve the training process. (Red part in the diagram)


Basic Usage

stylenet_patch.render_gen(  , 

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.