Getting error for adding InfogainLoss layer?

只谈情不闲聊 提交于 2019-12-11 07:29:47

问题


I followed the instructions here to create weight matrix for classes and add the Infogainloss function, which is able to tackle my imbalance data. The few last layers

    ....
layer {
      name: "score_fr"
      type: "Convolution"
      bottom: "fc7"
      top: "score_fr"
      param {
        lr_mult: 1
        decay_mult: 1
      }
      param {
        lr_mult: 2
        decay_mult: 0
      }
      convolution_param {
        num_output: 5 #21
        pad: 0
        kernel_size: 1
        weight_filler {
            type: "xavier"
        }   
        bias_filler {
            type: "constant"
         } 
      }
    }
    layer {
      name: "upscore"
      type: "Deconvolution"
      bottom: "score_fr"
      top: "upscore"
      param {
        lr_mult: 0
      }
      convolution_param {
        num_output: 5 #21
        bias_term: false
        kernel_size: 64
        stride: 32
        group: 5 #2
        weight_filler: { 
             type: "bilinear" 
         }
      }
    }
    layer {
      name: "score"
      type: "Crop"
      bottom: "upscore"
      bottom: "data"
      top: "score"
      crop_param {
        axis: 2
        offset: 19
      }
    }
    layer {
      name: "accuracy"
      type: "Accuracy"
      bottom: "score"
      bottom: "label"
      top: "accuracy"
      include {
        phase: TEST
      }
    }
    layer {
      name: "prob"
      type: "Softmax" # NOT SoftmaxWithLoss
      bottom: "score"
      top: "prob"
      softmax_param { axis: 1 } # compute prob along 2nd axis
    }
    layer {
      bottom: "score"
      bottom: "label"
      top: "infoGainLoss"
      name: "infoGainLoss"
      type: "InfogainLoss"
      infogain_loss_param {
        source: "/.../infogainH.binaryproto"
        axis: 1  # compute loss and probability along axis
      }
    }

And edited/added the files that have been included in this link. However, it is giving an error while creating the layer in the network:

I0221 05:25:20.213062  5265 solver.cpp:91] Creating training net from net file: train_val.prototxt
[libprotobuf ERROR google/protobuf/text_format.cc:274] Error parsing text-format caffe.NetParameter: 604:9: Message type "caffe.InfogainLossParameter" has no field named "axis".
F0221 05:25:20.213347  5265 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: train_val.prototxt
*** Check failure stack trace: ***
  1. How can I solve this error? from which point this error stem from?
  2. And what is this parameter exactly doing?

    softmax_param { axis: 1 } # compute prob along 2nd axis

I would really appreciate if someone could post any suggestion. Thanks.

来源:https://stackoverflow.com/questions/42533280/getting-error-for-adding-infogainloss-layer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!