问题描述
我在使用 tensorflow-gpu 进行对象检测时遇到问题
I got problem while doing object detection using tensorflow-gpu
我正在关注 youtube 教程:https://www.youtube.com/watch?v=Rgpfk6eYxJA
I was follwing the youtube tutorials:https://www.youtube.com/watch?v=Rgpfk6eYxJA
我正在尝试使用带有虚拟环境的 tensorflow-gpu 检测对象.
I'm trying to detect object using tensorflow-gpu with virtual environment.
我在系统环境变量中添加了python、cuda、tensorflow,也做了制作带标签的训练模型.
I added python, cuda, tensorflow to system environment variables, and also didmake training models with labels.
我使用 xml_to_csv.py 将 xml 标签转换为 csv.
I converted xml labels to csv using xml_to_csv.py.
问题是当我尝试使用 generate_tfrecord.py 生成 tfrecord 时,会出现该错误.请帮忙
The problem is when I try to generate tfrecord using generate_tfrecord.py, that error appear. Please help
这是代码
(tensorflow) C:Usersice305 ensorflowmodels
esearchobject_detection>python generate_tfrecord.py --csv_input=images rain_labels.csv --image_dir=images rain --output_path=train.record
Traceback (most recent call last):
File "generate_tfrecord.py", line 17, in <module>
import tensorflow as tf
File "C:Anaconda3envs ensorflowlibsite-packages ensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:Anaconda3envs ensorflowlibsite-packages ensorflowpython\__init__.py", line 81, in <module>
from tensorflow.python import keras
File "C:Anaconda3envs ensorflowlibsite-packages ensorflowpythonkeras\__init__.py", line 24, in <module>
from tensorflow.python.keras import activations
File "C:Anaconda3envs ensorflowlibsite-packages ensorflowpythonkerasactivations\__init__.py", line 22, in <module>
from tensorflow.python.keras._impl.keras.activations import elu
File "C:Anaconda3envs ensorflowlibsite-packages ensorflowpythonkeras\_implkeras\__init__.py", line 21, in <module>
from tensorflow.python.keras._impl.keras import activations
File "C:Anaconda3envs ensorflowlibsite-packages ensorflowpythonkeras\_implkerasactivations.py", line 23, in <module>
from tensorflow.python.keras._impl.keras import backend as K
File "C:Anaconda3envs ensorflowlibsite-packages ensorflowpythonkeras\_implkerasackend.py", line 38, in <module>
from tensorflow.python.layers import base as tf_base_layers
File "C:Anaconda3envs ensorflowlibsite-packages ensorflowpythonlayersase.py", line 25, in <module>
from tensorflow.python.keras.engine import base_layer
File "C:Anaconda3envs ensorflowlibsite-packages ensorflowpythonkerasengine\__init__.py", line 21, in <module>
from tensorflow.python.keras.engine.base_layer import InputSpec
File "C:Anaconda3envs ensorflowlibsite-packages ensorflowpythonkerasenginease_layer.py", line 33, in <module>
from tensorflow.python.keras import backend
File "C:Anaconda3envs ensorflowlibsite-packages ensorflowpythonkerasackend\__init__.py", line 22, in <module>
from tensorflow.python.keras._impl.keras.backend import abs
ImportError: cannot import name 'abs'
(tensorflow) C:Usersice305 ensorflowmodels
esearchobject_detection>
我不明白abs"是什么.请帮忙
I don't understand what 'abs' is. Please help
推荐答案
这在 ubuntu 18.0.4 中对我有用
This worked for me in ubuntu 18.0.4
pip uninstall tensorflow protobuf --yes
find $CONDA_PREFIX -name "tensorflow" | xargs -Ipkg rm -rfv pkg
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0-cp36-cp36m-linux_x86_64.whl --no-cache-dir
从 GitHub 找到解决方案:ImportError: cannot import name 'abs' #20778.
这篇关于ImportError:无法导入名称“abs"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!