【发布时间】:2014-02-26 06:06:09
【问题描述】:
我正在尝试将flann 与大 hdf5 文件(尺寸 1kk x 1k)一起使用。
但在 flann_example.cpp 中的功能全部失败
Matrix<float> dataset;
load_from_file(dataset, "carray.hdf5", "carray");
上线
dataset = flann::Matrix<T>(new T[dims_out[0]*dims_out[1]], dims_out[0], dims_out[1]);
因为它似乎想用new分配大内存块
我用的是2Gb的win32,有没有办法处理这么大的数据?
我也试过python
def using_pyflann():
N=10000*6 # for 100k x 1k don't work
dim=1000
type=np.int32 #int8 can't be used?
x = np.array(np.random.rand(N, dim)*10, dtype=type)
perm = np.random.permutation(N)
fl= FLANN()
fl.build_index(x)
pt= np.array(np.random.rand(1, dim)*10, dtype=type)
t0= time.time()
res, dist= fl.nn_index(pt)
print (time.time()-t0)
print res
print dist
print 'done'
【问题讨论】:
-
恐怕你得逐篇阅读。
标签: c++ hdf5 nearest-neighbor knn flann