From f72f9485ebe2a9d47597f81c875bf1f879c76fe6 Mon Sep 17 00:00:00 2001 From: Samaneh Saadat Date: Tue, 30 Apr 2024 23:54:38 +0000 Subject: [PATCH 1/3] Improve error handling for missing TensorFlow dependency in keras_cv --- keras_cv/src/backend/tf_ops.py | 8 +++++++- keras_cv/src/bounding_box/converters.py | 8 +++++++- keras_cv/src/bounding_box/converters_test.py | 8 +++++++- .../bounding_box/mask_invalid_detections_test.py | 8 +++++++- keras_cv/src/bounding_box/to_dense.py | 8 +++++++- keras_cv/src/bounding_box/to_dense_test.py | 8 +++++++- keras_cv/src/bounding_box/to_ragged.py | 8 +++++++- keras_cv/src/bounding_box/validate_format.py | 8 +++++++- .../src/callbacks/waymo_evaluation_callback.py | 8 +++++++- .../callbacks/waymo_evaluation_callback_test.py | 8 +++++++- .../factor_sampler/constant_factor_sampler.py | 8 +++++++- .../core/factor_sampler/normal_factor_sampler.py | 8 +++++++- .../factor_sampler/uniform_factor_sampler.py | 8 +++++++- keras_cv/src/datasets/imagenet/load.py | 8 +++++++- keras_cv/src/datasets/pascal_voc/load.py | 8 +++++++- keras_cv/src/datasets/pascal_voc/segmentation.py | 8 +++++++- .../src/datasets/pascal_voc/segmentation_test.py | 8 +++++++- keras_cv/src/datasets/waymo/load.py | 8 +++++++- keras_cv/src/datasets/waymo/struct.py | 8 +++++++- keras_cv/src/datasets/waymo/transformer.py | 8 +++++++- keras_cv/src/datasets/waymo/transformer_test.py | 8 +++++++- keras_cv/src/keypoint/converters.py | 8 +++++++- keras_cv/src/keypoint/converters_test.py | 8 +++++++- keras_cv/src/keypoint/utils.py | 8 +++++++- keras_cv/src/keypoint/utils_test.py | 8 +++++++- keras_cv/src/layers/fusedmbconv_test.py | 8 +++++++- keras_cv/src/layers/mbconv_test.py | 8 +++++++- .../multi_class_non_max_suppression.py | 8 +++++++- .../multi_class_non_max_suppression_test.py | 8 +++++++- .../object_detection/non_max_suppression.py | 16 ++++++++++++++-- .../centernet_label_encoder.py | 8 +++++++- .../centernet_label_encoder_test.py | 8 +++++++- .../layers/object_detection_3d/voxel_utils.py | 8 +++++++- .../object_detection_3d/voxel_utils_test.py | 8 +++++++- .../object_detection_3d/voxelization_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/aug_mix.py | 8 +++++++- .../src/layers/preprocessing/aug_mix_test.py | 8 +++++++- .../src/layers/preprocessing/auto_contrast.py | 8 +++++++- .../base_image_augmentation_layer.py | 8 +++++++- .../base_image_augmentation_layer_test.py | 8 +++++++- .../src/layers/preprocessing/channel_shuffle.py | 8 +++++++- .../layers/preprocessing/channel_shuffle_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/cut_mix.py | 8 +++++++- .../src/layers/preprocessing/cut_mix_test.py | 8 +++++++- .../src/layers/preprocessing/equalization.py | 8 +++++++- keras_cv/src/layers/preprocessing/fourier_mix.py | 8 +++++++- .../src/layers/preprocessing/fourier_mix_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/grayscale.py | 8 +++++++- .../src/layers/preprocessing/grayscale_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/grid_mask.py | 8 +++++++- .../src/layers/preprocessing/grid_mask_test.py | 8 +++++++- .../src/layers/preprocessing/jittered_resize.py | 8 +++++++- .../layers/preprocessing/jittered_resize_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/mix_up.py | 8 +++++++- keras_cv/src/layers/preprocessing/mix_up_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/mosaic.py | 8 +++++++- keras_cv/src/layers/preprocessing/mosaic_test.py | 8 +++++++- .../src/layers/preprocessing/posterization.py | 8 +++++++- .../layers/preprocessing/posterization_test.py | 8 +++++++- .../layers/preprocessing/ragged_image_test.py | 8 +++++++- .../layers/preprocessing/rand_augment_test.py | 8 +++++++- .../layers/preprocessing/random_apply_test.py | 8 +++++++- .../layers/preprocessing/random_aspect_ratio.py | 8 +++++++- .../preprocessing/random_aspect_ratio_test.py | 8 +++++++- .../random_augmentation_pipeline.py | 8 +++++++- .../random_augmentation_pipeline_test.py | 8 +++++++- .../layers/preprocessing/random_brightness.py | 8 +++++++- .../preprocessing/random_brightness_test.py | 8 +++++++- .../layers/preprocessing/random_channel_shift.py | 8 +++++++- .../preprocessing/random_channel_shift_test.py | 8 +++++++- .../src/layers/preprocessing/random_choice.py | 8 +++++++- .../layers/preprocessing/random_choice_test.py | 8 +++++++- .../preprocessing/random_color_degeneration.py | 8 +++++++- .../random_color_degeneration_test.py | 8 +++++++- .../preprocessing/random_color_jitter_test.py | 8 +++++++- .../src/layers/preprocessing/random_contrast.py | 8 +++++++- .../layers/preprocessing/random_contrast_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/random_crop.py | 8 +++++++- .../preprocessing/random_crop_and_resize.py | 8 +++++++- .../preprocessing/random_crop_and_resize_test.py | 8 +++++++- .../src/layers/preprocessing/random_crop_test.py | 8 +++++++- .../src/layers/preprocessing/random_cutout.py | 8 +++++++- .../layers/preprocessing/random_cutout_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/random_flip.py | 8 +++++++- .../src/layers/preprocessing/random_flip_test.py | 8 +++++++- .../layers/preprocessing/random_gaussian_blur.py | 8 +++++++- .../preprocessing/random_gaussian_blur_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/random_hue.py | 8 +++++++- .../layers/preprocessing/random_jpeg_quality.py | 8 +++++++- .../preprocessing/random_jpeg_quality_test.py | 8 +++++++- .../src/layers/preprocessing/random_rotation.py | 8 +++++++- .../layers/preprocessing/random_rotation_test.py | 8 +++++++- .../layers/preprocessing/random_saturation.py | 8 +++++++- .../preprocessing/random_saturation_test.py | 8 +++++++- .../src/layers/preprocessing/random_sharpness.py | 8 +++++++- .../preprocessing/random_sharpness_test.py | 8 +++++++- .../src/layers/preprocessing/random_shear.py | 8 +++++++- .../layers/preprocessing/random_shear_test.py | 8 +++++++- .../layers/preprocessing/random_translation.py | 8 +++++++- .../preprocessing/random_translation_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/random_zoom.py | 8 +++++++- .../src/layers/preprocessing/random_zoom_test.py | 8 +++++++- .../preprocessing/repeated_augmentation.py | 8 +++++++- .../preprocessing/repeated_augmentation_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/rescaling.py | 8 +++++++- .../src/layers/preprocessing/rescaling_test.py | 8 +++++++- keras_cv/src/layers/preprocessing/resizing.py | 8 +++++++- .../src/layers/preprocessing/resizing_test.py | 8 +++++++- .../src/layers/preprocessing/solarization.py | 8 +++++++- .../layers/preprocessing/solarization_test.py | 8 +++++++- .../vectorized_base_image_augmentation_layer.py | 8 +++++++- ...torized_base_image_augmentation_layer_test.py | 8 +++++++- .../src/layers/preprocessing/with_labels_test.py | 8 +++++++- .../preprocessing/with_mixed_precision_test.py | 8 +++++++- .../with_segmentation_masks_test.py | 8 +++++++- .../base_augmentation_layer_3d.py | 8 +++++++- .../base_augmentation_layer_3d_test.py | 8 +++++++- .../layers/preprocessing_3d/input_format_test.py | 8 +++++++- .../waymo/frustum_random_dropping_points.py | 8 +++++++- .../waymo/frustum_random_point_feature_noise.py | 8 +++++++- .../waymo/global_random_dropping_points.py | 8 +++++++- .../preprocessing_3d/waymo/global_random_flip.py | 8 +++++++- .../waymo/global_random_rotation.py | 8 +++++++- .../waymo/global_random_scaling.py | 8 +++++++- .../waymo/global_random_translation.py | 8 +++++++- .../waymo/group_points_by_bounding_boxes.py | 8 +++++++- .../waymo/group_points_by_bounding_boxes_test.py | 8 +++++++- .../preprocessing_3d/waymo/random_copy_paste.py | 8 +++++++- .../preprocessing_3d/waymo/random_drop_box.py | 8 +++++++- .../preprocessing_3d/waymo/swap_background.py | 8 +++++++- .../src/layers/regularization/drop_path_test.py | 8 +++++++- .../layers/regularization/dropblock_2d_test.py | 8 +++++++- .../layers/regularization/squeeze_excite_test.py | 8 +++++++- .../regularization/stochastic_depth_test.py | 8 +++++++- keras_cv/src/layers/transformer_encoder_test.py | 8 +++++++- keras_cv/src/layers/vit_layers.py | 8 +++++++- keras_cv/src/layers/vit_layers_test.py | 8 +++++++- keras_cv/src/losses/giou_loss_test.py | 8 +++++++- .../numerical_tests/focal_loss_numerical_test.py | 8 +++++++- .../metrics/object_detection/box_coco_metrics.py | 8 +++++++- .../object_detection/box_coco_metrics_test.py | 8 +++++++- .../csp_darknet_backbone_presets_test.py | 8 +++++++- .../csp_darknet/csp_darknet_backbone_test.py | 8 +++++++- .../mix_transformer/mix_transformer_backbone.py | 8 +++++++- .../resnet_v1/resnet_v1_backbone_test.py | 8 +++++++- .../classification/image_classifier_test.py | 8 +++++++- .../classification/video_classifier_test.py | 8 +++++++- .../feature_extractor/clip/clip_processor.py | 8 +++++++- .../clip/clip_processor_utils.py | 8 +++++++- .../feature_extractor/clip/clip_tokenizer.py | 8 +++++++- keras_cv/src/models/legacy/convmixer.py | 8 +++++++- keras_cv/src/models/legacy/convnext.py | 8 +++++++- keras_cv/src/models/legacy/darknet.py | 8 +++++++- keras_cv/src/models/legacy/mlp_mixer.py | 8 +++++++- keras_cv/src/models/legacy/models_test.py | 8 +++++++- .../object_detection/faster_rcnn/faster_rcnn.py | 8 +++++++- .../faster_rcnn/faster_rcnn_test.py | 8 +++++++- keras_cv/src/models/legacy/regnet.py | 8 +++++++- keras_cv/src/models/legacy/vgg16.py | 8 +++++++- keras_cv/src/models/legacy/vgg19.py | 8 +++++++- keras_cv/src/models/legacy/vit.py | 8 +++++++- keras_cv/src/models/legacy/weights.py | 8 +++++++- .../src/models/object_detection/__internal__.py | 8 +++++++- .../models/object_detection/__test_utils__.py | 8 +++++++- .../src/models/object_detection/predict_utils.py | 8 +++++++- .../retinanet/retinanet_label_encoder.py | 8 +++++++- .../retinanet/retinanet_label_encoder_test.py | 8 +++++++- .../object_detection/retinanet/retinanet_test.py | 8 +++++++- .../yolo_v8/yolo_v8_label_encoder.py | 8 +++++++- .../yolox/binary_crossentropy.py | 8 +++++++- .../yolox/layers/yolox_decoder.py | 8 +++++++- .../yolox/layers/yolox_head_test.py | 8 +++++++- .../yolox/layers/yolox_label_encoder.py | 8 +++++++- .../yolox/layers/yolox_label_encoder_test.py | 8 +++++++- .../yolox/layers/yolox_pafpn_test.py | 8 +++++++- .../center_pillar_backbone_test.py | 8 +++++++- .../object_detection_3d/center_pillar_test.py | 8 +++++++- .../models/segmentation/basnet/basnet_test.py | 8 +++++++- .../deeplab_v3_plus/deeplab_v3_plus_test.py | 8 +++++++- .../models/segmentation/segformer/segformer.py | 6 ++++++ .../segmentation/segformer/segformer_test.py | 8 +++++++- keras_cv/src/point_cloud/point_cloud.py | 8 +++++++- keras_cv/src/point_cloud/point_cloud_test.py | 8 +++++++- keras_cv/src/point_cloud/within_box_3d_test.py | 8 +++++++- keras_cv/src/tests/test_case.py | 8 +++++++- .../ViT_weight_conversion.ipynb | 8 +++++++- .../tools/training_scipts/Training_YOLOv8.ipynb | 8 +++++++- .../training_deeplab_v3_plus.ipynb | 8 +++++++- .../training/contrastive/contrastive_trainer.py | 8 +++++++- .../contrastive/contrastive_trainer_test.py | 8 +++++++- .../training/contrastive/simclr_trainer_test.py | 8 +++++++- keras_cv/src/utils/fill_utils.py | 8 +++++++- keras_cv/src/utils/fill_utils_test.py | 8 +++++++- keras_cv/src/utils/preprocessing.py | 8 +++++++- keras_cv/src/utils/preprocessing_test.py | 8 +++++++- keras_cv/src/utils/resource_loader.py | 8 +++++++- keras_cv/src/utils/to_numpy.py | 8 +++++++- keras_cv/src/utils/train.py | 8 +++++++- keras_cv/src/version_check_test.py | 8 +++++++- keras_cv/src/visualization/plot_image_gallery.py | 8 +++++++- 200 files changed, 1406 insertions(+), 200 deletions(-) diff --git a/keras_cv/src/backend/tf_ops.py b/keras_cv/src/backend/tf_ops.py index aaf7ec7dfc..cd70d8ba91 100644 --- a/keras_cv/src/backend/tf_ops.py +++ b/keras_cv/src/backend/tf_ops.py @@ -46,7 +46,13 @@ from tensorflow import split # noqa: F403, F401 import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) def smart_resize(x, size, interpolation="bilinear"): diff --git a/keras_cv/src/bounding_box/converters.py b/keras_cv/src/bounding_box/converters.py index 689995644e..34355fcfb6 100644 --- a/keras_cv/src/bounding_box/converters.py +++ b/keras_cv/src/bounding_box/converters.py @@ -14,7 +14,13 @@ """Converter functions for working with bounding box formats.""" -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras diff --git a/keras_cv/src/bounding_box/converters_test.py b/keras_cv/src/bounding_box/converters_test.py index e8f1b949e3..eb1e0eb946 100644 --- a/keras_cv/src/bounding_box/converters_test.py +++ b/keras_cv/src/bounding_box/converters_test.py @@ -16,7 +16,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import bounding_box diff --git a/keras_cv/src/bounding_box/mask_invalid_detections_test.py b/keras_cv/src/bounding_box/mask_invalid_detections_test.py index a8c4fc9a66..18f4589da5 100644 --- a/keras_cv/src/bounding_box/mask_invalid_detections_test.py +++ b/keras_cv/src/bounding_box/mask_invalid_detections_test.py @@ -14,7 +14,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.backend import ops diff --git a/keras_cv/src/bounding_box/to_dense.py b/keras_cv/src/bounding_box/to_dense.py index cd75261287..f7c4c9d9c4 100644 --- a/keras_cv/src/bounding_box/to_dense.py +++ b/keras_cv/src/bounding_box/to_dense.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import keras_cv.src.bounding_box.validate_format as validate_format from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/bounding_box/to_dense_test.py b/keras_cv/src/bounding_box/to_dense_test.py index 9d098c43a3..899991cff0 100644 --- a/keras_cv/src/bounding_box/to_dense_test.py +++ b/keras_cv/src/bounding_box/to_dense_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/bounding_box/to_ragged.py b/keras_cv/src/bounding_box/to_ragged.py index 113367b82d..b30d85f596 100644 --- a/keras_cv/src/bounding_box/to_ragged.py +++ b/keras_cv/src/bounding_box/to_ragged.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import keras_cv.src.bounding_box.validate_format as validate_format from keras_cv.src import backend diff --git a/keras_cv/src/bounding_box/validate_format.py b/keras_cv/src/bounding_box/validate_format.py index ec42a00e50..31449f8bca 100644 --- a/keras_cv/src/bounding_box/validate_format.py +++ b/keras_cv/src/bounding_box/validate_format.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/callbacks/waymo_evaluation_callback.py b/keras_cv/src/callbacks/waymo_evaluation_callback.py index c678ddb3c3..78d7f14514 100644 --- a/keras_cv/src/callbacks/waymo_evaluation_callback.py +++ b/keras_cv/src/callbacks/waymo_evaluation_callback.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow.keras.callbacks import Callback from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/callbacks/waymo_evaluation_callback_test.py b/keras_cv/src/callbacks/waymo_evaluation_callback_test.py index 3a496000e0..1a55d68f7d 100644 --- a/keras_cv/src/callbacks/waymo_evaluation_callback_test.py +++ b/keras_cv/src/callbacks/waymo_evaluation_callback_test.py @@ -14,7 +14,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from keras_cv.src.callbacks import WaymoEvaluationCallback diff --git a/keras_cv/src/core/factor_sampler/constant_factor_sampler.py b/keras_cv/src/core/factor_sampler/constant_factor_sampler.py index 7faff0dab1..6f7aef3090 100644 --- a/keras_cv/src/core/factor_sampler/constant_factor_sampler.py +++ b/keras_cv/src/core/factor_sampler/constant_factor_sampler.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.core.factor_sampler.factor_sampler import FactorSampler diff --git a/keras_cv/src/core/factor_sampler/normal_factor_sampler.py b/keras_cv/src/core/factor_sampler/normal_factor_sampler.py index 8a0250fdb6..c9ded440b8 100644 --- a/keras_cv/src/core/factor_sampler/normal_factor_sampler.py +++ b/keras_cv/src/core/factor_sampler/normal_factor_sampler.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.core.factor_sampler.factor_sampler import FactorSampler diff --git a/keras_cv/src/core/factor_sampler/uniform_factor_sampler.py b/keras_cv/src/core/factor_sampler/uniform_factor_sampler.py index e17d87de68..5c0eacf3d7 100644 --- a/keras_cv/src/core/factor_sampler/uniform_factor_sampler.py +++ b/keras_cv/src/core/factor_sampler/uniform_factor_sampler.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.core.factor_sampler.factor_sampler import FactorSampler diff --git a/keras_cv/src/datasets/imagenet/load.py b/keras_cv/src/datasets/imagenet/load.py index 86101ba59d..a84ccd3d59 100644 --- a/keras_cv/src/datasets/imagenet/load.py +++ b/keras_cv/src/datasets/imagenet/load.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow.keras import layers from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/datasets/pascal_voc/load.py b/keras_cv/src/datasets/pascal_voc/load.py index d5592fd7b8..64552a5536 100644 --- a/keras_cv/src/datasets/pascal_voc/load.py +++ b/keras_cv/src/datasets/pascal_voc/load.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import tensorflow_datasets as tfds from keras_cv.src import bounding_box diff --git a/keras_cv/src/datasets/pascal_voc/segmentation.py b/keras_cv/src/datasets/pascal_voc/segmentation.py index 678acb6926..a12a72896a 100644 --- a/keras_cv/src/datasets/pascal_voc/segmentation.py +++ b/keras_cv/src/datasets/pascal_voc/segmentation.py @@ -43,7 +43,13 @@ class and instance segmentation masks. import xml import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import tensorflow_datasets as tfds from tensorflow import keras diff --git a/keras_cv/src/datasets/pascal_voc/segmentation_test.py b/keras_cv/src/datasets/pascal_voc/segmentation_test.py index 3695a31c04..56f2aa3407 100644 --- a/keras_cv/src/datasets/pascal_voc/segmentation_test.py +++ b/keras_cv/src/datasets/pascal_voc/segmentation_test.py @@ -15,7 +15,13 @@ import pathlib import sys -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl import flags from keras_cv.src.datasets.pascal_voc import segmentation diff --git a/keras_cv/src/datasets/waymo/load.py b/keras_cv/src/datasets/waymo/load.py index a7bf6ed0b4..29689762e9 100644 --- a/keras_cv/src/datasets/waymo/load.py +++ b/keras_cv/src/datasets/waymo/load.py @@ -14,7 +14,13 @@ """Data loader for the Waymo Open Dataset.""" import os -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.datasets.waymo import transformer from keras_cv.src.utils import assert_waymo_open_dataset_installed diff --git a/keras_cv/src/datasets/waymo/struct.py b/keras_cv/src/datasets/waymo/struct.py index 87e7179072..29722bea55 100644 --- a/keras_cv/src/datasets/waymo/struct.py +++ b/keras_cv/src/datasets/waymo/struct.py @@ -16,7 +16,13 @@ import dataclasses from typing import Optional -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) @dataclasses.dataclass diff --git a/keras_cv/src/datasets/waymo/transformer.py b/keras_cv/src/datasets/waymo/transformer.py index 94dc93dcab..5b17dd1510 100644 --- a/keras_cv/src/datasets/waymo/transformer.py +++ b/keras_cv/src/datasets/waymo/transformer.py @@ -20,7 +20,13 @@ from typing import Tuple import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.utils import assert_waymo_open_dataset_installed diff --git a/keras_cv/src/datasets/waymo/transformer_test.py b/keras_cv/src/datasets/waymo/transformer_test.py index 04941553d4..48f821cf42 100644 --- a/keras_cv/src/datasets/waymo/transformer_test.py +++ b/keras_cv/src/datasets/waymo/transformer_test.py @@ -15,7 +15,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/keypoint/converters.py b/keras_cv/src/keypoint/converters.py index 60e6b9b046..4b8eeedf74 100644 --- a/keras_cv/src/keypoint/converters.py +++ b/keras_cv/src/keypoint/converters.py @@ -13,7 +13,13 @@ # limitations under the License. """Converter functions for working with keypoints formats.""" -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/keypoint/converters_test.py b/keras_cv/src/keypoint/converters_test.py index 185ca50648..69d3d3da52 100644 --- a/keras_cv/src/keypoint/converters_test.py +++ b/keras_cv/src/keypoint/converters_test.py @@ -15,7 +15,13 @@ import itertools import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import keypoint diff --git a/keras_cv/src/keypoint/utils.py b/keras_cv/src/keypoint/utils.py index de776cf217..c90d3b8d72 100644 --- a/keras_cv/src/keypoint/utils.py +++ b/keras_cv/src/keypoint/utils.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. """Utility functions for keypoint transformation.""" -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/keypoint/utils_test.py b/keras_cv/src/keypoint/utils_test.py index 636c595deb..928eb2b261 100644 --- a/keras_cv/src/keypoint/utils_test.py +++ b/keras_cv/src/keypoint/utils_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.keypoint.utils import filter_out_of_image diff --git a/keras_cv/src/layers/fusedmbconv_test.py b/keras_cv/src/layers/fusedmbconv_test.py index 1e33a821d5..b16f59cba8 100644 --- a/keras_cv/src/layers/fusedmbconv_test.py +++ b/keras_cv/src/layers/fusedmbconv_test.py @@ -13,7 +13,13 @@ # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from keras_cv.src.layers.fusedmbconv import FusedMBConvBlock diff --git a/keras_cv/src/layers/mbconv_test.py b/keras_cv/src/layers/mbconv_test.py index 8ac36764f6..02b3a61b84 100644 --- a/keras_cv/src/layers/mbconv_test.py +++ b/keras_cv/src/layers/mbconv_test.py @@ -13,7 +13,13 @@ # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from keras_cv.src.layers.mbconv import MBConvBlock diff --git a/keras_cv/src/layers/object_detection/multi_class_non_max_suppression.py b/keras_cv/src/layers/object_detection/multi_class_non_max_suppression.py index fe22491626..b2fc77e168 100644 --- a/keras_cv/src/layers/object_detection/multi_class_non_max_suppression.py +++ b/keras_cv/src/layers/object_detection/multi_class_non_max_suppression.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py b/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py index 7d689159b0..890e1e99d6 100644 --- a/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py +++ b/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py @@ -13,7 +13,13 @@ # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import layers as cv_layers from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/object_detection/non_max_suppression.py b/keras_cv/src/layers/object_detection/non_max_suppression.py index 45993258e4..3a0375348b 100644 --- a/keras_cv/src/layers/object_detection/non_max_suppression.py +++ b/keras_cv/src/layers/object_detection/non_max_suppression.py @@ -14,7 +14,13 @@ import math -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export @@ -323,7 +329,13 @@ def suppression_loop_body(boxes, iou_threshold, output_size, idx): ops.reshape(sorted_indices, [-1]), take_along_axis_idx ) else: - import tensorflow as tf + try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) idx = tf.gather(ops.reshape(sorted_indices, [-1]), take_along_axis_idx) idx = ops.reshape(idx, [batch_size, -1]) diff --git a/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py b/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py index d6d61d2fb8..bb37d2c5ae 100644 --- a/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py +++ b/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py @@ -18,7 +18,13 @@ from typing import Union import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/object_detection_3d/centernet_label_encoder_test.py b/keras_cv/src/layers/object_detection_3d/centernet_label_encoder_test.py index 928a944351..9afd6f90bd 100644 --- a/keras_cv/src/layers/object_detection_3d/centernet_label_encoder_test.py +++ b/keras_cv/src/layers/object_detection_3d/centernet_label_encoder_test.py @@ -13,7 +13,13 @@ # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers.object_detection_3d.centernet_label_encoder import ( CenterNetLabelEncoder, diff --git a/keras_cv/src/layers/object_detection_3d/voxel_utils.py b/keras_cv/src/layers/object_detection_3d/voxel_utils.py index 94a0bda60b..6253ecc51f 100644 --- a/keras_cv/src/layers/object_detection_3d/voxel_utils.py +++ b/keras_cv/src/layers/object_detection_3d/voxel_utils.py @@ -15,7 +15,13 @@ import math import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops diff --git a/keras_cv/src/layers/object_detection_3d/voxel_utils_test.py b/keras_cv/src/layers/object_detection_3d/voxel_utils_test.py index e3c1115bab..518f748456 100644 --- a/keras_cv/src/layers/object_detection_3d/voxel_utils_test.py +++ b/keras_cv/src/layers/object_detection_3d/voxel_utils_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers.object_detection_3d import voxel_utils from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/object_detection_3d/voxelization_test.py b/keras_cv/src/layers/object_detection_3d/voxelization_test.py index 27795a1717..007f538b7e 100644 --- a/keras_cv/src/layers/object_detection_3d/voxelization_test.py +++ b/keras_cv/src/layers/object_detection_3d/voxelization_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import keras from keras_cv.src.layers.object_detection_3d.voxelization import ( diff --git a/keras_cv/src/layers/preprocessing/aug_mix.py b/keras_cv/src/layers/preprocessing/aug_mix.py index dbd9d5ea61..7e5cbe52a9 100644 --- a/keras_cv/src/layers/preprocessing/aug_mix.py +++ b/keras_cv/src/layers/preprocessing/aug_mix.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import layers from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/aug_mix_test.py b/keras_cv/src/layers/preprocessing/aug_mix_test.py index c39130d536..b9fe79de7b 100644 --- a/keras_cv/src/layers/preprocessing/aug_mix_test.py +++ b/keras_cv/src/layers/preprocessing/aug_mix_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers import preprocessing from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/auto_contrast.py b/keras_cv/src/layers/preprocessing/auto_contrast.py index eb78e8810c..4f29a95f1e 100644 --- a/keras_cv/src/layers/preprocessing/auto_contrast.py +++ b/keras_cv/src/layers/preprocessing/auto_contrast.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.vectorized_base_image_augmentation_layer import ( # noqa: E501 diff --git a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py index ff67f0b9d0..8ea49c36b7 100644 --- a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py +++ b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py @@ -13,7 +13,13 @@ # limitations under the License. import keras -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import tree if hasattr(keras, "src"): diff --git a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py index 8269010524..81ff8d6c24 100644 --- a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py +++ b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.backend import ops diff --git a/keras_cv/src/layers/preprocessing/channel_shuffle.py b/keras_cv/src/layers/preprocessing/channel_shuffle.py index 931be7b770..5f0b25e499 100644 --- a/keras_cv/src/layers/preprocessing/channel_shuffle.py +++ b/keras_cv/src/layers/preprocessing/channel_shuffle.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.vectorized_base_image_augmentation_layer import ( # noqa: E501 diff --git a/keras_cv/src/layers/preprocessing/channel_shuffle_test.py b/keras_cv/src/layers/preprocessing/channel_shuffle_test.py index 9fa6f2326a..5450cf7ee8 100644 --- a/keras_cv/src/layers/preprocessing/channel_shuffle_test.py +++ b/keras_cv/src/layers/preprocessing/channel_shuffle_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops from keras_cv.src.layers.preprocessing.channel_shuffle import ChannelShuffle diff --git a/keras_cv/src/layers/preprocessing/cut_mix.py b/keras_cv/src/layers/preprocessing/cut_mix.py index b2a02476cc..db0bdf08b6 100644 --- a/keras_cv/src/layers/preprocessing/cut_mix.py +++ b/keras_cv/src/layers/preprocessing/cut_mix.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.base_image_augmentation_layer import ( diff --git a/keras_cv/src/layers/preprocessing/cut_mix_test.py b/keras_cv/src/layers/preprocessing/cut_mix_test.py index 0127b0bc55..4de3feeb70 100644 --- a/keras_cv/src/layers/preprocessing/cut_mix_test.py +++ b/keras_cv/src/layers/preprocessing/cut_mix_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops from keras_cv.src.layers.preprocessing.cut_mix import CutMix diff --git a/keras_cv/src/layers/preprocessing/equalization.py b/keras_cv/src/layers/preprocessing/equalization.py index c09f57caa1..14dd8207cc 100644 --- a/keras_cv/src/layers/preprocessing/equalization.py +++ b/keras_cv/src/layers/preprocessing/equalization.py @@ -14,7 +14,13 @@ from functools import partial -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.vectorized_base_image_augmentation_layer import ( # noqa: E501 diff --git a/keras_cv/src/layers/preprocessing/fourier_mix.py b/keras_cv/src/layers/preprocessing/fourier_mix.py index 35042b1288..18cc79fba1 100644 --- a/keras_cv/src/layers/preprocessing/fourier_mix.py +++ b/keras_cv/src/layers/preprocessing/fourier_mix.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.base_image_augmentation_layer import ( diff --git a/keras_cv/src/layers/preprocessing/fourier_mix_test.py b/keras_cv/src/layers/preprocessing/fourier_mix_test.py index bde18d8504..9752b7b842 100644 --- a/keras_cv/src/layers/preprocessing/fourier_mix_test.py +++ b/keras_cv/src/layers/preprocessing/fourier_mix_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers.preprocessing.fourier_mix import FourierMix from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/grayscale.py b/keras_cv/src/layers/preprocessing/grayscale.py index 6b231ad26a..ea64f8300d 100644 --- a/keras_cv/src/layers/preprocessing/grayscale.py +++ b/keras_cv/src/layers/preprocessing/grayscale.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.vectorized_base_image_augmentation_layer import ( # noqa: E501 diff --git a/keras_cv/src/layers/preprocessing/grayscale_test.py b/keras_cv/src/layers/preprocessing/grayscale_test.py index 2d46308d59..9a8ede921d 100644 --- a/keras_cv/src/layers/preprocessing/grayscale_test.py +++ b/keras_cv/src/layers/preprocessing/grayscale_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers import preprocessing from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/grid_mask.py b/keras_cv/src/layers/preprocessing/grid_mask.py index 68b303ff1a..7647b3be97 100644 --- a/keras_cv/src/layers/preprocessing/grid_mask.py +++ b/keras_cv/src/layers/preprocessing/grid_mask.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import core from keras_cv.src import layers as cv_layers diff --git a/keras_cv/src/layers/preprocessing/grid_mask_test.py b/keras_cv/src/layers/preprocessing/grid_mask_test.py index d32826dec7..d6acec3690 100644 --- a/keras_cv/src/layers/preprocessing/grid_mask_test.py +++ b/keras_cv/src/layers/preprocessing/grid_mask_test.py @@ -14,7 +14,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import keras_cv from keras_cv.src.backend import ops diff --git a/keras_cv/src/layers/preprocessing/jittered_resize.py b/keras_cv/src/layers/preprocessing/jittered_resize.py index 79a75b4f21..e072d19152 100644 --- a/keras_cv/src/layers/preprocessing/jittered_resize.py +++ b/keras_cv/src/layers/preprocessing/jittered_resize.py @@ -16,7 +16,13 @@ # Reference: # https://github.com/tensorflow/models/blob/master/official/vision/ops/preprocess_ops.py -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/jittered_resize_test.py b/keras_cv/src/layers/preprocessing/jittered_resize_test.py index 421ca18607..c0ebe6731f 100644 --- a/keras_cv/src/layers/preprocessing/jittered_resize_test.py +++ b/keras_cv/src/layers/preprocessing/jittered_resize_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src import core diff --git a/keras_cv/src/layers/preprocessing/mix_up.py b/keras_cv/src/layers/preprocessing/mix_up.py index 01fff9cb03..2b062c27ee 100644 --- a/keras_cv/src/layers/preprocessing/mix_up.py +++ b/keras_cv/src/layers/preprocessing/mix_up.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/mix_up_test.py b/keras_cv/src/layers/preprocessing/mix_up_test.py index b8049608a8..5cfc0f519c 100644 --- a/keras_cv/src/layers/preprocessing/mix_up_test.py +++ b/keras_cv/src/layers/preprocessing/mix_up_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers.preprocessing.mix_up import MixUp from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/mosaic.py b/keras_cv/src/layers/preprocessing/mosaic.py index fe1258c623..ab37d989ec 100644 --- a/keras_cv/src/layers/preprocessing/mosaic.py +++ b/keras_cv/src/layers/preprocessing/mosaic.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/mosaic_test.py b/keras_cv/src/layers/preprocessing/mosaic_test.py index ec7574b199..c74b1e392c 100644 --- a/keras_cv/src/layers/preprocessing/mosaic_test.py +++ b/keras_cv/src/layers/preprocessing/mosaic_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers.preprocessing.mosaic import Mosaic from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/posterization.py b/keras_cv/src/layers/preprocessing/posterization.py index b60a1bc8e0..8a796fdf24 100644 --- a/keras_cv/src/layers/preprocessing/posterization.py +++ b/keras_cv/src/layers/preprocessing/posterization.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.base_image_augmentation_layer import ( diff --git a/keras_cv/src/layers/preprocessing/posterization_test.py b/keras_cv/src/layers/preprocessing/posterization_test.py index e61b0a4eb2..08ef5c4a60 100644 --- a/keras_cv/src/layers/preprocessing/posterization_test.py +++ b/keras_cv/src/layers/preprocessing/posterization_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers.preprocessing.posterization import Posterization from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/ragged_image_test.py b/keras_cv/src/layers/preprocessing/ragged_image_test.py index 97882db3ae..60b601ff40 100644 --- a/keras_cv/src/layers/preprocessing/ragged_image_test.py +++ b/keras_cv/src/layers/preprocessing/ragged_image_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import layers diff --git a/keras_cv/src/layers/preprocessing/rand_augment_test.py b/keras_cv/src/layers/preprocessing/rand_augment_test.py index c56829bcf0..528a9b92b0 100644 --- a/keras_cv/src/layers/preprocessing/rand_augment_test.py +++ b/keras_cv/src/layers/preprocessing/rand_augment_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import layers diff --git a/keras_cv/src/layers/preprocessing/random_apply_test.py b/keras_cv/src/layers/preprocessing/random_apply_test.py index 9bff4dbdfa..756ce6c97f 100644 --- a/keras_cv/src/layers/preprocessing/random_apply_test.py +++ b/keras_cv/src/layers/preprocessing/random_apply_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import layers diff --git a/keras_cv/src/layers/preprocessing/random_aspect_ratio.py b/keras_cv/src/layers/preprocessing/random_aspect_ratio.py index 7c1e62a2b9..25e0d0699b 100644 --- a/keras_cv/src/layers/preprocessing/random_aspect_ratio.py +++ b/keras_cv/src/layers/preprocessing/random_aspect_ratio.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/random_aspect_ratio_test.py b/keras_cv/src/layers/preprocessing/random_aspect_ratio_test.py index 257953c3cd..fc23875071 100644 --- a/keras_cv/src/layers/preprocessing/random_aspect_ratio_test.py +++ b/keras_cv/src/layers/preprocessing/random_aspect_ratio_test.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src import layers diff --git a/keras_cv/src/layers/preprocessing/random_augmentation_pipeline.py b/keras_cv/src/layers/preprocessing/random_augmentation_pipeline.py index 245c37cbe1..b7b1d6895b 100644 --- a/keras_cv/src/layers/preprocessing/random_augmentation_pipeline.py +++ b/keras_cv/src/layers/preprocessing/random_augmentation_pipeline.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py b/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py index 408bbc241a..a6eea87729 100644 --- a/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py +++ b/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py @@ -13,7 +13,13 @@ # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import layers diff --git a/keras_cv/src/layers/preprocessing/random_brightness.py b/keras_cv/src/layers/preprocessing/random_brightness.py index ded77fecaa..3e5fe8ad48 100644 --- a/keras_cv/src/layers/preprocessing/random_brightness.py +++ b/keras_cv/src/layers/preprocessing/random_brightness.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing/random_brightness_test.py b/keras_cv/src/layers/preprocessing/random_brightness_test.py index 281ad0d70b..d67925f1f7 100644 --- a/keras_cv/src/layers/preprocessing/random_brightness_test.py +++ b/keras_cv/src/layers/preprocessing/random_brightness_test.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import core from keras_cv.src.layers import preprocessing diff --git a/keras_cv/src/layers/preprocessing/random_channel_shift.py b/keras_cv/src/layers/preprocessing/random_channel_shift.py index f1e985741e..86e6c1bfff 100644 --- a/keras_cv/src/layers/preprocessing/random_channel_shift.py +++ b/keras_cv/src/layers/preprocessing/random_channel_shift.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.base_image_augmentation_layer import ( diff --git a/keras_cv/src/layers/preprocessing/random_channel_shift_test.py b/keras_cv/src/layers/preprocessing/random_channel_shift_test.py index d7123606c7..05c903d5c2 100644 --- a/keras_cv/src/layers/preprocessing/random_channel_shift_test.py +++ b/keras_cv/src/layers/preprocessing/random_channel_shift_test.py @@ -14,7 +14,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops from keras_cv.src.layers import preprocessing diff --git a/keras_cv/src/layers/preprocessing/random_choice.py b/keras_cv/src/layers/preprocessing/random_choice.py index b043f12c71..004ad9f1f7 100644 --- a/keras_cv/src/layers/preprocessing/random_choice.py +++ b/keras_cv/src/layers/preprocessing/random_choice.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.base_image_augmentation_layer import ( diff --git a/keras_cv/src/layers/preprocessing/random_choice_test.py b/keras_cv/src/layers/preprocessing/random_choice_test.py index 7d5eab924c..bb9a10811c 100644 --- a/keras_cv/src/layers/preprocessing/random_choice_test.py +++ b/keras_cv/src/layers/preprocessing/random_choice_test.py @@ -13,7 +13,13 @@ # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import layers from keras_cv.src.layers.preprocessing.base_image_augmentation_layer import ( diff --git a/keras_cv/src/layers/preprocessing/random_color_degeneration.py b/keras_cv/src/layers/preprocessing/random_color_degeneration.py index a239d76bb3..1c3557843b 100644 --- a/keras_cv/src/layers/preprocessing/random_color_degeneration.py +++ b/keras_cv/src/layers/preprocessing/random_color_degeneration.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py b/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py index 6725579da8..5d9bfd6f5b 100644 --- a/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py +++ b/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops from keras_cv.src.layers import preprocessing diff --git a/keras_cv/src/layers/preprocessing/random_color_jitter_test.py b/keras_cv/src/layers/preprocessing/random_color_jitter_test.py index 90128ac03d..1d7cd47709 100644 --- a/keras_cv/src/layers/preprocessing/random_color_jitter_test.py +++ b/keras_cv/src/layers/preprocessing/random_color_jitter_test.py @@ -14,7 +14,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers import preprocessing from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/random_contrast.py b/keras_cv/src/layers/preprocessing/random_contrast.py index 89ecf8b98c..b9a8fbc1af 100644 --- a/keras_cv/src/layers/preprocessing/random_contrast.py +++ b/keras_cv/src/layers/preprocessing/random_contrast.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.vectorized_base_image_augmentation_layer import ( # noqa: E501 diff --git a/keras_cv/src/layers/preprocessing/random_contrast_test.py b/keras_cv/src/layers/preprocessing/random_contrast_test.py index 8d440e8f0b..f1f5a81344 100644 --- a/keras_cv/src/layers/preprocessing/random_contrast_test.py +++ b/keras_cv/src/layers/preprocessing/random_contrast_test.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers import preprocessing from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/random_crop.py b/keras_cv/src/layers/preprocessing/random_crop.py index 404cb9b5f4..5b26de22b1 100644 --- a/keras_cv/src/layers/preprocessing/random_crop.py +++ b/keras_cv/src/layers/preprocessing/random_crop.py @@ -13,7 +13,13 @@ # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src import layers as cv_layers diff --git a/keras_cv/src/layers/preprocessing/random_crop_and_resize.py b/keras_cv/src/layers/preprocessing/random_crop_and_resize.py index 956e2a7788..c3c64e1658 100644 --- a/keras_cv/src/layers/preprocessing/random_crop_and_resize.py +++ b/keras_cv/src/layers/preprocessing/random_crop_and_resize.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src import core diff --git a/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py b/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py index 10c9f1ad20..8342d5a335 100644 --- a/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py +++ b/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import bounding_box diff --git a/keras_cv/src/layers/preprocessing/random_crop_test.py b/keras_cv/src/layers/preprocessing/random_crop_test.py index 89aa5120e6..06e80b9ba4 100644 --- a/keras_cv/src/layers/preprocessing/random_crop_test.py +++ b/keras_cv/src/layers/preprocessing/random_crop_test.py @@ -16,7 +16,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import layers as cv_layers diff --git a/keras_cv/src/layers/preprocessing/random_cutout.py b/keras_cv/src/layers/preprocessing/random_cutout.py index 7f93bf9ef0..606806162f 100644 --- a/keras_cv/src/layers/preprocessing/random_cutout.py +++ b/keras_cv/src/layers/preprocessing/random_cutout.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.vectorized_base_image_augmentation_layer import ( # noqa: E501 diff --git a/keras_cv/src/layers/preprocessing/random_cutout_test.py b/keras_cv/src/layers/preprocessing/random_cutout_test.py index da060022c6..4805b8e1f4 100644 --- a/keras_cv/src/layers/preprocessing/random_cutout_test.py +++ b/keras_cv/src/layers/preprocessing/random_cutout_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops from keras_cv.src.layers import preprocessing diff --git a/keras_cv/src/layers/preprocessing/random_flip.py b/keras_cv/src/layers/preprocessing/random_flip.py index d39c1e7bb2..d22e8d1ff0 100644 --- a/keras_cv/src/layers/preprocessing/random_flip.py +++ b/keras_cv/src/layers/preprocessing/random_flip.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/random_flip_test.py b/keras_cv/src/layers/preprocessing/random_flip_test.py index 3abac13327..4937911616 100644 --- a/keras_cv/src/layers/preprocessing/random_flip_test.py +++ b/keras_cv/src/layers/preprocessing/random_flip_test.py @@ -14,7 +14,13 @@ import unittest import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.backend import ops diff --git a/keras_cv/src/layers/preprocessing/random_gaussian_blur.py b/keras_cv/src/layers/preprocessing/random_gaussian_blur.py index e521b86fdb..6a43098dbb 100644 --- a/keras_cv/src/layers/preprocessing/random_gaussian_blur.py +++ b/keras_cv/src/layers/preprocessing/random_gaussian_blur.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py b/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py index 928b2b0f20..2324589995 100644 --- a/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py +++ b/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers import preprocessing from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/random_hue.py b/keras_cv/src/layers/preprocessing/random_hue.py index f291da7ced..e3e0a6f917 100644 --- a/keras_cv/src/layers/preprocessing/random_hue.py +++ b/keras_cv/src/layers/preprocessing/random_hue.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing/random_jpeg_quality.py b/keras_cv/src/layers/preprocessing/random_jpeg_quality.py index 69d4d6b227..0b3d3497a6 100644 --- a/keras_cv/src/layers/preprocessing/random_jpeg_quality.py +++ b/keras_cv/src/layers/preprocessing/random_jpeg_quality.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.base_image_augmentation_layer import ( diff --git a/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py b/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py index 22a7926adc..f3b143b735 100644 --- a/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py +++ b/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers import preprocessing from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/random_rotation.py b/keras_cv/src/layers/preprocessing/random_rotation.py index 0cbf86a441..49d28b15d2 100644 --- a/keras_cv/src/layers/preprocessing/random_rotation.py +++ b/keras_cv/src/layers/preprocessing/random_rotation.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/random_rotation_test.py b/keras_cv/src/layers/preprocessing/random_rotation_test.py index 2ffecd5b3d..adecc26e43 100644 --- a/keras_cv/src/layers/preprocessing/random_rotation_test.py +++ b/keras_cv/src/layers/preprocessing/random_rotation_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.backend import ops diff --git a/keras_cv/src/layers/preprocessing/random_saturation.py b/keras_cv/src/layers/preprocessing/random_saturation.py index f03b7e847f..0ad89a1794 100644 --- a/keras_cv/src/layers/preprocessing/random_saturation.py +++ b/keras_cv/src/layers/preprocessing/random_saturation.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing/random_saturation_test.py b/keras_cv/src/layers/preprocessing/random_saturation_test.py index aad13716e0..15a361b9f6 100644 --- a/keras_cv/src/layers/preprocessing/random_saturation_test.py +++ b/keras_cv/src/layers/preprocessing/random_saturation_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import core from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing/random_sharpness.py b/keras_cv/src/layers/preprocessing/random_sharpness.py index c65d35d1df..fce2c71ea5 100644 --- a/keras_cv/src/layers/preprocessing/random_sharpness.py +++ b/keras_cv/src/layers/preprocessing/random_sharpness.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.vectorized_base_image_augmentation_layer import ( # noqa: E501 diff --git a/keras_cv/src/layers/preprocessing/random_sharpness_test.py b/keras_cv/src/layers/preprocessing/random_sharpness_test.py index c83e2e157e..19fe767841 100644 --- a/keras_cv/src/layers/preprocessing/random_sharpness_test.py +++ b/keras_cv/src/layers/preprocessing/random_sharpness_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers import preprocessing from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/preprocessing/random_shear.py b/keras_cv/src/layers/preprocessing/random_shear.py index 726b831f18..3ee6c254d2 100644 --- a/keras_cv/src/layers/preprocessing/random_shear.py +++ b/keras_cv/src/layers/preprocessing/random_shear.py @@ -14,7 +14,13 @@ import warnings -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/random_shear_test.py b/keras_cv/src/layers/preprocessing/random_shear_test.py index 8876fd2729..977fb37e55 100644 --- a/keras_cv/src/layers/preprocessing/random_shear_test.py +++ b/keras_cv/src/layers/preprocessing/random_shear_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.backend import ops diff --git a/keras_cv/src/layers/preprocessing/random_translation.py b/keras_cv/src/layers/preprocessing/random_translation.py index 017cdb612b..50c9d5e1e0 100644 --- a/keras_cv/src/layers/preprocessing/random_translation.py +++ b/keras_cv/src/layers/preprocessing/random_translation.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/random_translation_test.py b/keras_cv/src/layers/preprocessing/random_translation_test.py index bf3786dacd..166631c109 100644 --- a/keras_cv/src/layers/preprocessing/random_translation_test.py +++ b/keras_cv/src/layers/preprocessing/random_translation_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops from keras_cv.src.layers import preprocessing diff --git a/keras_cv/src/layers/preprocessing/random_zoom.py b/keras_cv/src/layers/preprocessing/random_zoom.py index 57100226cf..3b658c2f42 100644 --- a/keras_cv/src/layers/preprocessing/random_zoom.py +++ b/keras_cv/src/layers/preprocessing/random_zoom.py @@ -13,7 +13,13 @@ # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow.keras import backend from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/random_zoom_test.py b/keras_cv/src/layers/preprocessing/random_zoom_test.py index 51b1e4d499..5ca8dee8ea 100644 --- a/keras_cv/src/layers/preprocessing/random_zoom_test.py +++ b/keras_cv/src/layers/preprocessing/random_zoom_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.backend import ops diff --git a/keras_cv/src/layers/preprocessing/repeated_augmentation.py b/keras_cv/src/layers/preprocessing/repeated_augmentation.py index 33f6ac7c08..56168c2c40 100644 --- a/keras_cv/src/layers/preprocessing/repeated_augmentation.py +++ b/keras_cv/src/layers/preprocessing/repeated_augmentation.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py b/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py index 2e424493da..c40005006e 100644 --- a/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py +++ b/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import keras_cv.src.layers as cv_layers from keras_cv.src.backend.config import keras_3 diff --git a/keras_cv/src/layers/preprocessing/rescaling.py b/keras_cv/src/layers/preprocessing/rescaling.py index aeece4df10..4478e2e67e 100644 --- a/keras_cv/src/layers/preprocessing/rescaling.py +++ b/keras_cv/src/layers/preprocessing/rescaling.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing.base_image_augmentation_layer import ( diff --git a/keras_cv/src/layers/preprocessing/rescaling_test.py b/keras_cv/src/layers/preprocessing/rescaling_test.py index 0e9c7294f0..e7161aaf6b 100644 --- a/keras_cv/src/layers/preprocessing/rescaling_test.py +++ b/keras_cv/src/layers/preprocessing/rescaling_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops from keras_cv.src.layers.preprocessing.rescaling import Rescaling diff --git a/keras_cv/src/layers/preprocessing/resizing.py b/keras_cv/src/layers/preprocessing/resizing.py index 69ae998dc2..4f4aae46be 100644 --- a/keras_cv/src/layers/preprocessing/resizing.py +++ b/keras_cv/src/layers/preprocessing/resizing.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing/resizing_test.py b/keras_cv/src/layers/preprocessing/resizing_test.py index a4b606bf64..af2172a4b9 100644 --- a/keras_cv/src/layers/preprocessing/resizing_test.py +++ b/keras_cv/src/layers/preprocessing/resizing_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import layers as cv_layers diff --git a/keras_cv/src/layers/preprocessing/solarization.py b/keras_cv/src/layers/preprocessing/solarization.py index 1d3a83d670..affac94edf 100644 --- a/keras_cv/src/layers/preprocessing/solarization.py +++ b/keras_cv/src/layers/preprocessing/solarization.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing/solarization_test.py b/keras_cv/src/layers/preprocessing/solarization_test.py index f3abce6ae5..470fdc14cd 100644 --- a/keras_cv/src/layers/preprocessing/solarization_test.py +++ b/keras_cv/src/layers/preprocessing/solarization_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.layers.preprocessing.solarization import Solarization diff --git a/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer.py b/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer.py index fe43515b3b..56df425513 100644 --- a/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer.py +++ b/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import tree from keras_cv.src import bounding_box diff --git a/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py b/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py index 19805c1b5e..a6b24bc3fc 100644 --- a/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py +++ b/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing/with_labels_test.py b/keras_cv/src/layers/preprocessing/with_labels_test.py index cf766c8a92..3f93877be5 100644 --- a/keras_cv/src/layers/preprocessing/with_labels_test.py +++ b/keras_cv/src/layers/preprocessing/with_labels_test.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import layers diff --git a/keras_cv/src/layers/preprocessing/with_mixed_precision_test.py b/keras_cv/src/layers/preprocessing/with_mixed_precision_test.py index 15a8ece219..dbb0ab8eab 100644 --- a/keras_cv/src/layers/preprocessing/with_mixed_precision_test.py +++ b/keras_cv/src/layers/preprocessing/with_mixed_precision_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import layers diff --git a/keras_cv/src/layers/preprocessing/with_segmentation_masks_test.py b/keras_cv/src/layers/preprocessing/with_segmentation_masks_test.py index 466be689a1..f17ee01572 100644 --- a/keras_cv/src/layers/preprocessing/with_segmentation_masks_test.py +++ b/keras_cv/src/layers/preprocessing/with_segmentation_masks_test.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.layers import preprocessing diff --git a/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d.py b/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d.py index c69f1a2ced..4ff15758eb 100644 --- a/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d.py +++ b/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import keras diff --git a/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py b/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py index 23f94d7242..d504e64745 100644 --- a/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py +++ b/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import random from keras_cv.src.layers.preprocessing_3d import base_augmentation_layer_3d diff --git a/keras_cv/src/layers/preprocessing_3d/input_format_test.py b/keras_cv/src/layers/preprocessing_3d/input_format_test.py index 20d85d0a0d..9e3bd99756 100644 --- a/keras_cv/src/layers/preprocessing_3d/input_format_test.py +++ b/keras_cv/src/layers/preprocessing_3d/input_format_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.layers import preprocessing_3d diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_dropping_points.py b/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_dropping_points.py index 9df85ff685..0f0d4a08ac 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_dropping_points.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_dropping_points.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import point_cloud from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_point_feature_noise.py b/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_point_feature_noise.py index 1d99e5aabe..519731d552 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_point_feature_noise.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_point_feature_noise.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import point_cloud from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_dropping_points.py b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_dropping_points.py index ba13e19e37..1d38f7334d 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_dropping_points.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_dropping_points.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import random diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_flip.py b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_flip.py index 7e2bc48597..0257698baa 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_flip.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_flip.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.bounding_box_3d import CENTER_XYZ_DXDYDZ_PHI diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_rotation.py b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_rotation.py index e21915a270..15739ddfc5 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_rotation.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_rotation.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import random diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_scaling.py b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_scaling.py index 9992eae6d2..c649140640 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_scaling.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_scaling.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import random diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_translation.py b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_translation.py index eec3b8edd0..bf7089ce93 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_translation.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_translation.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import random diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes.py b/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes.py index 473a85fd2e..b6212baa9e 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.bounding_box_3d import CENTER_XYZ_DXDYDZ_PHI diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py b/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py index 66238256b7..56dc6b8dac 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py @@ -6,7 +6,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers.preprocessing_3d import base_augmentation_layer_3d from keras_cv.src.layers.preprocessing_3d.waymo.group_points_by_bounding_boxes import ( # noqa: E501 diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/random_copy_paste.py b/keras_cv/src/layers/preprocessing_3d/waymo/random_copy_paste.py index c437d8537d..0028d7eb03 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/random_copy_paste.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/random_copy_paste.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.backend import random diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/random_drop_box.py b/keras_cv/src/layers/preprocessing_3d/waymo/random_drop_box.py index 1c49ac16ef..e8f82b5e3c 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/random_drop_box.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/random_drop_box.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.layers.preprocessing_3d import base_augmentation_layer_3d diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/swap_background.py b/keras_cv/src/layers/preprocessing_3d/waymo/swap_background.py index b0dfa5159f..67dac228bf 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/swap_background.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/swap_background.py @@ -2,7 +2,13 @@ # # Licensed under the terms in https://github.com/keras-team/keras-cv/blob/master/keras_cv/layers/preprocessing_3d/waymo/LICENSE # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.api_export import keras_cv_export from keras_cv.src.bounding_box_3d import CENTER_XYZ_DXDYDZ_PHI diff --git a/keras_cv/src/layers/regularization/drop_path_test.py b/keras_cv/src/layers/regularization/drop_path_test.py index 95e59ae374..3830ae8412 100644 --- a/keras_cv/src/layers/regularization/drop_path_test.py +++ b/keras_cv/src/layers/regularization/drop_path_test.py @@ -14,7 +14,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers import DropPath from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/regularization/dropblock_2d_test.py b/keras_cv/src/layers/regularization/dropblock_2d_test.py index ef3ded658b..ef4b394714 100644 --- a/keras_cv/src/layers/regularization/dropblock_2d_test.py +++ b/keras_cv/src/layers/regularization/dropblock_2d_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers.regularization.dropblock_2d import DropBlock2D from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/regularization/squeeze_excite_test.py b/keras_cv/src/layers/regularization/squeeze_excite_test.py index a0492381fa..ab21511ba6 100644 --- a/keras_cv/src/layers/regularization/squeeze_excite_test.py +++ b/keras_cv/src/layers/regularization/squeeze_excite_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers import SqueezeAndExcite2D from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/regularization/stochastic_depth_test.py b/keras_cv/src/layers/regularization/stochastic_depth_test.py index 28c061db99..132c013f1f 100644 --- a/keras_cv/src/layers/regularization/stochastic_depth_test.py +++ b/keras_cv/src/layers/regularization/stochastic_depth_test.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers.regularization.stochastic_depth import StochasticDepth from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/transformer_encoder_test.py b/keras_cv/src/layers/transformer_encoder_test.py index 097983453b..c4d911ef8f 100644 --- a/keras_cv/src/layers/transformer_encoder_test.py +++ b/keras_cv/src/layers/transformer_encoder_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers import TransformerEncoder from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/layers/vit_layers.py b/keras_cv/src/layers/vit_layers.py index b96f47db3b..72f1882115 100644 --- a/keras_cv/src/layers/vit_layers.py +++ b/keras_cv/src/layers/vit_layers.py @@ -14,7 +14,13 @@ import math -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow.keras import layers from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/layers/vit_layers_test.py b/keras_cv/src/layers/vit_layers_test.py index ab269c8403..3904418f1d 100644 --- a/keras_cv/src/layers/vit_layers_test.py +++ b/keras_cv/src/layers/vit_layers_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.layers.vit_layers import PatchingAndEmbedding from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/losses/giou_loss_test.py b/keras_cv/src/losses/giou_loss_test.py index 5943e6a112..1c6f5d9ab7 100644 --- a/keras_cv/src/losses/giou_loss_test.py +++ b/keras_cv/src/losses/giou_loss_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.losses.giou_loss import GIoULoss from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py b/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py index 6f514cb4a2..a1f7c41516 100644 --- a/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py +++ b/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from tensorflow import keras diff --git a/keras_cv/src/metrics/object_detection/box_coco_metrics.py b/keras_cv/src/metrics/object_detection/box_coco_metrics.py index fa2583418a..ef8d7fa538 100644 --- a/keras_cv/src/metrics/object_detection/box_coco_metrics.py +++ b/keras_cv/src/metrics/object_detection/box_coco_metrics.py @@ -16,7 +16,13 @@ import types import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import tensorflow.keras as keras from keras_cv.src import bounding_box diff --git a/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py b/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py index fb1252fdea..0a35ba817f 100644 --- a/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py +++ b/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py @@ -14,7 +14,13 @@ import os import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.metrics import BoxCOCOMetrics diff --git a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py index 230a3b8d18..aee5275c16 100644 --- a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py +++ b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py @@ -14,7 +14,13 @@ """Tests for loading pretrained model presets.""" import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops from keras_cv.src.models.backbones.csp_darknet.csp_darknet_aliases import ( diff --git a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py index 099db3064d..c495e29f65 100644 --- a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py +++ b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py @@ -16,7 +16,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.backend import keras diff --git a/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py b/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py index 0b6ba83be0..b06837e2e3 100644 --- a/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py +++ b/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py @@ -75,7 +75,13 @@ def __init__( Using the class with a `backbone`: ```python - import tensorflow as tf + try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import keras_cv images = np.ones(shape=(1, 96, 96, 3)) diff --git a/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py b/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py index a49d16d620..5fffd25def 100644 --- a/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py +++ b/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py @@ -16,7 +16,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.backend import keras diff --git a/keras_cv/src/models/classification/image_classifier_test.py b/keras_cv/src/models/classification/image_classifier_test.py index d437d4f0c4..742075b146 100644 --- a/keras_cv/src/models/classification/image_classifier_test.py +++ b/keras_cv/src/models/classification/image_classifier_test.py @@ -18,7 +18,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.backend import keras diff --git a/keras_cv/src/models/classification/video_classifier_test.py b/keras_cv/src/models/classification/video_classifier_test.py index ceb4ba2a48..46af2a8141 100644 --- a/keras_cv/src/models/classification/video_classifier_test.py +++ b/keras_cv/src/models/classification/video_classifier_test.py @@ -18,7 +18,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.backend import keras diff --git a/keras_cv/src/models/feature_extractor/clip/clip_processor.py b/keras_cv/src/models/feature_extractor/clip/clip_processor.py index cebbe962fa..9bdbcefb0e 100644 --- a/keras_cv/src/models/feature_extractor/clip/clip_processor.py +++ b/keras_cv/src/models/feature_extractor/clip/clip_processor.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import tree from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/models/feature_extractor/clip/clip_processor_utils.py b/keras_cv/src/models/feature_extractor/clip/clip_processor_utils.py index a4467520e9..a86972acef 100644 --- a/keras_cv/src/models/feature_extractor/clip/clip_processor_utils.py +++ b/keras_cv/src/models/feature_extractor/clip/clip_processor_utils.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops diff --git a/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py b/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py index 55b292618d..ae2a7a41ae 100644 --- a/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py +++ b/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import regex as re -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) try: import tensorflow_text as tf_text diff --git a/keras_cv/src/models/legacy/convmixer.py b/keras_cv/src/models/legacy/convmixer.py index 263807a36f..ec88a9277f 100644 --- a/keras_cv/src/models/legacy/convmixer.py +++ b/keras_cv/src/models/legacy/convmixer.py @@ -19,7 +19,13 @@ - [Patches Are All You Need?](https://arxiv.org/abs/2201.09792) """ -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import layers diff --git a/keras_cv/src/models/legacy/convnext.py b/keras_cv/src/models/legacy/convnext.py index b38539e0a8..9b8d3ccc48 100644 --- a/keras_cv/src/models/legacy/convnext.py +++ b/keras_cv/src/models/legacy/convnext.py @@ -18,7 +18,13 @@ (CVPR 2022) """ -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import backend from tensorflow.keras import layers diff --git a/keras_cv/src/models/legacy/darknet.py b/keras_cv/src/models/legacy/darknet.py index 539a7287c5..5e4edb5655 100644 --- a/keras_cv/src/models/legacy/darknet.py +++ b/keras_cv/src/models/legacy/darknet.py @@ -18,7 +18,13 @@ - [YoloV3 implementation](https://github.com/ultralytics/yolov3) """ -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import layers diff --git a/keras_cv/src/models/legacy/mlp_mixer.py b/keras_cv/src/models/legacy/mlp_mixer.py index 55ffa8c44e..d56ad86b16 100644 --- a/keras_cv/src/models/legacy/mlp_mixer.py +++ b/keras_cv/src/models/legacy/mlp_mixer.py @@ -18,7 +18,13 @@ - [MLP-Mixer: An all-MLP Architecture for Vision](https://arxiv.org/abs/2105.01601) """ # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import backend from tensorflow.keras import layers diff --git a/keras_cv/src/models/legacy/models_test.py b/keras_cv/src/models/legacy/models_test.py index 203ac4625e..351d1f2451 100644 --- a/keras_cv/src/models/legacy/models_test.py +++ b/keras_cv/src/models/legacy/models_test.py @@ -16,7 +16,13 @@ import os import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import backend diff --git a/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn.py b/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn.py index df5e2981b7..a1dd664217 100644 --- a/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn.py +++ b/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl import logging from tensorflow import keras diff --git a/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py b/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py index 02c57f5dad..5c2931f63d 100644 --- a/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py +++ b/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py @@ -13,7 +13,13 @@ # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from tensorflow import keras from tensorflow.keras import optimizers diff --git a/keras_cv/src/models/legacy/regnet.py b/keras_cv/src/models/legacy/regnet.py index 21aa55a0af..d35051e66c 100644 --- a/keras_cv/src/models/legacy/regnet.py +++ b/keras_cv/src/models/legacy/regnet.py @@ -17,7 +17,13 @@ - [Based on the Original keras.applications RegNet](https://github.com/keras-team/keras/blob/master/keras/applications/regnet.py) """ # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import backend from tensorflow.keras import layers diff --git a/keras_cv/src/models/legacy/vgg16.py b/keras_cv/src/models/legacy/vgg16.py index 0659014f54..a0b4805712 100644 --- a/keras_cv/src/models/legacy/vgg16.py +++ b/keras_cv/src/models/legacy/vgg16.py @@ -19,7 +19,13 @@ (ICLR 2015) """ # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import layers diff --git a/keras_cv/src/models/legacy/vgg19.py b/keras_cv/src/models/legacy/vgg19.py index 21c3739df6..1a690d1c5f 100644 --- a/keras_cv/src/models/legacy/vgg19.py +++ b/keras_cv/src/models/legacy/vgg19.py @@ -18,7 +18,13 @@ - [Very Deep Convolutional Networks for Large-Scale Image Recognition](https://arxiv.org/abs/1409.1556) (ICLR 2015) """ # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import layers diff --git a/keras_cv/src/models/legacy/vit.py b/keras_cv/src/models/legacy/vit.py index d89cd4fd04..f4e3b4f7fe 100644 --- a/keras_cv/src/models/legacy/vit.py +++ b/keras_cv/src/models/legacy/vit.py @@ -19,7 +19,13 @@ (CoRR 2021) """ # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import layers diff --git a/keras_cv/src/models/legacy/weights.py b/keras_cv/src/models/legacy/weights.py index 5f93d1ba97..f2d0eb4d67 100644 --- a/keras_cv/src/models/legacy/weights.py +++ b/keras_cv/src/models/legacy/weights.py @@ -10,7 +10,13 @@ # 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 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow.keras import utils diff --git a/keras_cv/src/models/object_detection/__internal__.py b/keras_cv/src/models/object_detection/__internal__.py index 5b3ddf912e..46338eb8cf 100644 --- a/keras_cv/src/models/object_detection/__internal__.py +++ b/keras_cv/src/models/object_detection/__internal__.py @@ -16,7 +16,13 @@ import math import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) try: import pandas as pd diff --git a/keras_cv/src/models/object_detection/__test_utils__.py b/keras_cv/src/models/object_detection/__test_utils__.py index ad795b9cbd..7fdc88f567 100644 --- a/keras_cv/src/models/object_detection/__test_utils__.py +++ b/keras_cv/src/models/object_detection/__test_utils__.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import keras_cv from keras_cv.src.backend import ops diff --git a/keras_cv/src/models/object_detection/predict_utils.py b/keras_cv/src/models/object_detection/predict_utils.py index 9cd7a1bd44..72ef817142 100644 --- a/keras_cv/src/models/object_detection/predict_utils.py +++ b/keras_cv/src/models/object_detection/predict_utils.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) try: from keras.src.utils import tf_utils diff --git a/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder.py b/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder.py index c33e5edafa..8187ef3b5c 100644 --- a/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder.py +++ b/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py b/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py index b528d42ba2..38fd5167be 100644 --- a/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py +++ b/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py @@ -14,7 +14,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import backend from keras_cv.src import layers as cv_layers diff --git a/keras_cv/src/models/object_detection/retinanet/retinanet_test.py b/keras_cv/src/models/object_detection/retinanet/retinanet_test.py index e08426b9d0..5eab2ab105 100644 --- a/keras_cv/src/models/object_detection/retinanet/retinanet_test.py +++ b/keras_cv/src/models/object_detection/retinanet/retinanet_test.py @@ -16,7 +16,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized import keras_cv diff --git a/keras_cv/src/models/object_detection/yolo_v8/yolo_v8_label_encoder.py b/keras_cv/src/models/object_detection/yolo_v8/yolo_v8_label_encoder.py index 2fbbc8587b..45cba0b2b9 100644 --- a/keras_cv/src/models/object_detection/yolo_v8/yolo_v8_label_encoder.py +++ b/keras_cv/src/models/object_detection/yolo_v8/yolo_v8_label_encoder.py @@ -16,7 +16,13 @@ implementation at https://github.com/fcjian/TOOD/blob/master/mmdet/core/bbox/assigners/task_aligned_assigner.py """ # noqa: E501 -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box from keras_cv.src.api_export import keras_cv_export diff --git a/keras_cv/src/models/object_detection/yolox/binary_crossentropy.py b/keras_cv/src/models/object_detection/yolox/binary_crossentropy.py index 17a5d59e67..74731482e2 100644 --- a/keras_cv/src/models/object_detection/yolox/binary_crossentropy.py +++ b/keras_cv/src/models/object_detection/yolox/binary_crossentropy.py @@ -15,7 +15,13 @@ import warnings -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras diff --git a/keras_cv/src/models/object_detection/yolox/layers/yolox_decoder.py b/keras_cv/src/models/object_detection/yolox/layers/yolox_decoder.py index 56e5619f0d..b0d85313be 100644 --- a/keras_cv/src/models/object_detection/yolox/layers/yolox_decoder.py +++ b/keras_cv/src/models/object_detection/yolox/layers/yolox_decoder.py @@ -13,7 +13,13 @@ # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras import keras_cv.src.layers as cv_layers diff --git a/keras_cv/src/models/object_detection/yolox/layers/yolox_head_test.py b/keras_cv/src/models/object_detection/yolox/layers/yolox_head_test.py index 3f391ab5d3..20563bd21b 100644 --- a/keras_cv/src/models/object_detection/yolox/layers/yolox_head_test.py +++ b/keras_cv/src/models/object_detection/yolox/layers/yolox_head_test.py @@ -13,7 +13,13 @@ # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from keras_cv.src.models.object_detection.yolox.layers import YoloXHead diff --git a/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder.py b/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder.py index 3928ee3152..7fd666014a 100644 --- a/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder.py +++ b/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder.py @@ -13,7 +13,13 @@ # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow.keras import layers from keras_cv.src import bounding_box diff --git a/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder_test.py b/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder_test.py index 8bc5660185..02808fbc6c 100644 --- a/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder_test.py +++ b/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.models.object_detection.yolox.layers import YoloXLabelEncoder from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/models/object_detection/yolox/layers/yolox_pafpn_test.py b/keras_cv/src/models/object_detection/yolox/layers/yolox_pafpn_test.py index 18484bd481..81512d0f61 100644 --- a/keras_cv/src/models/object_detection/yolox/layers/yolox_pafpn_test.py +++ b/keras_cv/src/models/object_detection/yolox/layers/yolox_pafpn_test.py @@ -13,7 +13,13 @@ # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from keras_cv.src.models.object_detection.yolox.layers import YoloXPAFPN diff --git a/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py b/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py index df4c303a10..d139a960c9 100644 --- a/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py +++ b/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py @@ -13,7 +13,13 @@ # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import keras from keras_cv.src.backend.config import keras_3 diff --git a/keras_cv/src/models/object_detection_3d/center_pillar_test.py b/keras_cv/src/models/object_detection_3d/center_pillar_test.py index 46902decc0..43f42aad0b 100644 --- a/keras_cv/src/models/object_detection_3d/center_pillar_test.py +++ b/keras_cv/src/models/object_detection_3d/center_pillar_test.py @@ -13,7 +13,13 @@ # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import keras from keras_cv.src.backend.config import keras_3 diff --git a/keras_cv/src/models/segmentation/basnet/basnet_test.py b/keras_cv/src/models/segmentation/basnet/basnet_test.py index 868156f82d..28fc42618f 100644 --- a/keras_cv/src/models/segmentation/basnet/basnet_test.py +++ b/keras_cv/src/models/segmentation/basnet/basnet_test.py @@ -17,7 +17,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.backend import keras diff --git a/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py b/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py index 9170ef4f8e..a27cedc40a 100644 --- a/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py +++ b/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py @@ -16,7 +16,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.backend import keras diff --git a/keras_cv/src/models/segmentation/segformer/segformer.py b/keras_cv/src/models/segmentation/segformer/segformer.py index 2b6f553c5d..8f9751d71e 100644 --- a/keras_cv/src/models/segmentation/segformer/segformer.py +++ b/keras_cv/src/models/segmentation/segformer/segformer.py @@ -59,7 +59,13 @@ class SegFormer(Task): Using the class with a `backbone`: ```python + try: import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import keras_cv images = np.ones(shape=(1, 96, 96, 3)) diff --git a/keras_cv/src/models/segmentation/segformer/segformer_test.py b/keras_cv/src/models/segmentation/segformer/segformer_test.py index 1441847746..f1bc320816 100644 --- a/keras_cv/src/models/segmentation/segformer/segformer_test.py +++ b/keras_cv/src/models/segmentation/segformer/segformer_test.py @@ -16,7 +16,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import keras from keras_cv.src.backend import ops diff --git a/keras_cv/src/point_cloud/point_cloud.py b/keras_cv/src/point_cloud/point_cloud.py index f7bc0171dd..fd1e693f32 100644 --- a/keras_cv/src/point_cloud/point_cloud.py +++ b/keras_cv/src/point_cloud/point_cloud.py @@ -13,7 +13,13 @@ # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.utils.resource_loader import LazySO diff --git a/keras_cv/src/point_cloud/point_cloud_test.py b/keras_cv/src/point_cloud/point_cloud_test.py index 559fa5cfd7..99db817b78 100644 --- a/keras_cv/src/point_cloud/point_cloud_test.py +++ b/keras_cv/src/point_cloud/point_cloud_test.py @@ -16,7 +16,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src import point_cloud diff --git a/keras_cv/src/point_cloud/within_box_3d_test.py b/keras_cv/src/point_cloud/within_box_3d_test.py index 8f4ed9d786..4e73ca6205 100644 --- a/keras_cv/src/point_cloud/within_box_3d_test.py +++ b/keras_cv/src/point_cloud/within_box_3d_test.py @@ -17,7 +17,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) import keras_cv from keras_cv.src.tests.test_case import TestCase diff --git a/keras_cv/src/tests/test_case.py b/keras_cv/src/tests/test_case.py index 7a388cf854..179ed36b2e 100644 --- a/keras_cv/src/tests/test_case.py +++ b/keras_cv/src/tests/test_case.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from absl.testing import parameterized from keras_cv.src.backend import ops diff --git a/keras_cv/src/tools/checkpoint_conversion/ViT_weight_conversion.ipynb b/keras_cv/src/tools/checkpoint_conversion/ViT_weight_conversion.ipynb index f06146643f..53543a75a6 100644 --- a/keras_cv/src/tools/checkpoint_conversion/ViT_weight_conversion.ipynb +++ b/keras_cv/src/tools/checkpoint_conversion/ViT_weight_conversion.ipynb @@ -91,7 +91,13 @@ "import os\n", "import pandas as pd\n", "\n", - "import tensorflow as tf\n", + "try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + )\n", "import keras_cv\n", "\n", "import matplotlib.pyplot as plt\n", diff --git a/keras_cv/src/tools/training_scipts/Training_YOLOv8.ipynb b/keras_cv/src/tools/training_scipts/Training_YOLOv8.ipynb index dc0cf695e2..a43cea81bd 100644 --- a/keras_cv/src/tools/training_scipts/Training_YOLOv8.ipynb +++ b/keras_cv/src/tools/training_scipts/Training_YOLOv8.ipynb @@ -66,7 +66,13 @@ "import resource\n", "import sys\n", "\n", - "import tensorflow as tf\n", + "try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + )\n", "import tensorflow_datasets as tfds\n", "import tqdm\n", "from tensorflow import keras\n", diff --git a/keras_cv/src/tools/training_scipts/training_deeplab_v3_plus.ipynb b/keras_cv/src/tools/training_scipts/training_deeplab_v3_plus.ipynb index e7ff38752a..2a67b756e4 100644 --- a/keras_cv/src/tools/training_scipts/training_deeplab_v3_plus.ipynb +++ b/keras_cv/src/tools/training_scipts/training_deeplab_v3_plus.ipynb @@ -464,7 +464,13 @@ "outputs": [], "source": [ "def dict_to_tuple(x):\n", - " import tensorflow as tf\n", + " try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + )\n", "\n", " return x[\"images\"], tf.one_hot(\n", " tf.cast(tf.squeeze(x[\"segmentation_masks\"], axis=-1), \"int32\"), 21\n", diff --git a/keras_cv/src/training/contrastive/contrastive_trainer.py b/keras_cv/src/training/contrastive/contrastive_trainer.py index 1538169c8d..b3196b478e 100644 --- a/keras_cv/src/training/contrastive/contrastive_trainer.py +++ b/keras_cv/src/training/contrastive/contrastive_trainer.py @@ -13,7 +13,13 @@ # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from keras_cv.src.utils.train import convert_inputs_to_tf_dataset diff --git a/keras_cv/src/training/contrastive/contrastive_trainer_test.py b/keras_cv/src/training/contrastive/contrastive_trainer_test.py index adde94d7e1..100a6db830 100644 --- a/keras_cv/src/training/contrastive/contrastive_trainer_test.py +++ b/keras_cv/src/training/contrastive/contrastive_trainer_test.py @@ -14,7 +14,13 @@ import numpy as np import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras import metrics diff --git a/keras_cv/src/training/contrastive/simclr_trainer_test.py b/keras_cv/src/training/contrastive/simclr_trainer_test.py index 828c3e9e1d..e7d1b55191 100644 --- a/keras_cv/src/training/contrastive/simclr_trainer_test.py +++ b/keras_cv/src/training/contrastive/simclr_trainer_test.py @@ -13,7 +13,13 @@ # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras import optimizers diff --git a/keras_cv/src/utils/fill_utils.py b/keras_cv/src/utils/fill_utils.py index 2569feb576..0d4bd730ea 100644 --- a/keras_cv/src/utils/fill_utils.py +++ b/keras_cv/src/utils/fill_utils.py @@ -11,7 +11,13 @@ # 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. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import bounding_box diff --git a/keras_cv/src/utils/fill_utils_test.py b/keras_cv/src/utils/fill_utils_test.py index 7dd09cb14f..7790315dd3 100644 --- a/keras_cv/src/utils/fill_utils_test.py +++ b/keras_cv/src/utils/fill_utils_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.tests.test_case import TestCase from keras_cv.src.utils import fill_utils diff --git a/keras_cv/src/utils/preprocessing.py b/keras_cv/src/utils/preprocessing.py index 47470a2017..2290c87daf 100644 --- a/keras_cv/src/utils/preprocessing.py +++ b/keras_cv/src/utils/preprocessing.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from tensorflow import keras from tensorflow.keras import backend diff --git a/keras_cv/src/utils/preprocessing_test.py b/keras_cv/src/utils/preprocessing_test.py index 70dd2866fa..98dc4e58cf 100644 --- a/keras_cv/src/utils/preprocessing_test.py +++ b/keras_cv/src/utils/preprocessing_test.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.tests.test_case import TestCase from keras_cv.src.utils import preprocessing diff --git a/keras_cv/src/utils/resource_loader.py b/keras_cv/src/utils/resource_loader.py index 6813736a60..ea0132b55c 100644 --- a/keras_cv/src/utils/resource_loader.py +++ b/keras_cv/src/utils/resource_loader.py @@ -20,7 +20,13 @@ import os import warnings -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) TF_VERSION_FOR_ABI_COMPATIBILITY = "2.13" abi_warning_already_raised = False diff --git a/keras_cv/src/utils/to_numpy.py b/keras_cv/src/utils/to_numpy.py index e2e6f96ba9..5abd3c3107 100644 --- a/keras_cv/src/utils/to_numpy.py +++ b/keras_cv/src/utils/to_numpy.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import ops diff --git a/keras_cv/src/utils/train.py b/keras_cv/src/utils/train.py index 7091f4ad64..33b007f689 100644 --- a/keras_cv/src/utils/train.py +++ b/keras_cv/src/utils/train.py @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src.backend import keras diff --git a/keras_cv/src/version_check_test.py b/keras_cv/src/version_check_test.py index ea116871a3..01db946e76 100644 --- a/keras_cv/src/version_check_test.py +++ b/keras_cv/src/version_check_test.py @@ -13,7 +13,13 @@ # limitations under the License. import pytest -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import version_check diff --git a/keras_cv/src/visualization/plot_image_gallery.py b/keras_cv/src/visualization/plot_image_gallery.py index 8038286d48..438bb85577 100644 --- a/keras_cv/src/visualization/plot_image_gallery.py +++ b/keras_cv/src/visualization/plot_image_gallery.py @@ -15,7 +15,13 @@ import math import numpy as np -import tensorflow as tf +try: + import tensorflow as tf +except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) from keras_cv.src import utils from keras_cv.src.api_export import keras_cv_export From ead5fb9e32efc5a76b6911e6066d20f5e56f178f Mon Sep 17 00:00:00 2001 From: Samaneh Saadat Date: Wed, 1 May 2024 05:41:54 +0000 Subject: [PATCH 2/3] Remove extra space. --- keras_cv/src/backend/tf_ops.py | 2 +- keras_cv/src/bounding_box/converters.py | 2 +- keras_cv/src/bounding_box/converters_test.py | 2 +- .../src/bounding_box/mask_invalid_detections_test.py | 2 +- keras_cv/src/bounding_box/to_dense.py | 2 +- keras_cv/src/bounding_box/to_dense_test.py | 2 +- keras_cv/src/bounding_box/to_ragged.py | 2 +- keras_cv/src/bounding_box/validate_format.py | 2 +- keras_cv/src/callbacks/waymo_evaluation_callback.py | 2 +- .../src/callbacks/waymo_evaluation_callback_test.py | 2 +- .../src/core/factor_sampler/constant_factor_sampler.py | 2 +- .../src/core/factor_sampler/normal_factor_sampler.py | 2 +- .../src/core/factor_sampler/uniform_factor_sampler.py | 2 +- keras_cv/src/datasets/imagenet/load.py | 2 +- keras_cv/src/datasets/pascal_voc/load.py | 2 +- keras_cv/src/datasets/pascal_voc/segmentation.py | 2 +- keras_cv/src/datasets/pascal_voc/segmentation_test.py | 2 +- keras_cv/src/datasets/waymo/load.py | 2 +- keras_cv/src/datasets/waymo/struct.py | 2 +- keras_cv/src/datasets/waymo/transformer.py | 2 +- keras_cv/src/datasets/waymo/transformer_test.py | 2 +- keras_cv/src/keypoint/converters.py | 2 +- keras_cv/src/keypoint/converters_test.py | 2 +- keras_cv/src/keypoint/utils.py | 2 +- keras_cv/src/keypoint/utils_test.py | 2 +- keras_cv/src/layers/fusedmbconv_test.py | 2 +- keras_cv/src/layers/mbconv_test.py | 2 +- .../multi_class_non_max_suppression.py | 2 +- .../multi_class_non_max_suppression_test.py | 2 +- .../src/layers/object_detection/non_max_suppression.py | 10 ++-------- .../object_detection_3d/centernet_label_encoder.py | 2 +- .../centernet_label_encoder_test.py | 2 +- keras_cv/src/layers/object_detection_3d/voxel_utils.py | 2 +- .../src/layers/object_detection_3d/voxel_utils_test.py | 2 +- .../layers/object_detection_3d/voxelization_test.py | 2 +- keras_cv/src/layers/preprocessing/aug_mix.py | 2 +- keras_cv/src/layers/preprocessing/aug_mix_test.py | 2 +- keras_cv/src/layers/preprocessing/auto_contrast.py | 2 +- .../preprocessing/base_image_augmentation_layer.py | 2 +- .../base_image_augmentation_layer_test.py | 2 +- keras_cv/src/layers/preprocessing/channel_shuffle.py | 2 +- .../src/layers/preprocessing/channel_shuffle_test.py | 2 +- keras_cv/src/layers/preprocessing/cut_mix.py | 2 +- keras_cv/src/layers/preprocessing/cut_mix_test.py | 2 +- keras_cv/src/layers/preprocessing/equalization.py | 2 +- keras_cv/src/layers/preprocessing/fourier_mix.py | 2 +- keras_cv/src/layers/preprocessing/fourier_mix_test.py | 2 +- keras_cv/src/layers/preprocessing/grayscale.py | 2 +- keras_cv/src/layers/preprocessing/grayscale_test.py | 2 +- keras_cv/src/layers/preprocessing/grid_mask.py | 2 +- keras_cv/src/layers/preprocessing/grid_mask_test.py | 2 +- keras_cv/src/layers/preprocessing/jittered_resize.py | 2 +- .../src/layers/preprocessing/jittered_resize_test.py | 2 +- keras_cv/src/layers/preprocessing/mix_up.py | 2 +- keras_cv/src/layers/preprocessing/mix_up_test.py | 2 +- keras_cv/src/layers/preprocessing/mosaic.py | 2 +- keras_cv/src/layers/preprocessing/mosaic_test.py | 2 +- keras_cv/src/layers/preprocessing/posterization.py | 2 +- .../src/layers/preprocessing/posterization_test.py | 2 +- keras_cv/src/layers/preprocessing/ragged_image_test.py | 2 +- keras_cv/src/layers/preprocessing/rand_augment_test.py | 2 +- keras_cv/src/layers/preprocessing/random_apply_test.py | 2 +- .../src/layers/preprocessing/random_aspect_ratio.py | 2 +- .../layers/preprocessing/random_aspect_ratio_test.py | 2 +- .../preprocessing/random_augmentation_pipeline.py | 2 +- .../preprocessing/random_augmentation_pipeline_test.py | 2 +- keras_cv/src/layers/preprocessing/random_brightness.py | 2 +- .../src/layers/preprocessing/random_brightness_test.py | 2 +- .../src/layers/preprocessing/random_channel_shift.py | 2 +- .../layers/preprocessing/random_channel_shift_test.py | 2 +- keras_cv/src/layers/preprocessing/random_choice.py | 2 +- .../src/layers/preprocessing/random_choice_test.py | 2 +- .../layers/preprocessing/random_color_degeneration.py | 2 +- .../preprocessing/random_color_degeneration_test.py | 2 +- .../layers/preprocessing/random_color_jitter_test.py | 2 +- keras_cv/src/layers/preprocessing/random_contrast.py | 2 +- .../src/layers/preprocessing/random_contrast_test.py | 2 +- keras_cv/src/layers/preprocessing/random_crop.py | 2 +- .../src/layers/preprocessing/random_crop_and_resize.py | 2 +- .../preprocessing/random_crop_and_resize_test.py | 2 +- keras_cv/src/layers/preprocessing/random_crop_test.py | 2 +- keras_cv/src/layers/preprocessing/random_cutout.py | 2 +- .../src/layers/preprocessing/random_cutout_test.py | 2 +- keras_cv/src/layers/preprocessing/random_flip.py | 2 +- keras_cv/src/layers/preprocessing/random_flip_test.py | 2 +- .../src/layers/preprocessing/random_gaussian_blur.py | 2 +- .../layers/preprocessing/random_gaussian_blur_test.py | 2 +- keras_cv/src/layers/preprocessing/random_hue.py | 2 +- .../src/layers/preprocessing/random_jpeg_quality.py | 2 +- .../layers/preprocessing/random_jpeg_quality_test.py | 2 +- keras_cv/src/layers/preprocessing/random_rotation.py | 2 +- .../src/layers/preprocessing/random_rotation_test.py | 2 +- keras_cv/src/layers/preprocessing/random_saturation.py | 2 +- .../src/layers/preprocessing/random_saturation_test.py | 2 +- keras_cv/src/layers/preprocessing/random_sharpness.py | 2 +- .../src/layers/preprocessing/random_sharpness_test.py | 2 +- keras_cv/src/layers/preprocessing/random_shear.py | 2 +- keras_cv/src/layers/preprocessing/random_shear_test.py | 2 +- .../src/layers/preprocessing/random_translation.py | 2 +- .../layers/preprocessing/random_translation_test.py | 2 +- keras_cv/src/layers/preprocessing/random_zoom.py | 2 +- keras_cv/src/layers/preprocessing/random_zoom_test.py | 2 +- .../src/layers/preprocessing/repeated_augmentation.py | 2 +- .../layers/preprocessing/repeated_augmentation_test.py | 2 +- keras_cv/src/layers/preprocessing/rescaling.py | 2 +- keras_cv/src/layers/preprocessing/rescaling_test.py | 2 +- keras_cv/src/layers/preprocessing/resizing.py | 2 +- keras_cv/src/layers/preprocessing/resizing_test.py | 2 +- keras_cv/src/layers/preprocessing/solarization.py | 2 +- keras_cv/src/layers/preprocessing/solarization_test.py | 2 +- .../vectorized_base_image_augmentation_layer.py | 2 +- .../vectorized_base_image_augmentation_layer_test.py | 2 +- keras_cv/src/layers/preprocessing/with_labels_test.py | 2 +- .../layers/preprocessing/with_mixed_precision_test.py | 2 +- .../preprocessing/with_segmentation_masks_test.py | 2 +- .../preprocessing_3d/base_augmentation_layer_3d.py | 2 +- .../base_augmentation_layer_3d_test.py | 2 +- .../src/layers/preprocessing_3d/input_format_test.py | 2 +- .../waymo/frustum_random_dropping_points.py | 2 +- .../waymo/frustum_random_point_feature_noise.py | 2 +- .../waymo/global_random_dropping_points.py | 2 +- .../preprocessing_3d/waymo/global_random_flip.py | 2 +- .../preprocessing_3d/waymo/global_random_rotation.py | 2 +- .../preprocessing_3d/waymo/global_random_scaling.py | 2 +- .../waymo/global_random_translation.py | 2 +- .../waymo/group_points_by_bounding_boxes.py | 2 +- .../waymo/group_points_by_bounding_boxes_test.py | 2 +- .../layers/preprocessing_3d/waymo/random_copy_paste.py | 2 +- .../layers/preprocessing_3d/waymo/random_drop_box.py | 2 +- .../layers/preprocessing_3d/waymo/swap_background.py | 2 +- keras_cv/src/layers/regularization/drop_path_test.py | 2 +- .../src/layers/regularization/dropblock_2d_test.py | 2 +- .../src/layers/regularization/squeeze_excite_test.py | 2 +- .../src/layers/regularization/stochastic_depth_test.py | 2 +- keras_cv/src/layers/transformer_encoder_test.py | 2 +- keras_cv/src/layers/vit_layers.py | 2 +- keras_cv/src/layers/vit_layers_test.py | 2 +- keras_cv/src/losses/giou_loss_test.py | 2 +- .../numerical_tests/focal_loss_numerical_test.py | 2 +- .../src/metrics/object_detection/box_coco_metrics.py | 2 +- .../metrics/object_detection/box_coco_metrics_test.py | 2 +- .../csp_darknet/csp_darknet_backbone_presets_test.py | 2 +- .../backbones/csp_darknet/csp_darknet_backbone_test.py | 2 +- .../mix_transformer/mix_transformer_backbone.py | 2 +- .../backbones/resnet_v1/resnet_v1_backbone_test.py | 2 +- .../src/models/classification/image_classifier_test.py | 2 +- .../src/models/classification/video_classifier_test.py | 2 +- .../models/feature_extractor/clip/clip_processor.py | 2 +- .../feature_extractor/clip/clip_processor_utils.py | 2 +- .../models/feature_extractor/clip/clip_tokenizer.py | 2 +- keras_cv/src/models/legacy/convmixer.py | 2 +- keras_cv/src/models/legacy/convnext.py | 2 +- keras_cv/src/models/legacy/darknet.py | 2 +- keras_cv/src/models/legacy/mlp_mixer.py | 2 +- keras_cv/src/models/legacy/models_test.py | 2 +- .../legacy/object_detection/faster_rcnn/faster_rcnn.py | 2 +- .../object_detection/faster_rcnn/faster_rcnn_test.py | 2 +- keras_cv/src/models/legacy/regnet.py | 2 +- keras_cv/src/models/legacy/vgg16.py | 2 +- keras_cv/src/models/legacy/vgg19.py | 2 +- keras_cv/src/models/legacy/vit.py | 2 +- keras_cv/src/models/legacy/weights.py | 2 +- keras_cv/src/models/object_detection/__internal__.py | 2 +- keras_cv/src/models/object_detection/__test_utils__.py | 2 +- keras_cv/src/models/object_detection/predict_utils.py | 2 +- .../retinanet/retinanet_label_encoder.py | 2 +- .../retinanet/retinanet_label_encoder_test.py | 2 +- .../object_detection/retinanet/retinanet_test.py | 2 +- .../object_detection/yolo_v8/yolo_v8_label_encoder.py | 2 +- .../object_detection/yolox/binary_crossentropy.py | 2 +- .../object_detection/yolox/layers/yolox_decoder.py | 2 +- .../object_detection/yolox/layers/yolox_head_test.py | 2 +- .../yolox/layers/yolox_label_encoder.py | 2 +- .../yolox/layers/yolox_label_encoder_test.py | 2 +- .../object_detection/yolox/layers/yolox_pafpn_test.py | 2 +- .../object_detection_3d/center_pillar_backbone_test.py | 2 +- .../models/object_detection_3d/center_pillar_test.py | 2 +- keras_cv/src/models/segmentation/basnet/basnet_test.py | 2 +- .../deeplab_v3_plus/deeplab_v3_plus_test.py | 2 +- .../src/models/segmentation/segformer/segformer.py | 6 ------ .../models/segmentation/segformer/segformer_test.py | 2 +- keras_cv/src/point_cloud/point_cloud.py | 2 +- keras_cv/src/point_cloud/point_cloud_test.py | 2 +- keras_cv/src/point_cloud/within_box_3d_test.py | 2 +- keras_cv/src/tests/test_case.py | 2 +- .../checkpoint_conversion/ViT_weight_conversion.ipynb | 8 +------- .../src/tools/training_scipts/Training_YOLOv8.ipynb | 8 +------- .../training_scipts/training_deeplab_v3_plus.ipynb | 8 +------- .../src/training/contrastive/contrastive_trainer.py | 2 +- .../training/contrastive/contrastive_trainer_test.py | 2 +- .../src/training/contrastive/simclr_trainer_test.py | 2 +- keras_cv/src/utils/fill_utils.py | 2 +- keras_cv/src/utils/fill_utils_test.py | 2 +- keras_cv/src/utils/preprocessing.py | 2 +- keras_cv/src/utils/preprocessing_test.py | 2 +- keras_cv/src/utils/resource_loader.py | 2 +- keras_cv/src/utils/to_numpy.py | 2 +- keras_cv/src/utils/train.py | 2 +- keras_cv/src/version_check_test.py | 2 +- keras_cv/src/visualization/plot_image_gallery.py | 2 +- 200 files changed, 200 insertions(+), 230 deletions(-) diff --git a/keras_cv/src/backend/tf_ops.py b/keras_cv/src/backend/tf_ops.py index cd70d8ba91..1552a8c3a1 100644 --- a/keras_cv/src/backend/tf_ops.py +++ b/keras_cv/src/backend/tf_ops.py @@ -50,7 +50,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/bounding_box/converters.py b/keras_cv/src/bounding_box/converters.py index 34355fcfb6..e55e4b9c51 100644 --- a/keras_cv/src/bounding_box/converters.py +++ b/keras_cv/src/bounding_box/converters.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/bounding_box/converters_test.py b/keras_cv/src/bounding_box/converters_test.py index eb1e0eb946..403ec13493 100644 --- a/keras_cv/src/bounding_box/converters_test.py +++ b/keras_cv/src/bounding_box/converters_test.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/bounding_box/mask_invalid_detections_test.py b/keras_cv/src/bounding_box/mask_invalid_detections_test.py index 18f4589da5..293ad67a21 100644 --- a/keras_cv/src/bounding_box/mask_invalid_detections_test.py +++ b/keras_cv/src/bounding_box/mask_invalid_detections_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/bounding_box/to_dense.py b/keras_cv/src/bounding_box/to_dense.py index f7c4c9d9c4..145d331fb3 100644 --- a/keras_cv/src/bounding_box/to_dense.py +++ b/keras_cv/src/bounding_box/to_dense.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/bounding_box/to_dense_test.py b/keras_cv/src/bounding_box/to_dense_test.py index 899991cff0..1deef9a812 100644 --- a/keras_cv/src/bounding_box/to_dense_test.py +++ b/keras_cv/src/bounding_box/to_dense_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/bounding_box/to_ragged.py b/keras_cv/src/bounding_box/to_ragged.py index b30d85f596..1f87cd384e 100644 --- a/keras_cv/src/bounding_box/to_ragged.py +++ b/keras_cv/src/bounding_box/to_ragged.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/bounding_box/validate_format.py b/keras_cv/src/bounding_box/validate_format.py index 31449f8bca..4541a5deab 100644 --- a/keras_cv/src/bounding_box/validate_format.py +++ b/keras_cv/src/bounding_box/validate_format.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/callbacks/waymo_evaluation_callback.py b/keras_cv/src/callbacks/waymo_evaluation_callback.py index 78d7f14514..f2b261782a 100644 --- a/keras_cv/src/callbacks/waymo_evaluation_callback.py +++ b/keras_cv/src/callbacks/waymo_evaluation_callback.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow.keras.callbacks import Callback diff --git a/keras_cv/src/callbacks/waymo_evaluation_callback_test.py b/keras_cv/src/callbacks/waymo_evaluation_callback_test.py index 1a55d68f7d..5f51b25177 100644 --- a/keras_cv/src/callbacks/waymo_evaluation_callback_test.py +++ b/keras_cv/src/callbacks/waymo_evaluation_callback_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/core/factor_sampler/constant_factor_sampler.py b/keras_cv/src/core/factor_sampler/constant_factor_sampler.py index 6f7aef3090..c5ed578dc5 100644 --- a/keras_cv/src/core/factor_sampler/constant_factor_sampler.py +++ b/keras_cv/src/core/factor_sampler/constant_factor_sampler.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/core/factor_sampler/normal_factor_sampler.py b/keras_cv/src/core/factor_sampler/normal_factor_sampler.py index c9ded440b8..5d2aee7f1b 100644 --- a/keras_cv/src/core/factor_sampler/normal_factor_sampler.py +++ b/keras_cv/src/core/factor_sampler/normal_factor_sampler.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/core/factor_sampler/uniform_factor_sampler.py b/keras_cv/src/core/factor_sampler/uniform_factor_sampler.py index 5c0eacf3d7..632d20eab8 100644 --- a/keras_cv/src/core/factor_sampler/uniform_factor_sampler.py +++ b/keras_cv/src/core/factor_sampler/uniform_factor_sampler.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/datasets/imagenet/load.py b/keras_cv/src/datasets/imagenet/load.py index a84ccd3d59..6b62bd5657 100644 --- a/keras_cv/src/datasets/imagenet/load.py +++ b/keras_cv/src/datasets/imagenet/load.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow.keras import layers diff --git a/keras_cv/src/datasets/pascal_voc/load.py b/keras_cv/src/datasets/pascal_voc/load.py index 64552a5536..68924a68d2 100644 --- a/keras_cv/src/datasets/pascal_voc/load.py +++ b/keras_cv/src/datasets/pascal_voc/load.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) import tensorflow_datasets as tfds diff --git a/keras_cv/src/datasets/pascal_voc/segmentation.py b/keras_cv/src/datasets/pascal_voc/segmentation.py index a12a72896a..b55b464a72 100644 --- a/keras_cv/src/datasets/pascal_voc/segmentation.py +++ b/keras_cv/src/datasets/pascal_voc/segmentation.py @@ -47,7 +47,7 @@ class and instance segmentation masks. import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) import tensorflow_datasets as tfds diff --git a/keras_cv/src/datasets/pascal_voc/segmentation_test.py b/keras_cv/src/datasets/pascal_voc/segmentation_test.py index 56f2aa3407..76f1d1e576 100644 --- a/keras_cv/src/datasets/pascal_voc/segmentation_test.py +++ b/keras_cv/src/datasets/pascal_voc/segmentation_test.py @@ -19,7 +19,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl import flags diff --git a/keras_cv/src/datasets/waymo/load.py b/keras_cv/src/datasets/waymo/load.py index 29689762e9..a84791399d 100644 --- a/keras_cv/src/datasets/waymo/load.py +++ b/keras_cv/src/datasets/waymo/load.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/datasets/waymo/struct.py b/keras_cv/src/datasets/waymo/struct.py index 29722bea55..6d90261335 100644 --- a/keras_cv/src/datasets/waymo/struct.py +++ b/keras_cv/src/datasets/waymo/struct.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/datasets/waymo/transformer.py b/keras_cv/src/datasets/waymo/transformer.py index 5b17dd1510..012dce7efb 100644 --- a/keras_cv/src/datasets/waymo/transformer.py +++ b/keras_cv/src/datasets/waymo/transformer.py @@ -24,7 +24,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/datasets/waymo/transformer_test.py b/keras_cv/src/datasets/waymo/transformer_test.py index 48f821cf42..62ed198b52 100644 --- a/keras_cv/src/datasets/waymo/transformer_test.py +++ b/keras_cv/src/datasets/waymo/transformer_test.py @@ -19,7 +19,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/keypoint/converters.py b/keras_cv/src/keypoint/converters.py index 4b8eeedf74..11991de98b 100644 --- a/keras_cv/src/keypoint/converters.py +++ b/keras_cv/src/keypoint/converters.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/keypoint/converters_test.py b/keras_cv/src/keypoint/converters_test.py index 69d3d3da52..d640eb57b5 100644 --- a/keras_cv/src/keypoint/converters_test.py +++ b/keras_cv/src/keypoint/converters_test.py @@ -19,7 +19,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/keypoint/utils.py b/keras_cv/src/keypoint/utils.py index c90d3b8d72..f067df7462 100644 --- a/keras_cv/src/keypoint/utils.py +++ b/keras_cv/src/keypoint/utils.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/keypoint/utils_test.py b/keras_cv/src/keypoint/utils_test.py index 928eb2b261..722a087db7 100644 --- a/keras_cv/src/keypoint/utils_test.py +++ b/keras_cv/src/keypoint/utils_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/fusedmbconv_test.py b/keras_cv/src/layers/fusedmbconv_test.py index b16f59cba8..18a7326253 100644 --- a/keras_cv/src/layers/fusedmbconv_test.py +++ b/keras_cv/src/layers/fusedmbconv_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/layers/mbconv_test.py b/keras_cv/src/layers/mbconv_test.py index 02b3a61b84..fae503d95d 100644 --- a/keras_cv/src/layers/mbconv_test.py +++ b/keras_cv/src/layers/mbconv_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/layers/object_detection/multi_class_non_max_suppression.py b/keras_cv/src/layers/object_detection/multi_class_non_max_suppression.py index b2fc77e168..292d3dc1bf 100644 --- a/keras_cv/src/layers/object_detection/multi_class_non_max_suppression.py +++ b/keras_cv/src/layers/object_detection/multi_class_non_max_suppression.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py b/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py index 890e1e99d6..20a4e8bf6a 100644 --- a/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py +++ b/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/object_detection/non_max_suppression.py b/keras_cv/src/layers/object_detection/non_max_suppression.py index 3a0375348b..5fb8c506c7 100644 --- a/keras_cv/src/layers/object_detection/non_max_suppression.py +++ b/keras_cv/src/layers/object_detection/non_max_suppression.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) @@ -329,13 +329,7 @@ def suppression_loop_body(boxes, iou_threshold, output_size, idx): ops.reshape(sorted_indices, [-1]), take_along_axis_idx ) else: - try: - import tensorflow as tf -except ImportError: - raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " - "The TensorFlow package is required for data preprocessing with any backend." - ) + import tensorflow as tf idx = tf.gather(ops.reshape(sorted_indices, [-1]), take_along_axis_idx) idx = ops.reshape(idx, [batch_size, -1]) diff --git a/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py b/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py index bb37d2c5ae..d0f6075dd9 100644 --- a/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py +++ b/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py @@ -22,7 +22,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/layers/object_detection_3d/centernet_label_encoder_test.py b/keras_cv/src/layers/object_detection_3d/centernet_label_encoder_test.py index 9afd6f90bd..57190978ee 100644 --- a/keras_cv/src/layers/object_detection_3d/centernet_label_encoder_test.py +++ b/keras_cv/src/layers/object_detection_3d/centernet_label_encoder_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/object_detection_3d/voxel_utils.py b/keras_cv/src/layers/object_detection_3d/voxel_utils.py index 6253ecc51f..1a586e6e51 100644 --- a/keras_cv/src/layers/object_detection_3d/voxel_utils.py +++ b/keras_cv/src/layers/object_detection_3d/voxel_utils.py @@ -19,7 +19,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/object_detection_3d/voxel_utils_test.py b/keras_cv/src/layers/object_detection_3d/voxel_utils_test.py index 518f748456..98775860de 100644 --- a/keras_cv/src/layers/object_detection_3d/voxel_utils_test.py +++ b/keras_cv/src/layers/object_detection_3d/voxel_utils_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/object_detection_3d/voxelization_test.py b/keras_cv/src/layers/object_detection_3d/voxelization_test.py index 007f538b7e..83ed09393b 100644 --- a/keras_cv/src/layers/object_detection_3d/voxelization_test.py +++ b/keras_cv/src/layers/object_detection_3d/voxelization_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/aug_mix.py b/keras_cv/src/layers/preprocessing/aug_mix.py index 7e5cbe52a9..33a79612f9 100644 --- a/keras_cv/src/layers/preprocessing/aug_mix.py +++ b/keras_cv/src/layers/preprocessing/aug_mix.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/aug_mix_test.py b/keras_cv/src/layers/preprocessing/aug_mix_test.py index b9fe79de7b..2b38f40c6a 100644 --- a/keras_cv/src/layers/preprocessing/aug_mix_test.py +++ b/keras_cv/src/layers/preprocessing/aug_mix_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/auto_contrast.py b/keras_cv/src/layers/preprocessing/auto_contrast.py index 4f29a95f1e..c2c2881168 100644 --- a/keras_cv/src/layers/preprocessing/auto_contrast.py +++ b/keras_cv/src/layers/preprocessing/auto_contrast.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py index 8ea49c36b7..1bd457140f 100644 --- a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py +++ b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) import tree diff --git a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py index 81ff8d6c24..43ccc279e3 100644 --- a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py +++ b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/channel_shuffle.py b/keras_cv/src/layers/preprocessing/channel_shuffle.py index 5f0b25e499..3377d3e7d1 100644 --- a/keras_cv/src/layers/preprocessing/channel_shuffle.py +++ b/keras_cv/src/layers/preprocessing/channel_shuffle.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/channel_shuffle_test.py b/keras_cv/src/layers/preprocessing/channel_shuffle_test.py index 5450cf7ee8..c8ed5e2cad 100644 --- a/keras_cv/src/layers/preprocessing/channel_shuffle_test.py +++ b/keras_cv/src/layers/preprocessing/channel_shuffle_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/cut_mix.py b/keras_cv/src/layers/preprocessing/cut_mix.py index db0bdf08b6..8cf76788d8 100644 --- a/keras_cv/src/layers/preprocessing/cut_mix.py +++ b/keras_cv/src/layers/preprocessing/cut_mix.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/cut_mix_test.py b/keras_cv/src/layers/preprocessing/cut_mix_test.py index 4de3feeb70..046fd07a97 100644 --- a/keras_cv/src/layers/preprocessing/cut_mix_test.py +++ b/keras_cv/src/layers/preprocessing/cut_mix_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/equalization.py b/keras_cv/src/layers/preprocessing/equalization.py index 14dd8207cc..c606f1c1cf 100644 --- a/keras_cv/src/layers/preprocessing/equalization.py +++ b/keras_cv/src/layers/preprocessing/equalization.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/fourier_mix.py b/keras_cv/src/layers/preprocessing/fourier_mix.py index 18cc79fba1..3f6c5c05c0 100644 --- a/keras_cv/src/layers/preprocessing/fourier_mix.py +++ b/keras_cv/src/layers/preprocessing/fourier_mix.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/fourier_mix_test.py b/keras_cv/src/layers/preprocessing/fourier_mix_test.py index 9752b7b842..620296d430 100644 --- a/keras_cv/src/layers/preprocessing/fourier_mix_test.py +++ b/keras_cv/src/layers/preprocessing/fourier_mix_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/grayscale.py b/keras_cv/src/layers/preprocessing/grayscale.py index ea64f8300d..7c3495507a 100644 --- a/keras_cv/src/layers/preprocessing/grayscale.py +++ b/keras_cv/src/layers/preprocessing/grayscale.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/grayscale_test.py b/keras_cv/src/layers/preprocessing/grayscale_test.py index 9a8ede921d..567f85e0b9 100644 --- a/keras_cv/src/layers/preprocessing/grayscale_test.py +++ b/keras_cv/src/layers/preprocessing/grayscale_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/grid_mask.py b/keras_cv/src/layers/preprocessing/grid_mask.py index 7647b3be97..8f1cbf59f2 100644 --- a/keras_cv/src/layers/preprocessing/grid_mask.py +++ b/keras_cv/src/layers/preprocessing/grid_mask.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/grid_mask_test.py b/keras_cv/src/layers/preprocessing/grid_mask_test.py index d6acec3690..dc0ef5399c 100644 --- a/keras_cv/src/layers/preprocessing/grid_mask_test.py +++ b/keras_cv/src/layers/preprocessing/grid_mask_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/jittered_resize.py b/keras_cv/src/layers/preprocessing/jittered_resize.py index e072d19152..eb76d17168 100644 --- a/keras_cv/src/layers/preprocessing/jittered_resize.py +++ b/keras_cv/src/layers/preprocessing/jittered_resize.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/jittered_resize_test.py b/keras_cv/src/layers/preprocessing/jittered_resize_test.py index c0ebe6731f..4858bd8d28 100644 --- a/keras_cv/src/layers/preprocessing/jittered_resize_test.py +++ b/keras_cv/src/layers/preprocessing/jittered_resize_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/mix_up.py b/keras_cv/src/layers/preprocessing/mix_up.py index 2b062c27ee..cee9a94d77 100644 --- a/keras_cv/src/layers/preprocessing/mix_up.py +++ b/keras_cv/src/layers/preprocessing/mix_up.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/mix_up_test.py b/keras_cv/src/layers/preprocessing/mix_up_test.py index 5cfc0f519c..7772c51e8d 100644 --- a/keras_cv/src/layers/preprocessing/mix_up_test.py +++ b/keras_cv/src/layers/preprocessing/mix_up_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/mosaic.py b/keras_cv/src/layers/preprocessing/mosaic.py index ab37d989ec..ced9ecf23d 100644 --- a/keras_cv/src/layers/preprocessing/mosaic.py +++ b/keras_cv/src/layers/preprocessing/mosaic.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/mosaic_test.py b/keras_cv/src/layers/preprocessing/mosaic_test.py index c74b1e392c..6c084d022f 100644 --- a/keras_cv/src/layers/preprocessing/mosaic_test.py +++ b/keras_cv/src/layers/preprocessing/mosaic_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/posterization.py b/keras_cv/src/layers/preprocessing/posterization.py index 8a796fdf24..a0b9d492ac 100644 --- a/keras_cv/src/layers/preprocessing/posterization.py +++ b/keras_cv/src/layers/preprocessing/posterization.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/posterization_test.py b/keras_cv/src/layers/preprocessing/posterization_test.py index 08ef5c4a60..22b1b9da3c 100644 --- a/keras_cv/src/layers/preprocessing/posterization_test.py +++ b/keras_cv/src/layers/preprocessing/posterization_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/ragged_image_test.py b/keras_cv/src/layers/preprocessing/ragged_image_test.py index 60b601ff40..e9787617f9 100644 --- a/keras_cv/src/layers/preprocessing/ragged_image_test.py +++ b/keras_cv/src/layers/preprocessing/ragged_image_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/rand_augment_test.py b/keras_cv/src/layers/preprocessing/rand_augment_test.py index 528a9b92b0..592f43a19a 100644 --- a/keras_cv/src/layers/preprocessing/rand_augment_test.py +++ b/keras_cv/src/layers/preprocessing/rand_augment_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/random_apply_test.py b/keras_cv/src/layers/preprocessing/random_apply_test.py index 756ce6c97f..e42cfd4b6a 100644 --- a/keras_cv/src/layers/preprocessing/random_apply_test.py +++ b/keras_cv/src/layers/preprocessing/random_apply_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/random_aspect_ratio.py b/keras_cv/src/layers/preprocessing/random_aspect_ratio.py index 25e0d0699b..c26500bc97 100644 --- a/keras_cv/src/layers/preprocessing/random_aspect_ratio.py +++ b/keras_cv/src/layers/preprocessing/random_aspect_ratio.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_aspect_ratio_test.py b/keras_cv/src/layers/preprocessing/random_aspect_ratio_test.py index fc23875071..f2b65c83ea 100644 --- a/keras_cv/src/layers/preprocessing/random_aspect_ratio_test.py +++ b/keras_cv/src/layers/preprocessing/random_aspect_ratio_test.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_augmentation_pipeline.py b/keras_cv/src/layers/preprocessing/random_augmentation_pipeline.py index b7b1d6895b..4ad9e9b875 100644 --- a/keras_cv/src/layers/preprocessing/random_augmentation_pipeline.py +++ b/keras_cv/src/layers/preprocessing/random_augmentation_pipeline.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py b/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py index a6eea87729..2f0e930228 100644 --- a/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py +++ b/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/random_brightness.py b/keras_cv/src/layers/preprocessing/random_brightness.py index 3e5fe8ad48..a754bde3b6 100644 --- a/keras_cv/src/layers/preprocessing/random_brightness.py +++ b/keras_cv/src/layers/preprocessing/random_brightness.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_brightness_test.py b/keras_cv/src/layers/preprocessing/random_brightness_test.py index d67925f1f7..b4727a2077 100644 --- a/keras_cv/src/layers/preprocessing/random_brightness_test.py +++ b/keras_cv/src/layers/preprocessing/random_brightness_test.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_channel_shift.py b/keras_cv/src/layers/preprocessing/random_channel_shift.py index 86e6c1bfff..fb9e846252 100644 --- a/keras_cv/src/layers/preprocessing/random_channel_shift.py +++ b/keras_cv/src/layers/preprocessing/random_channel_shift.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_channel_shift_test.py b/keras_cv/src/layers/preprocessing/random_channel_shift_test.py index 05c903d5c2..d5e79ad9d1 100644 --- a/keras_cv/src/layers/preprocessing/random_channel_shift_test.py +++ b/keras_cv/src/layers/preprocessing/random_channel_shift_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_choice.py b/keras_cv/src/layers/preprocessing/random_choice.py index 004ad9f1f7..b4484b1d97 100644 --- a/keras_cv/src/layers/preprocessing/random_choice.py +++ b/keras_cv/src/layers/preprocessing/random_choice.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_choice_test.py b/keras_cv/src/layers/preprocessing/random_choice_test.py index bb9a10811c..ebbf8506de 100644 --- a/keras_cv/src/layers/preprocessing/random_choice_test.py +++ b/keras_cv/src/layers/preprocessing/random_choice_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_color_degeneration.py b/keras_cv/src/layers/preprocessing/random_color_degeneration.py index 1c3557843b..e1bbf14109 100644 --- a/keras_cv/src/layers/preprocessing/random_color_degeneration.py +++ b/keras_cv/src/layers/preprocessing/random_color_degeneration.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py b/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py index 5d9bfd6f5b..3295a1ac85 100644 --- a/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py +++ b/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_color_jitter_test.py b/keras_cv/src/layers/preprocessing/random_color_jitter_test.py index 1d7cd47709..9066ef29ef 100644 --- a/keras_cv/src/layers/preprocessing/random_color_jitter_test.py +++ b/keras_cv/src/layers/preprocessing/random_color_jitter_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_contrast.py b/keras_cv/src/layers/preprocessing/random_contrast.py index b9a8fbc1af..6e5f84f36f 100644 --- a/keras_cv/src/layers/preprocessing/random_contrast.py +++ b/keras_cv/src/layers/preprocessing/random_contrast.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_contrast_test.py b/keras_cv/src/layers/preprocessing/random_contrast_test.py index f1f5a81344..8ef9c15360 100644 --- a/keras_cv/src/layers/preprocessing/random_contrast_test.py +++ b/keras_cv/src/layers/preprocessing/random_contrast_test.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_crop.py b/keras_cv/src/layers/preprocessing/random_crop.py index 5b26de22b1..c030017e6f 100644 --- a/keras_cv/src/layers/preprocessing/random_crop.py +++ b/keras_cv/src/layers/preprocessing/random_crop.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_crop_and_resize.py b/keras_cv/src/layers/preprocessing/random_crop_and_resize.py index c3c64e1658..2797e307d8 100644 --- a/keras_cv/src/layers/preprocessing/random_crop_and_resize.py +++ b/keras_cv/src/layers/preprocessing/random_crop_and_resize.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py b/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py index 8342d5a335..c588efe8ff 100644 --- a/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py +++ b/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/random_crop_test.py b/keras_cv/src/layers/preprocessing/random_crop_test.py index 06e80b9ba4..abfdfdf405 100644 --- a/keras_cv/src/layers/preprocessing/random_crop_test.py +++ b/keras_cv/src/layers/preprocessing/random_crop_test.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/random_cutout.py b/keras_cv/src/layers/preprocessing/random_cutout.py index 606806162f..b0e308bc91 100644 --- a/keras_cv/src/layers/preprocessing/random_cutout.py +++ b/keras_cv/src/layers/preprocessing/random_cutout.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_cutout_test.py b/keras_cv/src/layers/preprocessing/random_cutout_test.py index 4805b8e1f4..c900e7da4b 100644 --- a/keras_cv/src/layers/preprocessing/random_cutout_test.py +++ b/keras_cv/src/layers/preprocessing/random_cutout_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_flip.py b/keras_cv/src/layers/preprocessing/random_flip.py index d22e8d1ff0..93764fe05e 100644 --- a/keras_cv/src/layers/preprocessing/random_flip.py +++ b/keras_cv/src/layers/preprocessing/random_flip.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_flip_test.py b/keras_cv/src/layers/preprocessing/random_flip_test.py index 4937911616..2195c7f06d 100644 --- a/keras_cv/src/layers/preprocessing/random_flip_test.py +++ b/keras_cv/src/layers/preprocessing/random_flip_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_gaussian_blur.py b/keras_cv/src/layers/preprocessing/random_gaussian_blur.py index 6a43098dbb..7b4e4f7659 100644 --- a/keras_cv/src/layers/preprocessing/random_gaussian_blur.py +++ b/keras_cv/src/layers/preprocessing/random_gaussian_blur.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py b/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py index 2324589995..a4729240a3 100644 --- a/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py +++ b/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_hue.py b/keras_cv/src/layers/preprocessing/random_hue.py index e3e0a6f917..e3094f77ae 100644 --- a/keras_cv/src/layers/preprocessing/random_hue.py +++ b/keras_cv/src/layers/preprocessing/random_hue.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_jpeg_quality.py b/keras_cv/src/layers/preprocessing/random_jpeg_quality.py index 0b3d3497a6..9805f88f4a 100644 --- a/keras_cv/src/layers/preprocessing/random_jpeg_quality.py +++ b/keras_cv/src/layers/preprocessing/random_jpeg_quality.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py b/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py index f3b143b735..9e71c33c27 100644 --- a/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py +++ b/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_rotation.py b/keras_cv/src/layers/preprocessing/random_rotation.py index 49d28b15d2..e25815c616 100644 --- a/keras_cv/src/layers/preprocessing/random_rotation.py +++ b/keras_cv/src/layers/preprocessing/random_rotation.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_rotation_test.py b/keras_cv/src/layers/preprocessing/random_rotation_test.py index adecc26e43..b52ea62685 100644 --- a/keras_cv/src/layers/preprocessing/random_rotation_test.py +++ b/keras_cv/src/layers/preprocessing/random_rotation_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_saturation.py b/keras_cv/src/layers/preprocessing/random_saturation.py index 0ad89a1794..d397bb6dfe 100644 --- a/keras_cv/src/layers/preprocessing/random_saturation.py +++ b/keras_cv/src/layers/preprocessing/random_saturation.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_saturation_test.py b/keras_cv/src/layers/preprocessing/random_saturation_test.py index 15a361b9f6..335344d45c 100644 --- a/keras_cv/src/layers/preprocessing/random_saturation_test.py +++ b/keras_cv/src/layers/preprocessing/random_saturation_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_sharpness.py b/keras_cv/src/layers/preprocessing/random_sharpness.py index fce2c71ea5..2829469be6 100644 --- a/keras_cv/src/layers/preprocessing/random_sharpness.py +++ b/keras_cv/src/layers/preprocessing/random_sharpness.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_sharpness_test.py b/keras_cv/src/layers/preprocessing/random_sharpness_test.py index 19fe767841..1266d5090b 100644 --- a/keras_cv/src/layers/preprocessing/random_sharpness_test.py +++ b/keras_cv/src/layers/preprocessing/random_sharpness_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_shear.py b/keras_cv/src/layers/preprocessing/random_shear.py index 3ee6c254d2..93c55bf7af 100644 --- a/keras_cv/src/layers/preprocessing/random_shear.py +++ b/keras_cv/src/layers/preprocessing/random_shear.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_shear_test.py b/keras_cv/src/layers/preprocessing/random_shear_test.py index 977fb37e55..a2edb2c4c9 100644 --- a/keras_cv/src/layers/preprocessing/random_shear_test.py +++ b/keras_cv/src/layers/preprocessing/random_shear_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_translation.py b/keras_cv/src/layers/preprocessing/random_translation.py index 50c9d5e1e0..ce3af2c0b0 100644 --- a/keras_cv/src/layers/preprocessing/random_translation.py +++ b/keras_cv/src/layers/preprocessing/random_translation.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_translation_test.py b/keras_cv/src/layers/preprocessing/random_translation_test.py index 166631c109..ed5d70fb65 100644 --- a/keras_cv/src/layers/preprocessing/random_translation_test.py +++ b/keras_cv/src/layers/preprocessing/random_translation_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/random_zoom.py b/keras_cv/src/layers/preprocessing/random_zoom.py index 3b658c2f42..c375b459b7 100644 --- a/keras_cv/src/layers/preprocessing/random_zoom.py +++ b/keras_cv/src/layers/preprocessing/random_zoom.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow.keras import backend diff --git a/keras_cv/src/layers/preprocessing/random_zoom_test.py b/keras_cv/src/layers/preprocessing/random_zoom_test.py index 5ca8dee8ea..d09f8efff6 100644 --- a/keras_cv/src/layers/preprocessing/random_zoom_test.py +++ b/keras_cv/src/layers/preprocessing/random_zoom_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/repeated_augmentation.py b/keras_cv/src/layers/preprocessing/repeated_augmentation.py index 56168c2c40..3bd19f131b 100644 --- a/keras_cv/src/layers/preprocessing/repeated_augmentation.py +++ b/keras_cv/src/layers/preprocessing/repeated_augmentation.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py b/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py index c40005006e..3d3a03f640 100644 --- a/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py +++ b/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/rescaling.py b/keras_cv/src/layers/preprocessing/rescaling.py index 4478e2e67e..2fa08cc6cf 100644 --- a/keras_cv/src/layers/preprocessing/rescaling.py +++ b/keras_cv/src/layers/preprocessing/rescaling.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/rescaling_test.py b/keras_cv/src/layers/preprocessing/rescaling_test.py index e7161aaf6b..acee4dc24e 100644 --- a/keras_cv/src/layers/preprocessing/rescaling_test.py +++ b/keras_cv/src/layers/preprocessing/rescaling_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/resizing.py b/keras_cv/src/layers/preprocessing/resizing.py index 4f4aae46be..aac723c43a 100644 --- a/keras_cv/src/layers/preprocessing/resizing.py +++ b/keras_cv/src/layers/preprocessing/resizing.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/resizing_test.py b/keras_cv/src/layers/preprocessing/resizing_test.py index af2172a4b9..b249837bd5 100644 --- a/keras_cv/src/layers/preprocessing/resizing_test.py +++ b/keras_cv/src/layers/preprocessing/resizing_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/solarization.py b/keras_cv/src/layers/preprocessing/solarization.py index affac94edf..6ab518d71a 100644 --- a/keras_cv/src/layers/preprocessing/solarization.py +++ b/keras_cv/src/layers/preprocessing/solarization.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/solarization_test.py b/keras_cv/src/layers/preprocessing/solarization_test.py index 470fdc14cd..e98f4a0724 100644 --- a/keras_cv/src/layers/preprocessing/solarization_test.py +++ b/keras_cv/src/layers/preprocessing/solarization_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer.py b/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer.py index 56df425513..52ea96f020 100644 --- a/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer.py +++ b/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) import tree diff --git a/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py b/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py index a6b24bc3fc..b6c8085994 100644 --- a/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py +++ b/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing/with_labels_test.py b/keras_cv/src/layers/preprocessing/with_labels_test.py index 3f93877be5..179219da57 100644 --- a/keras_cv/src/layers/preprocessing/with_labels_test.py +++ b/keras_cv/src/layers/preprocessing/with_labels_test.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/with_mixed_precision_test.py b/keras_cv/src/layers/preprocessing/with_mixed_precision_test.py index dbb0ab8eab..50eb3cf2b0 100644 --- a/keras_cv/src/layers/preprocessing/with_mixed_precision_test.py +++ b/keras_cv/src/layers/preprocessing/with_mixed_precision_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing/with_segmentation_masks_test.py b/keras_cv/src/layers/preprocessing/with_segmentation_masks_test.py index f17ee01572..d66b420568 100644 --- a/keras_cv/src/layers/preprocessing/with_segmentation_masks_test.py +++ b/keras_cv/src/layers/preprocessing/with_segmentation_masks_test.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d.py b/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d.py index 4ff15758eb..6b03a1bdd2 100644 --- a/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d.py +++ b/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py b/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py index d504e64745..a35762a9b6 100644 --- a/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py +++ b/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/input_format_test.py b/keras_cv/src/layers/preprocessing_3d/input_format_test.py index 9e3bd99756..ddf9dae285 100644 --- a/keras_cv/src/layers/preprocessing_3d/input_format_test.py +++ b/keras_cv/src/layers/preprocessing_3d/input_format_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_dropping_points.py b/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_dropping_points.py index 0f0d4a08ac..a2e041a8d4 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_dropping_points.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_dropping_points.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_point_feature_noise.py b/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_point_feature_noise.py index 519731d552..c4bf08185c 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_point_feature_noise.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/frustum_random_point_feature_noise.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_dropping_points.py b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_dropping_points.py index 1d38f7334d..5cdb4429de 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_dropping_points.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_dropping_points.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_flip.py b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_flip.py index 0257698baa..00e938ab77 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_flip.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_flip.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_rotation.py b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_rotation.py index 15739ddfc5..e1087229b0 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_rotation.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_rotation.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_scaling.py b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_scaling.py index c649140640..892ded2803 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_scaling.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_scaling.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_translation.py b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_translation.py index bf7089ce93..51b790880c 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/global_random_translation.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/global_random_translation.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes.py b/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes.py index b6212baa9e..c863a6e9a9 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py b/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py index 56dc6b8dac..6e9b211677 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py @@ -10,7 +10,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/random_copy_paste.py b/keras_cv/src/layers/preprocessing_3d/waymo/random_copy_paste.py index 0028d7eb03..8d1b927482 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/random_copy_paste.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/random_copy_paste.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/random_drop_box.py b/keras_cv/src/layers/preprocessing_3d/waymo/random_drop_box.py index e8f82b5e3c..37495062f6 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/random_drop_box.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/random_drop_box.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/swap_background.py b/keras_cv/src/layers/preprocessing_3d/waymo/swap_background.py index 67dac228bf..304eb56d16 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/swap_background.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/swap_background.py @@ -6,7 +6,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/regularization/drop_path_test.py b/keras_cv/src/layers/regularization/drop_path_test.py index 3830ae8412..afc6bca11f 100644 --- a/keras_cv/src/layers/regularization/drop_path_test.py +++ b/keras_cv/src/layers/regularization/drop_path_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/regularization/dropblock_2d_test.py b/keras_cv/src/layers/regularization/dropblock_2d_test.py index ef4b394714..1ffc826135 100644 --- a/keras_cv/src/layers/regularization/dropblock_2d_test.py +++ b/keras_cv/src/layers/regularization/dropblock_2d_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/regularization/squeeze_excite_test.py b/keras_cv/src/layers/regularization/squeeze_excite_test.py index ab21511ba6..ae81bf0f32 100644 --- a/keras_cv/src/layers/regularization/squeeze_excite_test.py +++ b/keras_cv/src/layers/regularization/squeeze_excite_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/regularization/stochastic_depth_test.py b/keras_cv/src/layers/regularization/stochastic_depth_test.py index 132c013f1f..f2088b4257 100644 --- a/keras_cv/src/layers/regularization/stochastic_depth_test.py +++ b/keras_cv/src/layers/regularization/stochastic_depth_test.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/transformer_encoder_test.py b/keras_cv/src/layers/transformer_encoder_test.py index c4d911ef8f..d75af1ad67 100644 --- a/keras_cv/src/layers/transformer_encoder_test.py +++ b/keras_cv/src/layers/transformer_encoder_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/layers/vit_layers.py b/keras_cv/src/layers/vit_layers.py index 72f1882115..04db6a9f57 100644 --- a/keras_cv/src/layers/vit_layers.py +++ b/keras_cv/src/layers/vit_layers.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow.keras import layers diff --git a/keras_cv/src/layers/vit_layers_test.py b/keras_cv/src/layers/vit_layers_test.py index 3904418f1d..02a203d048 100644 --- a/keras_cv/src/layers/vit_layers_test.py +++ b/keras_cv/src/layers/vit_layers_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/losses/giou_loss_test.py b/keras_cv/src/losses/giou_loss_test.py index 1c6f5d9ab7..adecf433a0 100644 --- a/keras_cv/src/losses/giou_loss_test.py +++ b/keras_cv/src/losses/giou_loss_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py b/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py index a1f7c41516..6eeb1a2856 100644 --- a/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py +++ b/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/metrics/object_detection/box_coco_metrics.py b/keras_cv/src/metrics/object_detection/box_coco_metrics.py index ef8d7fa538..8972677eaa 100644 --- a/keras_cv/src/metrics/object_detection/box_coco_metrics.py +++ b/keras_cv/src/metrics/object_detection/box_coco_metrics.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) import tensorflow.keras as keras diff --git a/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py b/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py index 0a35ba817f..6fec4d299f 100644 --- a/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py +++ b/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py index aee5275c16..0b1bcbb3bf 100644 --- a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py +++ b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py index c495e29f65..5a4a274bc7 100644 --- a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py +++ b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py b/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py index b06837e2e3..dd9a43798a 100644 --- a/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py +++ b/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py @@ -79,7 +79,7 @@ def __init__( import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) import keras_cv diff --git a/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py b/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py index 5fffd25def..1eeb04983e 100644 --- a/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py +++ b/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/models/classification/image_classifier_test.py b/keras_cv/src/models/classification/image_classifier_test.py index 742075b146..91589983fe 100644 --- a/keras_cv/src/models/classification/image_classifier_test.py +++ b/keras_cv/src/models/classification/image_classifier_test.py @@ -22,7 +22,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/models/classification/video_classifier_test.py b/keras_cv/src/models/classification/video_classifier_test.py index 46af2a8141..5b77a75de8 100644 --- a/keras_cv/src/models/classification/video_classifier_test.py +++ b/keras_cv/src/models/classification/video_classifier_test.py @@ -22,7 +22,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/models/feature_extractor/clip/clip_processor.py b/keras_cv/src/models/feature_extractor/clip/clip_processor.py index 9bdbcefb0e..ed6ff7b785 100644 --- a/keras_cv/src/models/feature_extractor/clip/clip_processor.py +++ b/keras_cv/src/models/feature_extractor/clip/clip_processor.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) import tree diff --git a/keras_cv/src/models/feature_extractor/clip/clip_processor_utils.py b/keras_cv/src/models/feature_extractor/clip/clip_processor_utils.py index a86972acef..3abfdad5b6 100644 --- a/keras_cv/src/models/feature_extractor/clip/clip_processor_utils.py +++ b/keras_cv/src/models/feature_extractor/clip/clip_processor_utils.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py b/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py index ae2a7a41ae..0eb06043aa 100644 --- a/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py +++ b/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/legacy/convmixer.py b/keras_cv/src/models/legacy/convmixer.py index ec88a9277f..6a288b3156 100644 --- a/keras_cv/src/models/legacy/convmixer.py +++ b/keras_cv/src/models/legacy/convmixer.py @@ -23,7 +23,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/legacy/convnext.py b/keras_cv/src/models/legacy/convnext.py index 9b8d3ccc48..f75bd172f2 100644 --- a/keras_cv/src/models/legacy/convnext.py +++ b/keras_cv/src/models/legacy/convnext.py @@ -22,7 +22,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/legacy/darknet.py b/keras_cv/src/models/legacy/darknet.py index 5e4edb5655..c3a3ff4ebe 100644 --- a/keras_cv/src/models/legacy/darknet.py +++ b/keras_cv/src/models/legacy/darknet.py @@ -22,7 +22,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/legacy/mlp_mixer.py b/keras_cv/src/models/legacy/mlp_mixer.py index d56ad86b16..1e8d9dea31 100644 --- a/keras_cv/src/models/legacy/mlp_mixer.py +++ b/keras_cv/src/models/legacy/mlp_mixer.py @@ -22,7 +22,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/legacy/models_test.py b/keras_cv/src/models/legacy/models_test.py index 351d1f2451..eec7acc343 100644 --- a/keras_cv/src/models/legacy/models_test.py +++ b/keras_cv/src/models/legacy/models_test.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn.py b/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn.py index a1dd664217..d9f79653dd 100644 --- a/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn.py +++ b/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl import logging diff --git a/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py b/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py index 5c2931f63d..507630570f 100644 --- a/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py +++ b/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/models/legacy/regnet.py b/keras_cv/src/models/legacy/regnet.py index d35051e66c..04f32243ef 100644 --- a/keras_cv/src/models/legacy/regnet.py +++ b/keras_cv/src/models/legacy/regnet.py @@ -21,7 +21,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/legacy/vgg16.py b/keras_cv/src/models/legacy/vgg16.py index a0b4805712..090bf3dc8e 100644 --- a/keras_cv/src/models/legacy/vgg16.py +++ b/keras_cv/src/models/legacy/vgg16.py @@ -23,7 +23,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/legacy/vgg19.py b/keras_cv/src/models/legacy/vgg19.py index 1a690d1c5f..37e579e64a 100644 --- a/keras_cv/src/models/legacy/vgg19.py +++ b/keras_cv/src/models/legacy/vgg19.py @@ -22,7 +22,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/legacy/vit.py b/keras_cv/src/models/legacy/vit.py index f4e3b4f7fe..12f05d2b14 100644 --- a/keras_cv/src/models/legacy/vit.py +++ b/keras_cv/src/models/legacy/vit.py @@ -23,7 +23,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/legacy/weights.py b/keras_cv/src/models/legacy/weights.py index f2d0eb4d67..04462fa861 100644 --- a/keras_cv/src/models/legacy/weights.py +++ b/keras_cv/src/models/legacy/weights.py @@ -14,7 +14,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow.keras import utils diff --git a/keras_cv/src/models/object_detection/__internal__.py b/keras_cv/src/models/object_detection/__internal__.py index 46338eb8cf..aef6f072cc 100644 --- a/keras_cv/src/models/object_detection/__internal__.py +++ b/keras_cv/src/models/object_detection/__internal__.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/object_detection/__test_utils__.py b/keras_cv/src/models/object_detection/__test_utils__.py index 7fdc88f567..01ad71240d 100644 --- a/keras_cv/src/models/object_detection/__test_utils__.py +++ b/keras_cv/src/models/object_detection/__test_utils__.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/object_detection/predict_utils.py b/keras_cv/src/models/object_detection/predict_utils.py index 72ef817142..9289b9130e 100644 --- a/keras_cv/src/models/object_detection/predict_utils.py +++ b/keras_cv/src/models/object_detection/predict_utils.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder.py b/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder.py index 8187ef3b5c..2eda323ba7 100644 --- a/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder.py +++ b/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py b/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py index 38fd5167be..ac7c97a04c 100644 --- a/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py +++ b/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/object_detection/retinanet/retinanet_test.py b/keras_cv/src/models/object_detection/retinanet/retinanet_test.py index 5eab2ab105..a5b00748dc 100644 --- a/keras_cv/src/models/object_detection/retinanet/retinanet_test.py +++ b/keras_cv/src/models/object_detection/retinanet/retinanet_test.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/models/object_detection/yolo_v8/yolo_v8_label_encoder.py b/keras_cv/src/models/object_detection/yolo_v8/yolo_v8_label_encoder.py index 45cba0b2b9..134502ff5b 100644 --- a/keras_cv/src/models/object_detection/yolo_v8/yolo_v8_label_encoder.py +++ b/keras_cv/src/models/object_detection/yolo_v8/yolo_v8_label_encoder.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/object_detection/yolox/binary_crossentropy.py b/keras_cv/src/models/object_detection/yolox/binary_crossentropy.py index 74731482e2..6cc699627c 100644 --- a/keras_cv/src/models/object_detection/yolox/binary_crossentropy.py +++ b/keras_cv/src/models/object_detection/yolox/binary_crossentropy.py @@ -19,7 +19,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/object_detection/yolox/layers/yolox_decoder.py b/keras_cv/src/models/object_detection/yolox/layers/yolox_decoder.py index b0d85313be..3f97d808ab 100644 --- a/keras_cv/src/models/object_detection/yolox/layers/yolox_decoder.py +++ b/keras_cv/src/models/object_detection/yolox/layers/yolox_decoder.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/object_detection/yolox/layers/yolox_head_test.py b/keras_cv/src/models/object_detection/yolox/layers/yolox_head_test.py index 20563bd21b..de19dce812 100644 --- a/keras_cv/src/models/object_detection/yolox/layers/yolox_head_test.py +++ b/keras_cv/src/models/object_detection/yolox/layers/yolox_head_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder.py b/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder.py index 7fd666014a..15bb2f8f18 100644 --- a/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder.py +++ b/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow.keras import layers diff --git a/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder_test.py b/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder_test.py index 02808fbc6c..f0b8c3272c 100644 --- a/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder_test.py +++ b/keras_cv/src/models/object_detection/yolox/layers/yolox_label_encoder_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/object_detection/yolox/layers/yolox_pafpn_test.py b/keras_cv/src/models/object_detection/yolox/layers/yolox_pafpn_test.py index 81512d0f61..685cc121f1 100644 --- a/keras_cv/src/models/object_detection/yolox/layers/yolox_pafpn_test.py +++ b/keras_cv/src/models/object_detection/yolox/layers/yolox_pafpn_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py b/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py index d139a960c9..8ea07f6150 100644 --- a/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py +++ b/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/object_detection_3d/center_pillar_test.py b/keras_cv/src/models/object_detection_3d/center_pillar_test.py index 43f42aad0b..84e643c2f2 100644 --- a/keras_cv/src/models/object_detection_3d/center_pillar_test.py +++ b/keras_cv/src/models/object_detection_3d/center_pillar_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/models/segmentation/basnet/basnet_test.py b/keras_cv/src/models/segmentation/basnet/basnet_test.py index 28fc42618f..d15f17461e 100644 --- a/keras_cv/src/models/segmentation/basnet/basnet_test.py +++ b/keras_cv/src/models/segmentation/basnet/basnet_test.py @@ -21,7 +21,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py b/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py index a27cedc40a..909ff9c7e7 100644 --- a/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py +++ b/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/models/segmentation/segformer/segformer.py b/keras_cv/src/models/segmentation/segformer/segformer.py index 8f9751d71e..2b6f553c5d 100644 --- a/keras_cv/src/models/segmentation/segformer/segformer.py +++ b/keras_cv/src/models/segmentation/segformer/segformer.py @@ -59,13 +59,7 @@ class SegFormer(Task): Using the class with a `backbone`: ```python - try: import tensorflow as tf -except ImportError: - raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " - "The TensorFlow package is required for data preprocessing with any backend." - ) import keras_cv images = np.ones(shape=(1, 96, 96, 3)) diff --git a/keras_cv/src/models/segmentation/segformer/segformer_test.py b/keras_cv/src/models/segmentation/segformer/segformer_test.py index f1bc320816..952f405ab7 100644 --- a/keras_cv/src/models/segmentation/segformer/segformer_test.py +++ b/keras_cv/src/models/segmentation/segformer/segformer_test.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/point_cloud/point_cloud.py b/keras_cv/src/point_cloud/point_cloud.py index fd1e693f32..e33df39626 100644 --- a/keras_cv/src/point_cloud/point_cloud.py +++ b/keras_cv/src/point_cloud/point_cloud.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/point_cloud/point_cloud_test.py b/keras_cv/src/point_cloud/point_cloud_test.py index 99db817b78..aa1af26d17 100644 --- a/keras_cv/src/point_cloud/point_cloud_test.py +++ b/keras_cv/src/point_cloud/point_cloud_test.py @@ -20,7 +20,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/point_cloud/within_box_3d_test.py b/keras_cv/src/point_cloud/within_box_3d_test.py index 4e73ca6205..a34108886b 100644 --- a/keras_cv/src/point_cloud/within_box_3d_test.py +++ b/keras_cv/src/point_cloud/within_box_3d_test.py @@ -21,7 +21,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/tests/test_case.py b/keras_cv/src/tests/test_case.py index 179ed36b2e..22ce4e1da7 100644 --- a/keras_cv/src/tests/test_case.py +++ b/keras_cv/src/tests/test_case.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from absl.testing import parameterized diff --git a/keras_cv/src/tools/checkpoint_conversion/ViT_weight_conversion.ipynb b/keras_cv/src/tools/checkpoint_conversion/ViT_weight_conversion.ipynb index 53543a75a6..f06146643f 100644 --- a/keras_cv/src/tools/checkpoint_conversion/ViT_weight_conversion.ipynb +++ b/keras_cv/src/tools/checkpoint_conversion/ViT_weight_conversion.ipynb @@ -91,13 +91,7 @@ "import os\n", "import pandas as pd\n", "\n", - "try: - import tensorflow as tf -except ImportError: - raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " - "The TensorFlow package is required for data preprocessing with any backend." - )\n", + "import tensorflow as tf\n", "import keras_cv\n", "\n", "import matplotlib.pyplot as plt\n", diff --git a/keras_cv/src/tools/training_scipts/Training_YOLOv8.ipynb b/keras_cv/src/tools/training_scipts/Training_YOLOv8.ipynb index a43cea81bd..dc0cf695e2 100644 --- a/keras_cv/src/tools/training_scipts/Training_YOLOv8.ipynb +++ b/keras_cv/src/tools/training_scipts/Training_YOLOv8.ipynb @@ -66,13 +66,7 @@ "import resource\n", "import sys\n", "\n", - "try: - import tensorflow as tf -except ImportError: - raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " - "The TensorFlow package is required for data preprocessing with any backend." - )\n", + "import tensorflow as tf\n", "import tensorflow_datasets as tfds\n", "import tqdm\n", "from tensorflow import keras\n", diff --git a/keras_cv/src/tools/training_scipts/training_deeplab_v3_plus.ipynb b/keras_cv/src/tools/training_scipts/training_deeplab_v3_plus.ipynb index 2a67b756e4..e7ff38752a 100644 --- a/keras_cv/src/tools/training_scipts/training_deeplab_v3_plus.ipynb +++ b/keras_cv/src/tools/training_scipts/training_deeplab_v3_plus.ipynb @@ -464,13 +464,7 @@ "outputs": [], "source": [ "def dict_to_tuple(x):\n", - " try: - import tensorflow as tf -except ImportError: - raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " - "The TensorFlow package is required for data preprocessing with any backend." - )\n", + " import tensorflow as tf\n", "\n", " return x[\"images\"], tf.one_hot(\n", " tf.cast(tf.squeeze(x[\"segmentation_masks\"], axis=-1), \"int32\"), 21\n", diff --git a/keras_cv/src/training/contrastive/contrastive_trainer.py b/keras_cv/src/training/contrastive/contrastive_trainer.py index b3196b478e..8b46b21a0f 100644 --- a/keras_cv/src/training/contrastive/contrastive_trainer.py +++ b/keras_cv/src/training/contrastive/contrastive_trainer.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/training/contrastive/contrastive_trainer_test.py b/keras_cv/src/training/contrastive/contrastive_trainer_test.py index 100a6db830..2a6938e4c4 100644 --- a/keras_cv/src/training/contrastive/contrastive_trainer_test.py +++ b/keras_cv/src/training/contrastive/contrastive_trainer_test.py @@ -18,7 +18,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/training/contrastive/simclr_trainer_test.py b/keras_cv/src/training/contrastive/simclr_trainer_test.py index e7d1b55191..79f0b3bc2a 100644 --- a/keras_cv/src/training/contrastive/simclr_trainer_test.py +++ b/keras_cv/src/training/contrastive/simclr_trainer_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/utils/fill_utils.py b/keras_cv/src/utils/fill_utils.py index 0d4bd730ea..0e2e732b35 100644 --- a/keras_cv/src/utils/fill_utils.py +++ b/keras_cv/src/utils/fill_utils.py @@ -15,7 +15,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/utils/fill_utils_test.py b/keras_cv/src/utils/fill_utils_test.py index 7790315dd3..cf81647302 100644 --- a/keras_cv/src/utils/fill_utils_test.py +++ b/keras_cv/src/utils/fill_utils_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/utils/preprocessing.py b/keras_cv/src/utils/preprocessing.py index 2290c87daf..1b4ca6dd48 100644 --- a/keras_cv/src/utils/preprocessing.py +++ b/keras_cv/src/utils/preprocessing.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) from tensorflow import keras diff --git a/keras_cv/src/utils/preprocessing_test.py b/keras_cv/src/utils/preprocessing_test.py index 98dc4e58cf..c4e3c68ed8 100644 --- a/keras_cv/src/utils/preprocessing_test.py +++ b/keras_cv/src/utils/preprocessing_test.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/utils/resource_loader.py b/keras_cv/src/utils/resource_loader.py index ea0132b55c..c3c5271f7f 100644 --- a/keras_cv/src/utils/resource_loader.py +++ b/keras_cv/src/utils/resource_loader.py @@ -24,7 +24,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/utils/to_numpy.py b/keras_cv/src/utils/to_numpy.py index 5abd3c3107..33da3d1914 100644 --- a/keras_cv/src/utils/to_numpy.py +++ b/keras_cv/src/utils/to_numpy.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/utils/train.py b/keras_cv/src/utils/train.py index 33b007f689..1019e2360a 100644 --- a/keras_cv/src/utils/train.py +++ b/keras_cv/src/utils/train.py @@ -16,7 +16,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/version_check_test.py b/keras_cv/src/version_check_test.py index 01db946e76..3216f7b93d 100644 --- a/keras_cv/src/version_check_test.py +++ b/keras_cv/src/version_check_test.py @@ -17,7 +17,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) diff --git a/keras_cv/src/visualization/plot_image_gallery.py b/keras_cv/src/visualization/plot_image_gallery.py index 438bb85577..ef93349729 100644 --- a/keras_cv/src/visualization/plot_image_gallery.py +++ b/keras_cv/src/visualization/plot_image_gallery.py @@ -19,7 +19,7 @@ import tensorflow as tf except ImportError: raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " "The TensorFlow package is required for data preprocessing with any backend." ) From c2289be2c0e9274182a188d44803534f1127499e Mon Sep 17 00:00:00 2001 From: Samaneh Saadat Date: Wed, 1 May 2024 16:42:24 +0000 Subject: [PATCH 3/3] Run formatter. --- keras_cv/src/backend/tf_ops.py | 1 + keras_cv/src/bounding_box/converters_test.py | 1 + .../mask_invalid_detections_test.py | 1 + keras_cv/src/bounding_box/to_dense_test.py | 1 + .../waymo_evaluation_callback_test.py | 1 + .../src/datasets/pascal_voc/segmentation.py | 1 + keras_cv/src/datasets/waymo/transformer.py | 1 + .../src/datasets/waymo/transformer_test.py | 1 + keras_cv/src/keypoint/converters_test.py | 1 + keras_cv/src/keypoint/utils_test.py | 1 + keras_cv/src/layers/fusedmbconv_test.py | 1 + keras_cv/src/layers/mbconv_test.py | 1 + .../multi_class_non_max_suppression_test.py | 1 + .../centernet_label_encoder.py | 1 + .../layers/object_detection_3d/voxel_utils.py | 1 + .../base_image_augmentation_layer.py | 1 + .../base_image_augmentation_layer_test.py | 1 + .../preprocessing/channel_shuffle_test.py | 1 + .../src/layers/preprocessing/cut_mix_test.py | 1 + .../layers/preprocessing/fourier_mix_test.py | 1 + .../layers/preprocessing/grayscale_test.py | 1 + .../layers/preprocessing/grid_mask_test.py | 1 + .../preprocessing/jittered_resize_test.py | 1 + .../src/layers/preprocessing/mix_up_test.py | 1 + .../src/layers/preprocessing/mosaic_test.py | 1 + .../preprocessing/posterization_test.py | 1 + .../layers/preprocessing/ragged_image_test.py | 1 + .../layers/preprocessing/rand_augment_test.py | 1 + .../layers/preprocessing/random_apply_test.py | 1 + .../random_augmentation_pipeline_test.py | 1 + .../random_channel_shift_test.py | 1 + .../preprocessing/random_choice_test.py | 1 + .../random_color_degeneration_test.py | 1 + .../preprocessing/random_color_jitter_test.py | 1 + .../random_crop_and_resize_test.py | 1 + .../layers/preprocessing/random_crop_test.py | 1 + .../preprocessing/random_cutout_test.py | 1 + .../layers/preprocessing/random_flip_test.py | 1 + .../random_gaussian_blur_test.py | 1 + .../preprocessing/random_jpeg_quality_test.py | 1 + .../layers/preprocessing/random_rotation.py | 1 + .../preprocessing/random_rotation_test.py | 1 + .../preprocessing/random_saturation_test.py | 1 + .../preprocessing/random_sharpness_test.py | 1 + .../layers/preprocessing/random_shear_test.py | 1 + .../preprocessing/random_translation_test.py | 1 + .../layers/preprocessing/random_zoom_test.py | 1 + .../repeated_augmentation_test.py | 1 + .../layers/preprocessing/rescaling_test.py | 1 + .../src/layers/preprocessing/resizing_test.py | 1 + .../layers/preprocessing/solarization_test.py | 1 + ...ized_base_image_augmentation_layer_test.py | 1 + .../base_augmentation_layer_3d_test.py | 1 + .../preprocessing_3d/input_format_test.py | 1 + .../group_points_by_bounding_boxes_test.py | 1 + .../layers/regularization/drop_path_test.py | 1 + keras_cv/src/layers/vit_layers_test.py | 1 + .../focal_loss_numerical_test.py | 1 + .../object_detection/box_coco_metrics.py | 1 + .../object_detection/box_coco_metrics_test.py | 1 + .../csp_darknet_backbone_presets_test.py | 1 + .../csp_darknet/csp_darknet_backbone_test.py | 1 + .../mix_transformer_backbone.py | 94 +++++++++---------- .../resnet_v1/resnet_v1_backbone_test.py | 1 + .../classification/image_classifier_test.py | 1 + .../classification/video_classifier_test.py | 1 + .../feature_extractor/clip/clip_tokenizer.py | 1 + keras_cv/src/models/legacy/models_test.py | 1 + .../faster_rcnn/faster_rcnn_test.py | 1 + .../models/object_detection/__internal__.py | 1 + .../models/object_detection/__test_utils__.py | 1 + .../retinanet/retinanet_label_encoder_test.py | 1 + .../retinanet/retinanet_test.py | 1 + .../center_pillar_backbone_test.py | 1 + .../object_detection_3d/center_pillar_test.py | 1 + .../models/segmentation/basnet/basnet_test.py | 1 + .../deeplab_v3_plus/deeplab_v3_plus_test.py | 1 + .../segmentation/segformer/segformer_test.py | 1 + keras_cv/src/point_cloud/point_cloud.py | 1 + keras_cv/src/point_cloud/point_cloud_test.py | 1 + .../src/point_cloud/within_box_3d_test.py | 1 + .../contrastive/contrastive_trainer_test.py | 1 + .../contrastive/simclr_trainer_test.py | 1 + keras_cv/src/utils/fill_utils_test.py | 1 + keras_cv/src/utils/to_numpy.py | 1 + keras_cv/src/version_check_test.py | 1 + .../src/visualization/plot_image_gallery.py | 1 + 87 files changed, 133 insertions(+), 47 deletions(-) diff --git a/keras_cv/src/backend/tf_ops.py b/keras_cv/src/backend/tf_ops.py index 1552a8c3a1..4ef359e917 100644 --- a/keras_cv/src/backend/tf_ops.py +++ b/keras_cv/src/backend/tf_ops.py @@ -46,6 +46,7 @@ from tensorflow import split # noqa: F403, F401 import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/bounding_box/converters_test.py b/keras_cv/src/bounding_box/converters_test.py index 403ec13493..23c47f82c6 100644 --- a/keras_cv/src/bounding_box/converters_test.py +++ b/keras_cv/src/bounding_box/converters_test.py @@ -16,6 +16,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/bounding_box/mask_invalid_detections_test.py b/keras_cv/src/bounding_box/mask_invalid_detections_test.py index 293ad67a21..15d6b519c5 100644 --- a/keras_cv/src/bounding_box/mask_invalid_detections_test.py +++ b/keras_cv/src/bounding_box/mask_invalid_detections_test.py @@ -14,6 +14,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/bounding_box/to_dense_test.py b/keras_cv/src/bounding_box/to_dense_test.py index 1deef9a812..01e2c63d5c 100644 --- a/keras_cv/src/bounding_box/to_dense_test.py +++ b/keras_cv/src/bounding_box/to_dense_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/callbacks/waymo_evaluation_callback_test.py b/keras_cv/src/callbacks/waymo_evaluation_callback_test.py index 5f51b25177..92489b913b 100644 --- a/keras_cv/src/callbacks/waymo_evaluation_callback_test.py +++ b/keras_cv/src/callbacks/waymo_evaluation_callback_test.py @@ -14,6 +14,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/datasets/pascal_voc/segmentation.py b/keras_cv/src/datasets/pascal_voc/segmentation.py index b55b464a72..b5f17df338 100644 --- a/keras_cv/src/datasets/pascal_voc/segmentation.py +++ b/keras_cv/src/datasets/pascal_voc/segmentation.py @@ -43,6 +43,7 @@ class and instance segmentation masks. import xml import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/datasets/waymo/transformer.py b/keras_cv/src/datasets/waymo/transformer.py index 012dce7efb..cba7d4bfa3 100644 --- a/keras_cv/src/datasets/waymo/transformer.py +++ b/keras_cv/src/datasets/waymo/transformer.py @@ -20,6 +20,7 @@ from typing import Tuple import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/datasets/waymo/transformer_test.py b/keras_cv/src/datasets/waymo/transformer_test.py index 62ed198b52..86ce34d35c 100644 --- a/keras_cv/src/datasets/waymo/transformer_test.py +++ b/keras_cv/src/datasets/waymo/transformer_test.py @@ -15,6 +15,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/keypoint/converters_test.py b/keras_cv/src/keypoint/converters_test.py index d640eb57b5..6665906e2f 100644 --- a/keras_cv/src/keypoint/converters_test.py +++ b/keras_cv/src/keypoint/converters_test.py @@ -15,6 +15,7 @@ import itertools import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/keypoint/utils_test.py b/keras_cv/src/keypoint/utils_test.py index 722a087db7..48bf92884f 100644 --- a/keras_cv/src/keypoint/utils_test.py +++ b/keras_cv/src/keypoint/utils_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/fusedmbconv_test.py b/keras_cv/src/layers/fusedmbconv_test.py index 18a7326253..bd47bced5d 100644 --- a/keras_cv/src/layers/fusedmbconv_test.py +++ b/keras_cv/src/layers/fusedmbconv_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/mbconv_test.py b/keras_cv/src/layers/mbconv_test.py index fae503d95d..b8335779a4 100644 --- a/keras_cv/src/layers/mbconv_test.py +++ b/keras_cv/src/layers/mbconv_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py b/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py index 20a4e8bf6a..32427e0292 100644 --- a/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py +++ b/keras_cv/src/layers/object_detection/multi_class_non_max_suppression_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py b/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py index d0f6075dd9..51bef33c98 100644 --- a/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py +++ b/keras_cv/src/layers/object_detection_3d/centernet_label_encoder.py @@ -18,6 +18,7 @@ from typing import Union import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/object_detection_3d/voxel_utils.py b/keras_cv/src/layers/object_detection_3d/voxel_utils.py index 1a586e6e51..d5787d40a2 100644 --- a/keras_cv/src/layers/object_detection_3d/voxel_utils.py +++ b/keras_cv/src/layers/object_detection_3d/voxel_utils.py @@ -15,6 +15,7 @@ import math import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py index 1bd457140f..d6775af10e 100644 --- a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py +++ b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer.py @@ -13,6 +13,7 @@ # limitations under the License. import keras + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py index 43ccc279e3..327574a48e 100644 --- a/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py +++ b/keras_cv/src/layers/preprocessing/base_image_augmentation_layer_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/channel_shuffle_test.py b/keras_cv/src/layers/preprocessing/channel_shuffle_test.py index c8ed5e2cad..e0001dca27 100644 --- a/keras_cv/src/layers/preprocessing/channel_shuffle_test.py +++ b/keras_cv/src/layers/preprocessing/channel_shuffle_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/cut_mix_test.py b/keras_cv/src/layers/preprocessing/cut_mix_test.py index 046fd07a97..c6d545bfd8 100644 --- a/keras_cv/src/layers/preprocessing/cut_mix_test.py +++ b/keras_cv/src/layers/preprocessing/cut_mix_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/fourier_mix_test.py b/keras_cv/src/layers/preprocessing/fourier_mix_test.py index 620296d430..a61511eb78 100644 --- a/keras_cv/src/layers/preprocessing/fourier_mix_test.py +++ b/keras_cv/src/layers/preprocessing/fourier_mix_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/grayscale_test.py b/keras_cv/src/layers/preprocessing/grayscale_test.py index 567f85e0b9..af6f833055 100644 --- a/keras_cv/src/layers/preprocessing/grayscale_test.py +++ b/keras_cv/src/layers/preprocessing/grayscale_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/grid_mask_test.py b/keras_cv/src/layers/preprocessing/grid_mask_test.py index dc0ef5399c..84552a1227 100644 --- a/keras_cv/src/layers/preprocessing/grid_mask_test.py +++ b/keras_cv/src/layers/preprocessing/grid_mask_test.py @@ -14,6 +14,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/jittered_resize_test.py b/keras_cv/src/layers/preprocessing/jittered_resize_test.py index 4858bd8d28..0b37af0e05 100644 --- a/keras_cv/src/layers/preprocessing/jittered_resize_test.py +++ b/keras_cv/src/layers/preprocessing/jittered_resize_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/mix_up_test.py b/keras_cv/src/layers/preprocessing/mix_up_test.py index 7772c51e8d..e791125628 100644 --- a/keras_cv/src/layers/preprocessing/mix_up_test.py +++ b/keras_cv/src/layers/preprocessing/mix_up_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/mosaic_test.py b/keras_cv/src/layers/preprocessing/mosaic_test.py index 6c084d022f..ddae75ea14 100644 --- a/keras_cv/src/layers/preprocessing/mosaic_test.py +++ b/keras_cv/src/layers/preprocessing/mosaic_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/posterization_test.py b/keras_cv/src/layers/preprocessing/posterization_test.py index 22b1b9da3c..0fc7ad0ab2 100644 --- a/keras_cv/src/layers/preprocessing/posterization_test.py +++ b/keras_cv/src/layers/preprocessing/posterization_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/ragged_image_test.py b/keras_cv/src/layers/preprocessing/ragged_image_test.py index e9787617f9..00a0988ef1 100644 --- a/keras_cv/src/layers/preprocessing/ragged_image_test.py +++ b/keras_cv/src/layers/preprocessing/ragged_image_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/rand_augment_test.py b/keras_cv/src/layers/preprocessing/rand_augment_test.py index 592f43a19a..d40f9a8763 100644 --- a/keras_cv/src/layers/preprocessing/rand_augment_test.py +++ b/keras_cv/src/layers/preprocessing/rand_augment_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_apply_test.py b/keras_cv/src/layers/preprocessing/random_apply_test.py index e42cfd4b6a..338dc808c4 100644 --- a/keras_cv/src/layers/preprocessing/random_apply_test.py +++ b/keras_cv/src/layers/preprocessing/random_apply_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py b/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py index 2f0e930228..e58fa409f9 100644 --- a/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py +++ b/keras_cv/src/layers/preprocessing/random_augmentation_pipeline_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_channel_shift_test.py b/keras_cv/src/layers/preprocessing/random_channel_shift_test.py index d5e79ad9d1..b5f31c75d0 100644 --- a/keras_cv/src/layers/preprocessing/random_channel_shift_test.py +++ b/keras_cv/src/layers/preprocessing/random_channel_shift_test.py @@ -14,6 +14,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_choice_test.py b/keras_cv/src/layers/preprocessing/random_choice_test.py index ebbf8506de..30bdecc1cf 100644 --- a/keras_cv/src/layers/preprocessing/random_choice_test.py +++ b/keras_cv/src/layers/preprocessing/random_choice_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py b/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py index 3295a1ac85..39ab31c716 100644 --- a/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py +++ b/keras_cv/src/layers/preprocessing/random_color_degeneration_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_color_jitter_test.py b/keras_cv/src/layers/preprocessing/random_color_jitter_test.py index 9066ef29ef..afa6d9b147 100644 --- a/keras_cv/src/layers/preprocessing/random_color_jitter_test.py +++ b/keras_cv/src/layers/preprocessing/random_color_jitter_test.py @@ -14,6 +14,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py b/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py index c588efe8ff..ba2c3ab1fd 100644 --- a/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py +++ b/keras_cv/src/layers/preprocessing/random_crop_and_resize_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_crop_test.py b/keras_cv/src/layers/preprocessing/random_crop_test.py index abfdfdf405..b2b3eea14e 100644 --- a/keras_cv/src/layers/preprocessing/random_crop_test.py +++ b/keras_cv/src/layers/preprocessing/random_crop_test.py @@ -16,6 +16,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_cutout_test.py b/keras_cv/src/layers/preprocessing/random_cutout_test.py index c900e7da4b..9dfce92cd3 100644 --- a/keras_cv/src/layers/preprocessing/random_cutout_test.py +++ b/keras_cv/src/layers/preprocessing/random_cutout_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_flip_test.py b/keras_cv/src/layers/preprocessing/random_flip_test.py index 2195c7f06d..fdfb24c66f 100644 --- a/keras_cv/src/layers/preprocessing/random_flip_test.py +++ b/keras_cv/src/layers/preprocessing/random_flip_test.py @@ -14,6 +14,7 @@ import unittest import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py b/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py index a4729240a3..5fb2a41c21 100644 --- a/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py +++ b/keras_cv/src/layers/preprocessing/random_gaussian_blur_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py b/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py index 9e71c33c27..072616e924 100644 --- a/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py +++ b/keras_cv/src/layers/preprocessing/random_jpeg_quality_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_rotation.py b/keras_cv/src/layers/preprocessing/random_rotation.py index e25815c616..85cb6069d5 100644 --- a/keras_cv/src/layers/preprocessing/random_rotation.py +++ b/keras_cv/src/layers/preprocessing/random_rotation.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_rotation_test.py b/keras_cv/src/layers/preprocessing/random_rotation_test.py index b52ea62685..1d6fc93ddb 100644 --- a/keras_cv/src/layers/preprocessing/random_rotation_test.py +++ b/keras_cv/src/layers/preprocessing/random_rotation_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_saturation_test.py b/keras_cv/src/layers/preprocessing/random_saturation_test.py index 335344d45c..bec132f3ed 100644 --- a/keras_cv/src/layers/preprocessing/random_saturation_test.py +++ b/keras_cv/src/layers/preprocessing/random_saturation_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_sharpness_test.py b/keras_cv/src/layers/preprocessing/random_sharpness_test.py index 1266d5090b..2163a0eca3 100644 --- a/keras_cv/src/layers/preprocessing/random_sharpness_test.py +++ b/keras_cv/src/layers/preprocessing/random_sharpness_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_shear_test.py b/keras_cv/src/layers/preprocessing/random_shear_test.py index a2edb2c4c9..0dee4aba0d 100644 --- a/keras_cv/src/layers/preprocessing/random_shear_test.py +++ b/keras_cv/src/layers/preprocessing/random_shear_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_translation_test.py b/keras_cv/src/layers/preprocessing/random_translation_test.py index ed5d70fb65..2659612f85 100644 --- a/keras_cv/src/layers/preprocessing/random_translation_test.py +++ b/keras_cv/src/layers/preprocessing/random_translation_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/random_zoom_test.py b/keras_cv/src/layers/preprocessing/random_zoom_test.py index d09f8efff6..31a94a63d4 100644 --- a/keras_cv/src/layers/preprocessing/random_zoom_test.py +++ b/keras_cv/src/layers/preprocessing/random_zoom_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py b/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py index 3d3a03f640..baca82cf26 100644 --- a/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py +++ b/keras_cv/src/layers/preprocessing/repeated_augmentation_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/rescaling_test.py b/keras_cv/src/layers/preprocessing/rescaling_test.py index acee4dc24e..9d8469231c 100644 --- a/keras_cv/src/layers/preprocessing/rescaling_test.py +++ b/keras_cv/src/layers/preprocessing/rescaling_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/resizing_test.py b/keras_cv/src/layers/preprocessing/resizing_test.py index b249837bd5..2dd654b349 100644 --- a/keras_cv/src/layers/preprocessing/resizing_test.py +++ b/keras_cv/src/layers/preprocessing/resizing_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/solarization_test.py b/keras_cv/src/layers/preprocessing/solarization_test.py index e98f4a0724..3b124e8e1c 100644 --- a/keras_cv/src/layers/preprocessing/solarization_test.py +++ b/keras_cv/src/layers/preprocessing/solarization_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py b/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py index b6c8085994..d785af6e72 100644 --- a/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py +++ b/keras_cv/src/layers/preprocessing/vectorized_base_image_augmentation_layer_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py b/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py index a35762a9b6..20f361067f 100644 --- a/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py +++ b/keras_cv/src/layers/preprocessing_3d/base_augmentation_layer_3d_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing_3d/input_format_test.py b/keras_cv/src/layers/preprocessing_3d/input_format_test.py index ddf9dae285..06f0e61077 100644 --- a/keras_cv/src/layers/preprocessing_3d/input_format_test.py +++ b/keras_cv/src/layers/preprocessing_3d/input_format_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py b/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py index 6e9b211677..6e0173f90f 100644 --- a/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py +++ b/keras_cv/src/layers/preprocessing_3d/waymo/group_points_by_bounding_boxes_test.py @@ -6,6 +6,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/regularization/drop_path_test.py b/keras_cv/src/layers/regularization/drop_path_test.py index afc6bca11f..708eebd0bc 100644 --- a/keras_cv/src/layers/regularization/drop_path_test.py +++ b/keras_cv/src/layers/regularization/drop_path_test.py @@ -14,6 +14,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/layers/vit_layers_test.py b/keras_cv/src/layers/vit_layers_test.py index 02a203d048..cd21e1528c 100644 --- a/keras_cv/src/layers/vit_layers_test.py +++ b/keras_cv/src/layers/vit_layers_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py b/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py index 6eeb1a2856..7ea300bf19 100644 --- a/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py +++ b/keras_cv/src/losses/numerical_tests/focal_loss_numerical_test.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/metrics/object_detection/box_coco_metrics.py b/keras_cv/src/metrics/object_detection/box_coco_metrics.py index 8972677eaa..a1fd998721 100644 --- a/keras_cv/src/metrics/object_detection/box_coco_metrics.py +++ b/keras_cv/src/metrics/object_detection/box_coco_metrics.py @@ -16,6 +16,7 @@ import types import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py b/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py index 6fec4d299f..84e55550cd 100644 --- a/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py +++ b/keras_cv/src/metrics/object_detection/box_coco_metrics_test.py @@ -14,6 +14,7 @@ import os import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py index 0b1bcbb3bf..573f9d34d4 100644 --- a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py +++ b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_presets_test.py @@ -14,6 +14,7 @@ """Tests for loading pretrained model presets.""" import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py index 5a4a274bc7..f93e4882fb 100644 --- a/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py +++ b/keras_cv/src/models/backbones/csp_darknet/csp_darknet_backbone_test.py @@ -16,6 +16,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py b/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py index dd9a43798a..98aef57839 100644 --- a/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py +++ b/keras_cv/src/models/backbones/mix_transformer/mix_transformer_backbone.py @@ -52,53 +52,53 @@ def __init__( **kwargs, ): """A Keras model implementing the MixTransformer architecture to be - used as a backbone for the SegFormer architecture. - - References: - - [SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers](https://arxiv.org/abs/2105.15203) # noqa: E501 - - [Based on the TensorFlow implementation from DeepVision](https://github.com/DavidLandup0/deepvision/tree/main/deepvision/models/classification/mix_transformer) # noqa: E501 - - Args: - include_rescaling: bool, whether to rescale the inputs. If set - to `True`, inputs will be passed through a `Rescaling(1/255.0)` - layer. - depths: the number of transformer encoders to be used per stage in the - network - embedding_dims: the embedding dims per hierarchical stage, used as - the levels of the feature pyramid - input_shape: optional shape tuple, defaults to (None, None, 3). - input_tensor: optional Keras tensor (i.e. output of `keras.layers.Input()`) - to use as image input for the model. - - Example: - - Using the class with a `backbone`: - - ```python - try: - import tensorflow as tf -except ImportError: - raise ImportError( - "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " - "The TensorFlow package is required for data preprocessing with any backend." - ) - import keras_cv - - images = np.ones(shape=(1, 96, 96, 3)) - labels = np.zeros(shape=(1, 96, 96, 1)) - backbone = keras_cv.models.MiTBackbone.from_preset("mit_b0_imagenet") - - # Evaluate model - model(images) - - # Train model - model.compile( - optimizer="adam", - loss=keras.losses.BinaryCrossentropy(from_logits=False), - metrics=["accuracy"], - ) - model.fit(images, labels, epochs=3) - ``` + used as a backbone for the SegFormer architecture. + + References: + - [SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers](https://arxiv.org/abs/2105.15203) # noqa: E501 + - [Based on the TensorFlow implementation from DeepVision](https://github.com/DavidLandup0/deepvision/tree/main/deepvision/models/classification/mix_transformer) # noqa: E501 + + Args: + include_rescaling: bool, whether to rescale the inputs. If set + to `True`, inputs will be passed through a `Rescaling(1/255.0)` + layer. + depths: the number of transformer encoders to be used per stage in the + network + embedding_dims: the embedding dims per hierarchical stage, used as + the levels of the feature pyramid + input_shape: optional shape tuple, defaults to (None, None, 3). + input_tensor: optional Keras tensor (i.e. output of `keras.layers.Input()`) + to use as image input for the model. + + Example: + + Using the class with a `backbone`: + + ```python + try: + import tensorflow as tf + except ImportError: + raise ImportError( + "To use KerasCV, please install TensorFlow: `pip install tensorflow`. " + "The TensorFlow package is required for data preprocessing with any backend." + ) + import keras_cv + + images = np.ones(shape=(1, 96, 96, 3)) + labels = np.zeros(shape=(1, 96, 96, 1)) + backbone = keras_cv.models.MiTBackbone.from_preset("mit_b0_imagenet") + + # Evaluate model + model(images) + + # Train model + model.compile( + optimizer="adam", + loss=keras.losses.BinaryCrossentropy(from_logits=False), + metrics=["accuracy"], + ) + model.fit(images, labels, epochs=3) + ``` """ drop_path_rate = 0.1 dpr = [x for x in np.linspace(0.0, drop_path_rate, sum(depths))] diff --git a/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py b/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py index 1eeb04983e..9f51055df3 100644 --- a/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py +++ b/keras_cv/src/models/backbones/resnet_v1/resnet_v1_backbone_test.py @@ -16,6 +16,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/classification/image_classifier_test.py b/keras_cv/src/models/classification/image_classifier_test.py index 91589983fe..35ea430bd1 100644 --- a/keras_cv/src/models/classification/image_classifier_test.py +++ b/keras_cv/src/models/classification/image_classifier_test.py @@ -18,6 +18,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/classification/video_classifier_test.py b/keras_cv/src/models/classification/video_classifier_test.py index 5b77a75de8..200b4b6810 100644 --- a/keras_cv/src/models/classification/video_classifier_test.py +++ b/keras_cv/src/models/classification/video_classifier_test.py @@ -18,6 +18,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py b/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py index 0eb06043aa..5ef8213672 100644 --- a/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py +++ b/keras_cv/src/models/feature_extractor/clip/clip_tokenizer.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import regex as re + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/legacy/models_test.py b/keras_cv/src/models/legacy/models_test.py index eec7acc343..8d00d044b0 100644 --- a/keras_cv/src/models/legacy/models_test.py +++ b/keras_cv/src/models/legacy/models_test.py @@ -16,6 +16,7 @@ import os import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py b/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py index 507630570f..baa0042143 100644 --- a/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py +++ b/keras_cv/src/models/legacy/object_detection/faster_rcnn/faster_rcnn_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/object_detection/__internal__.py b/keras_cv/src/models/object_detection/__internal__.py index aef6f072cc..a54f850a5b 100644 --- a/keras_cv/src/models/object_detection/__internal__.py +++ b/keras_cv/src/models/object_detection/__internal__.py @@ -16,6 +16,7 @@ import math import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/object_detection/__test_utils__.py b/keras_cv/src/models/object_detection/__test_utils__.py index 01ad71240d..3f1ef2aa2c 100644 --- a/keras_cv/src/models/object_detection/__test_utils__.py +++ b/keras_cv/src/models/object_detection/__test_utils__.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py b/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py index ac7c97a04c..2669478ba5 100644 --- a/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py +++ b/keras_cv/src/models/object_detection/retinanet/retinanet_label_encoder_test.py @@ -14,6 +14,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/object_detection/retinanet/retinanet_test.py b/keras_cv/src/models/object_detection/retinanet/retinanet_test.py index a5b00748dc..a17e1d4a11 100644 --- a/keras_cv/src/models/object_detection/retinanet/retinanet_test.py +++ b/keras_cv/src/models/object_detection/retinanet/retinanet_test.py @@ -16,6 +16,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py b/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py index 8ea07f6150..9e999183c1 100644 --- a/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py +++ b/keras_cv/src/models/object_detection_3d/center_pillar_backbone_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/object_detection_3d/center_pillar_test.py b/keras_cv/src/models/object_detection_3d/center_pillar_test.py index 84e643c2f2..2b68898324 100644 --- a/keras_cv/src/models/object_detection_3d/center_pillar_test.py +++ b/keras_cv/src/models/object_detection_3d/center_pillar_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/segmentation/basnet/basnet_test.py b/keras_cv/src/models/segmentation/basnet/basnet_test.py index d15f17461e..b9207e5a20 100644 --- a/keras_cv/src/models/segmentation/basnet/basnet_test.py +++ b/keras_cv/src/models/segmentation/basnet/basnet_test.py @@ -17,6 +17,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py b/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py index 909ff9c7e7..2940f89231 100644 --- a/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py +++ b/keras_cv/src/models/segmentation/deeplab_v3_plus/deeplab_v3_plus_test.py @@ -16,6 +16,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/models/segmentation/segformer/segformer_test.py b/keras_cv/src/models/segmentation/segformer/segformer_test.py index 952f405ab7..6a35cfba4d 100644 --- a/keras_cv/src/models/segmentation/segformer/segformer_test.py +++ b/keras_cv/src/models/segmentation/segformer/segformer_test.py @@ -16,6 +16,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/point_cloud/point_cloud.py b/keras_cv/src/point_cloud/point_cloud.py index e33df39626..5a134534e4 100644 --- a/keras_cv/src/point_cloud/point_cloud.py +++ b/keras_cv/src/point_cloud/point_cloud.py @@ -13,6 +13,7 @@ # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/point_cloud/point_cloud_test.py b/keras_cv/src/point_cloud/point_cloud_test.py index aa1af26d17..3222664cf7 100644 --- a/keras_cv/src/point_cloud/point_cloud_test.py +++ b/keras_cv/src/point_cloud/point_cloud_test.py @@ -16,6 +16,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/point_cloud/within_box_3d_test.py b/keras_cv/src/point_cloud/within_box_3d_test.py index a34108886b..7fa543e301 100644 --- a/keras_cv/src/point_cloud/within_box_3d_test.py +++ b/keras_cv/src/point_cloud/within_box_3d_test.py @@ -17,6 +17,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/training/contrastive/contrastive_trainer_test.py b/keras_cv/src/training/contrastive/contrastive_trainer_test.py index 2a6938e4c4..3e88f42f91 100644 --- a/keras_cv/src/training/contrastive/contrastive_trainer_test.py +++ b/keras_cv/src/training/contrastive/contrastive_trainer_test.py @@ -14,6 +14,7 @@ import numpy as np import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/training/contrastive/simclr_trainer_test.py b/keras_cv/src/training/contrastive/simclr_trainer_test.py index 79f0b3bc2a..a3d7e5447a 100644 --- a/keras_cv/src/training/contrastive/simclr_trainer_test.py +++ b/keras_cv/src/training/contrastive/simclr_trainer_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/utils/fill_utils_test.py b/keras_cv/src/utils/fill_utils_test.py index cf81647302..f5eb7963a4 100644 --- a/keras_cv/src/utils/fill_utils_test.py +++ b/keras_cv/src/utils/fill_utils_test.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/utils/to_numpy.py b/keras_cv/src/utils/to_numpy.py index 33da3d1914..ba322de286 100644 --- a/keras_cv/src/utils/to_numpy.py +++ b/keras_cv/src/utils/to_numpy.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/version_check_test.py b/keras_cv/src/version_check_test.py index 3216f7b93d..ff3b964e91 100644 --- a/keras_cv/src/version_check_test.py +++ b/keras_cv/src/version_check_test.py @@ -13,6 +13,7 @@ # limitations under the License. import pytest + try: import tensorflow as tf except ImportError: diff --git a/keras_cv/src/visualization/plot_image_gallery.py b/keras_cv/src/visualization/plot_image_gallery.py index ef93349729..30c51e88ac 100644 --- a/keras_cv/src/visualization/plot_image_gallery.py +++ b/keras_cv/src/visualization/plot_image_gallery.py @@ -15,6 +15,7 @@ import math import numpy as np + try: import tensorflow as tf except ImportError: