zoukankan      html  css  js  c++  java
  • 配置和运行 MatchNet CVPR 2015 MatchNet: Unifying Feature and Metric Learning for Patch-Based Matching

     

    配置和运行 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 ???



























  • 相关阅读:
    解决 iOS View Controller Push/Pop 时的黑影
    AFN发送请求失败
    cocoapods安装失败
    cocoapods 更新失败 bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)
    iOS开发: 向右滑动手势功能实现
    虚拟器运行iOS8地图提示错误
    unexpected nil window in _UIApplicationHandleEventFromQueueEvent...
    控制控制器只支持横/竖屏
    UIWebView执行JS语句
    Warning: Attempt to present * on * which is already presenting *
  • 原文地址:https://www.cnblogs.com/wangxiaocvpr/p/6323348.html
Copyright © 2011-2022 走看看