Metadata-Version: 2.4
Name: gan_face_generate
Version: 1.1.1
Summary: Generate a random face created by DCGAN trained with DigiFace1M database
Author-email: Chien Liu <chienliu6001@gmail.com>
License: Copyright (c) 2023, chien liu
        
        Permission is hereby granted, free of charge, to any person obtaining
        a copy of this software and associated documentation files (the
        "Software"), to deal in the Software without restriction, including
        without limitation the rights to use, copy, modify, merge, publish,
        distribute, sublicense, and/or sell copies of the Software, and to
        permit persons to whom the Software is furnished to do so, subject to
        the following conditions:
        
        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
        NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
        LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
        OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
        WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
Project-URL: Homepage, https://github.com/chien-liu/DCGAN-PyTorch
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: <3.13,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matplotlib>=3.8.0
Requires-Dist: numpy>=1.26.0
Requires-Dist: platformdirs>=4.3.8
Requires-Dist: requests>=2.32.4
Requires-Dist: torch>=2.1.0
Requires-Dist: torchvision>=0.16.0
Requires-Dist: tqdm>=4.67.1
Requires-Dist: wandb[media]>=0.20.1
Provides-Extra: dev
Requires-Dist: mypy==1.16.1; extra == "dev"
Requires-Dist: pandas-stubs>=2.0.0; extra == "dev"
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
Requires-Dist: pytest>=8.4.1; extra == "dev"
Requires-Dist: ruff==0.12.1; extra == "dev"
Requires-Dist: types-requests>=2.32; extra == "dev"
Dynamic: license-file

# DCGAN
Deep Convolutional Generative Adversarial Networks (DCGAN) is a class of generative adversarial networks (GAN) introduced by Radford et. al. in the paper [Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks](https://arxiv.org/pdf/1511.06434.pdf). The generator and discriminator of DCGAN are contructed of convolutional and convolutional-transpose layers.

## Usage
Install the package (Consider installing in a virtual environment)
```bash
pip install gan_face_generate
```

Create your own GAN-generated face
```bash
gan_face_generate
```

The package works with python >= 3.9, <3.12. Check [CI Result](https://github.com/chien-liu/DCGAN-PyTorch/actions/runs/7515301223)

## Dataset
[DigiFace-1M](https://github.com/microsoft/DigiFace1M) is a generated dataset for training face recognition models. The face images are high quality and thus are qualified to train a GAN network. There are two additional advantages of the dataset:

* Ethical considerations: The use of existing datasets that were collected from web images without explicit consent. In contrast, digital faces in DigiFace-1M are generated using a generative model constructed from high-quality head scans of a limited number of individuals obtained with consent.

* Data bias - DigiFace-1M is generated in a controlled pipeline, so that the racial distribution is guaranteed to be balance.

## Results
### Loss in Training Process
![](assets/training/loss.png)

### Generated Images compared with Dataset Images
![](assets/results/real_and_fake.png)

### Noise Arithmetic
![](assets/results/noise_arithmetic.png)



## Reference
* [PyTorch DCGAN TUTORIAL](https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html)
* [Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks](https://arxiv.org/pdf/1511.06434.pdf)
* [DigiFace-1M: 1 Million Digital Face Images for Face Recognition](https://github.com/microsoft/DigiFace1M)
