示例#1
0
        os.makedirs(init_w_path)

    rnd = np.random.RandomState(1231)
    nhid_l0 = 1025
    nhid_l1 = 512
    nhid_l2 = 64

    # Create the AE in 1
    nvis, nhid = w*h, nhid_l0
    path_ini_params_l0 = init_w_path + "dae_w_l0_init_" + str(nvis) + '_' +\
        str(nhid) + ".pkl"
    dae_l0 = DenoisingAutoencoder(input,
                                  nvis=nvis,
                                  nhid=nhid,
                                  L1_reg=0.,
                                  L2_reg=1e-2,
                                  rnd=rnd,
                                  nonlinearity=NonLinearity.SIGMOID,
                                  cost_type=CostType.MeanSquared,
                                  reverse=False,
                                  corruption_level=0.2)

    if not os.path.isfile(path_ini_params_l0):
        dae_l0.save_params(path_ini_params_l0)
    else:
        dae_l0.set_params_vals(path_ini_params_l0)

    # Create the AE in 2
    nvis, nhid = nhid_l0, nhid_l1
    path_ini_params_l1 = init_w_path + "dae_w_l1_init_" + str(nvis) + '_' +\
        str(nhid) + ".pkl"
    dae_l1 = DenoisingAutoencoder(dae_l0.encode((input)),
示例#2
0
    print len(id_deep_conv_ae_in), id_deep_conv_ae_in
    path_ini_params_deep_conv_ae_in = init_w_path +\
        "deep_conv_ae_init_" + id_deep_conv_ae_in + ".pkl"
    if not os.path.isfile(path_ini_params_deep_conv_ae_in):
        deep_conv_ae_in.save_params(path_ini_params_deep_conv_ae_in)
    else:
        deep_conv_ae_in.set_params_vals(path_ini_params_deep_conv_ae_in)
    # Create the AE in 1
    nvis, nhid = deep_conv_ae_in.encoder.output_size_flatten, nhid_l0
    path_ini_params_l0 = init_w_path + "dae_w_l0_init_" + str(nvis) + '_' +\
        str(nhid) + ".pkl"
    dae_l0 = DenoisingAutoencoder(deep_conv_ae_in.encoder.output.flatten(2),
                                  nvis=nvis,
                                  nhid=nhid,
                                  L1_reg=0.,
                                  L2_reg=0.,
                                  rnd=rnd,
                                  nonlinearity=NonLinearity.TANH,
                                  cost_type=CostType.MeanSquared,
                                  reverse=False,
                                  corruption_level=0.2)

    if not os.path.isfile(path_ini_params_l0):
        dae_l0.save_params(path_ini_params_l0)
    else:
        dae_l0.set_params_vals(path_ini_params_l0)

    # Create the AE in 2
#    nvis, nhid = nhid_l0, nhid_l1
#    path_ini_params_l1 = init_w_path + "dae_w_l1_init_" + str(nvis) + '_' +\
#        str(nhid) + ".pkl"
#    dae_l1 = DenoisingAutoencoder(dae_l0.encode(),