Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DepthwiseConv2D rather than SeparableConv2D with no-op pointwise conv #68

Merged
merged 2 commits into from
Apr 16, 2019

Conversation

ElteHupkes
Copy link
Contributor

@ElteHupkes ElteHupkes commented Mar 13, 2019

I noticed that my converted frozen .pb was much larger than a very similar model natively defined in Tensorflow. This turned out to be because of the pointwise convolution weights stored in the converted model - but these weights were all zero. I figured that instead of using a separable conv with a no-op pointwise conv, we can simply use a depthwise conv. I replaced it, and everything appears to be working as expected. tests/layers/convolutions/conv2d.py runs with a max error of 8.344650268554688e-07.

There is one caveat, which is that for whatever reason the dilation_rate parameter of keras.layers.DepthwiseConv2D isn't explicitly documented. This seems to be a documentation error rather than it being an unsupported feature, because it is most definitely used in the functional layer.

EDIT: Oh, and as a result, my .pb file went from 4.4mb to 1.3mb with the exact same output error (compared to the PyTorch model).

@gmalivenko gmalivenko merged commit 750eaf7 into gmalivenko:master Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants