prisma icon indicating copy to clipboard operation
prisma copied to clipboard

Prisma

prisma

Online fast neural style transfer

Requirements

  • Python 3+
  • Tensorflow 1.1.0+
  • Scipy
  • Flask
  • Flask-Mail
  • Celery
  • Redis

Setup

  • Dependencies
pip3 install numpy pillow scipy
pip3 install flask flask-mail celery redis
pip3 install tensorflow // for cpu
  • Download Models

http://pan.baidu.com/s/1pLPSXdx

mv models/ prisma/
  • Mailbox
default_config.py

MAIL_SERVER = 'xxxxx'
MAIL_PORT = xxx
MAIL_USERNAME = 'xxxxxx'
MAIL_PASSWORD = 'xxxxxx'
  • Run Redis
default_config.py

CELERY_BROKER_URL = 'redis://localhost:6379/0'
./redis-server
  • Run Celery
celery -A server.celery worker
  • Run Flask
python server.py

Training

  • Download COCO dataset and VGG19 model

VGG19 model

COCO dataset

  • Put the model and dataset into "prisma/"
# Recommend using tensorflow of gpu version
python3 train.py --STYLE_IMAGES style-image.jpg --CONTENT_WEIGHT 1.0 --STYLE_WEIGHT 10.0 --MODEL_PATH models/newmodel.ckpt

mv models/newmodel.ckpt-done models/newmodel.ckpt

# Test
python3 eval.py --CONTENT_IMAGE content-image.jpg --MODEL_PATH models/newmodel.ckpt --OUTPUT_FOLDER generate/
  • Add to Prisma
default_config.py

MODEL_FILES = set(['newmodel.ckpt', ......])

# Put a example image ("newmodel.jpg") into "static/models_image/"

Screenshot

http://localhost:5000/

Reference