gpt4 book ai didi

python - 导入错误 : cannot import name 'trace' from 'tensorflow.python.profiler'

转载 作者:行者123 更新时间:2023-12-05 05:57:47 25 4
gpt4 key购买 nike

我正在尝试在 Tensorflow 上运行对象检测训练

在我开始训练网络之前,一切正常。

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

它会产生以下错误:

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)

我使用的软件:Windows 10 - amd64Python 3.7.0TensorFlow 1.15.5

最佳答案

您可以使用最新的 Tensorflow 2.6 版导入它。

from tensorflow.python.profiler import trace

关于python - 导入错误 : cannot import name 'trace' from 'tensorflow.python.profiler' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68725060/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com