LIFT: Learned Invariant Feature Points 环境配置

论文: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)

相关package在该链接可找到 (https://developer.nvidia.com/), 具体操作参考网上教程。

测试代码:

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代码。其实操作不难,主要是作者没有将所需版本阐述清楚,所以才留下这么多坑。只要一个版本不对,大量的报错让人无从下手。

有问题可私聊或者在下面留言!!

扫描二维码关注公众号,回复: 2183763 查看本文章

参考:https://blog.csdn.net/qq_36355662/article/details/80114260
https://blog.csdn.net/xdzhangzhenhao/article/details/79058963

猜你喜欢

转载自blog.csdn.net/hansry/article/details/80714786