Coder Social home page Coder Social logo

pestjiang / scribe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from greydanus/scribe

0.0 0.0 0.0 20.77 MB

Realistic Handwriting with Tensorflow

Home Page: https://greydanus.github.io/2016/08/21/handwriting/

Python 1.22% OpenEdge ABL 4.90% Jupyter Notebook 93.88%

scribe's Introduction

Scribe: Realistic Handwriting in Tensorflow

See blog post

Samples

"A project by Sam Greydanus" Sample output 1 "You know nothing Jon Snow" (print) Sample output 2 "You know nothing Jon Snow" (cursive) Sample output 3

"lowering the bias" Sample output 4 "makes the writing messier" Sample output 5 "but more random" Sample output 6

Jupyter Notebooks

For an easy intro to the code (along with equations and explanations) check out these Jupyter notebooks:

Getting started

  • install dependencies (see below).
  • download the repo
  • navigate to the repo in bash
  • download and unzip folder containing pretrained models: Google Drive link
    • place in this directory

Now you have two options:

  1. Run the sampler in bash: mkdir -p ./logs/figures && python run.py --sample --tsteps 700
  2. Open the sample.ipynb jupyter notebook and run cell-by-cell (it includes equations and text to explain how the model works)

About

This model is trained on the IAM handwriting dataset and was inspired by the model described by the famous 2014 Alex Graves paper. It consists of a three-layer recurrent neural network (LSTM cells) with a Gaussian Mixture Density Network (MDN) cap on top. I have also implemented the attention mechanism from the paper which allows the network to 'focus' on character at a time in a sequence as it draws them.

The model at one time step looks like this

Rolled model

Unrolling in time, we get Unrolled model

I've implemented the attention mechanism from the paper: Attention mechanism

Dependencies

  • All code is written in python 2.7. You will need:
  • Numpy
  • Matplotlib
  • TensorFlow 1.0
  • OPTIONAL: Jupyter (if you want to run sample.ipynb and dataloader.ipynb)

scribe's People

Contributors

greydanus avatar dribnet 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.