Skip to content

Commit

Permalink
Remove direct imports of tf.keras (#2048)
Browse files Browse the repository at this point in the history
* Remove direct imports of keras

* Undo change in predict_utils

* Undo augmentation layer changes
  • Loading branch information
ianstenbit authored Sep 7, 2023
1 parent 2a0d753 commit fba14c2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion keras_cv/callbacks/pycoco_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
from keras.callbacks import Callback
from tensorflow.keras.callbacks import Callback

from keras_cv import bounding_box
from keras_cv.api_export import keras_cv_export
Expand Down
7 changes: 3 additions & 4 deletions keras_cv/callbacks/waymo_evaluation_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import tensorflow as tf
from keras.callbacks import Callback
from tensorflow.keras.callbacks import Callback

from keras_cv.api_export import keras_cv_export
from keras_cv.bounding_box_3d import CENTER_XYZ_DXDYDZ_PHI
from keras_cv.utils import assert_waymo_open_dataset_installed

try:
Expand All @@ -26,9 +28,6 @@
except ImportError:
WODDetectionEvaluator = None

from keras_cv.api_export import keras_cv_export
from keras_cv.bounding_box_3d import CENTER_XYZ_DXDYDZ_PHI


@keras_cv_export("keras_cv.callbacks.WaymoEvaluationCallback")
class WaymoEvaluationCallback(Callback):
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/random_zoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


import tensorflow as tf
from keras import backend
from tensorflow.keras import backend

from keras_cv.api_export import keras_cv_export
from keras_cv.layers.preprocessing.vectorized_base_image_augmentation_layer import ( # noqa: E501
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/models/legacy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# ==============================================================================
"""Utility functions for models"""

from keras import layers
from tensorflow import keras
from tensorflow.keras import layers


def parse_model_inputs(input_shape, input_tensor):
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/models/legacy/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.
"""Tests for KerasCV model utils."""

from keras import layers
from tensorflow import keras
from tensorflow.keras import layers

from keras_cv.models.legacy import utils
from keras_cv.tests.test_case import TestCase
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/models/legacy/weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
import tensorflow as tf
from keras import utils
from tensorflow.keras import utils


def parse_weights(weights, include_top, model_type):
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/models/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
"""Tests for KerasCV model utils."""

from keras import layers
from tensorflow.keras import layers

from keras_cv.models import utils
from keras_cv.tests.test_case import TestCase
Expand Down

0 comments on commit fba14c2

Please sign in to comment.