Giter VIP home page Giter VIP logo

interactive_style_transfer_from_two_images_pytorch's Introduction

Style Transfer

In this project, it was developed a method to transfer style from two different images onto a content image. Method allows for different weights to be assigned to each style image. Additionally, it was written an interactive widget tool to help with file selection, parameter tuning, and result visualization.

Installation

To use our Style Transfer project, you first need to install the necessary dependencies. The required packages and versions can be found in the environment.yml file. You can create a new conda environment and install the dependencies using the following commands:

conda env create -f environment.yml
conda activate <environment_name>

After activating the environment, navigate to the lib folder and run run_style_transfer.py to use the tool.

usage: run_style_transfer.py [-h] [--content_image CONTENT_IMAGE]
                             [--style_image1 STYLE_IMAGE1]
                             [--style_image2 STYLE_IMAGE2]
                             [--num_steps NUM_STEPS]
                             [--style_weight STYLE_WEIGHT]
                             [--content_weight CONTENT_WEIGHT] [--print PRINT]

Neural Style Transfer Parser

optional arguments:
  -h, --help            show this help message and exit
  --content_image CONTENT_IMAGE
                        number of optimization steps
  --style_image1 STYLE_IMAGE1
                        weight of style loss
  --style_image2 STYLE_IMAGE2
                        weight of content loss
  --num_steps NUM_STEPS
                        number of optimization steps
  --style_weight STYLE_WEIGHT
                        weight of style loss
  --content_weight CONTENT_WEIGHT
                        weight of content loss
  --print PRINT         printing of losses during training

To utilize the interactive widgets, please open the Demo.ipynb notebook within your installed conda environment and run all cells. Once you have run the script, ten images with their results will be generated in the results folder. Additionally, a plot of the loss values and a GIF file containing the results pictures will be created.

Examples

There were included several examples of style transfer. Specifically, examples of transferring styles from Pablo Picasso's Seated Nude and Edvard Munch's The Scream onto Leonardo da Vinci's Mona Lisa.``html

Seated Nude by Pablo Picasso
Style Transfered. Content weight 1
The Scream by Edvard Munch

The GIF with demonstration of interactive widget could be found by the link

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.