报错
Traceback (most recent call last):
File "E:\python\process\rotateflip.py", line 35, in
from object_detection import model_lib_v2
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\object_detection\model_lib_v2.py", line 29, in
from object_detection import eval_util
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\object_detection\eval_util.py", line 35, in
slim = tf.contrib.slim
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_core\python\util\lazy_loader.py", line 63, in __getattr__
return getattr(module, item)
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_core\contrib\__init__.py", line 39, in
from tensorflow.contrib import compiler
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 21, in
from tensorflow.contrib.compiler import jit
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 22, in
from tensorflow.contrib.compiler import xla
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_core\contrib\compiler\xla.py", line 22, in
from tensorflow.python.estimator import model_fn as model_fn_lib
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_core\python\estimator\model_fn.py", line 26, in
from tensorflow_estimator.python.estimator import model_fn
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_estimator\__init__.py", line 10, in
from tensorflow_estimator._api.v1 import estimator
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_estimator\_api\v1\estimator\__init__.py", line 10, in
from tensorflow_estimator._api.v1.estimator import experimental
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_estimator\_api\v1\estimator\experimental\__init__.py", line 10, in
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py", line 27, in
from tensorflow_estimator.python.estimator import estimator
File "D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 36, in
from tensorflow.python.profiler import trace
ImportError: cannot import name 'trace' from 'tensorflow.python.profiler' (D:\Anaconda3-4.3.0.1\envs\tmp\Lib\site-packages\tensorflow_core\python\profiler\__init__.py)
问题环境:windows、tf1.14.0
原因:windows conda安装tensorflow-estimator与tensorflow版本不一致,重新安装tensorflow-estimator版本一致即可