模块“tensorflow"没有属性“contrib" [英] Module 'tensorflow' has no attribute 'contrib'

查看:104
本文介绍了模块“tensorflow"没有属性“contrib"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Tensorflow Object-Detection-API 训练我自己的自定义对象检测器

I am trying to train my own custom object detector using Tensorflow Object-Detection-API

我在 Google 计算引擎中使用pip install tensorflow"安装了 tensorflow.然后我按照本网站上的所有说明进行操作:https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html

I installed the tensorflow using "pip install tensorflow" in my google compute engine. Then I followed all the instructions on this site: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html

当我尝试使用 train.py 时,我收到此错误消息:

When I try to use train.py I am getting this error message:

回溯(最近一次调用最后一次):文件train.py",第 49 行,在从 object_detection.builders 导入 dataset_builder文件/usr/local/lib/python3.6/dist-packages/object_detection-0.1->py3.6.egg/object_detection/builders/dataset_builder.py",第27行,在从 object_detection.data_decoders 导入 tf_example_decoder文件/usr/local/lib/python3.6/dist-packages/object_detection-0.1-py3.6.egg/object_detection/data_decoders/tf_example_decoder.py",第27行,在slim_example_decoder = tf.contrib.slim.tfexample_decoderAttributeError: 模块tensorflow"没有属性contrib"

Traceback (most recent call last): File "train.py", line 49, in from object_detection.builders import dataset_builder File "/usr/local/lib/python3.6/dist-packages/object_detection-0.1->py3.6.egg/object_detection/builders/dataset_builder.py", line 27, in from object_detection.data_decoders import tf_example_decoder File "/usr/local/lib/python3.6/dist-packages/object_detection-0.1-py3.6.egg/object_detection/data_decoders/tf_example_decoder.py", line 27, in slim_example_decoder = tf.contrib.slim.tfexample_decoder AttributeError: module 'tensorflow' has no attribute 'contrib'

当我尝试学习 tensorflow 的版本时,我也得到了不同的结果.

Also I am getting different results when I try to learn version of tensorflow.

python3 -c '将 tensorflow 导入为 tf;打印(tf.版本)':2.0.0-dev20190422

python3 -c 'import tensorflow as tf; print(tf.version)' : 2.0.0-dev20190422

当我使用

pip3 显示张量流:

pip3 show tensorflow:

名称:张量流版本:1.13.1总结:TensorFlow 是一个面向所有人的开源机器学习框架.主页:https://www.tensorflow.org/作者:谷歌公司作者邮箱:opensource@google.com许可证:Apache 2.0位置:/usr/local/lib/python3.6/dist-packages需要:gast、astor、absl-py、tensorflow-estimator、keras-preprocessing、grpcio、6、keras-applications、wheel、numpy、tensorboard、protobuf、termcolor必填项:

Name: tensorflow Version: 1.13.1 Summary: TensorFlow is an open source machine learning framework for everyone. Home-page: https://www.tensorflow.org/ Author: Google Inc. Author-email: opensource@google.com License: Apache 2.0 Location: /usr/local/lib/python3.6/dist-packages Requires: gast, astor, absl-py, tensorflow-estimator, keras-preprocessing, grpcio, six, keras-applications, wheel, numpy, tensorboard, protobuf, termcolor Required-by:

    sudo python3 train.py --logtostderr --train_dir=training/ -- 
    pipeline_config_path=training/ssd_inception_v2_coco.config

我应该怎么做才能解决这个问题?除了这个,我找不到关于此错误消息的任何信息:tensorflow 'module' object没有属性 'contrib'

What should I do to solve this problem? I couldn't find anything about this error message except this: tensorflow 'module' object has no attribute 'contrib'

推荐答案

tf.contrib 从 TF 2.0 alpha 开始移出 TF.
看看这些 tf 2.0 发行说明 https://github.com/tensorflow/tensorflow/releases/tag/v2.0.0-alpha0
您可以使用 tf_upgrade_v2 脚本将 TF 1.x 代码升级到 TF 2.xhttps://www.tensorflow.org/alpha/guide/upgrade

tf.contrib has moved out of TF starting TF 2.0 alpha.
Take a look at these tf 2.0 release notes https://github.com/tensorflow/tensorflow/releases/tag/v2.0.0-alpha0
You can upgrade your TF 1.x code to TF 2.x using the tf_upgrade_v2 script https://www.tensorflow.org/alpha/guide/upgrade

这篇关于模块“tensorflow"没有属性“contrib"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