def main(**kwargs): from types import SimpleNamespace _ = SimpleNamespace(**kwargs) loader = ImageLoader(_.folder) data = loader.setup(datalen=_.datalen) dcgan = DCGAN(loader.shape_x, loader.shape_y, loader.channels, data) dcgan.train(epochs=_.epochs, batch_size=_.batch_size, save_interval=50)
def __init__(self): self.img_rows = 256 self.img_cols = 256 self.channel = 3 # self.x_train = input_data.read_data_sets("mnist",\ # one_hot=True).train.images # self.x_train = self.x_train.reshape(-1, self.img_rows,\ # self.img_cols, 1).astype(np.float32) # self.x_train = self.x_train.reshape(-1, 28,\ # 28, 1).astype(np.float32) folder = 'C:/Users/lhrfxg/workspace/1902_fastai/datasets/codalab/' from image_loader import ImageLoader loader = ImageLoader(folder) data = loader.setup(datalen=100) self.x_train = np.array(data) self.DCGAN = DCGAN() self.discriminator = self.DCGAN.discriminator_model() self.adversarial = self.DCGAN.adversarial_model() self.generator = self.DCGAN.generator()