tjwei / Quick Neural Art Transfer
Labels
Projects that are alternatives of or similar to Quick Neural Art Transfer
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.
- Doing the transfer in pyramid manner to speed up and seems generating better results.
- Has an option to use ADAM as the optimizer.
- Use shared memory and can precompile theanot functions.
- 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/[email protected]/ color squares
CCB-BY-SA http://oilsoaked.deviantart.com/art/holiday-188505340?q=gallery%3ACreative-Commons%2F26171826&qo=373 Holidy