各類坑!!想要作好,必定要本身一步步試,下載別人的總會出現各類問題.api
步驟以下:(能夠把這些文件打包在一個文件加下,分兩個文件libs,include,必定要是本身的文件)ide
1 首先是配置caffe的VC++目錄中的include和庫文件。配置include lib dll都是坑,並且還分debug和release兩個版本。添加輸入項目須要注意,並且須要把編譯好的caffe.lib等等一系列東西拷貝到當前項目下。也就是caffe bulid文件夾下面的東西,包括caffe.lib 、libcaffe.lib、還有不少dll.ui
這個是debug_include配置圖spa
這個是debug_lib配置圖.net
這個是release_include配置圖debug
這個是release_lib配置圖3d
同時也須要在,項目屬性頁的連接器輸入中,填寫相應的lib,其中debug和release是不一樣的。如下是須要填寫的相應libcode
//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-397232819ff9a47a7b7e80a40613cfe1orm
所以安裝上面說的新建一個head.h blog
參考
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裏。