simplegan.datasets

The datasets subpackage allows users to load some standard datasets such MNIST, Cifar10 etc and also data from custom directory

MNIST Dataloader

class simplegan.datasets.load_mnist[source]

Loads the MNIST training data without labels - used in GANs

Parameters:None
Returns:a numpy array of shape (-1, 28, 28, 1)
class simplegan.datasets.load_mnist_AE[source]

Loads the MNIST training and testing data without labels - used in Autoencoder

Parameters:None
Returns:two numpy arrays of shape (-1, 28, 28, 1) each
class simplegan.datasets.load_mnist_with_labels[source]

Loads the MNIST train and test data along with labels and concatenates them - used in CGAN

Parameters:None
Returns:two numpy arrays, one of shape (-1, 28, 28, 1) which represents features and the other of shape (-1, 1) which represents labels

Cifar10 Dataloader

class simplegan.datasets.load_cifar10[source]

Loads the Cifar10 training data without labels - used in GANs

Parameters:None
Returns:a numpy array of shape (-1, 32, 32, 3)
class simplegan.datasets.load_cifar10_AE[source]

Loads the Cifar10 training and testing data without labels - used in Autoencoder

Parameters:None
Returns:two numpy arrays of shape (-1, 32, 32, 3) each
class simplegan.datasets.load_cifar10_with_labels[source]

Loads the Cifar10 train and test data along with labels and concatenates them - used in CGAN

Parameters:None
Returns:two numpy arrays, one of shape (-1, 32, 32, 3) which represents features and the other of shape (-1, 1) which represents labels

Cifar100 Dataloader

class simplegan.datasets.load_cifar100[source]

Loads the Cifar100 training data without labels - used in GANs

Parameters:None
Returns:a numpy array of shape (-1, 32, 32, 3)

LSUN Dataloader

class simplegan.datasets.load_lsun[source]

Loads the LSUN training data without labels - used in DCGAN

Parameters:
  • info (bool, optional) – to get info of the dataset loaded. Defaults to False
  • img_shape (int, tuple, optional) – shape of the image to be returned. Defaults to (64, 64)
Returns:

a numpy array of shape according to img_shape parameter

Custom Dataloader

class simplegan.datasets.load_custom_data[source]

Loads data from specified directory and returns a numpy array - used in GANs

Parameters:
  • datadir (str) – directory to load data from. Defaults to None
  • img_shape (int, tuple, optional) – shape of the image to be returned. Defaults to (64, 64)
Returns:

a numpy array of shape according to img_shape parameter

class simplegan.datasets.load_custom_data_AE[source]

Loads train and test data from a specified directory and returns a numpy array of train and test images - used in Autoencoder

Parameters:
  • datadir (str) – directory to load data from. Defaults to None
  • img_shape (int, tuple, optional) – shape of the image to be returned. Defaults to (64, 64)
Returns:

a numpy array of shape according to img_shape parameter

class simplegan.datasets.load_custom_data_with_labels[source]

Loads train with labels from a specified directory and returns a numpy array of train images and labels - used in CGAN

Parameters:
  • datadir (str) – directory to load data from. Defaults to None
  • img_shape (int, tuple, optional) – shape of the image to be returned. Defaults to (64, 64)
Returns:

a numpy array of shape according to img_shape parameter

Pix2Pix Dataloader

class simplegan.datasets.pix2pix_dataloader[source]

A dataloader class for Pix2Pix network

Parameters:
  • dataset_name (str, optional) – cityscapes edges2handbags edges2shoes facades maps. Defaults to None
  • img_width (int, optional) – width of the image. Defaults to 256
  • img_height (int, optional) – height of the image. Defaults to 256
  • datadir (str, optional) – Local directory to load data from. Defaults to None
load_dataset()[source]

Loads the data according to given parameters

Returns:tensorflow dataset object for training and testing data

CycleGAN Dataloader

class simplegan.datasets.cyclegan_dataloader[source]

A dataloader class for CycleGAN network

Parameters:
  • dataset_name (str, optional) – apple2orange summer2winter_yosemite horse2zebra monet2photo cezanne2photo
  • vangogh2photo maps cityscapes facades iphone2dslr_flower. Defaults to None (ukiyoe2photo) –
  • img_width (int, optional) – width of the image. Defaults to 256
  • img_height (int, optional) – height of the image. Defaults to 256
  • datadir (str, optional) – Local directory to load data from. Defaults to None
load_dataset()[source]

Loads the data according to given parameters

Returns:tensorflow dataset object for trainA trainB testA testB

Voxels Dataloader

class simplegan.datasets.load_vox_from_off[source]

A dataloader classes that loads .off files and renders them into voxels

Parameters:
  • datadir (str, optional) – Local directory to load data from. Defaults to None
  • side_length (int) – The rendered voxels are converted to a cube of dimension side_length. Defaults to 64
load_data()[source]

Load data from ModelNet10 if datadir is None or from local directory.

Returns:rendered voxels of shape (-1, side_length, side_length, side_length, 1)