Coder Social home page Coder Social logo

handwriting-synthesis-otuva's Introduction

Handwriting Synthesis (TFv2)

Original repo migrated to tensorflow v2 with better structure


Implementation of the handwriting synthesis experiments in the paper Generating Sequences with Recurrent Neural Networks by Alex Graves. The implementation closely follows the original paper, with a few slight deviations, and the generated samples are of similar quality to those presented in the paper.

Installation

git clone https://github.com/otuva/handwriting-synthesis
cd handwriting-synthesis
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

You can then run the demo as follows

python main.py

Usage

from handwriting_synthesis.hand import Hand

lines = [
    "Father time, I'm running late",
    "I'm winding down, I'm growing tired",
    "Seconds drift into the night",
    "The clock just ticks till my time expires",
]
biases = [.75 for _ in lines]
styles = [9 for _ in lines]
stroke_colors = ['red', 'green', 'black', 'blue']
stroke_widths = [1, 2, 1, 2]

hand = Hand()
hand.write(
    filename='img/usage_demo.svg',
    lines=lines,
    biases=biases,
    styles=styles,
    stroke_colors=stroke_colors,
    stroke_widths=stroke_widths
)

Demonstrations

Below are a few hundred samples from the model, including some samples demonstrating the effect of priming and biasing the model. Loosely speaking, biasing controls the neatness of the samples and priming controls the style of the samples. The code for these demonstrations can be found in main.py.

Demo #1:

The following samples were generated with a fixed style and fixed bias.

Smash Mouth – All Star (lyrics)

Demo #2

The following samples were generated with varying style and fixed bias. Each verse is generated in a different style.

Vanessa Carlton – A Thousand Miles ( lyrics)

Demo #3

The following samples were generated with a fixed style and varying bias. Each verse has a lower bias than the previous, with the last verse being unbiased.

Leonard Cohen – Hallelujah (lyrics)

Training

A pretrained model is included, but if you'd like to train your own, read these instructions

Contribute

All Pull Requests and packaging are welcome

You can take a look at the issues

If there aren't any, you can see TODO.md

If you are having a problem or have a feature request, feel free to open issue


This project was intended to serve as a reference implementation for a research paper, but since the results are of decent quality, it may be worthwile to make the project more broadly usable. I plan to continue focusing on the machine learning side of things. That said, I'd welcome contributors who can:

  • Package this, and otherwise make it look more like a usable software project and less like research code.
  • Add support for more sophisticated drawing, animations, or anything else in this direction. Currently, the project only creates some simple svg files.

handwriting-synthesis-otuva's People

Contributors

otuva avatar bryandam avatar netcarver 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.