CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Batchnormalization in Keras makes CNTK (C++) inference 10 times slower

Open CodeByMaxx opened this issue 7 years ago • 3 comments

I trained a model with Keras (Python) the backend was just CNTK, then I did the same but with batch normalization, batch normalization gives a lot better result, but the same model with batch normalization took 10 times more inference time. I don't know where it comes from. The backend for inference was just C++, is there a problem with compilation ?, wrong definition of the net? Should I update the compilation of the CNTK version? The CNTK version was just 2.2 because the new one also version 2.6 does not work for visual studio 2015.

Best regards

Best Regards

CodeByMaxx avatar Jan 05 '19 15:01 CodeByMaxx

Hello, have you solved this problem? I also encountered a similar problem, a piece of code running at cntk-gpu version 2.5 is about ten times slower than cntk-gpu2.7. (Using xception in keras to predict imagenet data with cntk as the backend. Xception contains batchnormalization) For some reason I have to use cntk-gpu2.5. Can you tell me the solution if you solve it? Thanks in advance!

Justobe avatar Jun 26 '19 01:06 Justobe

I think firstly you should take a look at your Net definition and check if both are really the same except the batchnormalization method. I think it also a problem to use some layer defintions which don't fit really well the data layout of the gpu or some combinations of it.

CodeByMaxx avatar Jun 27 '19 09:06 CodeByMaxx

Thanks for your answer. I will check it according to your suggestion.

Justobe avatar Jun 27 '19 11:06 Justobe