diff --git a/mediapipe/model_maker/python/core/utils/BUILD b/mediapipe/model_maker/python/core/utils/BUILD index e4b18b39..2538ec8f 100644 --- a/mediapipe/model_maker/python/core/utils/BUILD +++ b/mediapipe/model_maker/python/core/utils/BUILD @@ -31,20 +31,6 @@ py_library( ], ) -py_library( - name = "image_preprocessing", - srcs = ["image_preprocessing.py"], - srcs_version = "PY3", -) - -py_test( - name = "image_preprocessing_test", - srcs = ["image_preprocessing_test.py"], - python_version = "PY3", - srcs_version = "PY3", - deps = [":image_preprocessing"], -) - py_library( name = "model_util", srcs = ["model_util.py"], diff --git a/mediapipe/model_maker/python/vision/core/BUILD b/mediapipe/model_maker/python/vision/core/BUILD new file mode 100644 index 00000000..2658841a --- /dev/null +++ b/mediapipe/model_maker/python/vision/core/BUILD @@ -0,0 +1,33 @@ +# Copyright 2022 The MediaPipe 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. + +# Placeholder for internal Python strict library compatibility macro. +# Placeholder for internal Python strict test compatibility macro. + +licenses(["notice"]) + +package( + default_visibility = ["//mediapipe:__subpackages__"], +) + +py_library( + name = "image_preprocessing", + srcs = ["image_preprocessing.py"], +) + +py_test( + name = "image_preprocessing_test", + srcs = ["image_preprocessing_test.py"], + deps = [":image_preprocessing"], +) diff --git a/mediapipe/model_maker/python/vision/core/__init__.py b/mediapipe/model_maker/python/vision/core/__init__.py new file mode 100644 index 00000000..7ca2f921 --- /dev/null +++ b/mediapipe/model_maker/python/vision/core/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022 The MediaPipe 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. diff --git a/mediapipe/model_maker/python/core/utils/image_preprocessing.py b/mediapipe/model_maker/python/vision/core/image_preprocessing.py similarity index 98% rename from mediapipe/model_maker/python/core/utils/image_preprocessing.py rename to mediapipe/model_maker/python/vision/core/image_preprocessing.py index 62b34fb2..104ccd9c 100644 --- a/mediapipe/model_maker/python/core/utils/image_preprocessing.py +++ b/mediapipe/model_maker/python/vision/core/image_preprocessing.py @@ -13,11 +13,7 @@ # limitations under the License. # ============================================================================== """ImageNet preprocessing.""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -# Dependency imports import tensorflow as tf IMAGE_SIZE = 224 diff --git a/mediapipe/model_maker/python/core/utils/image_preprocessing_test.py b/mediapipe/model_maker/python/vision/core/image_preprocessing_test.py similarity index 94% rename from mediapipe/model_maker/python/core/utils/image_preprocessing_test.py rename to mediapipe/model_maker/python/vision/core/image_preprocessing_test.py index bc4b4456..0594b437 100644 --- a/mediapipe/model_maker/python/core/utils/image_preprocessing_test.py +++ b/mediapipe/model_maker/python/vision/core/image_preprocessing_test.py @@ -12,15 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -# Dependency imports import numpy as np import tensorflow as tf -from mediapipe.model_maker.python.core.utils import image_preprocessing +from mediapipe.model_maker.python.vision.core import image_preprocessing def _get_preprocessed_image(preprocessor, is_training=False): diff --git a/mediapipe/model_maker/python/vision/image_classifier/BUILD b/mediapipe/model_maker/python/vision/image_classifier/BUILD index a9386d56..5b4ec2bd 100644 --- a/mediapipe/model_maker/python/vision/image_classifier/BUILD +++ b/mediapipe/model_maker/python/vision/image_classifier/BUILD @@ -78,9 +78,9 @@ py_library( ":train_image_classifier_lib", "//mediapipe/model_maker/python/core/data:classification_dataset", "//mediapipe/model_maker/python/core/tasks:classifier", - "//mediapipe/model_maker/python/core/utils:image_preprocessing", "//mediapipe/model_maker/python/core/utils:model_util", "//mediapipe/model_maker/python/core/utils:quantization", + "//mediapipe/model_maker/python/vision/core:image_preprocessing", ], ) diff --git a/mediapipe/model_maker/python/vision/image_classifier/image_classifier.py b/mediapipe/model_maker/python/vision/image_classifier/image_classifier.py index 9161b12e..dd8929a7 100644 --- a/mediapipe/model_maker/python/vision/image_classifier/image_classifier.py +++ b/mediapipe/model_maker/python/vision/image_classifier/image_classifier.py @@ -20,9 +20,9 @@ import tensorflow_hub as hub from mediapipe.model_maker.python.core.data import classification_dataset as classification_ds from mediapipe.model_maker.python.core.tasks import classifier -from mediapipe.model_maker.python.core.utils import image_preprocessing from mediapipe.model_maker.python.core.utils import model_util from mediapipe.model_maker.python.core.utils import quantization +from mediapipe.model_maker.python.vision.core import image_preprocessing from mediapipe.model_maker.python.vision.image_classifier import hyperparameters as hp from mediapipe.model_maker.python.vision.image_classifier import model_spec as ms from mediapipe.model_maker.python.vision.image_classifier import train_image_classifier_lib