Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Clean up an unused parameter in MobileNetV2 (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
taehoonlee committed Jan 25, 2019
1 parent 5f99f52 commit a6d0e4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
7 changes: 4 additions & 3 deletions keras_applications/mobilenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,16 @@ def MobileNet(input_shape=None,
It should have exactly 3 inputs channels,
and width and height should be no smaller than 32.
E.g. `(200, 200, 3)` would be one valid value.
alpha: controls the width of the network.
alpha: controls the width of the network. This is known as the
width multiplier in the MobileNet paper.
- If `alpha` < 1.0, proportionally decreases the number
of filters in each layer.
- If `alpha` > 1.0, proportionally increases the number
of filters in each layer.
- If `alpha` = 1, default number of filters from the paper
are used at each layer.
depth_multiplier: depth multiplier for depthwise convolution
(also called the resolution multiplier)
depth_multiplier: depth multiplier for depthwise convolution. This
is called the resolution multiplier in the MobileNet paper.
dropout: dropout rate
include_top: whether to include the fully-connected
layer at the top of the network.
Expand Down
14 changes: 4 additions & 10 deletions keras_applications/mobilenet_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def _make_divisible(v, divisor, min_value=None):

def MobileNetV2(input_shape=None,
alpha=1.0,
depth_multiplier=1,
include_top=True,
weights='imagenet',
input_tensor=None,
Expand All @@ -147,15 +146,14 @@ def MobileNetV2(input_shape=None,
do not match then we will throw an error.
E.g. `(160, 160, 3)` would be one valid value.
alpha: controls the width of the network. This is known as the
width multiplier in the MobileNetV2 paper.
width multiplier in the MobileNetV2 paper, but the name is kept for
consistency with MobileNetV1 in Keras.
- If `alpha` < 1.0, proportionally decreases the number
of filters in each layer.
- If `alpha` > 1.0, proportionally increases the number
of filters in each layer.
- If `alpha` = 1, default number of filters from the paper
are used at each layer.
depth_multiplier: depth multiplier for depthwise convolution
(also called the resolution multiplier)
include_top: whether to include the fully-connected
layer at the top of the network.
weights: one of `None` (random initialization),
Expand Down Expand Up @@ -185,8 +183,8 @@ def MobileNetV2(input_shape=None,
# Raises
ValueError: in case of invalid argument for `weights`,
or invalid input shape or invalid depth_multiplier, alpha,
rows when weights='imagenet'
or invalid input shape or invalid alpha, rows when
weights='imagenet'
"""
global backend, layers, models, keras_utils
backend, layers, models, keras_utils = get_submodules_from_kwargs(kwargs)
Expand Down Expand Up @@ -286,10 +284,6 @@ def MobileNetV2(input_shape=None,
cols = input_shape[col_axis]

if weights == 'imagenet':
if depth_multiplier != 1:
raise ValueError('If imagenet weights are being loaded, '
'depth multiplier must be 1')

if alpha not in [0.35, 0.50, 0.75, 1.0, 1.3, 1.4]:
raise ValueError('If imagenet weights are being loaded, '
'alpha can be one of `0.35`, `0.50`, `0.75`, '
Expand Down

0 comments on commit a6d0e4d

Please sign in to comment.