错误:tensorflow:找不到图像目录“” [英] ERROR: tensorflow: Image directory ' ' not found

查看:301
本文介绍了错误:tensorflow:找不到图像目录“”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Tensorflow用于Windows 10和Anaconda Prompt的Poets 2。但是,运行此代码时,我在训练图像时遇到了麻烦:

I am trying use Tensorflow for Poets 2 with Windows 10 and Anaconda Prompt. However, I'm having troubles with training my images when I run this code:

python scripts/retrain.py
--bottleneck_dir=/tf_files/bottlenecks         
--how_many_training_steps 500
--model_dir=/{$your-working_directory}/inception
--output_graph=/{$your-working_directory}/retrained_graph.pb
--output_labels=/{$your-working_directory}/retrained_labels.txt
--image_dir /tf_files/paintings

我有两个文件夹,其中两个都包含.jpg格式的图像。这两个文件夹位于绘画文件夹中。

I have two folders where both of them contain images in .jpg format. These two folders are inside "paintings" folder.

即使我指定了图像目录,我仍然会收到此错误:

Even though I specify the image directory I still get this error:

2018-09-04 19:40:46.876487: W 
T:\src\github\tensorflow\tensorflow\core\framework\op_def_util.cc:346] Op 
BatchNormWithGlobalNormalization is deprecated. It will cease to work in 
GraphDef version 9. Use tf.nn.batch_normalization().

ERROR:tensorflow:Image directory '' not found.
Traceback (most recent call last):
File "C:\Users\JOHN\Anaconda3\envs\tensorflow\lib\runpy.py", line 193, in _ 
run_module_as_main
"__main__", mod_spec)
File "C:\Users\JOHN\Anaconda3\envs\tensorflow\lib\runpy.py", line 85, in 
_run_code
exec(code, run_globals)
File "C:\Users\JOHN\tensorflow-for-poets-2\scripts\retrain.py", line 1326, 
in <module>
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "C:\Users\JOHN\Anaconda3\envs\tensorflow\lib\site- 
packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "C:\Users\JOHN\tensorflow-for-poets-2\scripts\retrain.py", line 989, in 
main
class_count = len(image_lists.keys())
AttributeError: 'NoneType' object has no attribute 'keys'

我已经检查了类似的帖子,但对我来说却没有用。

I have checked similar posts about this problem but they were not useful in my case.

我该怎么办?

推荐答案

/ tf_files 表示 tf_files 文件夹位于主目录下(即的意思不是 / )。

/tf_files means that the tf_files folder is under your main directory (that's the meaning of /), which is not the case.

您应该删除所有前导斜线 / 从目录参数中获取,即

You should remove all the leading slashes / from your directory arguments, i.e.

python scripts/retrain.py
--bottleneck_dir=tf_files/bottlenecks         
--how_many_training_steps=500
--model_dir={$your-working_directory}/inception
--output_graph={$your-working_directory}/retrained_graph.pb
--output_labels={$your-working_directory}/retrained_labels.txt
--image_dir=tf_files/paintings

当然假设已经定义了外壳变量 your-working_directory (如果没有,请用您的实际工作目录替换)。

assuming of course that the shell variable your-working_directory has already been defined (if not, replace it with your actual working directory).

这篇关于错误:tensorflow:找不到图像目录“”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