Git Product home page Git Product logo

perceptual-losses's Introduction

Style transfer using perceptual losses

Introduction

This project contains a notebook which explores Johnson et. al's (2016) Perceptual Losses for Real-Time Style Transfer and Super Resolution paper. Since it promises similar results as in Gatys et. al's (2015) A Neural Algorithm of Artistic Style paper in less time, I want to try it out for myself.

A closer look into this project can be found in my blog post.

How to run

The Jupyter notebook called perceptual_losses.ipynb can be opened. Note that the following frameworks must exist in your PIP or Anaconda environment:

  • PyTorch
  • NumPy
  • Python Imaging Library
  • tqdm

Dataset

In this project, I used COCO dataset's 2014 training images (83K/13GB). Download this dataset and update DATASET_PATH to the location of the dataset.

How to train the model

After downloading the dataset, run the notebook from top to bottom. Training the dataset after two epochs takes around four hours.

How to style any image

Find any input image and update TEST_IMAGE_PATH to the image's location. Note that there is already a pre-trained model. Running the following line of code:

load_model_checkpoint(image_transformation_network, optimizer, "style-transfer-alpha1e5-beta1e10-epoch-2")

will load the pre-trained model and invoke the subsequent lines to style the input image.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.