AttributeError:“ NoneType”对象没有属性“键”

时间:2019-07-25 06:53:55

标签: python-3.x python-2.7 tensorflow

我正在尝试使用TensorFlow进行分类 我在Ubuntu 18.04.2 LTS上使用anaconda版本1.7.2

我从https://github.com/tensorflow/hub/blob/master/examples/image_retraining/retrain.py/下载了retrain.py代码

运行此文件时出现错误

File "retrain.py", line 1349, in <module> tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "/home/deepak/anaconda3/lib/python3.7/site-packages/tensorflow/python/platform/app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) 
File "/home/deepak/anaconda3/lib/python3.7/site-packages/absl/app.py", line 300, in run _run_main(main, args) File "/home/deepak/anaconda3/lib/python3.7/site-packages/absl/app.py", line 251, in _run_main sys.exit(main(argv)) 
File "retrain.py", line 1006, in main class_count = len(image_lists.keys()) 
AttributeError: 'NoneType' object has no attribute 'keys'

我正在运行此命令来运行该文件

python retrain.py 

    --image_dir ~/home/deepak/new_data_EHL/Augmented 
    --learning_rate=0.0001 
    --testing_percentage=20 
    --validation_percentage=20 
    --training_batch_size=32 
    --validation_batch_size=-1 
    --eval_step_interval=100 
    --how_many_training_steps=10 
    --random_scale=30 
    --random_brightness=30 
    --architecture mobilenet_1.0_224 
    --output_graph=output_graph.pb 
    --output_labels=output_labels.txt

0 个答案:

没有答案