Open ericshijian opened 6 years ago
@ericshijian 请问你是怎么合并到Linux的呢?具体过程能不能讲一下? 多谢啦
@ericshijian 编译问题解决了吗?具体是什么错误?
你好,请问如何将代码整合到linux系统进行编译?好像这个问题,能否给出步骤?
有哪位大佬可以给出整合代码到linux系统中的具体步骤么?
我有整理好的代码,步骤没有记录,我今天放到百度盘上,然后我贴链接:http://pan.baidu.com/s/1o8mQBjW 密码:irzd
赞一个
CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: WARP_CTC_INCLUDE_DIR used as include directory in directory /data2/yk/ocr/caffe used as include directory in directory /data2/yk/ocr/caffe used as include directory in directory /data2/yk/ocr/caffe used as include directory in directory /data2/yk/ocr/caffe used as include directory in directory /data2/yk/ocr/caffe used as include directory in directory /data2/yk/ocr/caffe used as include directory in directory /data2/yk/ocr/caffe used as include directory in directory /data2/yk/ocr/caffe used as include directory in directory /data2/yk/ocr/caffe used as include directory in directory /data2/yk/ocr/caffe/src/gtest used as include directory in directory /data2/yk/ocr/caffe/src/gtest used as include directory in directory /data2/yk/ocr/caffe/src/gtest used as include directory in directory /data2/yk/ocr/caffe/src/gtest used as include directory in directory /data2/yk/ocr/caffe/src/gtest used as include directory in directory /data2/yk/ocr/caffe/src/gtest used as include directory in directory /data2/yk/ocr/caffe/src/gtest used as include directory in directory /data2/yk/ocr/caffe/src/caffe used as include directory in directory /data2/yk/ocr/caffe/src/caffe used as include directory in directory /data2/yk/ocr/caffe/src/caffe used as include directory in directory /data2/yk/ocr/caffe/src/caffe used as include directory in directory /data2/yk/ocr/caffe/src/caffe used as include directory in directory /data2/yk/ocr/caffe/src/caffe used as include directory in directory /data2/yk/ocr/caffe/src/caffe used as include directory in directory /data2/yk/ocr/caffe/src/caffe used as include directory in directory /data2/yk/ocr/caffe/src/caffe/test used as include directory in directory /data2/yk/ocr/caffe/src/caffe/test used as include directory in directory /data2/yk/ocr/caffe/src/caffe/test used as include directory in directory /data2/yk/ocr/caffe/src/caffe/test used as include directory in directory /data2/yk/ocr/caffe/src/caffe/test used as include directory in directory /data2/yk/ocr/caffe/src/caffe/test used as include directory in directory /data2/yk/ocr/caffe/src/caffe/test used as include directory in directory /data2/yk/ocr/caffe/src/caffe/test used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/tools used as include directory in directory /data2/yk/ocr/caffe/examples used as include directory in directory /data2/yk/ocr/caffe/examples used as include directory in directory /data2/yk/ocr/caffe/examples used as include directory in directory /data2/yk/ocr/caffe/examples used as include directory in directory /data2/yk/ocr/caffe/examples used as include directory in directory /data2/yk/ocr/caffe/examples used as include directory in directory /data2/yk/ocr/caffe/examples used as include directory in directory /data2/yk/ocr/caffe/examples used as include directory in directory /data2/yk/ocr/caffe/examples used as include directory in directory /data2/yk/ocr/caffe/examples used as include directory in directory /data2/yk/ocr/caffe/python used as include directory in directory /data2/yk/ocr/caffe/python used as include directory in directory /data2/yk/ocr/caffe/python used as include directory in directory /data2/yk/ocr/caffe/python used as include directory in directory /data2/yk/ocr/caffe/python used as include directory in directory /data2/yk/ocr/caffe/python used as include directory in directory /data2/yk/ocr/caffe/python used as include directory in directory /data2/yk/ocr/caffe/matlab used as include directory in directory /data2/yk/ocr/caffe/matlab used as include directory in directory /data2/yk/ocr/caffe/matlab used as include directory in directory /data2/yk/ocr/caffe/matlab used as include directory in directory /data2/yk/ocr/caffe/matlab used as include directory in directory /data2/yk/ocr/caffe/matlab used as include directory in directory /data2/yk/ocr/caffe/docs used as include directory in directory /data2/yk/ocr/caffe/docs used as include directory in directory /data2/yk/ocr/caffe/docs used as include directory in directory /data2/yk/ocr/caffe/docs used as include directory in directory /data2/yk/ocr/caffe/docs used as include directory in directory /data2/yk/ocr/caffe/docs
-- Configuring incomplete, errors occurred! See also "/data2/yk/ocr/caffe/build/CMakeFiles/CMakeOutput.log". See also "/data2/yk/ocr/caffe/build/CMakeFiles/CMakeError.log". 请问这是怎么回事?是没找到wrapctc的目录么
我改动了CTC的代码如下: 在cpu_ctc.h及cpu_ctc.cuh中使用 \caffe_win2linux\caffe_ocr-master\include\detail\cpu_ctc.h第8行要添加
从日志文件看,您使用了GPU,请先确认您是否链接openmp的库吧,然后将#define CTC_DISABLE_OMP删除再做尝试,
@zhousteven 貌似你这个Linux版本的改动CPU-ONLY的不止一处啊,我看了看代码,error: no matching function for call to ‘caffe::DenseBlockLayer
@zhousteven 头文件声明的reshap_gpu_data的和cpp文件里面调用和相应实现的参数个数不一致,不知道怎么编译通过的?
candidate expects 4 arguments, 6 provided
src/caffe/layers/DenseBlock_layer.cpp: In instantiation of ‘void caffe::DenseBlockLayer
@zhousteven 看了作者提供的源代码,hpp文件定义的reshape_gpu_data的hpp文件里面是6个参数,你这改的有点太离谱了吧
@zhousteven ,傻帽?你放的是啥源码?明明是caffe原本的好不好。
@FLHonker 这个caffe还编译不过
@berli ,绝对是唬人的
我现在编译好了。其实就是添加几个层,另外就是编译warp-ctc时将动态库给链接一下就好了。 @ericshijian
@JackLongKing 怎么解决的,能分享下么
1.如果不加warp-ctc的话,相对比较容易。步骤如下:(1)将对应的.hpp,.cpp,.cu放入对应的位置(src/caffe/layers(.hpp),include/caffe/layers(.cpp,.cu));(2)修改src/caffe/proto/caffe.proto,在message LayerParameter数据结构中添加对应的信息。下面是我添加的层的相关信息(注意数字不能与现有层冲突)。
_optional DenseBlockParameter denseblock_param = 147; optional LSTMParameter lstm_param = 148; //lstm of junhyuk optional ReverseParameter reverse_param = 149; optional ReverseTimeParameter reverse_time_param = 150; optional TransposeParameter transpose_param=151; optional CtcDecoderParameter ctc_decoder_param = 152; optional WarpCtcLossParameter warp_ctc_loss_param = 153; // for warpctc loss
然后在caffe.proto最后面加入相关层对应的结构,即message。如下
message DenseBlockParameter { //if you don't use BC, BN-ReLU-Conv3 is one transition //if you use BC, then BN-ReLU-Conv1-BN-ReLU-Conv3 is one transition optional int32 numTransition = 1 [default = 40]; optional int32 initChannel = 2 [default = 16]; optional int32 growthRate = 3 [default = 12]; //Convolution related parameters optional int32 pad_h = 4 [default = 1]; optional int32 pad_w = 5 [default = 1]; optional int32 conv_verticalStride = 6 [default = 1]; optional int32 conv_horizentalStride = 7 [default = 1]; optional int32 filter_H = 8 [default = 3]; optional int32 filter_W = 9 [default = 3]; optional FillerParameter Filter_Filler = 10; //BN related parameters optional FillerParameter BN_Scaler_Filler = 11; optional FillerParameter BN_Bias_Filler = 12; //Performance Related parameters optional int32 gpuIdx = 15 [default = 0]; //Dropout related parameter optional bool use_dropout = 16 [default = false]; optional float dropout_amount = 17 [default = 0]; optional bool use_BC = 18 [default = false]; //If it is not ultra space efficient, then it stores output data of conv1 optional bool BC_ultra_space_efficient = 19 [default = false]; optional int32 workspace_MB = 20 [default = 8]; optional float moving_average_fraction = 21 [default = 0.1]; }
message LSTMParameter { optional uint32 num_output = 1; // The number of outputs for the layer optional float clipping_threshold = 2 [default = 0.0]; optional FillerParameter weight_filler = 3; // The filler for weight optional FillerParameter bias_filler = 4; // The filler for the bias optional uint32 batch_size = 5 [default = 1]; }
message ReverseParameter { // axis controls the data axis which shall be inverted. // The layout of the content will not be inverted // // The default axis is 0 that means: // data_previous[n] == data_afterwards[N - n -1] // where N is the shape of axis(n) // // Usually this layer will be used with recurrent layers to invert the // time axis which is axis 0 // This layer will therefore swap the order in time but not the // order of the actual data. optional int32 axis = 1 [default = 0]; }
message ReverseTimeParameter { // if true the rest of the sequence will not be reversed but copied // if false no more operation will be performed for the reset. // this can lead to random numbers in the blob. optional bool copy_remaining = 1 [default = false]; }
message TransposeParameter { // For example, if you want to transpose NxCxHxW into WxNxHxC, // the parameter should be the following: // transpose_param { dim: 3 dim: 0 dim: 2 dim: 1 } // ie, if the i-th dim has value n, then the i-th axis of top is equal to the n-th axis of bottom. repeated int32 dim=1; }
message CtcDecoderParameter { // The index of the blank index in the labels. A negative (default) // value will use the last index optional int32 blank_index = 1 [default = 0];
// Collapse the repeated labels during the ctc calculation // e.g. collapse [0bbb11bb11bb0b2] to [01102] instead of [0111102], // where b means blank label. // The default behaviour is to merge repeated labels. // Note: blank labels will be removed in any case. optional bool ctc_merge_repeated = 2 [default = true]; } message WarpCtcLossParameter { // Adds delayed output to the CTC loss calculation (untested!) optional int32 output_delay = 1 [default = 0];
// The index of the blank index in the labels. A negative (default) // value will use the last index optional int32 blank_index = 2 [default = 0];
// Collapse repeating labels of the target sequence before calculating // the loss and the gradients (e.g. collapse [01102] to [0102]) // The default behaviour is to keep repeated labels. Elsewise the // network will not learn to predict repetitions. optional bool preprocess_collapse_repeated = 3 [default = false];
// Collapse the repeated labels during the ctc calculation // e.g collapse [0bbb11bb11bb0b2] to [01102] instead of [0111102], // where b means blank label. // The default behaviour is to merge repeated labels. // Note: blank labels will be removed in any case. optional bool ctc_merge_repeated = 4 [default = true];
/// This parameter is for test cases only! /// The time for which to calculate the loss (see Graves Eq. (7.27) ) /// Note that the result must be the same for each 0 <= t < T /// Therefore you can chose an arbitrary value, default 0 optional int32 loss_calculation_t = 5 [default = 0]; }
@greatgeekgrace
2.如果要加入warp-ctc,首先参考https://github.com/kasyoukin/caffe_ocr_for_linux,编译libwarpctc.so,然后修改Makefile.config加入libwarpctc.so所在位置,修改Makefile,加入库名"warpctc"。然后按上述1所描述方法添加layer,编译应该就可以了。运行的时候,将libwarpctc.so复制到caffe根目录,就可以运行了。
您好,关于整合进linux版本caffe,目前卡在warp-ctc相关的几个层(编译总是报错),不知道是否需要特殊处理?