LIFT: Learned Invariant Feature Points 環境配置
阿新 • • 發佈:2019-01-11
論文:Kwang Moo Yi, Eduard Trulls, Vincent Lepetit, Pascal Fua, ” LIFT: Learned Invariant Feature Transform”, in ECCV 2016, https://arxiv.org/abs/1603.09114
LIFT github 程式碼: https://github.com/cvlab-epfl/LIFT
所需軟體及其正確版本: CUDA (8.0), cuDNN (5.1), python (2.7), theano (0.90), Lasagne (0.2.dev1), flufl.lock (2.4.1), 剩下的numpy, scipy, parse, h5py 版本沒有具體要求。同時需要強調的是,有要求的版本必須嚴格匹配。
一. 相關軟體包安裝
1.CUDA (8.0), cuDNN (5.1)
測試程式碼:
from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy
import time
vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
iters = 1000
rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX) )
f = function([], T.exp(x))
print(f.maker.fgraph.toposort())
t0 = time.time()
for i in range(iters):
r = f()
t1 = time.time()
print("Looping %d times took %f seconds" % (iters, t1 - t0))
print("Result is %s" % (r,))
if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]):
print ('Used the cpu')
else:
print('Used the gpu')
2.theano (0.90)
$ conda install theano=0.9
3.Lasagne (0.2.dev1)
$ conda install -c http://conda.anaconda.org/toli lasagne
4.flufl.lock (2.4.1)
$ pip install flufl.lock==2.4.1
二. 修改theano中少量程式碼
$ vim /home/hansry/anaconda2/envs/py27/lib/python2.7/site-packages/lasagne/layers/pool.py
將 from theano.tensor.signal import downsampled
改為 from theano.tensor.signal.pool import pool_2d
並將下文中出現 downsample.max_pool
改為 pool_2d
至此,可正常執行LIFT程式碼。其實操作不難,主要是作者沒有將所需版本闡述清楚,所以才留下這麼多坑。只要一個版本不對,大量的報錯讓人無從下手。
有問題可私聊或者在下面留言!!