TypeError: Error when deserializing class 'DepthwiseConv2D' using config={'name':…
- User
TypeError: Error when deserializing class 'DepthwiseConv2D' using config={'name': 'expanded_conv_depthwise', 'trainable': True, 'dtype': 'float32', 'kernel_size': [3, 3], 'strides': [1, 1], 'padding': 'same', 'data_format': 'channels_last', 'dilation_rate': [1, 1], 'groups' : 1, 'activation': 'linear', 'use_bias': False, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'bias_regularizer': None, 'act ivity_regularizer': None, 'bias_constraint': None, 'depth_multiplier': 1, 'depthwise_initializer': {'class_name': 'VarianceScaling', 'con fig': {'scale': 1, 'mode': 'fan_avg', 'distribution': 'uniform', 'seed': None}}, 'depthwise_regularizer': None, 'depthwise_constraint': N one}.
Exception encountered: Unrecognized keyword arguments passed to DepthwiseConv2D: {'groups': 1}
- Assistant
The error you're encountering is due to an unrecognized keyword argument
'groups': 1being passed to theDepthwiseConv2Dlayer in your code. In Keras,DepthwiseConv2Ddoes not accept agroupsargument, which is why you're seeing this error. Thegroupsparameter is typically associated with regularConv2Dlayers for grouped convolutions, but it's not applicable toDepthwiseConv2D.Here's how you can resolve the issue:
-
Remove the
groupsargument: Ensure that when you're instantiating or deserializing the layer, you do not include the parameter in your configuration or constructor arguments.
-