2

I am trying to train 3D-Unet in caffe. The width, height and depth of different volumes is different. The input shape of the first volume in HDF5 dataset is 1 1 104 281 389 (NxCxDxHxW), when it reaches to the Concat layer (concat_d2c_u2a-b), it is raising an error, which it is inputs are with the following two shapes:

  • 1 256 19 64 91 scaled2c_relu_d2c_0_split_1
  • 1 512 12 56 84 scaleu2a

How can I solve this issue? Is it because of the order of dimensions?

I0708 22:19:59.811188 30282 layer_factory.cpp:74] Creating layer concat_d2c_u2a-b
I0708 22:19:59.811198 30282 net.cpp:185] Creating Layer concat_d2c_u2a-b
I0708 22:19:59.811200 30282 net.cpp:549] concat_d2c_u2a-b <- scaleu2a
I0708 22:19:59.811203 30282 net.cpp:549] concat_d2c_u2a-b <- scaled2c_relu_d2c_0_split_1
I0708 22:19:59.811208 30282 net.cpp:515] concat_d2c_u2a-b -> u2b
F0708 22:19:59.811223 30282 concat_layer.cpp:45] Check failed: top_shape[j] == bottom[i]->shape(j) (12 vs. 19) All inputs must have the same shape, except at concat_axis.
*** Check failure stack trace: ***
Shai
  • 111,146
  • 38
  • 238
  • 371
sc241
  • 189
  • 17

1 Answers1

0

"Concat" operation puts two (or more) Blobs together. For example, if you have two 1D Blobs x1 of dimension 10 and x2 of dimension 15, concatenating them will result with a 1D vector y of dimension 25.
In order to concat higher dimensional Blobs, you must have all dimensions of the Blobs identical, apart from the concat dimension. For example, if you want to concat n1xc1xh1xw1 Blob with n1xc2xh2xw2 along the channel dimensions, then you must have n1==n2, h1==h2 and w1==w2 and your output Blob will be nx(c1+c2)xhxw.
Note that you cannot concat along channel dimension if any of the non-channel dimension do not match.

In your case none of the dimensions matches, therefore you cannot concat. You need to review your architecture and verify that you are padding/pooling/striding the right way to ensure the dimensions will match for concatenation.

Shai
  • 111,146
  • 38
  • 238
  • 371