help_ = "Number of training epochs"
    parser.add_argument("-e", "--epochs", help=help_, default=101, type=int)

    return parser.parse_args()


if __name__ == '__main__':

    # parse arguments
    args = parse_args()
    if args is None:
        exit()

    x_train, y_train = create_dataset(
        128, 128, nSlices=1000, resize=1,
        directory='FluidArt/')  # 3 channels = RGB
    assert (x_train.shape[0] > 0)

    x_train /= 255

    # plot results to make sure data looks good!
    fig, axs = plt.subplots(4, 4)
    for i in range(4):
        for j in range(4):
            axs[i, j].imshow(x_train[np.random.randint(x_train.shape[0])])
            axs[i, j].axis('off')
    plt.show()

    dcgan = DCGAN(img_rows=x_train[0].shape[0],
                  img_cols=x_train[0].shape[1],
Beispiel #2
0
    help_ = "Number of training epochs"
    parser.add_argument("-e", "--epochs", help=help_, default=101, type=int)

    return parser.parse_args()


if __name__ == '__main__':

    # parse arguments
    args = parse_args()
    if args is None:
        exit()

    x_train, y_train = create_dataset(
        64, 64, nSlices=20, resize=0.75,
        directory='SoapBubble/output/')  # 3 channels = RGB
    assert (x_train.shape[0] > 0)

    x_train /= 255

    stds = np.array(
        [np.std(x_train[i].mean(2)) for i in range(x_train.shape[0])])
    gmask = stds > np.percentile(stds, 25)

    x_train = x_train[gmask]

    # plot results to make sure data looks good!
    fig, axs = plt.subplots(10, 10)
    for i in range(10):
        for j in range(10):
Beispiel #3
0
from dcgan import DCGAN, create_dataset

def parse_args():
    parser = argparse.ArgumentParser()
    help_ = "Load h5 model trained weights"
    parser.add_argument("-w", "--weights", help=help_)

    help_ = "Number of training epochs"
    parser.add_argument("-e", "--epochs", help=help_, default=10 ,type=int)

    return parser.parse_args()

if __name__ == '__main__':

    # parse arguments
    args = parse_args()
    if args is None:
      exit()

    x_train, y_train = create_dataset(128,128, nSlices=150, resize=0.75, directory='space/') # 3 channels = RGB
    assert(x_train.shape[0]>0)

    x_train /= 255 

    dcgan = DCGAN(img_rows = x_train[0].shape[0],
                    img_cols = x_train[0].shape[1],
                    channels = x_train[0].shape[2], 
                    latent_dim=32,
                    name='nebula_32_128')
                    
    dcgan.train(x_train, epochs=args.epochs, batch_size=32, save_interval=100)
Beispiel #4
0
    help_ = "Number of training epochs"
    parser.add_argument("-e", "--epochs", help=help_, default=101, type=int)

    return parser.parse_args()


if __name__ == '__main__':

    # parse arguments
    args = parse_args()
    if args is None:
        exit()

    x_train, y_train = create_dataset(
        128, 128, nSlices=1000, resize=0.5,
        directory='Space/Galaxy/')  # 3 channels = RGB
    assert (x_train.shape[0] > 0)

    x_train /= 255

    # plot results to make sure data looks good!
    fig, axs = plt.subplots(4, 4)
    for i in range(4):
        for j in range(4):
            axs[i, j].imshow(x_train[np.random.randint(x_train.shape[0])])
            axs[i, j].axis('off')
    plt.show()

    dcgan = DCGAN(img_rows=x_train[0].shape[0],
                  img_cols=x_train[0].shape[1],