当前位置: 首页>>代码示例>>Python>>正文


Python layers.set_all_param_values方法代码示例

本文整理汇总了Python中lasagne.layers.set_all_param_values方法的典型用法代码示例。如果您正苦于以下问题:Python layers.set_all_param_values方法的具体用法?Python layers.set_all_param_values怎么用?Python layers.set_all_param_values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lasagne.layers的用法示例。


在下文中一共展示了layers.set_all_param_values方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: loadModel

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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!" 
开发者ID:kahst,项目名称:AcousticEventDetection,代码行数:18,代码来源:AED_train.py

示例2: loadPretrained

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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 ###################### 
开发者ID:kahst,项目名称:BirdCLEF-Baseline,代码行数:19,代码来源:lasagne_net.py

示例3: split_validation

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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; 
开发者ID:SBU-BMI,项目名称:u24_lymphocyte,代码行数:23,代码来源:deep_conv_classification_alt48_adeno_t1_heatmap.py

示例4: split_validation

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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; 
开发者ID:SBU-BMI,项目名称:u24_lymphocyte,代码行数:20,代码来源:deep_conv_classification_alt51_luad10_luad10in20_brca10x1_heatmap.py

示例5: split_validation

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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; 
开发者ID:SBU-BMI,项目名称:u24_lymphocyte,代码行数:18,代码来源:deep_conv_classification_lpatch_alt3.py

示例6: split_validation

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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; 
开发者ID:SBU-BMI,项目名称:u24_lymphocyte,代码行数:21,代码来源:deep_conv_classification_alt48_luad10_luad10in20_brca10x1_heatmap.py

示例7: split_validation

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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; 
开发者ID:SBU-BMI,项目名称:u24_lymphocyte,代码行数:18,代码来源:deep_conv_classification_lpatch_alt2.py

示例8: split_validation

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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; 
开发者ID:SBU-BMI,项目名称:u24_lymphocyte,代码行数:18,代码来源:deep_conv_classification_lpatch_alt1.py

示例9: split_validation

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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; 
开发者ID:SBU-BMI,项目名称:u24_lymphocyte,代码行数:18,代码来源:pred.py

示例10: loadParams

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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 
开发者ID:kahst,项目名称:BirdCLEF-Baseline,代码行数:13,代码来源:lasagne_io.py

示例11: loadParams

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
def loadParams(net, params):

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

    l.set_all_param_values(net, params)

    log.p('DONE!')
    
    return net 
开发者ID:kahst,项目名称:BirdNET,代码行数:11,代码来源:model.py

示例12: load_model

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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) 
开发者ID:MiuLab,项目名称:KB-InfoBot,代码行数:9,代码来源:agent_lu_rl.py

示例13: load_model

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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) 
开发者ID:MiuLab,项目名称:KB-InfoBot,代码行数:6,代码来源:agent_rl.py

示例14: split_validation

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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; 
开发者ID:SBU-BMI,项目名称:u24_lymphocyte,代码行数:16,代码来源:deep_conv_classification_alt48_luad10_skcm10_lr0_deploy.py

示例15: load_model

# 需要导入模块: from lasagne import layers [as 别名]
# 或者: from lasagne.layers import set_all_param_values [as 别名]
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) 
开发者ID:bdhingra,项目名称:ga-reader,代码行数:6,代码来源:GAReader.py


注:本文中的lasagne.layers.set_all_param_values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。