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

简介: 配置和运行 MatchNet CVPR 2015 GitHub: https://github.com/hanxf/matchnet  最近一个同学在配置,测试这个网络,但是总是遇到各种问题.

 

配置和运行 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 文件夹下, 如下图所示:

 

 

    但是, 其实这样子是不对的. 应该将下载的代码放到 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" 


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 ???



























相关文章
|
10月前
|
机器学习/深度学习 自然语言处理 算法
【论文精读】ACL 2022:Graph Pre-training for AMR Parsing and Generation
【论文精读】ACL 2022:Graph Pre-training for AMR Parsing and Generation
|
2月前
|
算法 数据挖掘
文献解读-Prediction of axillary lymph node metastasis in triple-negative breast cancer by multi-omics analysis and an integrated model
研究旨在为三阴性乳腺癌患者提供更准确的腋窝淋巴结转移风险评估工具。研究者综合分析了临床病理信息、基因组和转录组数据,构建了一个多组学预测模型。
43 4
|
10月前
|
存储 JSON 算法
【论文代码】②.1 STIOCS: Active learning-based semi-supervised training framework for IOC extraction
【论文代码】②.1 STIOCS: Active learning-based semi-supervised training framework for IOC extraction
47 0
|
10月前
|
自然语言处理
【论文代码】① STIOCS: Active learning-based semi-supervised training framework for IOC extraction
【论文代码】① STIOCS: Active learning-based semi-supervised training framework for IOC extraction
62 0
|
机器学习/深度学习 移动开发 自然语言处理
DEPPN:Document-level Event Extraction via Parallel Prediction Networks 论文解读
当在整个文档中描述事件时,文档级事件抽取(DEE)是必不可少的。我们认为,句子级抽取器不适合DEE任务,其中事件论元总是分散在句子中
163 0
DEPPN:Document-level Event Extraction via Parallel Prediction Networks 论文解读
|
机器学习/深度学习 自然语言处理 算法
Joint Information Extraction with Cross-Task and Cross-Instance High-Order Modeling 论文解读
先前的信息抽取(IE)工作通常独立地预测不同的任务和实例(例如,事件触发词、实体、角色、关系),而忽略了它们的相互作用,导致模型效率低下。
115 0
|
机器学习/深度学习 自然语言处理 索引
GTEE-DYNPREF: Dynamic Prefix-Tuning for Generative Template-based Event Extraction 论文解读
我们以基于模板的条件生成的生成方式考虑事件抽取。尽管将事件抽取任务转换为带有提示的序列生成问题的趋势正在上升,但这些基于生成的方法存在两个重大挑战
177 0
PointNet++:Deep Hierarchical Feature Learning on Points Sets in a Metrci Space 学习笔记
PointNet++:Deep Hierarchical Feature Learning on Points Sets in a Metrci Space 学习笔记
98 0
|
机器学习/深度学习 算法 数据挖掘
【多标签文本分类】Improved Neural Network-based Multi-label Classification with Better Initialization ……
【多标签文本分类】Improved Neural Network-based Multi-label Classification with Better Initialization ……
175 0
【多标签文本分类】Improved Neural Network-based Multi-label Classification with Better Initialization ……
|
机器学习/深度学习 算法 搜索推荐
On the Unreasonable Effectiveness of Feature propagation in Learning on Graphs with Missing 论文阅读笔记
On the Unreasonable Effectiveness of Feature propagation in Learning on Graphs with Missing 论文阅读笔记
233 0
On the Unreasonable Effectiveness of Feature propagation in Learning on Graphs with Missing 论文阅读笔记