在编译用于训练openpose模型的caffe时,遇到了如下错误:
/usr/include/opencv2/contrib/contrib.hpp:561:42: error: ‘vector’ has not been declared
CV_OUT vector<vector<Point> >& results, CV_OUT vector<float>& cost,
^
/usr/include/opencv2/contrib/contrib.hpp:561:48: error: expected ‘,’ or ‘...’ before ‘<’ token
CV_OUT vector<vector<Point> >& results, CV_OUT vector<float>& cost,
^
/usr/include/opencv2/contrib/contrib.hpp:760:9: error: ‘vector’ does not name a type
vector<int> Rsr;
^
/usr/include/opencv2/contrib/contrib.hpp:761:9: error: ‘vector’ does not name a type
vector<int> Csr;
^
/usr/include/opencv2/contrib/contrib.hpp:762:9: error: ‘vector’ does not name a type
vector<double> Wsr;
^
/usr/include/opencv2/contrib/contrib.hpp:771:13: error: ‘vector’ does not name a type
vector<double> weights;
^
/usr/include/opencv2/contrib/contrib.hpp:777:9: error: ‘vector’ does not name a type
vector<kernel> w_ker_2D;
^
此处只列出一部分,但是总体来看就是说在一个contrib.hpp文件中没有声明vector等等的一堆东西。
解决方法:
解决方法很简单,将这个用于训练openpose模型的caffe源码中的包涵contrib.hpp文件的这一行注释掉:
例如你的这个出现问题的caffe的目录为:~/caffe-pose-train 则在该目录下:
vim src/caffe/cpm_data_transformer.cpp
然后将
#include <opencv2/contrib/contrib.hpp>
这一行注释掉,然后重新编译即可。