Deconvolution layer problem

Hello.

I have the follow problem:

I have the converted from Caffe(with deconvolutional layer) model which work correct if I run it with python and coremltools. But if I try to load it on Iphone the loader return assertation error:

/BuildRoot/Library/Caches/com.apple.xbs/Sources/MetalImage/MetalImage-82.1/MPSNeuralNetwork/Filters/MPSCNNConvolutionTranspose.mm:207: failed assertion `number of groups must be > 0'


I now that nGroups correct (=2)


Caffe section:

layer {
  name: "upscore"
  type: "Deconvolution"
  bottom: "conv10_new"
  top: "upscore"
  param {
  lr_mult: 0
  decay_mult: 0
  }
  convolution_param {
  num_output: 2
  bias_term: false
  pad: 16
  kernel_size: 64
  group: 2
  stride: 32
  weight_filler {
  type: "bilinear"
  }
  }
}


Mlmodel spec section:

  layers {
    name: "upscore"
    input: "conv10_new"
    output: "upscore"
    convolution {
      outputChannels: 2
      kernelChannels: 1
      nGroups: 2
      kernelSize: 64
      kernelSize: 64
      stride: 32
      stride: 32
      dilationFactor: 1
      dilationFactor: 1
      valid {
        paddingAmounts {
          borderAmounts {
            startEdgeSize: 16
            endEdgeSize: 16
          }
          borderAmounts {
            startEdgeSize: 16
            endEdgeSize: 16
          }
        }
      }
      isDeconvolution: true
      weights {


Any ideas?

Thanks!


PS. coremltools convert Caffe deconvolution layer not totally correct, it needed to swap outputChannels and kernelChannels (reshape weights in caffe model). For example in this sample caffe model has weights shape (2, 1, 64, 64) but coremltools expect (1, 2, 64, 64)

Replies

I can highly recommend to check out the structure of the compiled model. There are JSON files representing your models in the app bundle after compiling.


I found a bug this way where the compiler fused a convolution and a normalization layer into one, but the implementation of the combined layer turnes out to be buggy (known issue).

Thank you!

In the app bundle all parameters are correct. It seems that framework have a bug with deconvolution with groups. When I reconfigured my net that nGroops=1 it became work fine.

Yes there is bug in deconvoltuion with groups > 1 currently. We are working on fixing it across all devices.

To get more information about your particular issue, which iPhone did you try it on and see the bug?

hi is this known bug (deconvoltuion with groups > 1) solved now? Please share the updates and followups if any. Thanks!