Giter Club home page Giter Club logo

quick-neural-art-transfer's Introduction

Quick-Neural-Art-Transfer

Theano/Lasagne based Neural artistic style transfer with Kivy GUI

based on https://github.com/Lasagne/Recipes/tree/master/examples/styletransfer an implementation of the algorithm described in "A Neural Algorithm of Artistic Style" (http://arxiv.org/abs/1508.06576) by Gatys, Ecker and Bethge.

use VGG19 model http://www.robots.ox.ac.uk/~vgg/research/very_deep/ ( wget https://s3.amazonaws.com/lasagne/recipes/pretrained/imagenet/vgg19_normalized.pkl to get the pickled file)

Several modification are made to speed up the process.

  1. Doing the transfer in pyramid manner to speed up and seems generating better results.
  2. Has an option to use ADAM as the optimizer.
  3. Use shared memory and can precompile theanot functions.
  4. Has a server and a Kivy GUI client, so you can capture image using a mobile device and the use the GPU on a remote machine. Usage:
import neuralStyle as ns
import cv2
ns.precompute() # compile theano functions
for x in ns.p_transfer("photo.jpg", "art.jpg"):
  cv2.imshow("output", x)

or you can use nstest.py photo.jpg art1.jpg art2.jpg art3.jpg to test it.

Demo program

The demo program with kivy UI is designed for an exhibition, which takes user's input from webcam and rendered it with a style.

The program expect an gpu of gtx 980 or better. To run this program, you will need a gpu at least as powerful as gtx 965m. If your gpu is slower, than you will need to chang zmq.RCVTIMEO to a larger value(more than 15 seconds) First run the server,

python nserver.py 

you will need to wait a while it for theano function to be compiled, it may take up to 2 minutes. Then you can run the kivy client. it requires a webcam and cv2 installed. Then you can run the client

python main.py

Currently, all messages are in Chinese.

content and styles Many image files are from https://github.com/jcjohnson/neural-style and some are public domain

CC-By http://agf81.deviantart.com/art/Ivy-Texture-7-326197006?q=gallery%3ACreative-Commons%2F26171837&qo=33 Ivy texture

CC-BY-SA http://maadmann.deviantart.com/art/Fullcolor-437966862?q=gallery%3ACreative-Commons%2F26171826&qo=88 fullcolor

CC-BY https://www.flickr.com/photos/fontplaydotcom/24795772945/in/pool-734017@N25/ color squares

CCB-BY-SA http://oilsoaked.deviantart.com/art/holiday-188505340?q=gallery%3ACreative-Commons%2F26171826&qo=373 Holidy

CC-BY https://www.flickr.com/photos/two/236883835/in/photolist-mW6j4-mW6kn-Jy6XP-Jy9fR-JxQD8-mW6gp-JxQGc-Jy5Xf-Jy3ES-mW6fr-Jy9eM-mW6hW-JxQqD-JxMdm-mW6nF-JxQtD-JxQxR-mW6mA-JxLZS-Jy72p-JxM2N-Jy3Hh-JxLU7-JxLWb-JxQsz-oH3ixB-4Nri37-JxQJr-JxQFe-Jy3AY-JxMcq-Jy3xG-JxQvT-Jy95i-Jy99n-JxQz2-a97MmE-JxQm6-Jy5V5-a97Nqb-a97PVu-Jy97c-a94ZyK-ADmwE6-B3g6KV-ADmtTV-BysQ61-a97Ptd-a94Zex-dwVdG ndhu

CC-BY https://www.flickr.com/photos/jphotos/5998521863/in/photolist-mW6gp-JxQGc-Jy5Xf-Jy3ES-mW6fr-Jy9eM-mW6hW-JxQqD-JxMdm-mW6nF-JxQtD-JxQxR-mW6mA-JxLZS-Jy72p-JxM2N-Jy3Hh-JxLU7-JxLWb-JxQsz-oH3ixB-4Nri37-JxQJr-JxQFe-Jy3AY-JxMcq-Jy3xG-JxQvT-Jy95i-Jy99n-JxQz2-a97MmE-JxQm6-Jy5V5-a97Nqb-a97PVu-Jy97c-a94ZyK-ADmwE6-B3g6KV-ADmtTV-BysQ61-a97Ptd-a94Zex-dwVdG-fJCm8H-ih4o2w-farbgP-ez8gpV-a244iL ndhu2

CC-BY https://www.flickr.com/photos/kurtbudiarto/7257851556/in/photolist-c4mopE-jZZkdx-8bohuZ-bjLvVe-c4wRru-gkp48t-hPNbbL-qfySJz-c84E3h-fBV6ve-aijVu7-fCaHPs-qZ7XnX-f8zn77-eQRUQ5-695MbG-dQNbTm-rowN34-6o4FFz-d3MjtL-9htwN2-r6Yib1-fCau8q-fCaCh9-551xgk-bkueEX-fBVtqt-pbJvac-fCbdY9-aRQ2oH-oUai6n-fCbaRs-fKzB9m-fCbmqA-7kBUGU-eX5Ce9-fBVu9x-ftqE1w-aihyDg-bku5n4-54rawt-nixm7H-dDjykx-55JGBX-c4mnWy-bkudkH-pRMC8L-55JGWa-5A9m5g-6uijiE/ smile face

quick-neural-art-transfer's People

Contributors

tjwei avatar

Watchers

John D. Pope avatar  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.