Пример #1
0
 def batch_iterator(batch_size, k_samples, shuffle):
     return BatchIterator(batch_size=batch_size // 4,
                          prepare=prepare_valid,
                          k_samples=k_samples,
                          shuffle=shuffle,
                          fill_last_batch=False)
Пример #2
0
 def batch_iterator(batch_size, k_samples, shuffle):
     return BatchIterator(batch_size=batch_size,
                          prepare=prepare_train,
                          k_samples=k_samples,
                          shuffle=shuffle)
Пример #3
0
    if args.params:
        dump_file = args.params
        print("overwriting parameter dump file", os.path.basename(dump_file))

    # compile network
    net = model.build_model(batch_size=1)

    # initialize neural network
    my_net = Network(net, print_architecture=False)

    # load model parameters network
    my_net.load(dump_file)

    # init batch iterator
    bi = BatchIterator(batch_size=1,
                       k_samples=None,
                       shuffle=False,
                       prepare=model.prepare)

    # iterate samples for prediction
    print("Predicting on test set ...")
    prediction_stats = []
    y_true, y_probs, y_predicted = [], [], []
    for i, (X, y) in enumerate(bi(data[args.set])):
        print("Processing file %d / %d" % (i + 1, data[args.set].shape[0]),
              end='\r')
        sys.stdout.flush()

        X_orig = X.copy()

        # fix spectrogram lengths
        if args.min_len: