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

mobilenet train speed is slow than full convolution? #1

Open
qingzhouzhen opened this issue Jul 18, 2017 · 2 comments
Open

mobilenet train speed is slow than full convolution? #1

qingzhouzhen opened this issue Jul 18, 2017 · 2 comments

Comments

@qingzhouzhen
Copy link

Is there something wrong with your symbol_mobilenet.py in line 22?
I fixed it in my repository in https://github.com/qingzhouzhen/mobilenet-mxnet,
And I both trained mobilenet with https://github.com/qingzhouzhen/mobilenet-mxnet/blob/master/mobilenet.py and https://github.com/qingzhouzhen/mobilenet-mxnet/blob/master/mobilenet_normal.py
Unfortunately, mobilenet is slower, mobilenet is about 50 samples/second, normal convolution is about 98 sample/second, why?

mobilenet tarin speed:
INFO:root:Epoch[0] Batch [20] Speed: 56.48 samples/sec accuracy=0.000744
INFO:root:Epoch[0] Batch [40] Speed: 56.53 samples/sec accuracy=0.000781
INFO:root:Epoch[0] Batch [60] Speed: 56.53 samples/sec accuracy=0.000000
INFO:root:Epoch[0] Batch [80] Speed: 56.55 samples/sec accuracy=0.001563
INFO:root:Epoch[0] Batch [100] Speed: 56.55 samples/sec accuracy=0.002344
INFO:root:Epoch[0] Batch [120] Speed: 56.55 samples/sec accuracy=0.002734
INFO:root:Epoch[0] Batch [140] Speed: 56.53 samples/sec accuracy=0.001563
INFO:root:Epoch[0] Batch [160] Speed: 56.53 samples/sec accuracy=0.002734
INFO:root:Epoch[0] Batch [180] Speed: 56.54 samples/sec accuracy=0.001172
INFO:root:Epoch[0] Batch [200] Speed: 56.50 samples/sec accuracy=0.002734
INFO:root:Epoch[0] Batch [220] Speed: 56.53 samples/sec accuracy=0.001953
INFO:root:Epoch[0] Batch [240] Speed: 56.55 samples/sec accuracy=0.003516
INFO:root:Epoch[0] Batch [260] Speed: 56.54 samples/sec accuracy=0.001953
INFO:root:Epoch[0] Batch [280] Speed: 56.55 samples/sec accuracy=0.005078
INFO:root:Epoch[0] Batch [300] Speed: 56.54 samples/sec accuracy=0.004297

the counterpart is:
INFO:root:Epoch[0] Batch [20] Speed: 92.89 samples/sec accuracy=0.002604
INFO:root:Epoch[0] Batch [40] Speed: 93.21 samples/sec accuracy=0.002344
INFO:root:Epoch[0] Batch [60] Speed: 93.19 samples/sec accuracy=0.003516
INFO:root:Epoch[0] Batch [80] Speed: 93.09 samples/sec accuracy=0.000781
INFO:root:Epoch[0] Batch [100] Speed: 93.11 samples/sec accuracy=0.001953
INFO:root:Epoch[0] Batch [120] Speed: 93.16 samples/sec accuracy=0.002344
INFO:root:Epoch[0] Batch [140] Speed: 93.16 samples/sec accuracy=0.001563
INFO:root:Epoch[0] Batch [160] Speed: 93.20 samples/sec accuracy=0.003906
INFO:root:Epoch[0] Batch [180] Speed: 93.35 samples/sec accuracy=0.003125
INFO:root:Epoch[0] Batch [200] Speed: 93.74 samples/sec accuracy=0.001953
INFO:root:Epoch[0] Batch [220] Speed: 93.65 samples/sec accuracy=0.002344
INFO:root:Epoch[0] Batch [240] Speed: 93.72 samples/sec accuracy=0.002344
INFO:root:Epoch[0] Batch [260] Speed: 93.62 samples/sec accuracy=0.002734
INFO:root:Epoch[0] Batch [280] Speed: 93.59 samples/sec accuracy=0.003125
INFO:root:Epoch[0] Batch [300] Speed: 93.51 samples/sec accuracy=0.002344
INFO:root:Epoch[0] Batch [320] Speed: 93.52 samples/sec accuracy=0.002344
INFO:root:Epoch[0] Batch [340] Speed: 93.59 samples/sec accuracy=0.003906
INFO:root:Epoch[0] Batch [360] Speed: 93.72 samples/sec accuracy=0.001953
INFO:root:Epoch[0] Batch [380] Speed: 93.47 samples/sec accuracy=0.002344
INFO:root:Epoch[0] Batch [400] Speed: 93.45 samples/sec accuracy=0.003516
INFO:root:Epoch[0] Batch [420] Speed: 93.59 samples/sec accuracy=0.002344
INFO:root:Epoch[0] Batch [440] Speed: 93.65 samples/sec accuracy=0.004297
INFO:root:Epoch[0] Batch [460] Speed: 93.70 samples/sec accuracy=0.004687
INFO:root:Epoch[0] Batch [480] Speed: 93.59 samples/sec accuracy=0.005859
INFO:root:Epoch[0] Batch [500] Speed: 93.73 samples/sec accuracy=0.006250

why mobilenet is slow than full convolution?

@wranglerwong
Copy link
Owner

@qingzhouzhen
because depthwise convolution implemented by group (group > 1) is much slower than normal convolution (group = 1)

See https://github.com/dmlc/mxnet/blob/master/src/operator/convolution-inl.h#L144

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

No branches or pull requests

3 participants
@wranglerwong @qingzhouzhen and others