Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: cannot import name 'trace' from 'tensorflow.python.profiler'

I'm trying to run an object detection training on Tensorflow

Everything is working fine until I start training the network, here.

python C:\RealTimeObjectDetection-main\Tensorflow/models/research/object_detection/model_main_tf2.py --model_dir=C:\RealTimeObjectDetection-main\Tensorflow\workspace/models/my_ssd_mobnet --pipeline_config_path=C:\RealTimeObjectDetection-main\Tensorflow\workspace/models/my_ssd_mobnet/pipeline.config --num_train_steps=200000

It produces the following error:

Traceback (most recent call last):
  File "C:\RealTimeObjectDetection-main\Tensorflow/models/research/object_detection/model_main_tf2.py", line 32, in <module>
    from object_detection import model_lib_v2
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\object_detection\model_lib_v2.py", line 29, in <module>
    from object_detection import eval_util
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\object_detection\eval_util.py", line 35, in <module>
    slim = tf.contrib.slim
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\util\lazy_loader.py", line 63, in __getattr__
    return getattr(module, item)
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\contrib\__init__.py", line 39, in <module>
    from tensorflow.contrib import compiler
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 21, in <module>
    from tensorflow.contrib.compiler import jit
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 22, in <module>
    from tensorflow.contrib.compiler import xla
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\contrib\compiler\xla.py", line 22, in <module>
    from tensorflow.python.estimator import model_fn as model_fn_lib
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\estimator\model_fn.py", line 26, in <module>
    from tensorflow_estimator.python.estimator import model_fn
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_estimator\__init__.py", line 10, in <module>
    from tensorflow_estimator._api.v1 import estimator
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_estimator\_api\v1\estimator\__init__.py", line 10, in <module>
    from tensorflow_estimator._api.v1.estimator import experimental
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_estimator\_api\v1\estimator\experimental\__init__.py", line 10, in <module>
    from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py", line 27, in <module>
    from tensorflow_estimator.python.estimator import estimator
  File "C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 36, in <module>
    from tensorflow.python.profiler import trace
ImportError: cannot import name 'trace' from 'tensorflow.python.profiler' (C:\Users\m8\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\profiler\__init__.py)

Software I am using: Windows 10 - amd64, Python 3.7.0, TensorFlow 1.15.5

like image 534
Massive_M8 Avatar asked Mar 13 '26 11:03

Massive_M8


1 Answers

You can import this using latest Tensorflow version 2.6.

from tensorflow.python.profiler import trace

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!