Python FileNotFoundError:[Errno 2]没有这样的文件或目录:';tf_files/retranted_graph.pb';

Python FileNotFoundError:[Errno 2]没有这样的文件或目录:';tf_files/retranted_graph.pb';,python,tensorflow,cmd,Python,Tensorflow,Cmd,我正在尝试在Windows10和Anaconda提示符下使用Tensorflow for Poeters 2。在我重新训练我的图像后,我想通过编写以下代码来测试它们: python scripts/label_image.py --graph=tf_files/retrained_graph.pb --image=tf_files/test_pic.jpg 但是,我得到了这个错误: Traceback (most recent call last): File "scripts/label

我正在尝试在Windows10和Anaconda提示符下使用Tensorflow for Poeters 2。在我重新训练我的图像后,我想通过编写以下代码来测试它们:

python scripts/label_image.py  --graph=tf_files/retrained_graph.pb  --image=tf_files/test_pic.jpg
但是,我得到了这个错误:

Traceback (most recent call last):
File "scripts/label_image.py", line 112, in <module>
graph = load_graph(model_file)
File "scripts/label_image.py", line 31, in load_graph
with open(model_file, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 
'tf_files/retrained_graph.pb'

我该怎么办?

您的脚本似乎找不到您的
tf\u文件
文件夹


您应该使用absolute来确保脚本可以访问您的文件,或者只需在
脚本
目录中移动文件夹。

在重新培训时,您应该显式地包含参数
--output\u graph=tf\u files/retranted\u graph.pb
;你方的后续行动:


您是否在重新培训时使用了参数
--output\u graph=tf\u files/retranted\u graph.pb
,就像在您的中一样?我意识到我没有这样做。修复了它,它开始测试我的图像。谢谢你的帮助。
INFO:tensorflow:Final test accuracy = 96.2% (N=52)
INFO:tensorflow:Froze 2 variables.
INFO:tensorflow:Converted 2 variables to const ops.
python scripts/retrain.py 
  --bottleneck_dir=tf_files/bottlenecks 
  --how_many_training_steps=500 
  --model_dir=tf_files/models 
  --output_graph=tf_files/retrained_graph.pb    
  --output_labels=tf_files/retrained_labels.txx
  --image_dir=tf_files/paintings