Giter Site home page Giter Site logo

fast-neural-style-keras-1's Introduction

This is a Keras implementation of Fast-Neural-Style (link)

Results



You could also use it to train a network combining two different styles. Here are some results:


These images are generated by combining two styles above.

How to use it

For training the network:

python main.py -c ./configs/[config_name] -m train

For predicting:

python main.py -c ./configs/[config_name] -m predict -i [image_read_path] -o [image_save_path]

For viewing the baseline: (link)

python main.py -c ./configs/[config_name] -m temp_view -i [image_read_path] -o [image_save_path] --iters [ITER]

The implementation of viewing base line is a little different from the original paper and shares the same loss net with training process, so you could use this temp_view function to adjust the hyperparameters.

For training the network, you should download COCO dataset first and unzip it to the train_image_path, which is specified in the config files.

Here is the explanation for parameters in config files:

  • "net_name": the name of your style transferring net. weights will be saved according to the name of the network;
  • "learning_rate": learning rate of the Adam optimizer. It is set to 1e-3, as recommended in the original paper;
  • "content_weight": the weight of content loss;
  • "style_weight": the weight of style loss;
  • "total_variation_weight": the weight of total variation loss;
  • "train_image_height" / "train_image_width": All of images in the training set will be resized to pre-defined height and width. It's set to 256/256 as recommended in the original paper;
  • "plot_model": If it's set to true, the program will use pyplot to plot the model and save the graph;
  • "content_layer": the layer for computing content loss. Please do not change it;
  • "style_layer": a list, specified the layer for computing style loss. Please do not change it;
  • "style_image_path": the path to style image;
  • "style_image_path_2": the path to another style image. If exists the program will get results by combining two different styles;
  • "test_image_path": the path to test image. You could use this option to validate the training process;
  • "test_res_save_path": All test results will be saved to this path.

Performance

It takes about 8 hours to train a network on a Nvidia K80 GPU. After training, predicting will be really fast and only use less than one second.

fast-neural-style-keras-1's People

Contributors

overflocat avatar

Watchers

 avatar

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.