aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Francois Chollet <fchollet@google.com>2018-08-13 11:45:12 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-13 11:52:10 -0700
commit1e2566f029ec24ab1208a9d65c6295b0ce499940 (patch)
tree2bc235a3b189457deadd6fa9ab71935ff077820c
parent54f3661a5f19cdae186abee7547c5edd93a0a122 (diff)
Replace applications tests with lighter integration test.
Also remove MobileNetV2 due to a compatibility issue (will be re-enabled in the next version). PiperOrigin-RevId: 208517089
-rwxr-xr-xtensorflow/python/keras/BUILD116
-rw-r--r--tensorflow/python/keras/applications/__init__.py2
-rw-r--r--tensorflow/python/keras/applications/applications_test.py58
-rw-r--r--tensorflow/python/keras/applications/densenet_test.py101
-rw-r--r--tensorflow/python/keras/applications/imagenet_utils_test.py93
-rw-r--r--tensorflow/python/keras/applications/inception_resnet_v2_test.py59
-rw-r--r--tensorflow/python/keras/applications/inception_v3_test.py58
-rw-r--r--tensorflow/python/keras/applications/mobilenet_test.py71
-rw-r--r--tensorflow/python/keras/applications/mobilenet_v2.py12
-rw-r--r--tensorflow/python/keras/applications/nasnet_test.py76
-rw-r--r--tensorflow/python/keras/applications/resnet50_test.py51
-rw-r--r--tensorflow/python/keras/applications/vgg16_test.py50
-rw-r--r--tensorflow/python/keras/applications/vgg19_test.py50
-rw-r--r--tensorflow/python/keras/applications/xception_test.py57
-rw-r--r--tensorflow/python/tools/api/generator/api_init_files.bzl1
-rw-r--r--tensorflow/python/tools/api/generator/api_init_files_v1.bzl1
16 files changed, 65 insertions, 791 deletions
diff --git a/tensorflow/python/keras/BUILD b/tensorflow/python/keras/BUILD
index e04d0e93e2..7eb7884d1d 100755
--- a/tensorflow/python/keras/BUILD
+++ b/tensorflow/python/keras/BUILD
@@ -296,109 +296,15 @@ py_test(
)
py_test(
- name = "densenet_test",
- size = "large",
- srcs = ["applications/densenet_test.py"],
- srcs_version = "PY2AND3",
- tags = ["nomsan"], # times out, http://b/78650237
- deps = [
- ":keras",
- "//tensorflow/python:client_testlib",
- "//third_party/py/numpy",
- ],
-)
-
-py_test(
- name = "inception_resnet_v2_test",
- size = "medium",
- srcs = ["applications/inception_resnet_v2_test.py"],
- srcs_version = "PY2AND3",
- deps = [
- ":keras",
- "//tensorflow/python:client_testlib",
- "//third_party/py/numpy",
- ],
-)
-
-py_test(
- name = "inception_v3_test",
- size = "medium",
- srcs = ["applications/inception_v3_test.py"],
- srcs_version = "PY2AND3",
- deps = [
- ":keras",
- "//tensorflow/python:client_testlib",
- "//third_party/py/numpy",
- ],
-)
-
-py_test(
- name = "mobilenet_test",
- size = "medium",
- srcs = ["applications/mobilenet_test.py"],
- srcs_version = "PY2AND3",
- deps = [
- ":keras",
- "//tensorflow/python:client_testlib",
- "//third_party/py/numpy",
- ],
-)
-
-py_test(
- name = "nasnet_test",
- size = "large",
- srcs = ["applications/nasnet_test.py"],
- srcs_version = "PY2AND3",
- tags = ["nomsan"], # times out, http://b/78573625
- deps = [
- ":keras",
- "//tensorflow/python:client_testlib",
- "//third_party/py/numpy",
- ],
-)
-
-py_test(
- name = "resnet50_test",
- size = "medium",
- srcs = ["applications/resnet50_test.py"],
- srcs_version = "PY2AND3",
- deps = [
- ":keras",
- "//tensorflow/python:client_testlib",
- ],
-)
-
-py_test(
- name = "vgg16_test",
- size = "small",
- srcs = ["applications/vgg16_test.py"],
- srcs_version = "PY2AND3",
- deps = [
- ":keras",
- "//tensorflow/python:client_testlib",
- ],
-)
-
-py_test(
- name = "vgg19_test",
- size = "small",
- srcs = ["applications/vgg19_test.py"],
- srcs_version = "PY2AND3",
- deps = [
- ":keras",
- "//tensorflow/python:client_testlib",
- ],
-)
-
-py_test(
- name = "xception_test",
- size = "medium",
- srcs = ["applications/xception_test.py"],
+ name = "applications_test",
+ size = "enormous",
+ srcs = ["applications/applications_test.py"],
+ shard_count = 2,
srcs_version = "PY2AND3",
deps = [
":keras",
"//tensorflow/python:client_testlib",
- "//third_party/py/numpy",
+ "@absl_py//absl/testing:parameterized",
],
)
@@ -719,18 +625,6 @@ cuda_py_test(
)
py_test(
- name = "imagenet_utils_test",
- size = "small",
- srcs = ["applications/imagenet_utils_test.py"],
- srcs_version = "PY2AND3",
- deps = [
- ":keras",
- "//tensorflow/python:client_testlib",
- "//third_party/py/numpy",
- ],
-)
-
-py_test(
name = "image_test",
size = "medium",
srcs = ["preprocessing/image_test.py"],
diff --git a/tensorflow/python/keras/applications/__init__.py b/tensorflow/python/keras/applications/__init__.py
index 51cc51998c..cd9462d6b5 100644
--- a/tensorflow/python/keras/applications/__init__.py
+++ b/tensorflow/python/keras/applications/__init__.py
@@ -39,7 +39,7 @@ from tensorflow.python.keras.applications.densenet import DenseNet201
from tensorflow.python.keras.applications.inception_resnet_v2 import InceptionResNetV2
from tensorflow.python.keras.applications.inception_v3 import InceptionV3
from tensorflow.python.keras.applications.mobilenet import MobileNet
-from tensorflow.python.keras.applications.mobilenet_v2 import MobileNetV2
+# TODO(fchollet): enable MobileNetV2 in next version.
from tensorflow.python.keras.applications.nasnet import NASNetLarge
from tensorflow.python.keras.applications.nasnet import NASNetMobile
from tensorflow.python.keras.applications.resnet50 import ResNet50
diff --git a/tensorflow/python/keras/applications/applications_test.py b/tensorflow/python/keras/applications/applications_test.py
new file mode 100644
index 0000000000..ef3198a937
--- /dev/null
+++ b/tensorflow/python/keras/applications/applications_test.py
@@ -0,0 +1,58 @@
+# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==============================================================================
+"""Integration tests for Keras applications."""
+
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
+from absl.testing import parameterized
+
+from tensorflow.python.keras import applications
+from tensorflow.python.platform import test
+
+
+MODEL_LIST = [
+ (applications.ResNet50, 2048),
+ (applications.VGG16, 512),
+ (applications.VGG19, 512),
+ (applications.Xception, 2048),
+ (applications.InceptionV3, 2048),
+ (applications.InceptionResNetV2, 1536),
+ (applications.MobileNet, 1024),
+ # TODO(fchollet): enable MobileNetV2 in next version.
+ (applications.DenseNet121, 1024),
+ (applications.DenseNet169, 1664),
+ (applications.DenseNet201, 1920),
+ (applications.NASNetMobile, 1056),
+ (applications.NASNetLarge, 4032),
+]
+
+
+class ApplicationsTest(test.TestCase, parameterized.TestCase):
+
+ @parameterized.parameters(*MODEL_LIST)
+ def test_classification_model(self, model_fn, _):
+ model = model_fn(classes=1000, weights=None)
+ self.assertEqual(model.output_shape[-1], 1000)
+
+ @parameterized.parameters(*MODEL_LIST)
+ def test_feature_extration_model(self, model_fn, output_dim):
+ model = model_fn(include_top=False, weights=None)
+ self.assertEqual(model.output_shape, (None, None, None, output_dim))
+
+
+if __name__ == '__main__':
+ test.main()
diff --git a/tensorflow/python/keras/applications/densenet_test.py b/tensorflow/python/keras/applications/densenet_test.py
deleted file mode 100644
index 8b6aa281ad..0000000000
--- a/tensorflow/python/keras/applications/densenet_test.py
+++ /dev/null
@@ -1,101 +0,0 @@
-# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Tests for DenseNet application."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-from tensorflow.python import keras
-from tensorflow.python.platform import test
-
-
-class DenseNet121Test(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.DenseNet121(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.DenseNet121(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 1024))
-
- def test_with_pooling(self):
- model = keras.applications.DenseNet121(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 1024))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.DenseNet121(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.DenseNet121(weights='imagenet',
- classes=2000)
-
-
-class DenseNet169Test(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.DenseNet169(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.DenseNet169(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 1664))
-
- def test_with_pooling(self):
- model = keras.applications.DenseNet169(weights=None,
- include_top=False,
- pooling='max')
- self.assertEqual(model.output_shape, (None, 1664))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.DenseNet169(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.DenseNet169(weights='imagenet',
- classes=2000)
-
-
-class DenseNet201(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.DenseNet201(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.DenseNet201(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 1920))
-
- def test_with_pooling(self):
- model = keras.applications.DenseNet201(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 1920))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.DenseNet201(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.DenseNet201(weights='imagenet',
- classes=2000)
-
-
-if __name__ == '__main__':
- test.main()
diff --git a/tensorflow/python/keras/applications/imagenet_utils_test.py b/tensorflow/python/keras/applications/imagenet_utils_test.py
deleted file mode 100644
index 037e939ac5..0000000000
--- a/tensorflow/python/keras/applications/imagenet_utils_test.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Tests for Inception V3 application."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import numpy as np
-
-from tensorflow.python import keras
-from tensorflow.python.keras.applications.imagenet_utils import preprocess_input
-from tensorflow.python.platform import test
-
-
-class ImageNetUtilsTest(test.TestCase):
-
- def test_preprocess_input(self):
- # Test batch of images
- x = np.random.uniform(0, 255, (2, 10, 10, 3))
- self.assertEqual(preprocess_input(x).shape, x.shape)
- out1 = preprocess_input(x, 'channels_last')
- out2 = preprocess_input(np.transpose(x, (0, 3, 1, 2)), 'channels_first')
- self.assertAllClose(out1, out2.transpose(0, 2, 3, 1))
-
- # Test single image
- x = np.random.uniform(0, 255, (10, 10, 3))
- self.assertEqual(preprocess_input(x).shape, x.shape)
- out1 = preprocess_input(x, 'channels_last')
- out2 = preprocess_input(np.transpose(x, (2, 0, 1)), 'channels_first')
- self.assertAllClose(out1, out2.transpose(1, 2, 0))
-
- def test_preprocess_input_symbolic(self):
- # Test image batch
- x = np.random.uniform(0, 255, (2, 10, 10, 3))
- inputs = keras.layers.Input(shape=x.shape[1:])
- outputs = keras.layers.Lambda(
- preprocess_input, output_shape=x.shape[1:])(inputs)
- model = keras.models.Model(inputs, outputs)
- assert model.predict(x).shape == x.shape
- # pylint: disable=g-long-lambda
- outputs1 = keras.layers.Lambda(lambda x:
- preprocess_input(x, 'channels_last'),
- output_shape=x.shape[1:])(inputs)
- model1 = keras.models.Model(inputs, outputs1)
- out1 = model1.predict(x)
- x2 = np.transpose(x, (0, 3, 1, 2))
- inputs2 = keras.layers.Input(shape=x2.shape[1:])
- # pylint: disable=g-long-lambda
- outputs2 = keras.layers.Lambda(lambda x:
- preprocess_input(x, 'channels_first'),
- output_shape=x2.shape[1:])(inputs2)
- model2 = keras.models.Model(inputs2, outputs2)
- out2 = model2.predict(x2)
- self.assertAllClose(out1, out2.transpose(0, 2, 3, 1))
-
- # Test single image
- x = np.random.uniform(0, 255, (10, 10, 3))
- inputs = keras.layers.Input(shape=x.shape)
- outputs = keras.layers.Lambda(preprocess_input,
- output_shape=x.shape)(inputs)
- model = keras.models.Model(inputs, outputs)
- assert model.predict(x[np.newaxis])[0].shape == x.shape
- # pylint: disable=g-long-lambda
- outputs1 = keras.layers.Lambda(lambda x:
- preprocess_input(x, 'channels_last'),
- output_shape=x.shape)(inputs)
- model1 = keras.models.Model(inputs, outputs1)
- out1 = model1.predict(x[np.newaxis])[0]
- x2 = np.transpose(x, (2, 0, 1))
- inputs2 = keras.layers.Input(shape=x2.shape)
- outputs2 = keras.layers.Lambda(lambda x:
- preprocess_input(x, 'channels_first'),
- output_shape=x2.shape)(inputs2) # pylint: disable=g-long-lambda
- model2 = keras.models.Model(inputs2, outputs2)
- out2 = model2.predict(x2[np.newaxis])[0]
- self.assertAllClose(out1, out2.transpose(1, 2, 0))
-
-
-if __name__ == '__main__':
- test.main()
diff --git a/tensorflow/python/keras/applications/inception_resnet_v2_test.py b/tensorflow/python/keras/applications/inception_resnet_v2_test.py
deleted file mode 100644
index 0a12f88505..0000000000
--- a/tensorflow/python/keras/applications/inception_resnet_v2_test.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Tests for Inception V3 application."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import numpy as np
-
-from tensorflow.python import keras
-from tensorflow.python.platform import test
-
-
-class InceptionResNetV2Test(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.InceptionResNetV2(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.InceptionResNetV2(weights=None,
- include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 1536))
-
- def test_with_pooling(self):
- model = keras.applications.InceptionResNetV2(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 1536))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.InceptionResNetV2(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.InceptionResNetV2(weights='imagenet',
- classes=2000)
-
- def test_preprocess_input(self):
- x = np.random.uniform(0, 255, (2, 300, 200, 3))
- out1 = keras.applications.inception_resnet_v2.preprocess_input(x)
- self.assertAllClose(np.mean(out1), 0., atol=0.1)
-
-
-if __name__ == '__main__':
- test.main()
diff --git a/tensorflow/python/keras/applications/inception_v3_test.py b/tensorflow/python/keras/applications/inception_v3_test.py
deleted file mode 100644
index a3fcdd5564..0000000000
--- a/tensorflow/python/keras/applications/inception_v3_test.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Tests for Inception V3 application."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import numpy as np
-
-from tensorflow.python import keras
-from tensorflow.python.platform import test
-
-
-class InceptionV3Test(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.InceptionV3(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.InceptionV3(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 2048))
-
- def test_with_pooling(self):
- model = keras.applications.InceptionV3(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 2048))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.InceptionV3(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.InceptionV3(weights='imagenet',
- classes=2000)
-
- def test_preprocess_input(self):
- x = np.random.uniform(0, 255, (2, 300, 200, 3))
- out1 = keras.applications.inception_v3.preprocess_input(x)
- self.assertAllClose(np.mean(out1), 0., atol=0.1)
-
-
-if __name__ == '__main__':
- test.main()
diff --git a/tensorflow/python/keras/applications/mobilenet_test.py b/tensorflow/python/keras/applications/mobilenet_test.py
deleted file mode 100644
index 65e4991ded..0000000000
--- a/tensorflow/python/keras/applications/mobilenet_test.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Tests for MobileNet application."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import numpy as np
-
-from tensorflow.python import keras
-from tensorflow.python.platform import test
-
-
-class MobileNetTest(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.MobileNet(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.MobileNet(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 1024))
-
- def test_with_pooling(self):
- model = keras.applications.MobileNet(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 1024))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.MobileNet(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.MobileNet(weights='imagenet',
- classes=2000)
-
- def test_preprocess_input(self):
- x = np.random.uniform(0, 255, (2, 300, 200, 3))
- out1 = keras.applications.mobilenet.preprocess_input(x)
- self.assertAllClose(np.mean(out1), 0., atol=0.1)
-
- def test_mobilenet_variable_input_channels(self):
- input_shape = (None, None, 1)
- model = keras.applications.MobileNet(weights=None,
- include_top=False,
- input_shape=input_shape)
- self.assertEqual(model.output_shape, (None, None, None, 1024))
-
- input_shape = (None, None, 4)
- model = keras.applications.MobileNet(weights=None,
- include_top=False,
- input_shape=input_shape)
- self.assertEqual(model.output_shape, (None, None, None, 1024))
-
-
-if __name__ == '__main__':
- test.main()
diff --git a/tensorflow/python/keras/applications/mobilenet_v2.py b/tensorflow/python/keras/applications/mobilenet_v2.py
index 74b8b029f8..9194c3ee14 100644
--- a/tensorflow/python/keras/applications/mobilenet_v2.py
+++ b/tensorflow/python/keras/applications/mobilenet_v2.py
@@ -19,14 +19,4 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-from keras_applications import mobilenet_v2
-
-from tensorflow.python.util.tf_export import tf_export
-
-MobileNetV2 = mobilenet_v2.MobileNetV2
-decode_predictions = mobilenet_v2.decode_predictions
-preprocess_input = mobilenet_v2.preprocess_input
-
-tf_export('keras.applications.mobilenet_v2.MobileNetV2',
- 'keras.applications.MobileNetV2')(MobileNetV2)
-tf_export('keras.applications.mobilenet_v2.preprocess_input')(preprocess_input)
+# TODO(fchollet): export MobileNetV2 as part of the public API in next version.
diff --git a/tensorflow/python/keras/applications/nasnet_test.py b/tensorflow/python/keras/applications/nasnet_test.py
deleted file mode 100644
index f96c3aa51c..0000000000
--- a/tensorflow/python/keras/applications/nasnet_test.py
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Tests for Nasnet application."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-from tensorflow.python import keras
-from tensorflow.python.platform import test
-
-
-class NASNetMobileTest(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.NASNetMobile(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.NASNetMobile(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 1056))
-
- def test_with_pooling(self):
- model = keras.applications.NASNetMobile(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 1056))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.NASNetMobile(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.NASNetMobile(weights='imagenet',
- classes=2000)
-
-
-class NASNetLargeTest(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.NASNetLarge(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.NASNetLarge(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 4032))
-
- def test_with_pooling(self):
- model = keras.applications.NASNetLarge(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 4032))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.NASNetLarge(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.NASNetLarge(weights='imagenet',
- classes=2000)
-
-
-if __name__ == '__main__':
- test.main()
diff --git a/tensorflow/python/keras/applications/resnet50_test.py b/tensorflow/python/keras/applications/resnet50_test.py
deleted file mode 100644
index 22a3f05580..0000000000
--- a/tensorflow/python/keras/applications/resnet50_test.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Tests for ResNet50 application."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-from tensorflow.python import keras
-from tensorflow.python.platform import test
-
-
-class ResNet50Test(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.ResNet50(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.ResNet50(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 2048))
-
- def test_with_pooling(self):
- model = keras.applications.ResNet50(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 2048))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.ResNet50(weights='unknown',
- include_top=False)
-
- with self.assertRaises(ValueError):
- keras.applications.ResNet50(weights='imagenet',
- classes=2000)
-
-if __name__ == '__main__':
- test.main()
diff --git a/tensorflow/python/keras/applications/vgg16_test.py b/tensorflow/python/keras/applications/vgg16_test.py
deleted file mode 100644
index cad65765f3..0000000000
--- a/tensorflow/python/keras/applications/vgg16_test.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Tests for VGG16 application."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-from tensorflow.python import keras
-from tensorflow.python.platform import test
-
-
-class VGG16Test(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.VGG16(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.VGG16(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 512))
-
- def test_with_pooling(self):
- model = keras.applications.VGG16(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 512))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.VGG16(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.VGG16(weights='imagenet',
- classes=2000)
-
-if __name__ == '__main__':
- test.main()
diff --git a/tensorflow/python/keras/applications/vgg19_test.py b/tensorflow/python/keras/applications/vgg19_test.py
deleted file mode 100644
index 61dccc0c5c..0000000000
--- a/tensorflow/python/keras/applications/vgg19_test.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Tests for VGG19 application."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-from tensorflow.python import keras
-from tensorflow.python.platform import test
-
-
-class VGG19Test(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.VGG19(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.VGG19(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 512))
-
- def test_with_pooling(self):
- model = keras.applications.VGG19(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 512))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.VGG19(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.VGG19(weights='imagenet',
- classes=2000)
-
-if __name__ == '__main__':
- test.main()
diff --git a/tensorflow/python/keras/applications/xception_test.py b/tensorflow/python/keras/applications/xception_test.py
deleted file mode 100644
index 7e2efd0017..0000000000
--- a/tensorflow/python/keras/applications/xception_test.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ==============================================================================
-"""Tests for Xception application."""
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import numpy as np
-
-from tensorflow.python import keras
-from tensorflow.python.platform import test
-
-
-class XceptionTest(test.TestCase):
-
- def test_with_top(self):
- model = keras.applications.Xception(weights=None)
- self.assertEqual(model.output_shape, (None, 1000))
-
- def test_no_top(self):
- model = keras.applications.Xception(weights=None, include_top=False)
- self.assertEqual(model.output_shape, (None, None, None, 2048))
-
- def test_with_pooling(self):
- model = keras.applications.Xception(weights=None,
- include_top=False,
- pooling='avg')
- self.assertEqual(model.output_shape, (None, 2048))
-
- def test_weight_loading(self):
- with self.assertRaises(ValueError):
- keras.applications.Xception(weights='unknown',
- include_top=False)
- with self.assertRaises(ValueError):
- keras.applications.Xception(weights='imagenet',
- classes=2000)
-
- def test_preprocess_input(self):
- x = np.random.uniform(0, 255, (2, 300, 200, 3))
- out1 = keras.applications.xception.preprocess_input(x)
- self.assertAllClose(np.mean(out1), 0., atol=0.1)
-
-if __name__ == '__main__':
- test.main()
diff --git a/tensorflow/python/tools/api/generator/api_init_files.bzl b/tensorflow/python/tools/api/generator/api_init_files.bzl
index 64f0469482..7001e566ce 100644
--- a/tensorflow/python/tools/api/generator/api_init_files.bzl
+++ b/tensorflow/python/tools/api/generator/api_init_files.bzl
@@ -25,7 +25,6 @@ TENSORFLOW_API_INIT_FILES = [
"keras/applications/inception_resnet_v2/__init__.py",
"keras/applications/inception_v3/__init__.py",
"keras/applications/mobilenet/__init__.py",
- "keras/applications/mobilenet_v2/__init__.py",
"keras/applications/nasnet/__init__.py",
"keras/applications/resnet50/__init__.py",
"keras/applications/vgg16/__init__.py",
diff --git a/tensorflow/python/tools/api/generator/api_init_files_v1.bzl b/tensorflow/python/tools/api/generator/api_init_files_v1.bzl
index bc2f3516d1..73d11199d9 100644
--- a/tensorflow/python/tools/api/generator/api_init_files_v1.bzl
+++ b/tensorflow/python/tools/api/generator/api_init_files_v1.bzl
@@ -25,7 +25,6 @@ TENSORFLOW_API_INIT_FILES_V1 = [
"keras/applications/inception_resnet_v2/__init__.py",
"keras/applications/inception_v3/__init__.py",
"keras/applications/mobilenet/__init__.py",
- "keras/applications/mobilenet_v2/__init__.py",
"keras/applications/nasnet/__init__.py",
"keras/applications/resnet50/__init__.py",
"keras/applications/vgg16/__init__.py",