===== ============ 配置 ================一,方法:微软caffe + 作者ssd版本的caffe 合并
1. 下载微软的caffe: https://github.com/Microsoft/caffe 。 下面简称caffe-microsoft
2. 下载作者ssd版本的caffe: https://github.com/weiliu89/caffe/tree/ssd 。 下面简称caffe-ssd
(注意作者的caffe有一个分支专门是ssd的)
二, 复制caffe-ssd下的部分文件到caffe-microsoft
1. 复制caffe-ssd下include、src、tools 文件夹,覆盖掉caffe-microsoft下面的文件夹。
三,打开caffe-microsoft 的Caffe.sln
1. caffe-microsoft\windows 下 复制一份CommonSettings.props.example到该路径下,并修改名字为CommonSettings.props。
2. 记事本打开CommonSettings.props 进行配置。(此步略,网上找个配置微软的caffe的教程,很多。根据自己需要配置:cpu还是gpu、支持还是不支持cudnn、需不需要matlab和python接口)
3. 用vs2013 打开Caffe.sln, 移出掉libcaffe项目中的cu、src、include文件下的子文件夹下的所有文件,再重新添加第二步提到的复制过来的ssd的源代码。
layers、solvers、util这样分好,看着清楚。(添加好后可以重启vs)
四,修改部分代码,编译libcaffe.lib(只针对gpu版本,cpu没配置过,应该差不多)
1. detection_output_layer.hpp 中注释掉 #include <boost/regex.hpp>
2. detection_output_layer.cpp 和 detection_output_layer.cu中注释掉boost::regex exp("\"(null|true|false|-?[0-9]+(\\.[0-9]+)?)\""); 和
//std::string rv = boost::regex_replace(ss.str(), exp, "$1");
// outfile << rv.substr(rv.find("["), rv.rfind("]") - rv.find("["))
// << std::endl << "]" << std::endl;
3. bbox_util.cpp 中 将snprintf 换成 _snprintf(两个处)。
bbox.cu 中注释掉 三个地方
1. //#include "thrust/functional.h"
2. //#include "thrust/sort.h"
3. // thrust::sort_by_key(&confidences[0], &confidences[0] + num_remain, &idx[0],
// thrust::greater<Dtype>());
4. common.cpp 中 改两处:
① 开头添加
#if defined(_MSC_VER)
#include <process.h>
#define getpid() _getpid()
#endif
::google::InstallFailureSignalHandler();
改成
#if !defined(_MSC_VER)
::google::InstallFailureSignalHandler();
#endif
5. hdf5.cpp 和 signal_handler.cpp 换成微软版本的signal_handler.cpp。
五, 切换到Realse, 编译生成libcaffe