'I cannot test installation of the Tensorflow Object Detection API in Google Colab

I'm just starting to learn how to use the ML models in the Tensorflow Object Detection API on Google Colab and so I'm trying to follow the documentation very carefully. After installing the libraries and packages, I'm testing the installation using the command from https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html:

python object_detection/builders/model_builder_tf2_test.py

But I get the following error:

Traceback (most recent call last):
  File "object_detection/builders/model_builder_tf2_test.py", line 24, in <module>
    from object_detection.builders import model_builder
  File "/usr/local/lib/python3.7/dist-packages/object_detection/builders/model_builder.py", line 37, in <module>
    from object_detection.meta_architectures import deepmac_meta_arch
  File "/usr/local/lib/python3.7/dist-packages/object_detection/meta_architectures/deepmac_meta_arch.py", line 20, in <module>
    from object_detection.models.keras_models import resnet_v1
  File "/usr/local/lib/python3.7/dist-packages/object_detection/models/keras_models/resnet_v1.py", line 28, in <module>
    from keras.applications import resnet  # pylint:disable=g-import-not-at-top
  File "/usr/local/lib/python3.7/dist-packages/keras/__init__.py", line 25, in <module>
    from keras import models
  File "/usr/local/lib/python3.7/dist-packages/keras/models.py", line 20, in <module>
    from keras import metrics as metrics_module
  File "/usr/local/lib/python3.7/dist-packages/keras/metrics.py", line 27, in <module>
    from keras import activations
  File "/usr/local/lib/python3.7/dist-packages/keras/activations.py", line 20, in <module>
    from keras.layers import advanced_activations
  File "/usr/local/lib/python3.7/dist-packages/keras/layers/__init__.py", line 93, in <module>
    from keras.layers.core import Masking
  File "/usr/local/lib/python3.7/dist-packages/keras/layers/core/__init__.py", line 20, in <module>
    from keras.layers.core.dropout import Dropout
  File "/usr/local/lib/python3.7/dist-packages/keras/layers/core/dropout.py", line 26, in <module>
    class Dropout(base_layer.BaseRandomLayer):
AttributeError: module 'keras.engine.base_layer' has no attribute 'BaseRandomLayer' 

Even after importing keras version 2.0, it still not working, what I can do to solve this issue, thanks



Solution 1:[1]

Solved it: tensorflow version 2.5.0 is not compatible with the code provided. I had to install 2.8.0 so that it will work

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Asd0311