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

Commit dda4997

Browse files
ezavarygintaehoonlee
authored andcommitted
Custom image size in Mobilenets v1 and v2 (#101)
* Size 224 is used for custom sizes in MobileNets * The warning message for undefined input shapes in MobileNets was updated
1 parent 8a1e4d4 commit dda4997

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

keras_applications/mobilenet.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ def MobileNet(input_shape=None,
203203
'`0.25`, `0.50`, `0.75` or `1.0` only.')
204204

205205
if rows != cols or rows not in [128, 160, 192, 224]:
206-
if rows is None:
207-
rows = 224
208-
warnings.warn('MobileNet shape is undefined.'
209-
' Weights for input shape '
210-
'(224, 224) will be loaded.')
206+
rows = 224
207+
warnings.warn('`input_shape` is undefined or non-square, '
208+
'or `rows` is not in [128, 160, 192, 224]. '
209+
'Weights for input shape (224, 224) will be'
210+
' loaded as the default.')
211211

212212
if input_tensor is None:
213213
img_input = layers.Input(shape=input_shape)

keras_applications/mobilenet_v2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,11 @@ def MobileNetV2(input_shape=None,
290290
'`1.0`, `1.3` or `1.4` only.')
291291

292292
if rows != cols or rows not in [96, 128, 160, 192, 224]:
293-
if rows is None:
294-
rows = 224
295-
warnings.warn('MobileNet shape is undefined.'
296-
' Weights for input shape'
297-
'(224, 224) will be loaded.')
293+
rows = 224
294+
warnings.warn('`input_shape` is undefined or non-square, '
295+
'or `rows` is not in [96, 128, 160, 192, 224].'
296+
' Weights for input shape (224, 224) will be'
297+
' loaded as the default.')
298298

299299
if input_tensor is None:
300300
img_input = layers.Input(shape=input_shape)

0 commit comments

Comments
 (0)