Skip to content

Neural-Style, or Neural-Transfer, allows you to take an image and reproduce it with a new artistic style. The algorithm takes three images, an input image, a content-image, and a style-image, and changes the input to resemble the content of the content-image and the artistic style of the style-image.

License

Notifications You must be signed in to change notification settings

swas-kar/Neural_Style_Transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Style Transfer using PyTorch (GPU version)

Neural Style Transfer Created By: Swastika Kar & Siddharth Sen

Try the web app on this link https://nst-v01.streamlit.app/

Table of Contents

Introduction

This project is based on the Neural-Style algorithm developed by Leon A. Gatys, Alexander S. Ecker and Matthias Bethge. Neural-Style, or Neural-Transfer, allows you to take an image and reproduce it with a new artistic style. The algorithm takes three images, an input image, a content-image, and a style-image, and changes the input to resemble the content of the content-image and the artistic style of the style-image.

Example5

Example1

We have referred to the paper Gatys_Image_Style_Transfer_CVPR_2016_paper.pdf for understanding the underlying principles.

Features

  • Apply the style of famous artworks to your photos.
  • Adjustable style strength.
  • Supports multiple image formats.
  • Easy to use command-line interface.

Important :

  1. The notebook demonstrates the PyTorch version utilizing the CUDA GPU available on Google Colab for executing the neural style transfer.
  2. The app version runs on PyTorch version , which required patience for up to 10-15 minutes of loading.
  3. We have referred to the paper Gatys_Image_Style_Transfer_CVPR_2016_paper.pdf for understanding the underlying principles.

Examples

Here are a few examples of the style transfer in action:

TensorFlow Version

Example1 Example2 Example3 Example4

PyTorch Version

Example5

Example6 Example7

Features

  • Apply the style of famous artworks to your photos.
  • Adjustable style strength.
  • Supports multiple image formats.
  • Easy to use command-line interface.

Different kinds of initializations

Initialization using Gaussian Noise

Initialization using White Noise

Initialization using Style image

Initialization using Content image

Installation

Prerequisites

  • Python 3.6 or higher
  • Git
  • Virtual environment (optional but recommended)

Steps

  1. Clone the repository:

    git clone https://github.com/swas-kar/Neural_Style_Transfer.git
    cd Neural_Style_Transfer
  2. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate   # On Windows use `venv\Scripts\activate`
  3. Install the required dependencies:

    pip install -r requirements.txt

Arguments

  • --content: Path to the content image.
  • --style: Path to the style image.
  • --output: Path to save the output image.
  • --iterations: Number of iterations to run (default: 500).
  • --style-weight: Weight of the style (default: 1e6).
  • --content-weight: Weight of the content (default: 1).

Contributing

We welcome contributions! If you find a bug or want to add a new feature, feel free to open an issue or submit a pull request. Please follow the guidelines below:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a new pull request.

License

This project is licensed under the MIT License - see the MIT LICENSE file for details.

About

Neural-Style, or Neural-Transfer, allows you to take an image and reproduce it with a new artistic style. The algorithm takes three images, an input image, a content-image, and a style-image, and changes the input to resemble the content of the content-image and the artistic style of the style-image.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published