【问题标题】:Shape mismatch in inner product layer Caffe内积层 Caffe 形状不匹配
【发布时间】:2016-09-09 20:37:11
【问题描述】:

我已经训练了一个网络并尝试应用它,但收到以下错误:

无法从层 'ip1' 复制参数 0 权重;形状不匹配。资源 参数形状为 384 72576 (27869184);目标参数形状为 384 224(86016)。从头开始学习这一层的参数,而不是 从保存的网络复制,重命名图层。

该层的网络配置如下所示:

layer {
  type: "Concat"
  bottom: "conv5f"
  bottom: "conv5_pf"
  top: "feat"
  name: "concat1"
}

layer {
  name: "ip1"
  type: "InnerProduct"
  bottom: "feat"
  top: "ip1"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  inner_product_param {
    num_output: 384
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}

这里是连体网络的联合场所。

当我开始训练时,我收到以下输出:

setting up concat
Top shape: 256 72576  
...
Setting up ip1
Top shape: 256 384

申请网:

setting up concat
Top shape: 256 224
...
Setting up ip1
Top shape: 256 384

如果重要的话,我在训练时使用了 256 的批量大小。

这里有什么问题?我只是看不到。我已经将我的网络从 train.prototxt 文件复制粘贴到 apply_net.prototxt,就是这样

【问题讨论】:

  • 您正在尝试使用不同形状的完全连接层初始化网络(如错误消息所述)。形状不同的原因是concat层的输出不同(一次是72576,一次是224)。如果没有看到完整的 prototxt(训练和部署),很难知道为什么您的 Concant 层具有不同的输出形状。

标签: neural-network deep-learning caffe conv-neural-network pycaffe


【解决方案1】:

不匹配是由于层的 blob 大小不同。您需要计算网络每一层的输出维度。使用给定的公式here

【讨论】:

    猜你喜欢
    • 2016-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-10
    • 2018-07-19
    • 1970-01-01
    • 2021-04-09
    • 2015-08-26
    相关资源
    最近更新 更多