簡體   English   中英

重新訓練Tensorflow的Inception v3模型時沒有反向移植錯誤

[英]No backports error while retraining Tensorflow's Inception v3 model

我一直在嘗試按照此處的教程來重新訓練Inception: https : //www.tensorflow.org/tutorials/image_retraining 運行此錯誤時,出現此錯誤“沒有名為backports的模塊”

bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir ~/marine_animal_species1

這是完整的回溯:

Traceback (most recent call last):

      File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/examples/image_retraining/retrain.py", line 91, in <module>
        import tensorflow as tf
      File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in <module>
        from tensorflow.python import *
      File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 64, in <module>
        from tensorflow.python.framework.framework_lib import *
      File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/framework_lib.py", line 100, in <module>
        from tensorflow.python.framework.subscribe import subscribe
      File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/subscribe.py", line 26, in <module>
        from tensorflow.python.ops import variables
      File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/variables.py", line 26, in <module>
        from tensorflow.python.ops import control_flow_ops
      File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/control_flow_ops.py", line 70, in <module>
        from tensorflow.python.ops import tensor_array_ops
      File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/tensor_array_ops.py", line 33, in <module>
        from tensorflow.python.util import tf_should_use
      File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/util/tf_should_use.py", line 28, in <module>
        from backports import weakref  # pylint: disable=g-bad-import-order
    ImportError: No module named backports

我使用的是Ubuntu 16.04。 感謝您的幫助。

sudo pip install backports.weakref
sudo pip3 install backports.weakref

為我解決了問題。

從反向端口名稱空間安裝weakref模塊。 您可以從https://pypi.python.org/pypi/backports.weakref/1.0rc1獲取車輪文件,並按以下方式安裝下載的車輪:

sudo pip install backports.weakref-1.0rc1-py2-none-any.whl # python2
sudo pip3 install backports.weakref-1.0rc1-py3-none-any.whl # python3

然后運行您的命令

bazel-bin/tensorflow/...

這應該可以解決您的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM