# Adversarial autoencoders
<img src="https://raw.githubusercontent.com/Naresh1318/Adversarial_Autoencoder/master/README/nw_architecture.png" alt="Cover"/>
This repository contains code to implement adversarial autoencoder using Tensorflow.
Medium posts:
1. [A Wizard's guide to Adversarial Autoencoders: Part 1. Autoencoders?](https://medium.com/towards-data-science/a-wizards-guide-to-adversarial-autoencoders-part-1-autoencoder-d9a5f8795af4)
2. [A Wizard's guide to Adversarial Autoencoders: Part 2. Exploring the latent space with Adversarial Autoencoders.](https://medium.com/towards-data-science/a-wizards-guide-to-adversarial-autoencoders-part-2-exploring-latent-space-with-adversarial-2d53a6f8a4f9)
3. [A Wizard's guide to Adversarial Autoencoders: Part 3. Disentanglement of style and content.](https://medium.com/towards-data-science/a-wizards-guide-to-adversarial-autoencoders-part-3-disentanglement-of-style-and-content-89262973a4d7)
3. [A Wizard's guide to Adversarial Autoencoders: Part 4. Classify MNIST using 1000 labels.](https://medium.com/towards-data-science/a-wizards-guide-to-adversarial-autoencoders-part-4-classify-mnist-using-1000-labels-2ca08071f95)
## Installing the dependencies
Install virtualenv and creating a new virtual environment:
pip install virtualenv
virtualenv -p /usr/bin/python3 aa
Install dependencies
pip3 install -r requirements.txt
***Note:***
* *I'd highly recommend using your GPU during training.*
* *`tf.nn.sigmoid_cross_entropy_with_logits` has a `targets` parameter which
has been changed to `labels` for tensorflow version > r0.12.*
## Dataset
The MNIST dataset will be downloaded automatically and will be made available
in `./Data` directory.
## Training!
### Autoencoder:
#### Architecture:
To train a basic autoencoder run:
python3 autoencoder.py --train True
* This trains an autoencoder and saves the trained model once every epoch
in the `./Results/Autoencoder` directory.
To load the trained model and generate images passing inputs to the decoder run:
python3 autoencoder.py --train False
### Adversarial Autoencoder:
#### Architecture:
<img src="https://raw.githubusercontent.com/Naresh1318/Adversarial_Autoencoder/master/README/AAE%20Block%20Diagram.png" alt="Cover"/>
Training:
python3 adversarial_autoencoder.py --train True
Load model and explore the latent space:
python3 adversarial_autoencoder.py --train False
Example of adversarial autoencoder output when the encoder is constrained
to have a stddev of 5.
<img src="https://raw.githubusercontent.com/Naresh1318/Adversarial_Autoencoder/master/README/AAE%20dist%20match.png" alt="Cover"/>
**_Matching prior and posterior distributions._**
![Adversarial_autoencoder](https://raw.githubusercontent.com/Naresh1318/Adversarial_Autoencoder/master/README/adversarial_autoencoder_2.png)
**_Distribution of digits in the latent space._**
### Supervised Adversarial Autoencoder:
#### Architecture:
<img src="https://raw.githubusercontent.com/Naresh1318/Adversarial_Autoencoder/master/README/Supervised%20AAE.png" alt="Cover"/>
Training:
python3 supervised_adversarial_autoencoder.py --train True
Load model and explore the latent space:
python3 supervised_adversarial_autoencoder.py --train False
Example of disentanglement of style and content:
<img src="https://raw.githubusercontent.com/Naresh1318/Adversarial_Autoencoder/master/README/disentanglement%20of%20style%20and%20content.png" alt="Cover"/>
### Semi-Supervised Adversarial Autoencoder:
#### Architecture:
<img src="https://raw.githubusercontent.com/Naresh1318/Adversarial_Autoencoder/master/README/semi_AAE%20architecture.png" alt="Cover"/>
Training:
python3 semi_supervised_adversarial_autoencoder.py --train True
Load model and explore the latent space:
python3 semi_supervised_adversarial_autoencoder.py --train False
Classification accuracy for 1000 labeled images:
<img src="https://raw.githubusercontent.com/Naresh1318/Adversarial_Autoencoder/master/README/semi_aae_accuracy_with_NN.png" alt="Cover"/>
<img src="https://raw.githubusercontent.com/Naresh1318/Adversarial_Autoencoder/master/README/cat_n_gauss_dist_real_obtained.png" alt="Cover"/>
***Note:***
* Each run generates a required tensorboard files under `./Results/<model>/<time_stamp_and_parameters>/Tensorboard` directory.
* Use `tensorboard --logdir <tensorboard_dir>` to look at loss variations
and distributions of latent code.
* Windows gives an error when `:` is used during folder naming (this is produced during the folder creation for each run).I
would suggest you to remove the time stamp from `folder_name` variable in the `form_results()` function. Or, just dual boot linux!
## Thank You
Please share this repo if you find it helpful.
没有合适的资源?快使用搜索试试~ 我知道了~
对抗性自动编码器向导指南_Python_下载.zip
共46个文件
png:26个
gitkeep:6个
py:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 157 浏览量
2023-04-22
16:24:01
上传
评论
收藏 8.57MB ZIP 举报
温馨提示
对抗性自动编码器向导指南_Python_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
对抗性自动编码器向导指南_Python_下载.zip (46个子文件)
Adversarial_Autoencoder-master
semi_supervised_adversarial_autoencoder.py 17KB
README
semi_e_c.png 88KB
cover.png 449KB
aa_encoder_dist.png 155KB
nw_architecture.png 629KB
disentanglement of style and content.png 469KB
adversarial_autoencoder.png 1011KB
aa_real_dist.png 168KB
autoencoder_architecture.png 629KB
semi_aae_accuracy_with_NN.png 182KB
Supervised AAE.png 266KB
semi_9970.png 175KB
semi_r_c.png 73KB
adversarial_autoencoder_2.png 1007KB
semi_1000.png 167KB
grid_175450.png 209KB
AAE Block Diagram.png 253KB
semi_9960.png 165KB
cat_n_gauss_dist_real_obtained.png 755KB
supervised_autoencoder_100.png 184KB
semi_9980.png 303KB
AAE dist match.png 694KB
semi_AAE architecture.png 280KB
semi_e_g.png 169KB
grid_177650.png 200KB
semi_r_g.png 148KB
semi_9990.png 177KB
Results
Adversarial_Autoencoder
.gitkeep 0B
Autoencoder
.gitkeep 0B
Supervised
.gitkeep 0B
Semi_Supervised
.gitkeep 0B
Basic_NN_Classifier
.gitkeep 0B
.gitkeep 0B
_config.yml 26B
LICENSE 1KB
adversarial_autoencoder.py 11KB
.idea
Adversarial_Autoencoder.iml 456B
vcs.xml 180B
misc.xml 210B
inspectionProfiles
Project_Default.xml 744B
modules.xml 298B
autoencoder.py 8KB
supervised_adversarial_autoencoder.py 12KB
requirements.txt 53B
basic_nn_classifier.py 6KB
README.md 5KB
共 46 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功