{"id":13454740,"url":"https://github.com/hardmaru/write-rnn-tensorflow","last_synced_at":"2025-04-13T16:36:28.363Z","repository":{"id":83994986,"uuid":"47870132","full_name":"hardmaru/write-rnn-tensorflow","owner":"hardmaru","description":"Generative Handwriting using LSTM Mixture Density Network with TensorFlow","archived":false,"fork":false,"pushed_at":"2018-02-10T08:17:23.000Z","size":55222,"stargazers_count":701,"open_issues_count":19,"forks_count":164,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-03-24T06:45:46.978Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hardmaru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-12-12T08:12:18.000Z","updated_at":"2025-03-21T16:05:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"3ebd00b5-1e70-4734-87ff-a9ff8ba5c949","html_url":"https://github.com/hardmaru/write-rnn-tensorflow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardmaru%2Fwrite-rnn-tensorflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardmaru%2Fwrite-rnn-tensorflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardmaru%2Fwrite-rnn-tensorflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardmaru%2Fwrite-rnn-tensorflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hardmaru","download_url":"https://codeload.github.com/hardmaru/write-rnn-tensorflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248745112,"owners_count":21155007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T08:00:57.524Z","updated_at":"2025-04-13T16:36:28.357Z","avatar_url":"https://github.com/hardmaru.png","language":"Python","funding_links":[],"categories":["Models/Projects","Python","模型项目"],"sub_categories":["微信群"],"readme":"\n## Generative Handwriting Demo using TensorFlow\n\n![example](https://cdn.rawgit.com/hardmaru/write-rnn-tensorflow/master/svg/example.svg)\n\n![example](https://cdn.rawgit.com/hardmaru/write-rnn-tensorflow/master/svg/many_examples.svg)\n\nAn attempt to implement the random handwriting generation portion of Alex Graves' [paper](http://arxiv.org/abs/1308.0850).\n\nSee my blog post at [blog.otoro.net](http://blog.otoro.net/2015/12/12/handwriting-generation-demo-in-tensorflow) for more information.\n\n### How to use\n\nI tested the implementation on TensorFlow r0.11 and Pyton 3.  I also used the following libraries to help:\n\n```\nsvgwrite\nIPython.display.SVG\nIPython.display.display\nxml.etree.ElementTree\nargparse\npickle\n```\n\n### Training\n\nYou will need permission from [these wonderful people](http://www.iam.unibe.ch/fki/databases/iam-on-line-handwriting-database) people to get the IAM On-Line Handwriting data.  Unzip `lineStrokes-all.tar.gz` into the data subdirectory, so that you end up with `data/lineStrokes/a01`, `data/lineStrokes/a02`, etc.  Afterwards, running `python train.py` will start the training process.\n\nA number of flags can be set for training if you wish to experiment with the parameters.  The default values are in `train.py`\n\n```\n--rnn_size RNN_SIZE             size of RNN hidden state\n--num_layers NUM_LAYERS         number of layers in the RNN\n--model MODEL                   rnn, gru, or lstm\n--batch_size BATCH_SIZE         minibatch size\n--seq_length SEQ_LENGTH         RNN sequence length\n--num_epochs NUM_EPOCHS         number of epochs\n--save_every SAVE_EVERY         save frequency\n--grad_clip GRAD_CLIP           clip gradients at this value\n--learning_rate LEARNING_RATE   learning rate\n--decay_rate DECAY_RATE         decay rate for rmsprop\n--num_mixture NUM_MIXTURE       number of gaussian mixtures\n--data_scale DATA_SCALE         factor to scale raw data down by\n--keep_prob KEEP_PROB           dropout keep probability\n```\n\n### Generating a Handwriting Sample\n\nI've included a pretrained model in `/save` so it should work out of the box.  Running `python sample.py --filename example_name --sample_length 1000` will generate 4 .svg files for each example, with 1000 points.\n\n### IPython interactive session.\n\nIf you wish to experiment with this code interactively, just run `%run -i sample.py` in an IPython console, and then the following code is an example on how to generate samples and show them inside IPython.\n\n```\n[strokes, params] = model.sample(sess, 800)\ndraw_strokes(strokes, factor=8, svg_filename = 'sample.normal.svg')\ndraw_strokes_random_color(strokes, factor=8, svg_filename = 'sample.color.svg')\ndraw_strokes_random_color(strokes, factor=8, per_stroke_mode = False, svg_filename = 'sample.multi_color.svg')\ndraw_strokes_eos_weighted(strokes, params, factor=8, svg_filename = 'sample.eos.svg')\ndraw_strokes_pdf(strokes, params, factor=8, svg_filename = 'sample.pdf.svg')\n\n```\n\n![example1a](https://cdn.rawgit.com/hardmaru/write-rnn-tensorflow/master/svg/example1.normal.svg)\n![example1b](https://cdn.rawgit.com/hardmaru/write-rnn-tensorflow/master/svg/example1.color.svg)\n![example1c](https://cdn.rawgit.com/hardmaru/write-rnn-tensorflow/master/svg/example1.multi_color.svg)\n![example1d](https://cdn.rawgit.com/hardmaru/write-rnn-tensorflow/master/svg/example1.eos_pdf.svg)\n![example1e](https://cdn.rawgit.com/hardmaru/write-rnn-tensorflow/master/svg/example1.pdf.svg)\n\nHave fun-\n\n## License\n\nMIT\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardmaru%2Fwrite-rnn-tensorflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhardmaru%2Fwrite-rnn-tensorflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardmaru%2Fwrite-rnn-tensorflow/lists"}