コード例 #1
0
        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:
                print('Puting the test data into the right shape...')
                parameters, testX, testY = frame_utils.read_frame_data(
                    conf['data_path'], sample_type, True)
                to_test_net = Net.ConvolutionLstm(
                    model_file=conf['model_path'], framework="keras")
        else:
            parameters, testX, testY = frame_utils.read_frame_data(
                conf['data_path'], sample_type)
            if net_type == "NOREC":
                print('Puting the test data into the right shape...')
                to_test_net = Net.Mlp(model_file=conf['model_path'],
                                      framework="tensorflow")
            else:
                print('Puting the test data into the right shape...')
コード例 #2
0
                    in_dim = [images_per_sample, dim[0], dim[1], 1]
                else:
                    in_dim = [images_per_sample, dim[0], dim[1]]
            else:
                _, trainX, trainY = frame_utils.read_frame_data(data_dir + 'train/', 'raw_samples', channels)
                _, valX, valY = frame_utils.read_frame_data(data_dir + 'val/', 'raw_samples', channels)
                train_data = [trainX, trainY]
                val_data = [valX, valY]
                in_dim = trainX.shape[1:]

            out_dim = np.prod(in_dim[1:])

            # Model settings
            if net_type == "NoRec":
                to_train_net = Net.Convolution2D(activation=activation, loss=loss, dropout=dropout,
                                                 drop_percentage=drop_percentage, input_shape=in_dim,
                                                 output_shape=out_dim, complexity=complexity, framework="keras")
            else:
                to_train_net = Net.ConvolutionLstm(activation=activation, loss=loss, dropout=dropout,
                                                   drop_percentage=drop_percentage, input_shape=in_dim,
                                                   output_shape=out_dim, complexity=complexity, framework="keras")

        else:
            print("Modeled images")
            loss = conf['modeled_frame_loss']
            activation = conf['modeled_activation']
            dim = (int(samples_dir.split('_')[-2]), int(samples_dir.split('_')[-1]))
            filename = root + "_Modeled/" + complexity

            _, trainX, trainY = frame_utils.read_frame_data(data_dir + 'train/', 'modeled_samples')
            _, valX, valY = frame_utils.read_frame_data(data_dir + 'val/', 'modeled_samples')