1
votes

I've trained a net and trying to apply it, but recieve following error:

Cannot copy param 0 weigths from layer 'ip1'; shape mismatch. Source param shape is 384 72576 (27869184); target param shape is 384 224(86016). To learn this layer's parameters from scratch rather than copying from a saved net, rename the layer.

Net config for this layer looks like this:

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

It is a joint place for Siamese network.

When I start training I recieve following output:

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

Applying net:

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

I've used batch size of 256 while training, if it matters.

What is wrong here? I just can't see. I've copypasted my net from train.prototxt file to apply_net.prototxt, that's it

1
You are trying to initialize a network with a fully-connect layer of different shape (as the error message says). The reason for having different shape is that the output of the concat layer is different (one time it's 72576 and one time it's 224). Without seeing the full prototxt (both training and deploy) it's hard to know why your Concant layer has different output shapes. - Or Sharir

1 Answers

2
votes

The mismatch is due to different blob sizes of the layers. You need to compute the output dimensions of each layer of your network. Use the formula given here.