adversarials package¶
Subpackages¶
Module contents¶
Adversarial package.
- @author
Victor I. Afolabi Artificial Intelligence Expert & Software Engineer. Email: javafolabi@gmail.com | victor.afolabi@zephyrtel.com GitHub: https://github.com/victor-iyiola
- @project
File: __init__.py Created on 20 December, 2018 @ 07:20 PM.
- @license
MIT License Copyright (c) 2018. Victor I. Afolabi. All rights reserved.
-
class
adversarials.
SimpleGAN
(size: Union[Tuple[int], int] = 28, channels: int = 1, batch_size: int = 32, **kwargs)¶ Bases:
adversarials.core.base.ModelBase
Simple Generative Adversarial Network.
- Methods:
def __init__(self, size: Union[Tuple[int], int]=28, channels: int=1, batch_size: int=32, **kwargs)
def train(self, X_train, epochs: int=10):
- def plot_images(self, samples: int=16, step:int=0):
# Plot generated images
- Attributes:
G (keras.model.Model): Generator model. D (keras.model.Model): Discriminator model. model (keras.model.Model): Combined G & D model. shape (Tuple[int]): Input image shape.
-
call
(n: int = 1, dim: int = 100)¶ Inference method. Given a random latent sample. Generate an image.
- Args:
- samples (int, optional): Defaults to 1. Number of images to
be generated.
dim (int, optional): Defaults to 100. Noise dimension.
- Returns:
np.ndarray: Array-like generated images.
-
property
model
¶ Stacked generator-discriminator model.
- Returns:
keras.model.Model: Combined G & D model.
-
plot_images
(samples=16, step=0)¶ Plot and generate images
samples (int, optional): Defaults to 16. Noise samples to generate. step (int, optional): Defaults to 0. Number of training step currently.
-
property
shape
¶ Input image shape.
- Returns:
Tuple[int]: image shape.
-
train
(X_train, epochs: int = 10)¶ Train function to be used after GAN initialization
X_train[np.array]: full set of images to be used