コード例 #1
0
        testX, testY = func_utils.reshape_function_data(test_set)

        to_test_net = Net.Mlp(model_file=conf['model_path'], framework="keras")

    elif data_type == "Vectors_dataset":
        parameters, test_set = vect_utils.read_vector_data(conf['data_path'])
        gap = parameters.iloc[0]['gap']
        dim = None

        print('Puting the test data into the right shape...')
        testX, testY = vect_utils.reshape_vector_data(test_set)
        if net_type == "NOREC":
            to_test_net = Net.Convolution1D(model_file=conf['model_path'],
                                            framework="keras")
        else:
            to_test_net = Net.Lstm(model_file=conf['model_path'],
                                   framework="keras")

    else:  # data_type == "Frames_dataset
        sample_type = conf['data_path'].split('/')[-1]
        data_type = data_type + "_" + sample_type
        samples_dir = conf['data_path'].split('/')[5]
        dim = (int(samples_dir.split('_')[-2]),
               int(samples_dir.split('_')[-1]))
        if sample_type == "raw_samples":
            if net_type == "NOREC":
                print('Puting the test data into the right shape...')
                parameters, testX, testY = frame_utils.read_frame_data(
                    conf['data_path'], sample_type)
                to_test_net = Net.Convolution2D(model_file=conf['model_path'],
                                                framework="keras")
            else:
コード例 #2
0
        # Put the validation data into the right shape
        valX, valY = vect_utils.reshape_vector_data(val_set)

        train_data = [trainX, trainY]
        val_data = [valX, valY]

        # Model settings
        in_dim = trainX.shape[1:]
        out_dim = np.prod(in_dim[1:])
        if net_type == "NoRec":
            to_train_net = Net.Convolution1D(activation=activation, loss=loss, dropout=dropout,
                                             drop_percentage=drop_percentage, input_shape=in_dim,
                                             output_shape=out_dim, framework="keras")
        else:  # net_type == "Rec"
            to_train_net = Net.Lstm(activation=activation, loss=loss, dropout=dropout,
                                    drop_percentage=drop_percentage, input_shape=in_dim,
                                    output_shape=out_dim, data_type="Vector", framework="keras")

    else:  # data_type == 'Frames_dataset':
        print('Training with frames')
        data_model = conf['data_model']
        samples_dir = data_dir.split('/')[5]
        dim = (int(samples_dir.split('_')[-2]), int(samples_dir.split('_')[-1]))
        complexity = conf['complexity']

        # Load data
        channels = False
        if data_model == "raw":
            loss = conf['raw_frame_loss']

            print("Raw images")