This script runs neural style transfer against the provided content image.

Overview

Neural Style Transfer

Content Style Output

Description:

This script runs neural style transfer against the provided content image. The content image must be present in the src/data/content directory. All style images, that are in the directory src/data/style will be applied against it. The outputs will be saved in generated/ directory as .png files. By default, the input images (both style and content images, as they must be of the same dimensionality) will be transformed to the 512x512 size for the algorithm, and output image will be of size 512x512 as well. To change that, please use additional script arguments.

The neural networks architecture is based on the documentation provided by PyTorch, which itself uses Neural-Style algorithm developed by Leon A. Gatys, Alexander S. Ecker and Matthias Bethge.

Usage examples:

./main.py -i 
   
   
    
    
./main.py --image 
    
    
     
     
python3 main.py -i 
     
     
      
      
python3 main.py --image 
      
      
       
       

./main.py -i 
       
       
         -he 1024 -wi 1024 ./main.py --image 
        
          -height 1024 -width 1024 
         
       
      
      
     
     
    
    
   
   

Script arguments:

Required arguments:
  -i IMAGE, --image IMAGE
                        Content image to be taken as input. The file must be present in src/data/content.

Optional arguments:
  -h, --help            Show help message and exit.
  -he HEIGHT, --height HEIGHT
                        Sets the height of the input and output images. The default value is 512.
  -wi WIDTH, --width WIDTH
                        Sets the width of the input and output images. The default value is 512.

Setup

Python 3.9 must be installed on the operating system. To install the needed python dependencies run:

pip3 install -r requirements.txt

To run the script as ./main.py -i or to run the linter script, one might need to give executable permissions:

chmod -x main.py
chmod -x ./scripts/lint.sh

To run the black formatter and pylint linter, please run:

./scripts/lint.sh

The script ./scripts/lint_check.sh will be run as GitHub action, and will fail if any possible changes are detected.

You might also like...
Implementation of Neural Style Transfer in Pytorch

PytorchNeuralStyleTransfer Code to run Neural Style Transfer from our paper Image Style Transfer Using Convolutional Neural Networks. Also includes co

Two-Stage Peer-Regularized Feature Recombination for Arbitrary Image Style Transfer
Two-Stage Peer-Regularized Feature Recombination for Arbitrary Image Style Transfer

Two-Stage Peer-Regularized Feature Recombination for Arbitrary Image Style Transfer Paper on arXiv Public PyTorch implementation of two-stage peer-reg

U-2-Net: U Square Net - Modified for paired image training of style transfer
U-2-Net: U Square Net - Modified for paired image training of style transfer

U2-Net: U Square Net Modified for paired image training of style transfer This is an unofficial repo making use of the code which was made available b

Only a Matter of Style: Age Transformation Using a Style-Based Regression Model
Only a Matter of Style: Age Transformation Using a Style-Based Regression Model

Only a Matter of Style: Age Transformation Using a Style-Based Regression Model The task of age transformation illustrates the change of an individual

Instant Real-Time Example-Based Style Transfer to Facial Videos
Instant Real-Time Example-Based Style Transfer to Facial Videos

FaceBlit: Instant Real-Time Example-Based Style Transfer to Facial Videos The official implementation of FaceBlit: Instant Real-Time Example-Based Sty

An implementation of
An implementation of "Optimal Textures: Fast and Robust Texture Synthesis and Style Transfer through Optimal Transport"

Optex An implementation of Optimal Textures: Fast and Robust Texture Synthesis and Style Transfer through Optimal Transport for TU Delft CS4240. You c

The official code of Anisotropic Stroke Control for Multiple Artists Style Transfer
The official code of Anisotropic Stroke Control for Multiple Artists Style Transfer

ASMA-GAN Anisotropic Stroke Control for Multiple Artists Style Transfer Proceedings of the 28th ACM International Conference on Multimedia The officia

Pytorch implementation of Nueral Style transfer
Pytorch implementation of Nueral Style transfer

Nueral Style Transfer Pytorch implementation of Nueral style transfer algorithm , it is used to apply artistic styles to content images . Content is t

Official PyTorch implementation of Retrieve in Style: Unsupervised Facial Feature Transfer and Retrieval.
Official PyTorch implementation of Retrieve in Style: Unsupervised Facial Feature Transfer and Retrieval.

Retrieve in Style: Unsupervised Facial Feature Transfer and Retrieval PyTorch This is the PyTorch implementation of Retrieve in Style: Unsupervised Fa

Owner
Martynas Subonis
Full-Stack Software Engineer
Martynas Subonis
Pytorch implementation of the paper "Enhancing Content Preservation in Text Style Transfer Using Reverse Attention and Conditional Layer Normalization"

Pytorch implementation of the paper "Enhancing Content Preservation in Text Style Transfer Using Reverse Attention and Conditional Layer Normalization"

Dongkyu Lee 4 Sep 18, 2022
Fast Neural Style for Image Style Transform by Pytorch

FastNeuralStyle by Pytorch Fast Neural Style for Image Style Transform by Pytorch This is famous Fast Neural Style of Paper Perceptual Losses for Real

Bengxy 81 Sep 3, 2022
Official PyTorch implementation of "ArtFlow: Unbiased Image Style Transfer via Reversible Neural Flows"

ArtFlow Official PyTorch implementation of the paper: ArtFlow: Unbiased Image Style Transfer via Reversible Neural Flows Jie An*, Siyu Huang*, Yibing

null 123 Dec 27, 2022
Official Implementation of CoSMo: Content-Style Modulation for Image Retrieval with Text Feedback

CoSMo.pytorch Official Implementation of CoSMo: Content-Style Modulation for Image Retrieval with Text Feedback, Seungmin Lee*, Dongwan Kim*, Bohyung

Seung Min Lee 54 Dec 8, 2022
PyTorch implementation of neural style transfer algorithm

neural-style-pt This is a PyTorch implementation of the paper A Neural Algorithm of Artistic Style by Leon A. Gatys, Alexander S. Ecker, and Matthias

null 770 Jan 2, 2023
Neural style transfer in PyTorch.

style-transfer-pytorch An implementation of neural style transfer (A Neural Algorithm of Artistic Style) in PyTorch, supporting CPUs and Nvidia GPUs.

Katherine Crowson 395 Jan 6, 2023
Towards Ultra-Resolution Neural Style Transfer via Thumbnail Instance Normalization

Towards Ultra-Resolution Neural Style Transfer via Thumbnail Instance Normalization Official PyTorch implementation for our URST (Ultra-Resolution Sty

czczup 148 Dec 27, 2022
Neural style transfer as a class in PyTorch

pt-styletransfer Neural style transfer as a class in PyTorch Based on: https://github.com/alexis-jacq/Pytorch-Tutorials Adds: StyleTransferNet as a cl

Tyler Kvochick 31 Jun 27, 2022
CVPR '21: In the light of feature distributions: Moment matching for Neural Style Transfer

In the light of feature distributions: Moment matching for Neural Style Transfer (CVPR 2021) This repository provides code to recreate results present

Nikolai Kalischek 49 Oct 13, 2022
PyTorch implementation of paper: AdaAttN: Revisit Attention Mechanism in Arbitrary Neural Style Transfer, ICCV 2021.

AdaAttN: Revisit Attention Mechanism in Arbitrary Neural Style Transfer [Paper] [PyTorch Implementation] [Paddle Implementation] Overview This reposit

null 148 Dec 30, 2022