Skip to content

aliissaoui/Perceptual-loss-for-style-transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PerceptualLossNetwork

This repository is for CS577 (Deep Learning) @ IIT The work in this repository is based on the paper:

Perceptual Losses for Real-Time Style Transfer and Super Resolution

@article{
title={Perceptual Losses for Real-Time Style Transfer and Super Resolution},
author={Justin Johnson, Alexandre Alahi, Li Fei-Fei},
publisher={Dept. of Computer Science, Stanford University},
year={2016}
}

This implementation was inspired from the offical pytorch example from facebook research:

Installation

MacOS (CPU)

  • Install conda
  • Set env by either:
    • Create conda enviornment: conda create --name <env> --file macOS_local_req.txt
    • Install into existing conda environment: conda install -n <env_name> macOS_local_req.txt

Commands:

Example to test the model ( stylize an image ) :

python3 src/stylize.py --image data/test/COCO_train2014_000000363111.jpg --model data/trained_models/mosaic_id5320.pth

To train a model from scratch

python3 src/trainer.py --data-dir data/training_data/ --style data/style/mosaic.jpeg

To train with checkpoints

python3 src/trainer.py --data-dir data/training_data/ --style data/style/mosaic.jpeg --save 1 --checkpoints-path data/dir_to_save

To retrain a model

python3 src/trainer.py --data-dir data/training_data/ --style data/style/mosaic.jpeg --retrain 1 --retrain-model data/trained_models/tree_to_retrain.pth

To visualize the losses

python3 src/visualize_losses.py

To see the different arguments of trainer.py:

python3 src/trainer.py

Perceptual Loss

Transformation Network Architecture

Network

VGG16 Architecture:

VGG16 Architecture

Results

Results

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published