{"id":17139716,"url":"https://github.com/hwalsuklee/tensorflow-mnist-vae","last_synced_at":"2025-04-05T22:06:28.107Z","repository":{"id":110398806,"uuid":"85595055","full_name":"hwalsuklee/tensorflow-mnist-VAE","owner":"hwalsuklee","description":"Tensorflow implementation of variational auto-encoder for MNIST","archived":false,"fork":false,"pushed_at":"2017-04-11T07:08:25.000Z","size":383,"stargazers_count":495,"open_issues_count":6,"forks_count":182,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-29T21:04:30.899Z","etag":null,"topics":["autoencoder","dae","denoising-autoencoders","mnist","tensorflow","vae","variational-autoencoder"],"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/hwalsuklee.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-20T15:40:35.000Z","updated_at":"2025-03-21T13:16:14.000Z","dependencies_parsed_at":"2023-04-26T10:47:07.902Z","dependency_job_id":null,"html_url":"https://github.com/hwalsuklee/tensorflow-mnist-VAE","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/hwalsuklee%2Ftensorflow-mnist-VAE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwalsuklee%2Ftensorflow-mnist-VAE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwalsuklee%2Ftensorflow-mnist-VAE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hwalsuklee%2Ftensorflow-mnist-VAE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hwalsuklee","download_url":"https://codeload.github.com/hwalsuklee/tensorflow-mnist-VAE/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406087,"owners_count":20933803,"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":["autoencoder","dae","denoising-autoencoders","mnist","tensorflow","vae","variational-autoencoder"],"created_at":"2024-10-14T20:12:53.816Z","updated_at":"2025-04-05T22:06:28.079Z","avatar_url":"https://github.com/hwalsuklee.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Variational Auto-Encoder for MNIST\nAn implementation of variational auto-encoder (VAE) for MNIST descripbed in the paper:  \n* [Auto-Encoding Variational Bayes](https://arxiv.org/pdf/1312.6114) by Kingma et al.\n\n## Results\n### Reproduce\nWell trained VAE must be able to reproduce input image.  \nFigure 5 in the paper shows reproduce performance of learned generative models for different dimensionalities.  \nThe following results can be reproduced with command:  \n```\npython run_main.py --dim_z \u003ceach value\u003e --num_epochs 60\n``` \n\n\u003ctable align='center'\u003e\n\u003ctr align='center'\u003e\n\u003ctd\u003e Input image \u003c/td\u003e\n\u003ctd\u003e 2-D latent space \u003c/td\u003e\n\u003ctd\u003e 5-D latent space \u003c/td\u003e\n\u003ctd\u003e 10-D latent space \u003c/td\u003e\n\u003ctd\u003e 20-D latent space \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cimg src = 'results/input.jpg' height = '150px'\u003e\n\u003ctd\u003e\u003cimg src = 'results/dim_z_2.jpg' height = '150px'\u003e\n\u003ctd\u003e\u003cimg src = 'results/dim_z_5.jpg' height = '150px'\u003e\n\u003ctd\u003e\u003cimg src = 'results/dim_z_10.jpg' height = '150px'\u003e\n\u003ctd\u003e\u003cimg src = 'results/dim_z_20.jpg' height = '150px'\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n### Denoising\n\nWhen training, salt \u0026 pepper noise is added to input image, so that VAE can reduce noise and restore original input image.  \nThe following results can be reproduced with command:  \n```\npython run_main.py --dim_z 20 --add_noise True --num_epochs 40\n```\n\u003ctable align='center'\u003e\n\u003ctr align='center'\u003e\n\u003ctd\u003e Original input image \u003c/td\u003e\n\u003ctd\u003e Input image with noise \u003c/td\u003e\n\u003ctd\u003e Restored image via VAE \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cimg src = 'results/input.jpg' height = '300px'\u003e\n\u003ctd\u003e\u003cimg src = 'results/input_noise.jpg' height = '300px'\u003e\n\u003ctd\u003e\u003cimg src = 'results/denoising.jpg' height = '300px'\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n### Learned MNIST manifold\nVisualizations of learned data manifold for generative models with 2-dim. latent space are given in Figure. 4 in the paper.  \nThe following results can be reproduced with command:  \n```\npython run_main.py --dim_z 2 --num_epochs 60 --PMLR True\n```\n\u003ctable align='center'\u003e\n\u003ctr align='center'\u003e\n\u003ctd\u003e Learned MNIST manifold \u003c/td\u003e\n\u003ctd\u003e Distribution of labeled data  \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cimg src = 'results/PMLR.jpg' height = '400px'\u003e\n\u003ctd\u003e\u003cimg src = 'results/PMLR_map.jpg' height = '400px'\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Usage\n### Prerequisites\n1. Tensorflow\n2. Python packages : numpy, scipy, PIL(or Pillow), matplotlib\n\n### Command\n```\npython run_main.py --dim_z \u003clatent vector dimension\u003e\n```\n*Example*:\n`python run_main.py --dim_z 20`\n\n### Arguments\n*Required* :  \n* `--dim_z`: Dimension of latent vector. *Default*: `20`\n\n*Optional* :  \n* `--results_path`: File path of output images. *Default*: `results`\n* `--add_noise`: Boolean for adding salt \u0026 pepper noise to input image. *Default*: `False`\n* `--n_hidden`: Number of hidden units in MLP. *Default*: `500`\n* `--learn_rate`: Learning rate for Adam optimizer. *Default*: `1e-3`\n* `--num_epochs`: The number of epochs to run. *Default*: `20`\n* `--batch_size`: Batch size. *Default*: `128`\n* `--PRR`: Boolean for plot-reproduce-result. *Default*: `True`\n* `--PRR_n_img_x`: Number of images along x-axis. *Default*: `10`\n* `--PRR_n_img_y`: Number of images along y-axis. *Default*: `10`\n* `--PRR_resize_factor`: Resize factor for each displayed image. *Default*: `1.0`\n* `--PMLR`: Boolean for plot-manifold-learning-result. *Default*: `False`\n* `--PMLR_n_img_x`: Number of images along x-axis. *Default*: `20`\n* `--PMLR_n_img_y`: Number of images along y-axis. *Default*: `20`\n* `--PMLR_resize_factor`: Resize factor for each displayed image. *Default*: `1.0`\n* `--PMLR_n_samples`: Number of samples in order to get distribution of labeled data. *Default*: `5000`\n\n## References\nThe implementation is based on the projects:  \n[1] https://github.com/oduerr/dl_tutorial/tree/master/tensorflow/vae  \n[2] https://github.com/fastforwardlabs/vae-tf/tree/master  \n[3] https://github.com/kvfrans/variational-autoencoder  \n[4] https://github.com/altosaar/vae\n\n## Acknowledgements\nThis implementation has been tested with Tensorflow r0.12 on Windows 10.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhwalsuklee%2Ftensorflow-mnist-vae","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhwalsuklee%2Ftensorflow-mnist-vae","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhwalsuklee%2Ftensorflow-mnist-vae/lists"}