Closed innat closed 1 year ago
Thanks for the report @innat -- I've opened #2001 to fix this
Import breaks after 1f667e6 commit.
!pip install -q --upgrade git+https://github.com/keras-team/keras-cv import keras_cv
Using TensorFlow backend --------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[2], line 1 ----> 1 import keras_cv File /opt/conda/lib/python3.10/site-packages/keras_cv/__init__.py:31 28 # isort:on 30 from keras_cv import bounding_box ---> 31 from keras_cv import callbacks 32 from keras_cv import datasets 33 from keras_cv import layers File /opt/conda/lib/python3.10/site-packages/keras_cv/callbacks/__init__.py:14 1 # Copyright 2022 The KerasCV Authors 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); (...) 12 # See the License for the specific language governing permissions and 13 # limitations under the License. ---> 14 from keras_cv.callbacks.pycoco_callback import PyCOCOCallback 15 from keras_cv.callbacks.waymo_evaluation_callback import WaymoEvaluationCallback File /opt/conda/lib/python3.10/site-packages/keras_cv/callbacks/pycoco_callback.py:21 19 from keras_cv.backend import ops 20 from keras_cv.metrics.coco import compute_pycoco_metrics ---> 21 from keras_cv.models.object_detection.__internal__ import unpack_input 22 from keras_cv.utils.conditional_imports import assert_pycocotools_installed 25 @keras_cv_export("keras_cv.callbacks.PyCOCOCallback") 26 class PyCOCOCallback(Callback): File /opt/conda/lib/python3.10/site-packages/keras_cv/models/__init__.py:116 112 from keras_cv.models.backbones.resnet_v2.resnet_v2_backbone import ( 113 ResNetV2Backbone, 114 ) 115 from keras_cv.models.classification.image_classifier import ImageClassifier --> 116 from keras_cv.models.object_detection.retinanet.retinanet import RetinaNet 117 from keras_cv.models.object_detection.yolo_v8.yolo_v8_backbone import ( 118 YOLOV8Backbone, 119 ) 120 from keras_cv.models.object_detection.yolo_v8.yolo_v8_detector import ( 121 YOLOV8Detector, 122 ) File /opt/conda/lib/python3.10/site-packages/keras_cv/models/object_detection/retinanet/__init__.py:14 1 # Copyright 2022 The KerasCV Authors 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); (...) 12 # See the License for the specific language governing permissions and 13 # limitations under the License. ---> 14 from keras_cv.models.object_detection.retinanet.feature_pyramid import ( 15 FeaturePyramid, 16 ) 17 from keras_cv.models.object_detection.retinanet.prediction_head import ( 18 PredictionHead, 19 ) 20 from keras_cv.models.object_detection.retinanet.retinanet_label_encoder import ( # noqa: E501 21 RetinaNetLabelEncoder, 22 ) File /opt/conda/lib/python3.10/site-packages/keras_cv/models/object_detection/retinanet/feature_pyramid.py:21 16 from keras_cv.backend import keras 17 from keras_cv.backend import ops 20 @keras_cv_export("keras_cv.models.retinanet.FeaturePyramid") ---> 21 class FeaturePyramid(keras.layers.Layer): 22 """Builds the Feature Pyramid with the feature maps from the backbone.""" 24 def __init__(self, **kwargs): File /opt/conda/lib/python3.10/site-packages/keras_cv/api_export.py:37, in keras_cv_export.__call__(self, symbol) 36 def __call__(self, symbol): ---> 37 maybe_register_serializable(symbol) 38 return super().__call__(symbol) File /opt/conda/lib/python3.10/site-packages/keras_cv/api_export.py:27, in maybe_register_serializable(symbol) 25 def maybe_register_serializable(symbol): 26 if isinstance(symbol, types.FunctionType) or hasattr(symbol, "get_config"): ---> 27 keras.saving.register_keras_serializable(package="keras_cv")(symbol) File /opt/conda/lib/python3.10/site-packages/keras/saving/object_registration.py:154, in register_keras_serializable.<locals>.decorator(arg) 148 raise ValueError( 149 "Cannot register a class that does not have a " 150 "get_config() method." 151 ) 153 if registered_name in _GLOBAL_CUSTOM_OBJECTS: --> 154 raise ValueError( 155 f"{registered_name} has already been registered to " 156 f"{_GLOBAL_CUSTOM_OBJECTS[registered_name]}" 157 ) 159 if arg in _GLOBAL_CUSTOM_NAMES: 160 raise ValueError( 161 f"{arg} has already been registered to " 162 f"{_GLOBAL_CUSTOM_NAMES[arg]}" 163 ) ValueError: keras_cv>FeaturePyramid has already been registered to <class 'keras_cv.layers.feature_pyramid.FeaturePyramid'>
cc. @ianstenbit
pip install keras-cv==0.5.0 try this
Import breaks after 1f667e6 commit.
cc. @ianstenbit