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

Commit 5f99f52

Browse files
committed
Replace the custom preprocess_input for MobileNetV2 with the standard one (#61)
1 parent 7a03145 commit 5f99f52

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

keras_applications/mobilenet_v2.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282

8383
from . import correct_pad
8484
from . import get_submodules_from_kwargs
85+
from . import imagenet_utils
8586
from .imagenet_utils import decode_predictions
8687
from .imagenet_utils import _obtain_input_shape
8788

@@ -98,19 +99,13 @@
9899
def preprocess_input(x, **kwargs):
99100
"""Preprocesses a numpy array encoding a batch of images.
100101
101-
This function applies the "Inception" preprocessing which converts
102-
the RGB values from [0, 255] to [-1, 1]. Note that this preprocessing
103-
function is different from `imagenet_utils.preprocess_input()`.
104-
105102
# Arguments
106103
x: a 4D numpy array consists of RGB values within [0, 255].
107104
108105
# Returns
109106
Preprocessed array.
110107
"""
111-
x /= 128.
112-
x -= 1.
113-
return x.astype(np.float32)
108+
return imagenet_utils.preprocess_input(x, mode='tf', **kwargs)
114109

115110

116111
# This function is taken from the original tf repo.

0 commit comments

Comments
 (0)