示例#1
0
def run_dae():
    ########################################
    # Initialization things with arguments #
    ########################################
    config_root_logger()
    log.info("Creating a new DAE")

    mnist = MNIST()
    config = {
        "outdir": 'outputs/dae/mnist/',
        "input_size": 28 * 28,
        "tied_weights": True
    }
    dae = DenoisingAutoencoder(**config)

    # # Load initial weights and biases from file
    # params_to_load = 'dae_params.pkl'
    # dae.load_params(params_to_load)

    optimizer = AdaDelta(dae, mnist)
    optimizer.train()

    # Save some reconstruction output images
    import opendeep.data.dataset as datasets
    n_examples = 100
    test_xs, _ = mnist.getSubset(subset=datasets.TEST)
    test_xs = test_xs[:n_examples].eval()
    dae.create_reconstruction_image(test_xs)
示例#2
0
def run_dae():
    ########################################
    # Initialization things with arguments #
    ########################################
    config_root_logger()
    log.info("Creating a new DAE")

    mnist = MNIST()
    config = {
        "outdir": 'outputs/dae/mnist/',
        "input_size": 28*28,
        "tied_weights": True
    }
    dae = DenoisingAutoencoder(**config)

    # # Load initial weights and biases from file
    # params_to_load = 'dae_params.pkl'
    # dae.load_params(params_to_load)

    optimizer = AdaDelta(dae, mnist)
    optimizer.train()

    # Save some reconstruction output images
    import opendeep.data.dataset as datasets
    n_examples = 100
    test_xs, _ = mnist.getSubset(subset=datasets.TEST)
    test_xs = test_xs[:n_examples].eval()
    dae.create_reconstruction_image(test_xs)
示例#3
0
def run_dae():
    ########################################
    # Initialization things with arguments #
    ########################################
    config_root_logger()
    log.info("Creating a new DAE")

    mnist = MNIST()
    config = {
        "outdir": 'outputs/dae/mnist/',
        "input_size": 28 * 28,
        "tied_weights": True
    }
    dae = DenoisingAutoencoder(**config)

    # # Load initial weights and biases from file
    # params_to_load = 'dae_params.pkl'
    # dae.load_params(params_to_load)

    optimizer = AdaDelta(model=dae, dataset=mnist, epochs=100)
    optimizer.train()

    # Save some reconstruction output images
    n_examples = 100
    test_xs = mnist.test_inputs[:n_examples]
    dae.create_reconstruction_image(test_xs)

    del dae, mnist
示例#4
0
def run_dae():
    ########################################
    # Initialization things with arguments #
    ########################################
    config_root_logger()
    log.info("Creating a new DAE")

    mnist = MNIST()
    config = {
        "outdir": 'outputs/dae/mnist/',
        "input_size": 28*28,
        "tied_weights": True
    }
    dae = DenoisingAutoencoder(**config)

    # # Load initial weights and biases from file
    # params_to_load = 'dae_params.pkl'
    # dae.load_params(params_to_load)

    optimizer = AdaDelta(model=dae, dataset=mnist, epochs=100)
    optimizer.train()

    # Save some reconstruction output images
    n_examples = 100
    test_xs = mnist.test_inputs[:n_examples]
    dae.create_reconstruction_image(test_xs)

    del dae, mnist
示例#5
0
def run_dae():
    ########################################
    # Initialization things with arguments #
    ########################################
    config_root_logger()
    log.info("Creating a new DAE")

    mnist = MNIST()
    config = {"output_path": '../../../../outputs/dae/mnist/'}
    dae = DenoisingAutoencoder(config=config, dataset=mnist)

    # # Load initial weights and biases from file
    # params_to_load = 'dae_params.pkl'
    # dae.load_params(params_to_load)

    optimizer = AdaDelta(dae, mnist)
    optimizer.train()

    # Save some reconstruction output images
    import opendeep.data.dataset as datasets
    n_examples = 100
    test_xs = mnist.getDataByIndices(indices=range(n_examples), subset=datasets.TEST)
    dae.create_reconstruction_image(test_xs)