Skip to content

Repository files navigation

NeuralStyle-Tensorflow

Neural Style Transfer (NST) is a technique in machine learning and compute vision that allows the fusion of two images: One representing the content and the other the style. The result is a new image (generated image) that combines the content structure with the artistic features of the style image.

This project implements NST using Tensorflow with GPU acceleration via CUDA, leveraging the VGG19 pre-trained model for feature extraction.

Table of Contents

Features

  • Tensorflow GPU Acceleration: Uses Tensorflow and CUDA for optimal training speed.
  • VGG19 Pre-trained Model: Employs a modified VGG19 model for effective content and style extraction.
  • Noise Initialization: Starts with content image and noisy for enhanced stylization effects.

Dependencies

This project was made with the following main dependencies/configuration:

  • Tensorflow version 2.10
  • Python version 3.10
  • CUDA version 11.2
  • cuDNN version 8.1

You can try install CUDA here: [https://developer.nvidia.com/cuda-11.2.0-download-archive].

And cuDNN: [https://developer.nvidia.com/rdp/cudnn-archive].

Other way to do it could through an Anaconda3 environment: [https://www.anaconda.com/download].

Read this tutorial to install Tensorflow, CUDA and cuDNN through Anaconda: [https://medium.com/@Rahul_Meduri/install-cuda-cudnn-in-conda-virtual-environment-and-setup-gpu-support-using-tensorflow-f8a4c942b6ea].

Project Structure

.
├── generated_images/              # Images generated by neural style 
├── images/                        # Images: content and style images to use 
├── pretrained_model/              # VGG19 model without Top
├── Neural-Style-Transfer.ipybn    # Main application logic in jupyter (more explained) Neural Style Transfer
├── Neural-Style.py                # Python version of jupyter version
...

Results

Below are some example results produced by this neural style transfer project. Each output image combines the content of one image with the style of another:

  • With around 4000 iterations
Content Image Style Image Generated Image
Content Image Style Image Generated Image
--------------- ------------- -----------------
Content Image
Style Image
Result Image
  • With around 1000 iterations
Content Image Style Image Generated Image
Content Image
Style Image
Result Image

How to Run the Application

  • Option 1: With jupyter.
  • Option 2: Using the python script. Place your content and style images in the images/ directory. Run the main script (example):
python .\Neural-Style.py --content images/mona_lisa.jpg --style images/stone_style.jpg --output stone_lisa

References

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages