属性错误:模块';tensorflow';没有属性';contrib&x27;
我按照说明()安装Tensorflow对象检测API。我在ubuntu18.4上使用了Anaconda,说明中的所有步骤似乎都完成了 当我使用以下命令训练我的模型时:属性错误:模块';tensorflow';没有属性';contrib&x27;,tensorflow,Tensorflow,我按照说明()安装Tensorflow对象检测API。我在ubuntu18.4上使用了Anaconda,说明中的所有步骤似乎都完成了 当我使用以下命令训练我的模型时: python model_main_tf2.py --model_dir=models/my_ssd_resnet50_v1_fpn --pipeline_config_path=models/my_ssd_resnet50_v1_fpn/pipeline.config 我得到以下错误: Instructions for upd
python model_main_tf2.py --model_dir=models/my_ssd_resnet50_v1_fpn --pipeline_config_path=models/my_ssd_resnet50_v1_fpn/pipeline.config
我得到以下错误:
Instructions for updating:
non-resource variables are not supported in the long term
Traceback (most recent call last):
File "model_main_tf2.py", line 34, in <module>
from object_detection import model_lib_v2
File "/home/chanitda/Desktop/Tensorflow/workspace/training_demo/object_detection/model_lib_v2.py", line 28, in <module>
from object_detection import eval_util
File "/home/chanitda/Desktop/Tensorflow/workspace/training_demo/object_detection/eval_util.py", line 30, in <module>
slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'
更新说明:
长期不支持非资源变量
回溯(最近一次呼叫最后一次):
文件“model_main_tf2.py”,第34行,在
从对象检测导入模型库v2
文件“/home/chanitda/Desktop/Tensorflow/workspace/training\u demo/object\u detection/model\u lib\u v2.py”,第28行,在
从对象检测导入评估工具
文件“/home/chanitda/Desktop/Tensorflow/workspace/training\u demo/object\u detection/eval\u util.py”,第30行,在
slim=tf.contrib.slim
AttributeError:模块“tensorflow”没有属性“contrib”
我得到了标题中提到的错误。如果有人能帮我提供一个代码示例来解决这个问题,我将非常感激。看起来您使用的是tensorflow 2.0版本,但您使用的代码需要tf 1.14。tf 2.0中不再提供模块
contrib
,这就是您看到此错误的原因。因此,您应该设置一个新环境并在那里安装tf 1.14,这样您就可以在不破坏tf 2.0环境的情况下正确运行代码您的tensorflow版本是什么?