1

我按照此处的说明为类创建权重矩阵并添加 Infogainloss 函数,该函数能够处理我的不平衡数据。最后几层

    ....
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
      }
    }

并编辑/添加了此链接中包含的文件。但是,在网络中创建图层时会出错:

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. 我该如何解决这个错误?这个错误从何而来?
  2. 这个参数到底在做什么?

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

如果有人可以发表任何建议,我将不胜感激。谢谢。

4

0 回答 0