[GitHub] zhreshold commented on a change in pull request #9614: MobileNetV2

2018-02-15 Thread GitBox
zhreshold commented on a change in pull request #9614: MobileNetV2
URL: https://github.com/apache/incubator-mxnet/pull/9614#discussion_r168559118
 
 

 ##
 File path: python/mxnet/gluon/model_zoo/vision/mobilenet.py
 ##
 @@ -74,13 +124,71 @@ def hybrid_forward(self, F, x):
 x = self.output(x)
 return x
 
+
+class MobileNetV2(nn.HybridBlock):
+r"""MobileNetV2 model from the
+`"Inverted Residuals and Linear Bottlenecks:
+  Mobile Networks for Classification, Detection and Segmentation"
+`_ paper.
+
+Parameters
+--
+multiplier : float, default 1.0
+The width multiplier for controling the model size. The actual number 
of channels
+is equal to the original channel size multiplied by this multiplier.
+classes : int, default 1000
+Number of classes for the output layer.
+"""
+
+def __init__(self, multiplier=1.0, classes=1000, **kwargs):
+super(MobileNetV2, self).__init__(**kwargs)
+with self.name_scope():
+self.features = nn.HybridSequential(prefix='features_')
+with self.features.name_scope():
+_add_conv(self.features, int(32 * multiplier), kernel=3,
+  stride=2, pad=1, active=False)
 
 Review comment:
   no `relu` for the first conv?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] zhreshold commented on a change in pull request #9614: MobileNetV2

2018-02-13 Thread GitBox
zhreshold commented on a change in pull request #9614: MobileNetV2
URL: https://github.com/apache/incubator-mxnet/pull/9614#discussion_r168075699
 
 

 ##
 File path: python/mxnet/gluon/model_zoo/vision/mobilenet.py
 ##
 @@ -74,13 +123,69 @@ def hybrid_forward(self, F, x):
 x = self.output(x)
 return x
 
+
+class MobileNetV2(nn.HybridBlock):
+r"""MobileNetV2 model from the
+`"Inverted Residuals and Linear Bottlenecks:
+  Mobile Networks for Classification, Detection and Segmentation"
+`_ paper.
+
+Parameters
+--
+multiplier : float, default 1.0
+The width multiplier for controling the model size. The actual number 
of channels
+is equal to the original channel size multiplied by this multiplier.
+classes : int, default 1000
+Number of classes for the output layer.
+"""
+
+def __init__(self, multiplier=1.0, classes=1000, **kwargs):
+super(MobileNetV2, self).__init__(**kwargs)
+with self.name_scope():
+self.features = nn.HybridSequential(prefix='features_')
+with self.features.name_scope():
+_add_conv(self.features, int(32 * multiplier), kernel=3, 
stride=2, pad=1)
+
+in_channels_group = [int(x * multiplier) for x in [32] + [16] 
+ [24] * 2
+ + [32] * 3 + [64] * 4 + [96] * 3 + [160] 
* 3]
+channels_group = [int(x * multiplier) for x in [16] + [24] * 2 
+ [32] * 3
+  + [64] * 4 + [96] * 3 + [160] * 3 + [320]]
+ts = [1] + [6] * 16
+strides = [1, 2] * 2 + [1] * 2 + [2] + [1] * 3 + [1] * 3 + [2] 
+ [1] * 3
 
 Review comment:
   @dwSun from 28^2x32 to 28^2x64, it should be stride 1. I am observing 
14^2x64 feature map, which corresponds to stride 2. 
   The input sizes and strides in this table is conflicting, but I am not sure 
which one is correct unless we compute the Mult-add and compare with the claims 
in paper.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] zhreshold commented on a change in pull request #9614: MobileNetV2

2018-02-13 Thread GitBox
zhreshold commented on a change in pull request #9614: MobileNetV2
URL: https://github.com/apache/incubator-mxnet/pull/9614#discussion_r168043288
 
 

 ##
 File path: python/mxnet/gluon/model_zoo/vision/mobilenet.py
 ##
 @@ -74,13 +123,69 @@ def hybrid_forward(self, F, x):
 x = self.output(x)
 return x
 
