Python 使用tensorflow训练目标检测分类器
帮我摆脱我无法克服的错误 在使用下面的命令之后Python 使用tensorflow训练目标检测分类器,python,tensorflow,object-detection,Python,Tensorflow,Object Detection,帮我摆脱我无法克服的错误 在使用下面的命令之后 python generate_tfrecord.py --csv_input=images/train_labels.csv --image_dir=images/train --output_path=train.record 我收到了以下错误 Traceback (most recent call last): File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow_core
python generate_tfrecord.py --csv_input=images/train_labels.csv --image_dir=images/train --output_path=train.record
我收到了以下错误
Traceback (most recent call last):
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\asus\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\asus\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "generate_tfrecord.py", line 18, in <module>
import tensorflow as tf
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
from tensorflow_core import *
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\Users\asus\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\asus\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\asus\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\asus\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions.
Include the entire stack trace
above this error message when asking for help.
回溯(最近一次呼叫最后一次):
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\u core\python\pywrap\u tensorflow.py”,第58行,在
从tensorflow.python.pywrap\u tensorflow\u内部导入*
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\u core\python\pywrap\u tensorflow\u internal.py”,第28行,在
_pywrap\u tensorflow\u internal=swig\u import\u helper()
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\u core\python\pywrap\u tensorflow\u internal.py”,第24行,在swig\u import\u helper中
_mod=imp.load_模块(“pywrap_tensorflow_internal”,fp,路径名,描述)
文件“C:\Users\asus\Anaconda3\lib\imp.py”,第242行,在load_模块中
返回加载动态(名称、文件名、文件)
文件“C:\Users\asus\Anaconda3\lib\imp.py”,第342行,在load\u dynamic中
返回负载(规格)
ImportError:DLL加载失败:找不到指定的模块。
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“generate_tfrecord.py”,第18行,在
导入tensorflow作为tf
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\\uuuuu init\uuuuuu.py”,第101行,在
从tensorflow_核心导入*
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\u core\uuuuu init\uuuuu.py”,第40行,在
从tensorflow.python.tools将模块_util作为_模块_util导入
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\\uuuu init\uuuu.py”,第50行,在\uuu getattr中__
模块=自身。_加载()
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\\uuuu init\uuuu.py”,第44行,在加载中
模块=_importlib.import_模块(自身名称)
文件“C:\Users\asus\Anaconda3\lib\importlib\\uuuuu init\uuuuuu.py”,第127行,在导入模块中
return _bootstrap._gcd_import(名称[级别:],包,级别)
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\u core\python\\uuuu init\uuuu.py”,第49行,在
从tensorflow.python导入pywrap\u tensorflow
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\u core\python\pywrap\u tensorflow.py”,第74行,在
提高效率(msg)
ImportError:回溯(最近一次呼叫上次):
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\u core\python\pywrap\u tensorflow.py”,第58行,在
从tensorflow.python.pywrap\u tensorflow\u内部导入*
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\u core\python\pywrap\u tensorflow\u internal.py”,第28行,在
_pywrap\u tensorflow\u internal=swig\u import\u helper()
文件“C:\Users\asus\Anaconda3\lib\site packages\tensorflow\u core\python\pywrap\u tensorflow\u internal.py”,第24行,在swig\u import\u helper中
_mod=imp.load_模块(“pywrap_tensorflow_internal”,fp,路径名,描述)
文件“C:\Users\asus\Anaconda3\lib\imp.py”,第242行,在load_模块中
返回加载动态(名称、文件名、文件)
文件“C:\Users\asus\Anaconda3\lib\imp.py”,第342行,在load\u dynamic中
返回负载(规格)
ImportError:DLL加载失败:找不到指定的模块。
未能加载本机TensorFlow运行时。
看见https://www.tensorflow.org/install/errors
因为一些常见的原因和解决方案。
包括整个堆栈跟踪
以上是请求帮助时的错误消息。
错误消息表示您没有正确安装TensorFlow,或者其某些库没有正确安装。您应该尝试使用conda install tensorflow==2.0安装它
我通过从这里下载并安装visual studio 2017-2019 x86和x64解决了这个问题:
另一种解决方案是将tensorflow降级为2.0:
pip install tensorflow==2.0
我为CUDA 10.1准备了Python 3.7.6、CUDA 10.1和cuDNN,我遵循了以下要求:
如果这不适用于您,则创建虚拟环境
conda create -n tf-gpu tensorflow-gpu
conda activate tf-gpu