This project is an implementation of NST algorithm that generates artistic images.
Neural Style Transfer (NST) is one of the most fun techniques in deep learning. As seen below, it merges two images, namely, a "content" image (C) and a "style" image (S), to create a "generated" image (G). The generated image G combines the "content" of the image C with the "style" of image S.
Neural Style Transfer (NST) uses a previously trained convolutional network, and builds on top of that.
Following the original NST paper (https://arxiv.org/abs/1508.06576), we used the VGG-199 network. This model has already been trained on the very large ImageNet database, and thus has learned to recognize a variety of low level features (at the earlier layers) and high level features (at the deeper layers).
NST algorithm is build in three steps:
Putting everything together to implement Neural Style Transfer!
Here's what the program follows:
- Create an Interactive Session
- Load the content image
- Load the style image
- Randomly initialize the image to be generated
- Load the VGG19 model
- Build the TensorFlow graph:
- Run the content image through the VGG19 model and compute the content cost
- Run the style image through the VGG19 model and compute the style cost
- Compute the total cost
- Define the optimizer and the learning rate
- Initialize the TensorFlow graph and run it for a large number of iterations, updating the generated image at every step.
Here are few other examples: