kongsicong / Age_recognition_OR

40 stars 23 forks source link

make caffe error #7

Open hongnianwang opened 6 years ago

hongnianwang commented 6 years ago

添加mae_layer, ordianl_regression_loss_layer的步骤: 1,将mae_layer.hpp, ordinal_regression_loss_layer.hpp 放置在caffe/include/caffe/layers/下 2,将mae_layer.cpp, ordinal_regression_loss_layer.cpp, ordinal_regressioin_loss_layer.cu 放置在caffe/src/caffe/layers/下 3.修改caffe/src/caffe/proto/caffe.proto add LayerParameter{ optional OrdinalRegressionParameter ordinal_regression_loss_param = 153; optional OrdinalRegressionParameter mae_param = 154; } set parameter message OrdinalRegressionParameter { optional uint32 k = 1; optional string weight_file = 2; } message MAEParameter { optional int32 axis = 2 [default = 1];

// If specified, ignore instances with the given label. optional int32 ignore_label = 3;

} src/caffe/layers/mae_layer.cpp:13:21: error: ‘const class caffe::OrdinalRegressionParameter’ has no member named ‘has_ignore_label’ has_ignorelabel = this->layerparam.mae_param().has_ignore_label(); can any body tell me what's wrong and how to handle this problem. thanks!

hongnianwang commented 6 years ago

solve this problem by add optional OrdinalRegressionParameter ordinal_regression_loss_param = 154; optional MAEParameter mae_param = 155; optional ACCParameter acc_param = 156; optional OneoffACCParameter oneoff_acc_param = 157; optional OneoffAccuracyParameter oneoff_accuracy_param = 158; }

message OrdinalRegressionParameter { optional uint32 k = 1; optional string weight_file = 2; } message MAEParameter { optional int32 axis = 2 [default = 1];

// If specified, ignore instances with the given label. optional int32 ignore_label = 3; }

message ACCParameter { optional int32 axis = 2 [default = 1];

// If specified, ignore instances with the given label. optional int32 ignore_label = 3; }

message OneoffACCParameter { optional int32 axis = 2 [default = 1];

// If specified, ignore instances with the given label. optional int32 ignore_label = 3; }

message OneoffAccuracyParameter { // When computing accuracy, count as correct by comparing the true label to // the top k scoring classes. By default, only compare to the top scoring // class (i.e. argmax). optional uint32 top_k = 1 [default = 1];

// The "label" axis of the prediction blob, whose argmax corresponds to the // predicted label -- may be negative to index from the end (e.g., -1 for the // last axis). For example, if axis == 1 and the predictions are // (N x C x H x W), the label blob is expected to contain NHW ground truth // labels with integer values in {0, 1, ..., C-1}. optional int32 axis = 2 [default = 1];

// If specified, ignore instances with the given label. optional int32 ignore_label = 3; } to caffe.proto file

chaipangpang commented 5 years ago

modify caffe.proto file: message LayerParameter{ optional OrdinalRegressionParameter ordinal_regression_loss_param = your next available ID; optional MAEParameter mae_param = your next available ID+1; } message OrdinalRegressionParameter { optional uint32 k = 1; optional string weight_file = 2; } message MAEParameter { optional int32 axis = 2 [default = 1];

// If specified, ignore instances with the given label. optional int32 ignore_label = 3;

}