{"id":13936936,"url":"https://github.com/ericjang/draw","last_synced_at":"2025-04-05T09:06:31.198Z","repository":{"id":145006679,"uuid":"52287518","full_name":"ericjang/draw","owner":"ericjang","description":"TensorFlow Implementation of \"DRAW: A Recurrent Neural Network For Image Generation\"","archived":false,"fork":false,"pushed_at":"2018-08-07T08:13:15.000Z","size":1688,"stargazers_count":527,"open_issues_count":8,"forks_count":155,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-29T08:06:09.199Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericjang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-02-22T16:31:06.000Z","updated_at":"2025-03-23T23:11:42.000Z","dependencies_parsed_at":"2023-04-09T11:00:50.249Z","dependency_job_id":null,"html_url":"https://github.com/ericjang/draw","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/ericjang%2Fdraw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericjang%2Fdraw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericjang%2Fdraw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericjang%2Fdraw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericjang","download_url":"https://codeload.github.com/ericjang/draw/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312077,"owners_count":20918344,"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-08-07T23:03:08.076Z","updated_at":"2025-04-05T09:06:31.154Z","avatar_url":"https://github.com/ericjang.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# draw\n\nTensorFlow implementation of [DRAW: A Recurrent Neural Network For Image Generation](http://arxiv.org/pdf/1502.04623.pdf) on the MNIST generation task.\n\n| With Attention  | Without Attention |\n| ------------- | ------------- |\n| \u003cimg src=\"http://i.imgur.com/XfAkXPw.gif\" width=\"100%\"\u003e | \u003cimg src=\"http://i.imgur.com/qQUToOy.gif\" width=\"100%\"\u003e |\n\nAlthough open-source implementations of this paper already exist (see links below), this implementation focuses on simplicity and ease of understanding. I tried to make the code resemble the raw equations as closely as posible.\n\nFor a gentle walkthrough through the paper and implementation, see the writeup here: [http://blog.evjang.com/2016/06/understanding-and-implementing.html](http://blog.evjang.com/2016/06/understanding-and-implementing.html).\n\n## Usage\n\n`python draw.py --data_dir=/tmp/draw` downloads the binarized MNIST dataset to /tmp/draw/mnist and trains the DRAW model with attention enabled for both reading and writing. After training, output data is written to `/tmp/draw/draw_data.npy`\n\nYou can visualize the results by running the script `python plot_data.py \u003cprefix\u003e \u003coutput_data\u003e`\n\nFor example, \n\n`python myattn /tmp/draw/draw_data.npy`\n\nTo run training without attention, do:\n\n`python draw.py --working_dir=/tmp/draw --read_attn=False --write_attn=False`\n\n## Restoring from Pre-trained Model\n\nInstead of training from scratch, you can load pre-trained weights by uncommenting the following line in `draw.py` and editing the path to your checkpoint file as needed. Save electricity! \n\n```python\nsaver.restore(sess, \"/tmp/draw/drawmodel.ckpt\")\n```\n\nThis git repository contains the following pre-trained in the `data/` folder:\n\n| Filename  | Description |\n| ------------- | ------------- |\n| draw_data_attn.npy | Training outputs for DRAW with attention |\n| drawmodel_attn.ckpt | Saved weights for DRAW with attention |\n| draw_data_noattn.npy | Training outputs for DRAW without attention |\n| drawmodel_noattn.ckpt | Saved weights for DRAW without attention |\n\nThese were trained for 10000 iterations with minibatch size=100 on a GTX 970 GPU.\n\n## Useful Resources\n\n- https://github.com/vivanov879/draw\n- https://github.com/jbornschein/draw\n- https://github.com/ikostrikov/TensorFlow-VAE-GAN-DRAW (wish I had found this earlier)\n- [Video Lecture on Variational Autoencoders and Image Generation]( https://www.youtube.com/watch?v=P78QYjWh5sM\u0026list=PLE6Wd9FR--EfW8dtjAuPoTuPcqmOV53Fu\u0026index=3)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericjang%2Fdraw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericjang%2Fdraw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericjang%2Fdraw/lists"}