webdnn
webdnn copied to clipboard
Asymmetric padding assumption issue with keras + tensorflow models
Hi, me and my team have found a problem converting a xception based model trained with keras and tensorflow backend.
The converter doesn't give any error nor warning, but the webdnn version performs very badly w.r.t. keras model. We have seen different results after the first max_pooling layer (kernel 3, stride 2) and the divergence depends on difference assumptions on asymmetric padding that is performed by padding "same" mode.
Tensorflow uses bottom-right precedence, while webdnn uses top-left precedence. Tensorflow related issue https://github.com/tensorflow/tensorflow/issues/7969 / https://stackoverflow.com/questions/42924324/tensorflows-asymmetric-padding-assumptions or the reference documentation https://www.tensorflow.org/api_guides/python/nn#Convolution
The question is: will webdnn supports all kinds of padding assumptions in the future? Which is the correct way to use this kinds of models on webdnn?
As first fix we suggest that an error should be raised by the converter, because it is very hard to understand why the converted model does not work well.
P.S: as workaround we are trying to perform explicit manual padding directly in the model architecture.
Thanks for reporting. As you mentioned, different sized padding for each edge is not yet supported. Since padding is very common, so I will implement it within some weeks.
For more minor operation, users need to implement custom operator. https://mil-tokyo.github.io/webdnn/docs/tutorial/custom_operator/index.html