Name: tensorflow-sketch-rnn-example
Owner: Google Cloud Platform
Description: null
Created: 2017-10-27 22:19:06.0
Updated: 2018-04-10 21:01:12.0
Pushed: 2017-10-27 23:37:51.0
Homepage: null
Size: 232
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Discrlaimer: This is not an official Google product.
This is an example application demonstraing how Sketch-RNN: A Generative Model for Vector Drawings can be used to create a sketch generation application.
First you launch a GCE instance with the following configuration.
You can leave other settings as default. Once the instance has started, log in to the guest OS using SSH and change the OS user to root.
do -i
All remaining operations should be done from the root user.
t-get update
t-get install -y build-essential python-pip unzip python-cairosvg git
p install ipython==5.5.0 rdp==0.8 svgwrite==1.1.6 tensorflow==1.3.0 Flask==0.12.2
p install magenta
dir -p /opt/sketch_demo/models
/opt/sketch_demo/models
rl -OL http://download.magenta.tensorflow.org/models/sketch_rnn.zip
zip sketch_rnn.zip
$HOME
t clone https://github.com/GoogleCloudPlatform/tensorflow-sketch-rnn-example.git
-a tensorflow-sketch-rnn-example/sketch_demo /opt/
/opt/sketch_demo/sketch_demo.service /etc/systemd/system/
This application provides a simple user authentication mechanism.
You can change the username and password by modifying the following
part in /opt/sketch_demo/auth_decorator.py
.
NAME = 'username'
WORD = 'passw0rd'
stemctl daemon-reload
stemctl enable sketch_demo
stemctl start sketch_demo
stemctl status sketch_demo
The last command outputs the application status, as in the following example:
etch_demo.service - Sketch-RNN demo
oaded: loaded (/etc/systemd/system/sketch_demo.service; enabled; vendor preset: enabled)
ctive: active (running) since Sat 2017-10-21 05:59:12 UTC; 10s ago
n PID: 2049 (start_app.sh)
Tasks: 10 (limit: 4915)
Group: /system.slice/sketch_demo.service
??2049 /bin/bash /opt/sketch_demo/start_app.sh
??2050 /usr/bin/python /opt/sketch_demo/backend.py -p 8081 -d /opt/sketch_demo/models/catbu
??2051 /usr/bin/python /opt/sketch_demo/backend.py -p 8082 -d /opt/sketch_demo/models/eleph
??2052 /usr/bin/python /opt/sketch_demo/backend.py -p 8083 -d /opt/sketch_demo/models/flami
??2053 /usr/bin/python /opt/sketch_demo/backend.py -p 8084 -d /opt/sketch_demo/models/owl/l
??2054 /usr/bin/python /opt/sketch_demo/app.py
21 05:59:17 sketch-demo start_app.sh[2049]: INFO:tensorflow:Input dropout mode = 0.
21 05:59:17 sketch-demo start_app.sh[2049]: INFO:tensorflow:Output dropout mode = 0.
21 05:59:17 sketch-demo start_app.sh[2049]: INFO:tensorflow:Recurrent dropout mode = 0.
21 05:59:17 sketch-demo start_app.sh[2049]: INFO:tensorflow:Input dropout mode = 0.
21 05:59:17 sketch-demo start_app.sh[2049]: INFO:tensorflow:Output dropout mode = 0.
21 05:59:17 sketch-demo start_app.sh[2049]: INFO:tensorflow:Recurrent dropout mode = 0.
21 05:59:17 sketch-demo start_app.sh[2049]: INFO:tensorflow:Model using gpu.
21 05:59:17 sketch-demo start_app.sh[2049]: INFO:tensorflow:Input dropout mode = 0.
21 05:59:17 sketch-demo start_app.sh[2049]: INFO:tensorflow:Output dropout mode = 0.
21 05:59:17 sketch-demo start_app.sh[2049]: INFO:tensorflow:Recurrent dropout mode = 0.
You have to wait around 60secs for the application to finish loading the pre-trained model graph. After that, you can access the instance's static IP address using a web browser. You draw a sample picture on the white canvas, and when you submit it, three children (emulated by a machine learning model) try to imitate your sample.
There are four classrooms and the machine learning model in each class is tranied with a different dataset. As a result, the children in each classroom tend to draw some specific objects such as cats and buses. You can choose the classroom from the buttons on the screen.