Search code examples
pythontensorflowtensorflow2.0object-detection-api

'tensorflow._api.v2.experimental' has no attribute 'register_filesystem_plugin'


I am working with the TF2 Object Detection API. I am following the 'Installation' and 'Python Package Installation' steps here. I am working with my university's HPC cluster and there is a module system which has TensorFlow 2.2.0.

I load this TF2 module (it loads a bunch of deps with it) and then go through the installation steps. After completing these, I try to either run the test installation script or an actual training task, which gives an error saying no attribute 'register_filesystem_plugin'.

As I understand it, this is a part of the TF 2.7 API. Due to the module system, I am unable to succesfully downgrade or upgrade the tensorflow version. I have tried several different things including the downgrading the tensorflow_io outlined here.

I was under the impression the Object Detection API only requires TF 2.2? So why would it be using features from 2.7?

Any advice on how to resolve this would be appreciated, thanks!

Here is the full stack I am getting:

Traceback (most recent call last):
  File "object_detection/model_main_tf2.py", line 32, in <module>
    from object_detection import model_lib_v2
  File "cluster/home/myname/thesis/env/lib/python3.7/site-packages/object_detection/model_lib_v2.py", line 30, in <module>
    from object_detection import inputs
  File "cluster/home/myname/thesis/env/lib/python3.7/site-packages/object_detection/inputs.py", line 26, in <module>
    from object_detection.builders import model_builder
  File "cluster/home/myname/thesis/env/lib/python3.7/site-packages/object_detection/builders/model_builder.py", line 37, in <module>
    from object_detection.meta_architectures import deepmac_meta_arch
  File "cluster/home/myname/thesis/env/lib/python3.7/site-packages/object_detection/meta_architectures/deepmac_meta_arch.py", line 28, in <module>
    import tensorflow_io as tfio  # pylint:disable=g-import-not-at-top
  File "cluster/home/myname/thesis/env/lib/python3.7/site-packages/tensorflow_io/__init__.py", line 17, in <module>
    from tensorflow_io.python.api import *  # pylint: disable=wildcard-import
  File "cluster/home/myname/thesis/env/lib/python3.7/site-packages/tensorflow_io/python/api/__init__.py", line 19, in <module>
    from tensorflow_io.python.ops.io_dataset import IODataset
  File "cluster/home/myname/thesis/env/lib/python3.7/site-packages/tensorflow_io/python/ops/__init__.py", line 96, in <module>
    plugin_ops = _load_library("libtensorflow_io_plugins.so", "fs")
  File "cluster/home/myname/thesis/env/lib/python3.7/site-packages/tensorflow_io/python/ops/__init__.py", line 64, in _load_library
    l = load_fn(f)
  File "cluster/home/myname/thesis/env/lib/python3.7/site-packages/tensorflow_io/python/ops/__init__.py", line 56, in <lambda>
    load_fn = lambda f: tf.experimental.register_filesystem_plugin(f) is None
AttributeError: module 'tensorflow._api.v2.experimental' has no attribute 'register_filesystem_plugin'

Solution

  • Unfortunately, the only way I was able to solve this was to update my TensorFlow version to 2.7 from 2.2. I did try to update to 2.3 and 2.4 and it was possible to make some errors go away by finding the specific files and commenting out the lines in questions, but in the end an upgrade was required.

    Like I said in my initial question, while the API landing pages mentions that it's '2.2' compatible, they use the experimental code found in later versions.