diff --git a/imagenet_utils.py b/imagenet_utils.py index 5cf3d17..a4fee79 100644 --- a/imagenet_utils.py +++ b/imagenet_utils.py @@ -14,15 +14,15 @@ def preprocess_input(x, dim_ordering='default'): assert dim_ordering in {'tf', 'th'} if dim_ordering == 'th': - x[:, 0, :, :] -= 103.939 + x[:, 0, :, :] -= 123.68 x[:, 1, :, :] -= 116.779 - x[:, 2, :, :] -= 123.68 + x[:, 2, :, :] -= 103.939 # 'RGB'->'BGR' x = x[:, ::-1, :, :] else: - x[:, :, :, 0] -= 103.939 + x[:, :, :, 0] -= 123.68 x[:, :, :, 1] -= 116.779 - x[:, :, :, 2] -= 123.68 + x[:, :, :, 2] -= 103.939 # 'RGB'->'BGR' x = x[:, :, :, ::-1] return x