添加InfogainLoss图层时出错?

时间:2017-03-01 13:38:39

标签: python deep-learning caffe pycaffe matcaffe

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

@Optional()

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

    ....
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
      }
    }
  1. 如何解决此错误?从这一点来看,这个错误源于什么?
  2. 这个参数到底在做什么?

    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: ***

  3. 如果有人可以发布任何建议我真的很感激。 感谢。

0 个答案:

没有答案