gpt4 book ai didi

tensorflow - 模块 'tensorflow' 没有属性 'contrib'

转载 作者:行者123 更新时间:2023-12-04 00:59:42 24 4
gpt4 key购买 nike

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

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

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

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 版本时,我也会得到不同的结果。

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



当我使用

pip3 show tensorflow:

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 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.x脚本
https://www.tensorflow.org/alpha/guide/upgrade

关于tensorflow - 模块 'tensorflow' 没有属性 'contrib',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55870127/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com