示例#1
0
def getNNIndicesForBigFeatureMats(test_org,mats):
    
    test=ca.array(test_org);
    distances=[]
    
    for idx_mat,mat_curr in enumerate(mats):
        print idx_mat
        distances.append(nearest_neighbor.getSimpleDot(test,ca.array(mats[idx_mat]),gpuFlag=True));
    # print '';
    
    distances=np.hstack(tuple(distances));
    indices=np.argsort(distances,axis=1)[:,::-1].astype(np.uint32)        

    return indices
示例#2
0
def getNNIndicesForBigFeatureMats(test_org, mats):

    test = ca.array(test_org)
    distances = []

    for idx_mat, mat_curr in enumerate(mats):
        print idx_mat
        distances.append(
            nearest_neighbor.getSimpleDot(test,
                                          ca.array(mats[idx_mat]),
                                          gpuFlag=True))
    # print '';

    distances = np.hstack(tuple(distances))
    indices = np.argsort(distances, axis=1)[:, ::-1].astype(np.uint32)

    return indices
示例#3
0
def saveDotProduct((first_shot_path, second_shot_path, out_file, idx)):
    test = getGPUArray(first_shot_path)
    train = getGPUArray(second_shot_path)
    results = nearest_neighbor.getSimpleDot(test, train, gpuFlag=True)
    np.savez(out_file, results)
    return True
示例#4
0
def saveDotProduct((first_shot_path,second_shot_path,out_file,idx)):
    test = getGPUArray(first_shot_path);
    train = getGPUArray(second_shot_path);
    results = nearest_neighbor.getSimpleDot(test,train,gpuFlag=True)
    np.savez(out_file,results);
    return True