如何更正:TypeError:'_FlagValues'对象在重新训练移动网络模型时不可订阅

问题描述 投票:0回答:1

我正在尝试使用以下方式重新培训移动网络模型

!python tensorflow/hubmaster/examples/image_retraining/retrain.py \
--tfhub_module=https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/feature_vector/2

但我得到以下错误 -

Traceback (most recent call last):

File "tensorflow/tensorflow/hub-master/examples/image_retraining/retrain.py", line 1313, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "tensorflow/tensorflow/hub-master/examples/image_retraining/retrain.py", line 998, in main
    module_spec = hub.load_module_spec(FLAGS.tfhub_module)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow_hub/module.py", line 57, in load_module_spec
    path = registry.resolver(path)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow_hub/registry.py", line 42, in __call__
    return impl(*args, **kwargs)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow_hub/compressed_module_resolver.py", line 77, in __call__
    module_dir = _module_dir(handle)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow_hub/compressed_module_resolver.py", line 45, in _module_dir
    cache_dir = resolver.tfhub_cache_dir(use_temp=True)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow_hub/resolver.py", line 68, in tfhub_cache_dir
    os.getenv(_TFHUB_CACHE_DIR, "") or FLAGS["tfhub_cache_dir"].value or

TypeError: '_FlagValues' object is not subscriptable

我尝试将qazxsw poi更改为qazxsw poi中的qazxsw poi(错误的第二个最后一行),如os.getenv(_TFHUB_CACHE_DIR, "")所示,但我仍然得到相同的错误

python tensorflow image-segmentation flags
1个回答
0
投票

这是由于旧版Tensorflow造成的。我最初使用Tensorflow 1.4,升级到Tensorflow 1.9我没有收到此错误

© www.soinside.com 2019 - 2024. All rights reserved.