When using this installation out of the box, the last line fails with AttributeError: module 'keras._tf_keras.keras.layers' has no attribute 'experimental'
which has to do with an incompatible keras version.
I have also tried other Tensorflow versions to fix the problem. However either installation fails instantly or I am getting the keras error message.
Has anyone a working Tensorflow 2 object detection API installation?
I had to add these two lines on top of the installation:
import os
os.environ["TF_USE_LEGACY_KERAS"] = "1"
Then the AttributeError disappears.
Now when trying to train my model with model_main_tf2.py, I am getting this error:
ImportError: cannot import name 'estimator' from 'tensorflow.compat.v1' (/root/.local/lib/python3.10/site-packages/tensorflow/_api/v2/compat/v1/__init__.py)
I also had to modify tfexample_decoder.py as described in this post:
Now object detection is running fine with GPU.
I don’t know whether the issue has to do with the Kaggle environment but it would be great to use object detection out of the box with the latest Tensorflow version.
No, I am having the exact same problem as you are right now, and I’ve been stuck for days trying to figure out and I’m not using kaggle at all. I am becoming insane and I hope this post finally helps me to solve it.