keras-cv
keras-cv copied to clipboard
keras_cv.src.backend.keras' has no attribute 'src
Current Behavior:
I am following this guide: https://keras.io/guides/keras_cv/object_detection_keras_cv/
at this line: y_pred = pretrained_model.predict(image_batch). I get the following error:
AttributeError: module 'keras_cv.src.backend.keras' has no attribute 'src'
The traceback shows;
Cell In[15], line 1 ----> 1 y_pred = pretrained_model.predict(image_batch) 2 # y_pred is a bounding box Tensor: 3 # {"classes": ..., boxes": ...} 4 visualization.plot_bounding_box_gallery( 5 image_batch, 6 value_range=(0, 255), (...) 13 class_mapping=class_mapping, 14 )
File ~/venvs/yolov8_example/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py:122, in filter_traceback.keras.config.disable_traceback_filtering()
--> 122 raise e.with_traceback(filtered_tb) from None
123 finally:
124 del filtered_tb
File ~/venvs/yolov8_example/lib/python3.10/site-packages/keras_cv/src/models/object_detection/yolo_v8/yolo_v8_detector.py:616, in YOLOV8Detector.predict_step(self, *args) 614 return self.decode_predictions(outputs[0], args[-1]), outputs[1] 615 else: --> 616 return self.decode_predictions(outputs, args[-1])
File ~/venvs/yolov8_example/lib/python3.10/site-packages/keras_cv/src/models/object_detection/yolo_v8/yolo_v8_detector.py:602, in YOLOV8Detector.decode_predictions(self, pred, images) 599 stride_tensor = ops.expand_dims(stride_tensor, axis=-1) 601 box_preds = dist2bbox(boxes, anchor_points) * stride_tensor --> 602 box_preds = bounding_box.convert_format( 603 box_preds, 604 source="xyxy", 605 target=self.bounding_box_format, 606 images=images, 607 ) 609 return self.prediction_decoder(box_preds, scores)
File ~/venvs/yolov8_example/lib/python3.10/site-packages/keras_cv/src/backend/scope.py:33, in tf_data.
AttributeError: module 'keras_cv.src.backend.keras' has no attribute 'src'
Expected Behavior:
I would expect it to make a prediction.
Steps To Reproduce:
Just run the tutorial.
I have experienced the same problem
I have the same problem.
Thanks for reporting the issue. This issue could be due to the changes made here in the latest Keras version. @sampathweb , Could you please look into this.
Till we resolve the issue, you can downgrade the Keras version to 3.2.0 and continue using the tutorial without any error.
👍🏼
Changes have been made here https://github.com/keras-team/keras-cv/commit/fb4fca44d3ea8e43e84f66eee4acf4f9c7a6ec11 and it will be available in the next release( today or tomorrow)
@flocho-hy @sachinprasadhs @deepdatadive @TheSmileXiao - Release KerasCV 0.9.0. Can you update your KerasCV version by pip install -U keras-cv and let me know if you still run into this issue?
I had the same issue with Tensorflow 2.12 and keras_cv 0.9 on a conda envireronment. After trying a lot of solution, finally upgrade Tensorflow to 2.14 solved the issue.
@babanthierry94 , You can upgrade to latest Tensorflow version which comes with Keras 3 as a backend and keras_cv is also migarted to Keras 3
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.
Has been resolved.