Coder Social home page Coder Social logo

mb-29 / optimal-textures Goto Github PK

View Code? Open in Web Editor NEW
26.0 1.0 3.0 2.81 MB

Optimal deep texture generation and style transfer based on Eric Risser's paper

License: MIT License

Python 100.00%
texture deep generation style transfer torch pytorch image computer vision vgg autoencoder encoder decoder texture-synthesis deep-learning vgg19 style-transfer pytorch-implementation

optimal-textures's Introduction

Optimal textures

An implementation of the texture generation algorithm proposed in Optimal Textures: Fast and Robust Texture Synthesis and Style Transfer through Optimal Transport.

Example

Texture generation

python run.py scale.jpg decoder_states/scale/ -n 5 

output

Style transfer

python run.py scale.jpg -c university.jpg decoder_states/scale/ -n 5 

output

Usage

  • In order to used pre-trained decoder weights, set up a directory containing .pth weight files with the form
Relu1_1_decoder_state.pth
Relu2_1_decoder_state.pth
Relu3_1_decoder_state.pth
Relu4_1_decoder_state.pth
Relu5_1_decoder_state.pth

If you want to train your decoders on your own image instead, this directory will be used to store the generated weights.

  • Set layer-specific parameters like the number of epoch and the learning rate for the decoders training phase, as well as iteration parameters in the dictionary observed_layers at the bottom of the file decoders.py.

  • Run the generation process with

python run.py path_to_source_image path_to_decoder_states_directory -o output_path -n n_passes [--train]
  • Run the style transfer process with
python run.py path_to_source_image path_to_decoder_states_directory -c path_to_content_image -s content_strength -o output_path -n n_passes [--train]

Requirements

  • Python 3
  • torch

optimal-textures's People

Contributors

mb-29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

optimal-textures's Issues

code is not complete?

Dear MB-29

I'm very interesting with this "optimal-textures", but it looks the code is not complete?

there is no "utils" module.

could you please complete the code? thanks!

output_value_hook

Traceback (most recent call last):
File "run.py", line 10, in
from style_transfer import StyleTransfer
File "/content/optimal-textures/style_transfer.py", line 5, in
from utils import output_value_hook, sliced_transport, image_preprocessing, vgg_normalization
ImportError: cannot import name 'output_value_hook' from 'utils' (/content/optimal-textures/utils.py)

Bad results

I used the WCT decoder, but the results were bad , like this
generated_texture

Why?

code issue

Relu1_1_decoder_state.pth
Relu2_1_decoder_state.pth
Relu3_1_decoder_state.pth
Relu4_1_decoder_state.pth
Relu5_1_decoder_state.pth
缺失训练权重吗?

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.