ValueError: DepthwiseConv2D requires the stride attribute to contain 4 values, but got: 3

Im trying to import to tensorflow an onnx saved model from a pytorch implementation of efficientdet-d0 and I get the following error when I try to run a prediction or export the model :

ValueError: DepthwiseConv2D requires the stride attribute to contain 4 values, but got: 3 for ‘{{node depthwise}} = DepthwiseConv2dNative[T=DT_FLOAT, data_format=“NHWC”, dilations=[1, 1, 1, 1], explicit_paddings=[], padding=“VALID”, strides=[1, 1, 1]](transpose_4, Reshape_2)’ with input shapes: [?,?,?,?], [3,3,32,1].

code :

onnx_model = onnx.load(PATH + ‘model.onnx’)
onnx.checker.check_model(onnx_model)
tf_rep = prepare(onnx_model)
tf_rep.export_graph(“d0_s256_b32_ep400_TF.pb”)

or

onnx_model = onnx.load(PATH + ‘model.onnx’)
onnx.checker.check_model(onnx_model)
tf_rep = prepare(onnx_model)
tf_rep.run(Variable(torch.randn(32,3,256,256, dtype=torch.float32)))

I suggest you to post this on the LinuxFoundation ONNX slack:

https://onnx.ai/slack.html

1 Like

If you only want the EfficientDet model, you can download from TensorFlow Hub: TensorFlow Hub

1 Like

There has been some fine tuning on top of the original coco weights with another specific dataset so I need to keep the modifications for the new checkpoint

1 Like