Python lasagne.layers.set_all_param_values() Examples

The following are 30 code examples of lasagne.layers.set_all_param_values(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module lasagne.layers , or try the search function .
Example #1
Source File: deep_conv_classification_alt48_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, inds, coor = load_data();

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    A = get_aug_feas(X);
    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, _, Or, _ = val_fn_epoch(classn, val_fn, X, A, Y);
    Or_all = np.zeros(shape=(coor.shape[0],), dtype=np.float32);
    Or_all[inds] = Or[:, 0];

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or_all.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or_all[idx]));
    fid.close();

    return; 
Example #2
Source File: deep_conv_classification_alt48_adeno_prad_ucec_t1_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, inds, coor = load_data();

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    A = get_aug_feas(X);
    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, _, Or, _ = val_fn_epoch(classn, val_fn, X, A, Y);
    Or_all = np.zeros(shape=(coor.shape[0],), dtype=np.float32);
    Or_all[inds] = Or[:, 0];

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or_all.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or_all[idx]));
    fid.close();

    return; 
Example #3
Source File: deep_conv_classification_alt48_luad10_luad10in20_brca10x2_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, coor = load_data();

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    A = get_aug_feas(X);
    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X, A, Y);

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or[idx][0]));
    fid.close();

    return Pr, Or, Tr; 
Example #4
Source File: deep_conv_classification_lpatch_alt1.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn, valid_num):
    X_train, y_train, X_test, y_test = load_data(classn, valid_num);

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    layers.set_all_param_values(network, pickle.load(open('model_vals/deep_conv_classification_lpatch_alt1.py_e30_cv0.pkl', 'rb')));
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);

    a_train = get_aug_feas(X_train);
    a_test = get_aug_feas(X_test);
    #train_round(31,  network, valid_num, new_params_train_fn, val_fn, classn, X_train, a_train, y_train, X_test, a_test, y_test);
    LearningRate.set_value(np.float32(0.03*LearningRate.get_value()));
    train_round(240, network, valid_num, train_fn,            val_fn, classn, X_train, a_train, y_train, X_test, a_test, y_test);

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X_test, a_test, y_test);
    return Pr, Or, Tr; 
Example #5
Source File: deep_conv_classification_alt48_adeno_prad_t1_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, inds, coor = load_data();

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    A = get_aug_feas(X);
    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, _, Or, _ = val_fn_epoch(classn, val_fn, X, A, Y);
    Or_all = np.zeros(shape=(coor.shape[0],), dtype=np.float32);
    Or_all[inds] = Or[:, 0];

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or_all.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or_all[idx]));
    fid.close();

    return; 
Example #6
Source File: deep_conv_classification_alt51_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, coor = load_data();

    network, input_var, target_var = build_network_from_ae(classn);
    val_fn = make_training_functions(network, input_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X, Y);

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or[idx][0]));
    fid.close();

    return Pr, Or, Tr; 
Example #7
Source File: deep_conv_classification_lpatch_alt2.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn, valid_num):
    X_train, y_train, X_test, y_test = load_data(classn, valid_num);

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    layers.set_all_param_values(network, pickle.load(open('model_vals/deep_conv_classification_lpatch_alt2.py_e15_cv0.pkl', 'rb')));
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);

    a_train = get_aug_feas(X_train);
    a_test = get_aug_feas(X_test);
    #train_round(16,  network, valid_num, new_params_train_fn, val_fn, classn, X_train, a_train, y_train, X_test, a_test, y_test);
    LearningRate.set_value(np.float32(0.10*LearningRate.get_value()));
    train_round(240, network, valid_num, train_fn,            val_fn, classn, X_train, a_train, y_train, X_test, a_test, y_test);

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X_test, a_test, y_test);
    return Pr, Or, Tr; 
Example #8
Source File: deep_conv_classification_alt48_luad10_skcm10_lr0_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, inds, coor = load_data();

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    A = get_aug_feas(X);
    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, _, Or, _ = val_fn_epoch(classn, val_fn, X, A, Y);
    Or_all = np.zeros(shape=(coor.shape[0],), dtype=np.float32);
    Or_all[inds] = Or[:, 0];

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or_all.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or_all[idx]));
    fid.close();

    return; 
Example #9
Source File: deep_conv_classification_alt48_heatmap_only_melanoma.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, inds, coor = load_data();

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    A = get_aug_feas(X);
    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, _, Or, _ = val_fn_epoch(classn, val_fn, X, A, Y);
    Or_all = np.zeros(shape=(coor.shape[0],), dtype=np.float32);
    Or_all[inds] = Or[:, 0];

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or_all.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or_all[idx]));
    fid.close();

    return; 
Example #10
Source File: deep_conv_classification_alt48_luad10_luad10in20_brca10x1_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, coor = load_data();

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    A = get_aug_feas(X);
    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X, A, Y);

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or[idx][0]));
    fid.close();

    return Pr, Or, Tr; 
