caffe项目工程化封装FRCNN
各种坑!!想要做好,一定要自己一步步试,下载别人的总会出现各种问题.
步骤如下:(可以把这些文件打包在一个文件加下,分两个文件libs,include,一定要是自己的文件)
1 首先是配置caffe的VC++目录中的include和库文件。配置include lib dll都是坑,而且还分debug和release两个版本。添加输入项目需要注意,而且需要把编译好的caffe.lib等等一系列东西拷贝到当前项目下。也就是caffe bulid文件夹下面的东西,包括caffe.lib 、libcaffe.lib、还有很多dll.
这个是debug_include配置图
这个是debug_lib配置图
这个是release_include配置图
这个是release_lib配置图
同时也需要在,项目属性页的链接器输入中,填写相应的lib,其中debug和release是不同的。以下是需要填写的相应lib
//debug opencv_calib3d2413d.lib opencv_contrib2413d.lib opencv_core2413d.lib opencv_features2d2413d.lib opencv_flann2413d.lib opencv_gpu2413d.lib opencv_highgui2413d.lib opencv_imgproc2413d.lib opencv_legacy2413d.lib opencv_ml2413d.lib opencv_objdetect2413d.lib opencv_ts2413d.lib opencv_video2413d.lib caffe.lib libcaffe.lib cudart.lib cublas.lib curand.lib gflagsd.lib libglog.lib libopenblas.dll.a libprotobuf.lib leveldb.lib hdf5.lib hdf5_hl.lib Shlwapi.lib //release opencv_calib3d2410.lib opencv_contrib2410.lib opencv_core2410.lib opencv_features2d2410.lib opencv_flann2410.lib opencv_gpu2410.lib opencv_highgui2410.lib opencv_imgproc2410.lib opencv_legacy2410.lib opencv_ml2410.lib opencv_objdetect2410.lib opencv_ts2410.lib opencv_video2410.lib caffe.lib libcaffe.lib cudart.lib cublas.lib curand.lib gflags.lib libglog.lib libopenblas.dll.a libprotobuf.lib leveldb.lib lmdb.lib hdf5.lib hdf5_hl.lib Shlwapi.lib
3 直接编译后会出现的问题是F0519 14:54:12.494139 14504 layer_factory.hpp:77] Check failed: registry.count(t ype) == 1 (0 vs. 1) Unknown layer type: Input (known types: Input ),百度后发现是要加头文件!http://blog.csdn.net/fangjin_kl/article/details/50936952#0-tsina-1-63793-397232819ff9a47a7b7e80a40613cfe1
因此安装上面说的新建一个head.h
参考
1 #include<caffe/common.hpp> 2 #include<caffe/proto/caffe.pb.h> 3 #include<caffe/layers/batch_norm_layer.hpp> 4 #include<caffe/layers/bias_layer.hpp> 5 #include <caffe/layers/concat_layer.hpp> 6 #include <caffe/layers/conv_layer.hpp> 7 #include <caffe/layers/dropout_layer.hpp> 8 #include<caffe/layers/input_layer.hpp> 9 #include <caffe/layers/inner_product_layer.hpp> 10 #include "caffe/layers/lrn_layer.hpp" 11 #include <caffe/layers/pooling_layer.hpp> 12 #include <caffe/layers/relu_layer.hpp> 13 #include "caffe/layers/softmax_layer.hpp" 14 #include<caffe/layers/scale_layer.hpp> 15 namespace caffe 16 { 17 extern INSTANTIATE_CLASS(BatchNormLayer); 18 extern INSTANTIATE_CLASS(BiasLayer); 19 extern INSTANTIATE_CLASS(InputLayer); 20 extern INSTANTIATE_CLASS(InnerProductLayer); 21 extern INSTANTIATE_CLASS(DropoutLayer); 22 extern INSTANTIATE_CLASS(ConvolutionLayer); 23 REGISTER_LAYER_CLASS(Convolution); 24 extern INSTANTIATE_CLASS(ReLULayer); 25 REGISTER_LAYER_CLASS(ReLU); 26 extern INSTANTIATE_CLASS(PoolingLayer); 27 REGISTER_LAYER_CLASS(Pooling); 28 extern INSTANTIATE_CLASS(LRNLayer); 29 REGISTER_LAYER_CLASS(LRN); 30 extern INSTANTIATE_CLASS(SoftmaxLayer); 31 REGISTER_LAYER_CLASS(Softmax); 32 extern INSTANTIATE_CLASS(ScaleLayer); 33 extern INSTANTIATE_CLASS(ConcatLayer); 34 35 }
同时需要把
#include <caffe/proto/caffe.pb.h>
#include "head.h"
这两个头文件放到.cpp中,不要放.h里。
本文来自博客园,作者:NLazyo,转载请注明原文链接:https://www.cnblogs.com/bile/p/9168022.html