Skip to content

parasgulati8/Neural-Style-Transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Style Transfer

This project is an implementation of NST algorithm that generates artistic images.

1 - Problem Statement

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.

Monet

2 - Transfer Learning

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).

3 - Neural Style Transfer

NST algorithm is build in three steps:

  • Build the content cost function
  • Build the style cost function
  • Put it together to get

4 - Solving the optimization problem

Putting everything together to implement Neural Style Transfer!

Here's what the program follows:

  1. Create an Interactive Session
  2. Load the content image
  3. Load the style image
  4. Randomly initialize the image to be generated
  5. Load the VGG19 model
  6. 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
  7. Initialize the TensorFlow graph and run it for a large number of iterations, updating the generated image at every step.

Results

Here are few other examples:

  • The beautiful ruins of the ancient city of Persepolis (Iran) with the style of Van Gogh (The Starry Night)

  • The tomb of Cyrus the great in Pasargadae with the style of a Ceramic Kashi from Ispahan.

  • A scientific study of a turbulent fluid with the style of a abstract blue fluid painting.

About

Generate novel artistic images using NST algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published