【问题标题】:How to fix error :" AttributeError: module 'tensorflow' has no attribute 'contrib' " on Windows如何修复错误:Windows 上的“AttributeError: module 'tensorflow' has no attribute 'contrib'”
【发布时间】:2019-10-29 04:58:11
【问题描述】:

我有一个读取 CAPTCHA 的源代码。当我运行测试时,我在 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'

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

【问题讨论】:

  • 在您指向其他答案的链接中,有几个不错的解决方案可供尝试。你的问题到底是什么?您尝试了哪些方法,但没有成功?
  • 设置环境时出错
  • 我只在 Windows 上遇到了这个错误。在 ubuntu 上,我遇到了其他错误

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-01
    • 2022-12-01
    • 2014-12-20
    • 2021-12-12
    • 2012-02-29
    • 2018-10-05
    • 2022-10-05
    • 2022-09-29
    相关资源
    最近更新 更多