python-3.x - 如何修复Windows上的错误:"AttributeError: module 'tensorflow'没有属性 'contrib'

标签 python-3.x tensorflow object-detection-api

我有一个读取验证码的源代码。当我运行测试时,我在 Windows 10 上遇到问题

Traceback (most recent call last):
  File "train.py", line 48, in <module>
    from object_detection.builders import dataset_builder
  File "C:\Users\HuyHys\Anaconda3\lib\site-packages\object_detection\builders\dataset_builder.py", line 27, in <module>
    from object_detection.data_decoders import tf_example_decoder
  File "C:\Users\HuyHys\Anaconda3\lib\site-packages\object_detection\data_decoders\tf_example_decoder.py", line 27, in <module>
    slim_example_decoder = tf.contrib.slim.tfexample_decoder
AttributeError: module 'tensorflow' has no attribute 'contrib'

我在 stackoverflow 上发现了一个问题(访问 Module 'tensorflow' has no attribute 'contrib' )

但我无法修复这个错误。请任何人都可以帮助我! 如何修复此错误的详细信息???

最佳答案

出现此错误的原因是 tf.contrib 已从 TensorFlow 2 中删除。我猜您正在使用 Tensorflow 1 中的旧代码,该代码与新的 Tenserflow 2 不兼容。有关更多信息,请查看 Migrate your TensorFlow 1 code to TensorFlow 2 。如果您需要更多帮助,请分享您使用 tf.contrib 的所有代码片段。

关于python-3.x - 如何修复Windows上的错误:"AttributeError: module 'tensorflow'没有属性 'contrib',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58601627/

相关文章:

object-detection - 人们是否训练了早期停止的对象检测方法?他们的设置是什么?

algorithm - 需要一种更快、更有效的方法来将元素添加到 python 中的列表中

python - 如何从目录中获取最新文件?

tensorflow 2 : Customized Loss Function works differently from the original Keras SparseCategoricalCrossentropy

Tensorflow 对象检测 API 永远安装在 Google Colab 中并失败

tensorflow - 如何使用Tensorflow Object detection API提高ssd mobilenet v2 coco的准确率

python - 如何在python中读取动态生成的文件并建立索引

python - 使用对数刻度注释 seaborn distplot 会引发错误

python - Google Coral Edge TPU 编译模型 - 推理总是几乎相同

python - 在tensorflow代码中使用keras层