'AttributeError : module 'tensorflow_estimator.python.estimator.api._v1.estimator' has no attribute 'slim'

I am trying to run a training command and getting the following error.

Command:-

python Tensorflow\models\research\object_detection\model_main_tf2.py --model_dir=Tensorflow\workspace\models\my_ssd_mobnet --pipeline_config_path=Tensorflow\workspace\models\my_ssd_mobnet\pipeline.config --num_train_steps=10000

Error:-

2022-05-18 23:10:01.251229: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
Traceback (most recent call last):
  File "Tensorflow/models/research/object_detection/model_main_tf2.py", line 31, in <module>
    from object_detection import model_lib_v2
  File "C:\Users\Admin\anaconda3\lib\site-packages\object_detection\model_lib_v2.py", line 29, in <module>
    from object_detection import eval_util
  File "C:\Users\Admin\anaconda3\lib\site-packages\object_detection\eval_util.py", line 34, in <module>
    slim = tf.compat.v1.estimator.slim
  File "C:\Users\Admin\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py", line 63, in __getattr__
    return getattr(module, item)
  File "C:\Users\Admin\anaconda3\lib\site-packages\tensorflow\python\util\module_wrapper.py", line 194, in __getattr__
    attr = getattr(self._tfmw_wrapped_module, name)
AttributeError: module 'tensorflow_estimator.python.estimator.api._v1.estimator' has no attribute 'slim'

I have already installed slim using pip install slim as well as pip install tf-slim.



Sources

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

Source: Stack Overflow

Solution Source