I’ve been pulling my hair for hours trying to get Tensorflow, Keras 3 and KerasCV to work but it seems impossible.
My goal is to use KerasCV for object detection.
Looking at this guide it doesn’t seem that hard: https://keras.io/getting_started/
I’m on Ubuntu 24.04 LTS. Using conda to manage my python environment.
I’ve not managed to import keras_cv without errors yet.
Have anyone managed to use KerasCV with Keras 3 and Tensorflow?
If you have other advice on how to train a lite object detection model (that can run on regular smartphones in TFLite format) with decent accuracy that’s also appreciated. I got a working model using Tensorflow Lite Model Maker but the features and documentation just isn’t there. Everything I find is either broken, deprecated or not fully implemented yet.
$ conda create -n keras pip python=3.12
$ conda activate keras
$ pip install tensorflow~=2.16.1
$ pip install keras_cv==0.9.0
$ python -c 'import keras_cv'
Traceback (most recent call last):
File "/home/zlt/Documents/TF2ObjDecApiTest/keras.py", line 4, in <module>
import keras_cv
File "/home/zlt/miniconda3/envs/keras/lib/python3.12/site-packages/keras_cv/__init__.py", line 10, in <module>
from keras_cv.api import * # noqa: F403
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zlt/miniconda3/envs/keras/lib/python3.12/site-packages/keras_cv/api/__init__.py", line 7, in <module>
from keras_cv.api import bounding_box
File "/home/zlt/miniconda3/envs/keras/lib/python3.12/site-packages/keras_cv/api/bounding_box/__init__.py", line 7, in <module>
from keras_cv.src.bounding_box.converters import convert_format
File "/home/zlt/miniconda3/envs/keras/lib/python3.12/site-packages/keras_cv/src/__init__.py", line 30, in <module>
from keras_cv.src import bounding_box # noqa: E402
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zlt/miniconda3/envs/keras/lib/python3.12/site-packages/keras_cv/src/bounding_box/__init__.py", line 15, in <module>
from keras_cv.src.bounding_box.converters import _decode_deltas_to_boxes
File "/home/zlt/miniconda3/envs/keras/lib/python3.12/site-packages/keras_cv/src/bounding_box/converters.py", line 19, in <module>
from keras_cv.src.api_export import keras_cv_export
File "/home/zlt/miniconda3/envs/keras/lib/python3.12/site-packages/keras_cv/src/api_export.py", line 17, in <module>
from keras_cv.src.backend import keras
File "/home/zlt/miniconda3/envs/keras/lib/python3.12/site-packages/keras_cv/src/backend/__init__.py", line 31, in <module>
import keras_cv.src.backend.keras2 as keras # noqa: E402
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zlt/miniconda3/envs/keras/lib/python3.12/site-packages/keras_cv/src/backend/keras2.py", line 18, in <module>
from tensorflow.keras import * # noqa: F403, F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'tensorflow.keras'