• 在进行segnet 编译与测试时出现的错误


    在进行segnet 编译与测试时出现的错误

    1.在执行sudo make all -j4的时候,出现了以下错误,报错提示说在caffe-segnet/src/caffe/layers的路径下的contrastive_loss_layer.cpp出错

    CXX src/caffe/layers/multinomial_logistic_loss_layer.cpp
    src/caffe/layers/contrastive_loss_layer.cpp: In instantiation of ‘void caffe::ContrastiveLossLayer<Dtype>::Forward_cpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = float]’:
    src/caffe/layers/contrastive_loss_layer.cpp:118:1:   required from here
    src/caffe/layers/contrastive_loss_layer.cpp:56:30: error: no matching function for call to ‘max(double, float)’
             Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), Dtype(0.0));
                                  ^
    In file included from /usr/include/c++/5/algorithm:61:0,
                     from src/caffe/layers/contrastive_loss_layer.cpp:1:
    /usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
         max(const _Tp& __a, const _Tp& __b)
         ^
    /usr/include/c++/5/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
    src/caffe/layers/contrastive_loss_layer.cpp:56:30: note:   deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘float’)
             Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), Dtype(0.0));
                                  ^
    In file included from /usr/include/c++/5/algorithm:61:0,
                     from src/caffe/layers/contrastive_loss_layer.cpp:1:
    /usr/include/c++/5/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
         max(const _Tp& __a, const _Tp& __b, _Compare __comp)
         ^
    /usr/include/c++/5/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
    src/caffe/layers/contrastive_loss_layer.cpp:56:30: note:   deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘float’)
             Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), Dtype(0.0));
                                  ^
    Makefile:526: recipe for target '.build_release/src/caffe/layers/contrastive_loss_layer.o' failed
    make: *** [.build_release/src/caffe/layers/contrastive_loss_layer.o] Error 1
    make: *** 正在等待未完成的任务....

    2.

    在执行sudo python ./Scripts/test_segmentation_camvid.py --model Models/segnet_basic_inference.prototxt --weights ./Example_Models/segnet_weights_driving_webdemo.caffemodel --iter 1的时候出现的错误:

    解决方案:

    安装需要用到的库:

    sudo apt-get install python-matplotlib
    sudo apt-get install python-scipy
    sudo apt-get install python-opencv
    sudo apt-get install python-protobuf
    wget https://bootstrap.pypa.io/get-pip.py  --no-check-certificate
    sudo python get-pip.py
    sudo pip install -U scikit-image

    3.后面又出现了这个错误:


    Traceback (most recent call last):
      File "./Scripts/test_segmentation_camvid.py", line 14, in <module>
        import caffe
    ImportError: No module named caffe

    解决方案:

    发现这里在配置caffe_root路径时少打了个/,正确的应该是'xxx/cafe-segnet/'

  • 相关阅读:
    学习《Spring 3.x 企业应用开发实战》Day-1
    java面试32问
    线程的同步和异步
    TCP和UDP的区别
    深入理解Spring系列之四:BeanDefinition装载前奏曲
    深入浅出JDK动态代理(一)
    和大牛之间的差距
    深入理解Spring系列之三:BeanFactory解析
    深入理解Spring系列之二:BeanDefinition解析
    深入理解Spring系列之一:开篇
  • 原文地址:https://www.cnblogs.com/bxtfdxg/p/14029659.html
Copyright © 2020-2023  润新知