An implementation of the texture generation algorithm proposed in Optimal Textures: Fast and Robust Texture Synthesis and Style Transfer through Optimal Transport.
python run.py scale.jpg decoder_states/scale/ -n 5
python run.py scale.jpg -c university.jpg decoder_states/scale/ -n 5
- 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 filedecoders.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]
- Python 3
- torch