Example #11
Source File: deep_conv_classification_alt48_luad10_skcm10_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, coor = load_data();

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    A = get_aug_feas(X);
    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X, A, Y);

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or[idx][0]));
    fid.close();

    return Pr, Or, Tr; 
Example #12
Source File: deep_conv_classification_lpatch_alt3.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn, valid_num):
    X_train, y_train, X_test, y_test = load_data(classn, valid_num);

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    layers.set_all_param_values(network, pickle.load(open('model_vals/deep_conv_classification_lpatch_alt1.py_e10_cv0.pkl', 'rb')));
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);

    a_train = get_aug_feas(X_train);
    a_test = get_aug_feas(X_test);
    #train_round(31,  network, valid_num, new_params_train_fn, val_fn, classn, X_train, a_train, y_train, X_test, a_test, y_test);
    LearningRate.set_value(np.float32(0.03*LearningRate.get_value()));
    train_round(240, network, valid_num, train_fn,            val_fn, classn, X_train, a_train, y_train, X_test, a_test, y_test);

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X_test, a_test, y_test);
    return Pr, Or, Tr; 
Example #13
Source File: deep_conv_classification_alt48_adeno_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, inds, coor = load_data();

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    A = get_aug_feas(X);
    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, _, Or, _ = val_fn_epoch(classn, val_fn, X, A, Y);
    Or_all = np.zeros(shape=(coor.shape[0],), dtype=np.float32);
    Or_all[inds] = Or[:, 0];

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or_all.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or_all[idx]));
    fid.close();

    return; 
Example #14
Source File: pred.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    # Testing
    Or, inds, coor = val_fn_epoch_on_disk(classn, val_fn);
    Or_all = np.zeros(shape=(coor.shape[0],), dtype=np.float32);
    Or_all[inds] = Or[:, 0];

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or_all.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or_all[idx]));
    fid.close();

    return; 
Example #15
Source File: deep_conv_classification_alt51_luad10_luad10in20_brca10x2_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, coor = load_data();

    network, input_var, target_var = build_network_from_ae(classn);
    val_fn = make_training_functions(network, input_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X, Y);

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or[idx][0]));
    fid.close();

    return Pr, Or, Tr; 
Example #16
Source File: deep_conv_classification_alt51_luad10_luad10in20_brca10x1_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, coor = load_data();

    network, input_var, target_var = build_network_from_ae(classn);
    val_fn = make_training_functions(network, input_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X, Y);

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or[idx][0]));
    fid.close();

    return Pr, Or, Tr; 
Example #17
Source File: deep_conv_classification_alt48_adeno_t1_heatmap.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    X, inds, coor = load_data();

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    A = get_aug_feas(X);
    Y = np.zeros((X.shape[0], classn), dtype=np.int32);

    # Testing
    _, _, _, _, Or, _ = val_fn_epoch(classn, val_fn, X, A, Y);
    Or_all = np.zeros(shape=(coor.shape[0],), dtype=np.float32);
    Or_all[inds] = Or[:, 0];

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or_all.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or_all[idx]));
    fid.close();

    return; 
Example #18
Source File: pred.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def split_validation(classn):
    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);
    layers.set_all_param_values(network, pickle.load(open(CNNModel, 'rb')));

    # Testing
    Or, inds, coor = val_fn_epoch_on_disk(classn, val_fn);
    Or_all = np.zeros(shape=(coor.shape[0],), dtype=np.float32);
    Or_all[inds] = Or[:, 0];

    fid = open(TileFolder + '/' + heat_map_out, 'w');
    for idx in range(0, Or_all.shape[0]):
        fid.write('{} {} {}\n'.format(coor[idx][0], coor[idx][1], Or_all[idx]));
    fid.close();

    return; 
Example #19
Source File: lasagne_net.py    From BirdCLEF-Baseline with MIT License 6 votes vote down vote up
def loadPretrained(net):

    if cfg.MODEL_NAME:

        # Load saved model
        n, c = io.loadModel(cfg.MODEL_NAME)

        # Set params
        params = l.get_all_param_values(n)
        if cfg.LOAD_OUTPUT_LAYER:
            l.set_all_param_values(net, params)
        else:
            l.set_all_param_values(l.get_all_layers(net)[:-1], params[:-2])

    return net

#################### LOSS FUNCTION ###################### 
Example #20
Source File: AED_train.py    From AcousticEventDetection with MIT License 6 votes vote down vote up
def loadModel(filename):
    print "IMPORTING MODEL PARAMS...",
    net_filename = MODEL_PATH + filename

    with open(net_filename, 'rb') as f:
        data = pickle.load(f)

    #for training, we only want to load the model params
    net = data['net']
    params = l.get_all_param_values(net)
    if LOAD_OUTPUT_LAYER:
        l.set_all_param_values(NET, params)
    else:
        l.set_all_param_values(l.get_all_layers(NET)[:-1], params[:-2])    

    print "DONE!" 
