Exemplo n.º 1
0
def load_ground_truth(filename, file_format, dimension = 1000, nuse = 10000, offset = 0):
 
    (feature_vecs, actual_nuse) = yutils.load_vectors_fmt(filename, file_format, dimension, nuse, offset, verbose = True)
    feature_vecs = yael.ivec_to_numpy(feature_vecs, int(actual_nuse) * dimension)
    feature_vecs = feature_vecs.reshape((int(actual_nuse), dimension))

    return (feature_vecs, actual_nuse)
Exemplo n.º 2
0
def ivecs_read(filename):  
    (fvecs, n, d) = yael.ivecs_new_read(filename)
    if n == -1:
        raise IOError("could not read " + filename)
    elif n == 0: d = 0  
    ivecs = yael.ivec.acquirepointer(fvecs)
    # TODO find a way to avoid copy
    a = yael.ivec_to_numpy(fvecs, n * d)
    return a.reshape((n, d))
Exemplo n.º 3
0
def load_ground_truth(filename,
                      file_format,
                      dimension=1000,
                      nuse=10000,
                      offset=0):

    (feature_vecs, actual_nuse) = yutils.load_vectors_fmt(filename,
                                                          file_format,
                                                          dimension,
                                                          nuse,
                                                          offset,
                                                          verbose=True)
    feature_vecs = yael.ivec_to_numpy(feature_vecs,
                                      int(actual_nuse) * dimension)
    feature_vecs = feature_vecs.reshape((int(actual_nuse), dimension))

    return (feature_vecs, actual_nuse)