Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tensorflow无法识别的参数\\_Tensorflow - Fatal编程技术网

Tensorflow无法识别的参数\\

Tensorflow无法识别的参数\\,tensorflow,Tensorflow,您好,我正在尝试在codelab中创建tensorflow ImageClassifier,它位于tensorflow-for-poets2之后,同时我正在尝试执行以下代码 python label_image.py \ -- graph=C:\Python_PG\ImageClassifier\poets\tf_files\retrained_graph.pb \ -- image=C:\TensorFlow_ML\ImageClassifier\poets\tf_fi

您好,我正在尝试在codelab中创建tensorflow ImageClassifier,它位于tensorflow-for-poets2之后,同时我正在尝试执行以下代码

  python label_image.py \ -- 
    graph=C:\Python_PG\ImageClassifier\poets\tf_files\retrained_graph.pb \ -- 
    image=C:\TensorFlow_ML\ImageClassifier\poets\tf_files\3021186b83bc90c2.png
我得到以下错误

usage: label_image.py [-h] [--image IMAGE] [--graph GRAPH] [--labels LABELS]
                      [--input_height INPUT_HEIGHT]
                      [--input_width INPUT_WIDTH] [--input_mean INPUT_MEAN]
                      [--input_std INPUT_STD] [--input_layer INPUT_LAYER]
                      [--output_layer OUTPUT_LAYER]
label_image.py: error: unrecognized arguments: \ \
我正在使用windows操作系统。请帮助我解决此错误


提前感谢

简短回答:在单行中编写命令,不使用换行转义序列


更长的回答: 错误正好说明了您的错误:您在教程中键入了一个换行转义序列,作为命令的未识别参数

当然,您可以在命令内换行,如教程中所示。但是您添加了“-”(即空格、破折号、破折号、空格),这使得“\”不是换行符,而是一个参数。您需要将“\”放在换行符之前(前面没有空格或破折号),或者干脆放弃换行符和“\”,只需在一行中键入整个命令

顺便说一下,它不是Tensorflow或Python相关的。BASH就是这样工作的

还有一个问题:如果您不使用BASH(Windows路径表明您可能使用CMD.EXE,除非您使用类似git BASH的东西),转义序列可能会有所不同,即Windows命令行中的“^”字符。更多信息:


当然,参数语法是“-graph=…”,而不是“-graph=…”

简短回答:将命令写在一行中,不带换行符转义序列


更长的回答: 错误正好说明了您的错误:您在教程中键入了一个换行转义序列,作为命令的未识别参数

当然,您可以在命令内换行,如教程中所示。但是您添加了“-”(即空格、破折号、破折号、空格),这使得“\”不是换行符,而是一个参数。您需要将“\”放在换行符之前(前面没有空格或破折号),或者干脆放弃换行符和“\”,只需在一行中键入整个命令

顺便说一下,它不是Tensorflow或Python相关的。BASH就是这样工作的

还有一个问题:如果您不使用BASH(Windows路径表明您可能使用CMD.EXE,除非您使用类似git BASH的东西),转义序列可能会有所不同,即Windows命令行中的“^”字符。更多信息:


当然参数语法是“-graph=…”,而不是“-graph=…”

我的代码中也出现了类似的错误-

!python tensorflow/tensorflow/examples/label_image/label_image.py \
    --graph = model_output/graph_v1.pb \
    --labels = model_output/labels_v1.txt \
    --input_layer='input' --output_layer='final_result' \
    --input_height=224 --input_width=224 \
    --image=path/13.jpg

label_image.py: error: unrecognized arguments: model_output/graph_v1.pb model_output/labels_v1.txt
不能在“=”号前后添加空格

!python tensorflow/tensorflow/examples/label_image/label_image.py \
    --graph=model_output/graph_v1.pb \
    --labels=model_output/labels_v1.txt \
    --input_layer='input' --output_layer='final_result' \
    --input_height=224 --input_width=224 \
    --image=path/13.jpg

我的代码中也出现了类似的错误-

!python tensorflow/tensorflow/examples/label_image/label_image.py \
    --graph = model_output/graph_v1.pb \
    --labels = model_output/labels_v1.txt \
    --input_layer='input' --output_layer='final_result' \
    --input_height=224 --input_width=224 \
    --image=path/13.jpg

label_image.py: error: unrecognized arguments: model_output/graph_v1.pb model_output/labels_v1.txt
不能在“=”号前后添加空格

!python tensorflow/tensorflow/examples/label_image/label_image.py \
    --graph=model_output/graph_v1.pb \
    --labels=model_output/labels_v1.txt \
    --input_layer='input' --output_layer='final_result' \
    --input_height=224 --input_width=224 \
    --image=path/13.jpg

@jaboja的答案肯定是正确的。通常,当命令行程序响应
用法:
时,它会抱怨您没有以正确的格式提供其参数。@jaboja的回答肯定是正确的。通常,当命令行程序响应
用法:
时,它会抱怨您没有以正确的格式提供其参数。