コード例 #1
0
    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)),
                                  nvis=nhid_l0,
                                  nhid=nhid_l1,
                                  L1_reg=0.,
                                  L2_reg=1e-2,
                                  rnd=rnd,
                                  nonlinearity=NonLinearity.SIGMOID,
                                  cost_type=CostType.MeanSquared,
コード例 #2
0
    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(),
#                                  nvis=nhid_l0,
#                                  nhid=nhid_l1,
#                                  L1_reg=0.,
#                                  L2_reg=0.,
#                                  rnd=rnd,
#                                  nonlinearity=NonLinearity.TANH,
#                                  cost_type=CostType.MeanSquared,