首页 技术 正文
技术 2022年11月14日
0 收藏 362 点赞 5,080 浏览 2848 个字

配置和运行 MatchNet CVPR 2015

GitHub: https://github.com/hanxf/matchnet

最近一个同学在配置,测试这个网络,但是总是遇到各种问题. 我也尝试了一下,结果也是一堆问题. 这里记录一下.

问题1.  ImportError: No module named leveldb

wangxiao@AHU:~/Downloads/matchnet-master$ ./run_gen_data.sh
Traceback (most recent call last):
File “generate_patch_db.py”, line 19, in <module>
import leveldb, numpy as np, skimage
ImportError: No module named leveldb
Traceback (most recent call last):
File “generate_patch_db.py”, line 19, in <module>
import leveldb, numpy as np, skimage
ImportError: No module named leveldb
Traceback (most recent call last):
File “generate_patch_db.py”, line 19, in <module>
import leveldb, numpy as np, skimage
ImportError: No module named leveldb

可以看到, 总是提示没有这个 leveldb . Ok, 没有就安装就是了:   

wangxiao@AHU:~$ pip install leveldb
Collecting leveldb
Downloading leveldb-0.194.tar.gz (228kB)
100% |████████████████████████████████| 235kB 13kB/s
Building wheels for collected packages: leveldb
Running setup.py bdist_wheel for leveldb … done
Stored in directory: /home/wangxiao/.cache/pip/wheels/36/8f/73/51df0d55dae7b540bc560eb223fff5f909033954552eae8d15
Successfully built leveldb
Installing collected packages: leveldb
Successfully installed leveldb-0.194

然后,这个问题就解决了.

但是, 新出了一个问题2: No module named caffe.proto 

wangxiao@AHU:~/Downloads/matchnet-master$ ./run_gen_data.sh
Traceback (most recent call last):
File “generate_patch_db.py”, line 21, in <module>
from caffe.proto import caffe_pb2
ImportError: No module named caffe.proto
Traceback (most recent call last):
File “generate_patch_db.py”, line 21, in <module>
from caffe.proto import caffe_pb2
ImportError: No module named caffe.proto
Traceback (most recent call last):
File “generate_patch_db.py”, line 21, in <module>
from caffe.proto import caffe_pb2
ImportError: No module named caffe.proto

Ok, 感觉其实, 这个工程代码没有提示 caffe 该放在哪个文件夹, 是麻烦的问题所在. 那么, 现在只有猜测了.

我们在编译 pycaffe 的时候, 终端有提示我们 caffe.proto 的位置 :

wangxiao@AHU:~/Downloads/matchnet-master/caffe-master$ make pycaffe
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
touch python/caffe/proto/__init__.py
PROTOC (python) src/caffe/proto/caffe.proto
wangxiao@AHU:~/Downloads/matchnet-master/caffe-master$

—- to be continued …

终于找到原因了: 是 caffe 文件夹放置的路径不对 !

我之前一直将 caffe 文件夹放置在下载的  match net 文件夹下, 如下图所示:

配置和运行 MatchNet CVPR 2015 MatchNet: Unifying Feature and Metric Learning for Patch-Based Matching

但是, 其实这样子是不对的. 应该将下载的代码放到 caffe 文件中, 或者你也可以将 caffe 中的文件 拷贝到 matchnet 文件中.

 然后运行

./run_gen_data.sh 就可以开始处理数据,然后运行了. 

Acturally, we also need to export path to the environments. like followings: 

  export PATH=/usr/local/cuda-8.0/bin:$PATH
  export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
  export PYTHONPATH=/home/wangxiao/Documents/Siamese_Matching/matchnet-master/python:$PYTHONPATH

with pre-processed data, and we can now test this code with evaluate scripts. 

  $ ./run_eval.sh liberty notredame “–use_gpu –gpu_id=0”

配置和运行 MatchNet CVPR 2015 MatchNet: Unifying Feature and Metric Learning for Patch-Based Matching

Reference:

@inproceedings{matchnet_cvpr_15,

  Author = {Han, Xufeng and Leung, Thomas and Jia, Yangqing and Sukthankar, Rahul and Berg, Alexander. C.},
Booktitle = {CVPR},
Title = {MatchNet: Unifying Feature and Metric Learning for Patch-Based Matching},
Year = {2015}
}

Compared with only test this code, we also want to know how to train/finetune the network on our own data ? 
But, how ???
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,492
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,493
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,132
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,295