Skip to content

An approach to implement artistic style transfer in PyTorch ๐ŸŽจ๐Ÿ–Œ๏ธ

Notifications You must be signed in to change notification settings

Priya4607/neural_style_transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Art with CNN: Artistic Style Transfer in Pytorch

license

An approach to implement artistic stylized effects on images, loosely based on the implementation of A Neural Algorithm of Artistic Style by Gatys, Ecker, and Bethge. This implementation extracts features representing style and content from different layers in VGG-19 network, followed by manipulating both representations independently to produce stylized effects on the input image. There is a slight modification in the use of max-pooling layers as opposed to the use of average pooling in the paper.

Pre-trained VGG19's weights from PyTorch's model zoo is used in this implementation.

Table of Contents

  1. Requirements
  2. Usage
  3. Attribution

Requirements

Implementation takes considerable amount of time to produce results without GPU, it is advisable to use a CUDA capable GPU device.

Necessary libraries

  • PyTorch
  • Numpy

Usage

Project structure:

Here's an overview of project structure,

Main : Main program to implement stylized effects on images

Utilities: Performs necessary image transformation and also extracts loss at different layers of VGG19 network

Ancillary Functions: Defines necessary loss functions

Arguments:

--style_image: Path to style image

--content_image: Path to content image

--style_weight (Optional): Defaults to 1e6

--content_weight (Optional): Defaults to 1

--num_iter (Optional): Set the number of iterations (between 300-800) defaults to 300

To run,

python nst.py --style_image <path to style image> --content_image <path to content image>

Attribution

This work borrows some implementation from:

About

An approach to implement artistic style transfer in PyTorch ๐ŸŽจ๐Ÿ–Œ๏ธ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages