A TensorLayer implementation of Adversarial Feature Learning, which is also known as BiGAN.
- Python 3.7
- TensorFlow 2.0.0
- TensorLayer 2.1.1
We highly recommend you to install the packages above using Anaconda (or Miniconda).
conda create -n bigan python=3.7 tensorflow-gpuconda create -n bigan python=3.7 tensorflowconda activate bigan && pip install tensorlayerFirst, download the pre-trained weights from here.
Second, use the follow script to generate an images.
python eval.pyThis will ganerate 8x8 fake human faces and save the image to samples.png. For further evaluation usage, please read the code in eval.py and modify it as you like.
Clone this repository to your computer.
git clone https://github.com/YOUSIKI/BiGAN.TensorLayer.gitTo train a BiGAN network from nothing, please download CelebA Dataset from eigher Google Drive or Baidu Netdisk.
Here, I recommend you to download only Img/img_align_celeba.zip to save some time. Moreover, you may look for this dataset on other unofficial sites such as BYR.
After downloading the zip file, extract it to a fold such as data under the project directory. You can also extract it to other directories you like, but remember to modify DATA_PATH in data.py if you do so.
Next, use the follow script to train.
python train.pyThe training configurations can be found and modified in config.py.
If you want to train the network on your own dataset, please view every .py file and change them as your will.
For more sample images saved during training, check samples folder.
This project is mostly based on dcgan implementation of tensorlayer, you may find this repository useful while reviewing the code. Many thanks to its contributors (zsdonghao et al.)
We are just beginners of neural networks (and TensorLayer). There may be many mistakes in this project. Please contact us if you found. All issues and pull requests are welcomed.

