예제 #1
0
    # mandatory arguments
    train_data_spec = arguments['train_data']
    valid_data_spec = arguments['valid_data']
    conv_nnet_spec = arguments['conv_nnet_spec']
    nnet_spec = arguments['nnet_spec']
    wdir = arguments['wdir']

    # parse network configuration from arguments, and initialize data reading
    cfg = NetworkConfig()
    cfg.model_type = 'CNN'
    cfg.parse_config_cnn(arguments, '10:' + nnet_spec, conv_nnet_spec)
    cfg.init_data_reading(train_data_spec, valid_data_spec)

    if arguments.has_key('replicate'):
        cfg.replicate = int(arguments['replicate'])

    # parse pre-training options
    # pre-training files and layer number (how many layers are set to the pre-training parameters)
    ptr_layer_number = 0
    ptr_file = ''
    if arguments.has_key('ptr_file') and arguments.has_key('ptr_layer_number'):
        ptr_file = arguments['ptr_file']
        temp = arguments['ptr_layer_number'].split(':')

        if len(temp) > 1 or len(temp[0].split(',')) > 1:
            ptr_layer_number = [map(int, i.split(',')) for i in temp]
        else:
            ptr_layer_number = int(temp[0])

    # check working dir to see whether it's resuming training