Example #21
Source File: birdCLEF_train.py    From BirdCLEF2017 with MIT License 5 votes vote down vote up
def loadParams(epoch, filename=None):
    print "IMPORTING MODEL PARAMS...",
    if filename == None:
        net_filename = MODEL_PATH + "birdCLEF_" + RUN_NAME + "_model_params_epoch_" + str(epoch) + ".pkl"
    else:
        net_filename = MODEL_PATH + filename
    with open(net_filename, 'rb') as f:
        params = pickle.load(f)
    if LOAD_OUTPUT_LAYER:
        l.set_all_param_values(NET, params)
    else:
        l.set_all_param_values(l.get_all_layers(NET)[:-1], params[:-2])
    print "DONE!" 
Example #22
Source File: GAReader.py    From ga-reader with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def load_model(self, load_path):
        with open(load_path, 'r') as f:
            data = pickle.load(f)
        L.set_all_param_values(self.network, data) 
Example #23
Source File: birdCLEF_evaluate.py    From BirdCLEF2017 with MIT License 5 votes vote down vote up
def loadParams(epoch, filename=None):
    print "IMPORTING MODEL PARAMS...",
    net_filename = MODEL_PATH + filename
    with open(net_filename, 'rb') as f:
        params = pickle.load(f)
    if LOAD_OUTPUT_LAYER:
        l.set_all_param_values(NET, params)
    else:
        l.set_all_param_values(l.get_all_layers(NET)[:-1], params[:-2])
    print "DONE!"

################  PREDICTION SAVE/LOAD  ################## 
Example #24
Source File: birdCLEF_test.py    From BirdCLEF2017 with MIT License 5 votes vote down vote up
def loadParams(epoch, filename=None):
    print "IMPORTING MODEL PARAMS...",
    net_filename = MODEL_PATH + filename
    with open(net_filename, 'rb') as f:
        params = pickle.load(f)
    l.set_all_param_values(NET, params)
    print "DONE!"

#load params of trained model 
Example #25
Source File: deep_conv_classification_alt36_deploy.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def split_validation(classn, valid_num):
    X_train, y_train, X_test, y_test = load_data(classn, valid_num);

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);

    a_train = get_aug_feas(X_train);
    a_test = get_aug_feas(X_test);
    layers.set_all_param_values(network, pickle.load(open(model_dump + '_e{}_cv{}.pkl'.format(read_epoch, valid_num), 'rb')));

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X_test, a_test, y_test);
    save_visual_cases(X_test, Or, Tr);
    return Pr, Or, Tr; 
Example #26
Source File: deep_conv_classification_alt48_luad10_skcm10_lr0_deploy.py    From u24_lymphocyte with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def split_validation(classn, valid_num):
    X_train, y_train, X_test, y_test = load_data(classn, valid_num);

    network, new_params, input_var, aug_var, target_var = build_network_from_ae(classn);
    train_fn, new_params_train_fn, val_fn = make_training_functions(network, new_params, input_var, aug_var, target_var);

    a_train = get_aug_feas(X_train);
    a_test = get_aug_feas(X_test);
    layers.set_all_param_values(network, pickle.load(open(model_dump + '_e{}_cv{}.pkl'.format(read_epoch, valid_num), 'rb')));

    # Testing
    _, _, _, Pr, Or, Tr = val_fn_epoch(classn, val_fn, X_test, a_test, y_test);
    save_visual_cases(X_test, Or, Tr);
    return Pr, Or, Tr; 
Example #27
Source File: agent_rl.py    From KB-InfoBot with MIT License 5 votes vote down vote up
def load_model(self, load_path):
        with open(load_path, 'r') as f:
            data = pkl.load(f)
        L.set_all_param_values(self.network, data) 
Example #28
Source File: agent_lu_rl.py    From KB-InfoBot with MIT License 5 votes vote down vote up
def load_model(self, load_path):
        with open(load_path, 'r') as f:
            data = pkl.load(f)
            L.set_all_param_values(self.network, data)
            for item in self.trackers:
                data = pkl.load(f)
                L.set_all_param_values(item, data) 
Example #29
Source File: model.py    From BirdNET with MIT License 5 votes vote down vote up
def loadParams(net, params):

    log.p('IMPORTING MODEL PARAMS...', new_line=False)

    l.set_all_param_values(net, params)

    log.p('DONE!')
    
    return net 
Example #30
Source File: lasagne_io.py    From BirdCLEF-Baseline with MIT License 5 votes vote down vote up
def loadParams(net, params):

    log.i("IMPORTING MODEL PARAMS...", new_line=False)
    if cfg.LOAD_OUTPUT_LAYER:
        l.set_all_param_values(net, params)
    else:
        l.set_all_param_values(l.get_all_layers(net)[:-2], params[:-2])

    log.i("DONE!")
    
    return net