+
+class MobileNetV2(nn.HybridBlock):
+r"""MobileNetV2 model from the
+`"Inverted Residuals and Linear Bottlenecks:
+  Mobile Networks for Classification, Detection and Segmentation"
+`_ paper.
+
+Parameters
+--
+multiplier : float, default 1.0
+The width multiplier for controling the model size. The actual number 
of channels
+is equal to the original channel size multiplied by this multiplier.
+classes : int, default 1000
+Number of classes for the output layer.
+"""
+
+def __init__(self, multiplier=1.0, classes=1000, **kwargs):
+super(MobileNetV2, self).__init__(**kwargs)
+with self.name_scope():
+self.features = nn.HybridSequential(prefix='features_')
+with self.features.name_scope():
+_add_conv(self.features, int(32 * multiplier), kernel=3, 
stride=2, pad=1)
+
+in_channels_group = [int(x * multiplier) for x in [32] + [16] 
+ [24] * 2
+ + [32] * 3 + [64] * 4 + [96] * 3 + [160] 
* 3]
+channels_group = [int(x * multiplier) for x in [16] + [24] * 2 
+ [32] * 3
+  + [64] * 4 + [96] * 3 + [160] * 3 + [320]]
+ts = [1] + [6] * 16
+strides = [1, 2] * 2 + [1] * 2 + [2] + [1] * 3 + [1] * 3 + [2] 
+ [1] * 3
 
 Review comment:
   BTW, I am comparing 
http://ethereon.github.io/netscope/#/gist/d01b5b8783b4582a42fe07bd46243986
   with 
   
[plot.gv.pdf](https://github.com/apache/incubator-mxnet/files/1722162/plot.gv.pdf)
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] zhreshold commented on a change in pull request #9614: MobileNetV2

2018-02-13 Thread GitBox
zhreshold commented on a change in pull request #9614: MobileNetV2
URL: https://github.com/apache/incubator-mxnet/pull/9614#discussion_r168042820
 
 

 ##
 File path: python/mxnet/gluon/model_zoo/vision/mobilenet.py
 ##
 @@ -74,13 +123,69 @@ def hybrid_forward(self, F, x):
 x = self.output(x)
 return x
 
+
+class MobileNetV2(nn.HybridBlock):
+r"""MobileNetV2 model from the
+`"Inverted Residuals and Linear Bottlenecks:
+  Mobile Networks for Classification, Detection and Segmentation"
+`_ paper.
+
+Parameters
+--
+multiplier : float, default 1.0
+The width multiplier for controling the model size. The actual number 
of channels
+is equal to the original channel size multiplied by this multiplier.
+classes : int, default 1000
+Number of classes for the output layer.
+"""
+
+def __init__(self, multiplier=1.0, classes=1000, **kwargs):
+super(MobileNetV2, self).__init__(**kwargs)
+with self.name_scope():
+self.features = nn.HybridSequential(prefix='features_')
+with self.features.name_scope():
+_add_conv(self.features, int(32 * multiplier), kernel=3, 
stride=2, pad=1)
+
+in_channels_group = [int(x * multiplier) for x in [32] + [16] 
+ [24] * 2
+ + [32] * 3 + [64] * 4 + [96] * 3 + [160] 
* 3]
+channels_group = [int(x * multiplier) for x in [16] + [24] * 2 
+ [32] * 3
+  + [64] * 4 + [96] * 3 + [160] * 3 + [320]]
+ts = [1] + [6] * 16
+strides = [1, 2] * 2 + [1] * 2 + [2] + [1] * 3 + [1] * 3 + [2] 
+ [1] * 3
 
 Review comment:
   I think there's a mistake in paper:
   https://user-images.githubusercontent.com/3307514/36180798-82978a1a-10e7-11e8-85e9-b39b552c7908.png";>
   Therefore the strides here should be:
   ```
   strides = [1, 2] * 2 + [1] * 3 + [2] + [1] * 2 + [1] * 3 + [2] + [1] * 3
   ```
   More inputs and eyes are welcome if you find this not correct @dwSun @szha 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services