alexgkendall / caffe-segnet

Implementation of SegNet: A Deep Convolutional Encoder-Decoder Architecture for Semantic Pixel-Wise Labelling

Home Page:http://mi.eng.cam.ac.uk/projects/segnet/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build issue

matbs24 opened this issue · comments

I'm building caffe-segnet on ubuntu 17.10 in modalities CPU-only.

I have this error on terminal. Anyone can help me? I'm a beginner

CXX src/caffe/layer_factory.cpp
CXX src/caffe/common.cpp
CXX src/caffe/solver.cpp
CXX src/caffe/util/upgrade_proto.cpp
CXX src/caffe/util/io.cpp
CXX src/caffe/util/im2col.cpp
CXX src/caffe/util/cudnn.cpp
CXX src/caffe/util/insert_splits.cpp
CXX src/caffe/util/benchmark.cpp
CXX src/caffe/util/db.cpp
CXX src/caffe/util/math_functions.cpp
CXX src/caffe/blob.cpp
CXX src/caffe/syncedmem.cpp
CXX src/caffe/data_transformer.cpp
CXX src/caffe/internal_thread.cpp
CXX src/caffe/layers/deconv_layer.cpp
CXX src/caffe/layers/filter_layer.cpp
CXX src/caffe/layers/inner_product_layer.cpp
CXX src/caffe/layers/power_layer.cpp
CXX src/caffe/layers/loss_layer.cpp
CXX src/caffe/layers/silence_layer.cpp
CXX src/caffe/layers/infogain_loss_layer.cpp
CXX src/caffe/layers/relu_layer.cpp
CXX src/caffe/layers/cudnn_relu_layer.cpp
CXX src/caffe/layers/prelu_layer.cpp
CXX src/caffe/layers/concat_layer.cpp
CXX src/caffe/layers/cudnn_sigmoid_layer.cpp
CXX src/caffe/layers/hdf5_data_layer.cpp
CXX src/caffe/layers/hinge_loss_layer.cpp
CXX src/caffe/layers/memory_data_layer.cpp
CXX src/caffe/layers/conv_layer.cpp
CXX src/caffe/layers/sigmoid_layer.cpp
CXX src/caffe/layers/base_data_layer.cpp
CXX src/caffe/layers/dense_image_data_layer.cpp
CXX src/caffe/layers/data_layer.cpp
CXX src/caffe/layers/split_layer.cpp
CXX src/caffe/layers/exp_layer.cpp
CXX src/caffe/layers/cudnn_softmax_layer.cpp
CXX src/caffe/layers/sigmoid_cross_entropy_loss_layer.cpp
CXX src/caffe/layers/hdf5_output_layer.cpp
CXX src/caffe/layers/reshape_layer.cpp
CXX src/caffe/layers/accuracy_layer.cpp
CXX src/caffe/layers/cudnn_conv_layer.cpp
CXX src/caffe/layers/contrastive_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(float, double)’ Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), 0.0); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/algorithm:61:0, from src/caffe/layers/contrastive_loss_layer.cpp:1: /usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^~~
/usr/include/c++/7/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’ (‘float’ and ‘double’) Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), 0.0); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/algorithm:61:0, from src/caffe/layers/contrastive_loss_layer.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^~~
/usr/include/c++/7/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’ (‘float’ and ‘double’) Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), 0.0); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/algorithm:62:0, from src/caffe/layers/contrastive_loss_layer.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: template argument deduction/substitution failed:
src/caffe/layers/contrastive_loss_layer.cpp:56:30: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘float’ Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), 0.0); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/algorithm:62:0, from src/caffe/layers/contrastive_loss_layer.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: template argument deduction/substitution failed:
src/caffe/layers/contrastive_loss_layer.cpp:56:30: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘float’ Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), 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

How did you solve this problem?

this is the solution. It is a fix for CPU only:

#123

In my case, I had the gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)
So the updates they did to the project where causing similar problems.
CXX src/caffe/layers/contrastive_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

The way that worked for me was:
Doing the install with this version of segnet:
https://github.com/alexgkendall/caffe-segnet/tree/dba439804e7b65920ffc501098ad8c94650a494e

Or updating the gcc, from version 5 to 7. (:

@bermudezarii
I am also installing the same segnet that you have mentioned for solution but i still getting the same problem.
i have updated gcc from 5 to 7 but when i check the gcc version it still shows 5
i am installing this segnet on ubuntu16.04

plz help me
thank you in advance

When I had this problem, I didn't try changing the version, but that could be that you don't have that gcc like "default".
You could try installing the other segnet (as I did) or setting gcc 7 as default: https://askubuntu.com/questions/942784/install-gcc-7-1-on-xubuntu-16-04-and-make-it-default

Tell me then if you had the same problem.

@bermudezarii this ERROR is solved by Replacing Line no 56 of contrastive_loss_layer.cpp file
with this
Dtype dist = std::max(margin - (float)sqrt(dist_sq_.cpu_data()[i]), Dtype(0.0));
and make all done successfully
but a new ERROR raised while make runtest
I posted it on
#138
help me

@bermudezarii I am waiting for your response