User friendly library to generate datasets using GANs and VAEs.
Paper supporting this library: Synthetic Data Generation To Better Perceive Classifier Predictions
Use git to install generate_datasets.
git clone https://github.com/Mr-Vicente/generate_datasets.git
from generate_datasets import data_access
from generate_datasets.WGAN_GP.wgan_gp_class_generic import WGAN_GP
EPOCHS = 500
OUTPUT_DIR = "imgs_gen"
params = {
'lr': 0.0001,
'beta1': 0,
'batch_size': 64,
'latent_dim': 128,
'image_size': 152
}
class_names = ['Blond-yellow','Yellow','Orange','Orange-Brown','Blond',
'Light-Brown','Brown','Black','Gray','White']
Number_Dataset_Classes = len(class_names)
gan = WGAN_GP(params)
gan.load_dataset(data_access.prepare_data('gan'),Number_Dataset_Classes)
gan.train_model(EPOCHS)
gan.generate_images(10,OUTPUT_DIR,class_names)
If no classifier is provided to GANs, the gan model will behave like a normal gan. The interest of one providing a classifier to our GAN model might be to better understand how it is operating, or even to generate images of a specific class.
from generate_datasets import data_access
from generate_datasets.VAE.generic_vannila_vae import VAE
from generate_datasets.Processing import process_cartoon
EPOCHS = 500
n_images = 10
OUTPUT_DIR = "imgs_gen"
params = {
'lr': 0.0001,
'beta1': 0,
'batch_size': 64,
'latent_dim': 128,
'image_size': 152
}
class_names = ['Blond-yellow','Yellow','Orange','Orange-Brown','Blond',
'Light-Brown','Brown','Black','Gray','White']
def load_cartoon_data():
images, labels = process_cartoon.decode_data_cartoon()
return images, labels
tf.keras.backend.clear_session()
model = VAE()
model.load_dataset(data_access.prepare_dataset('vae',load_cartoon_data(),image_size=(128,128)))
model.train_model(epochs)
model.generate_images(n_images,OUTPUT_DIR)
This library has several generative models at your despose:
- GAN (Generative Adversarial Network)
- Status: Working
- Paper: GAN
- Official Implementation: None
- VAE (Variational Autoencoder)
- Status: Working
- Paper: VAE
- Official Implementation: None
- WGAN (Wasserstein GAN)
- Status: Working
- Paper: WGAN
- Official Implementation: None
- WGAN-GP (Wasserstein GAN with Gradient Penalty)
- Status: Working
- Paper: WGAN-GP
- Official Implementation: None, but check this one WGAN-GP Implementation
- PGGAN (Progressive Growing GAN)
- Status: Not working
- Paper: PGGAN
- Official Implementation: PGGAN Implementation
- IntroVAE (Introspective Variational Autoencoder)
- Status: Not giving proper results
- Paper: IntroVAE
- Official Implementation: None
To learn more about these Generative models visit the referenced papers/implementations.
Epochs | Datasets | Original Images | WGAN-GP | VAE | IntroVAE |
---|---|---|---|---|---|
~20 | Fashion MNIST | ![]() |
![]() |
![]() |
- |
~200 | Cartoon Dataset | ![]() |
![]() |
![]() |
- |
~200 | Train Dataset | ![]() |
![]() |
- | ![]() |
~200 | LSUN Bedroom Dataset | ![]() |
![]() |
- | - |
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
On going!
Frederico Vicente & Ludwig Krippahl