导入错误:无法从"tensorflow.python.profiler"导入名称"trace"



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

一切都很好,直到我开始训练网络,在这里。

python C:RealTimeObjectDetection-mainTensorflow/models/research/object_detection/model_main_tf2.py --model_dir=C:RealTimeObjectDetection-mainTensorflowworkspace/models/my_ssd_mobnet --pipeline_config_path=C:RealTimeObjectDetection-mainTensorflowworkspace/models/my_ssd_mobnet/pipeline.config --num_train_steps=200000

产生以下错误:

Traceback (most recent call last):
File "C:RealTimeObjectDetection-mainTensorflow/models/research/object_detection/model_main_tf2.py", line 32, in <module>
from object_detection import model_lib_v2
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagesobject_detectionmodel_lib_v2.py", line 29, in <module>
from object_detection import eval_util
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagesobject_detectioneval_util.py", line 35, in <module>
slim = tf.contrib.slim
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_corepythonutillazy_loader.py", line 63, in __getattr__
return getattr(module, item)
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow__init__.py", line 50, in __getattr__
module = self._load()
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:Usersm8AppDataLocalProgramsPythonPython37libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_corecontrib__init__.py", line 39, in <module>
from tensorflow.contrib import compiler
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_corecontribcompiler__init__.py", line 21, in <module>
from tensorflow.contrib.compiler import jit
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_corecontribcompiler__init__.py", line 22, in <module>
from tensorflow.contrib.compiler import xla
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_corecontribcompilerxla.py", line 22, in <module>
from tensorflow.python.estimator import model_fn as model_fn_lib
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_corepythonestimatormodel_fn.py", line 26, in <module>
from tensorflow_estimator.python.estimator import model_fn
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_estimator__init__.py", line 10, in <module>
from tensorflow_estimator._api.v1 import estimator
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_estimator_apiv1estimator__init__.py", line 10, in <module>
from tensorflow_estimator._api.v1.estimator import experimental
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_estimator_apiv1estimatorexperimental__init__.py", line 10, in <module>
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_estimatorpythonestimatorcanneddnn.py", line 27, in <module>
from tensorflow_estimator.python.estimator import estimator
File "C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_estimatorpythonestimatorestimator.py", line 36, in <module>
from tensorflow.python.profiler import trace
ImportError: cannot import name 'trace' from 'tensorflow.python.profiler' (C:Usersm8AppDataLocalProgramsPythonPython37libsite-packagestensorflow_corepythonprofiler__init__.py)

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

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

from tensorflow.python.profiler import trace

相关内容

  • 没有找到相关文章

最新更新