Just another small error I’ve run into while testing out Tensorflow’s label image example (Tensorflow/tensorflow/examples/image_retraining/label_image.py):
KeyError: "The name 'import/input' refers to an Operation not in the graph.
This one thankfully doesn’t seem to be my fault. In label_image.py change the following lines:
# Line 78-79
input_layer = "input"
output_layer = "InceptionV3/Predictions/Reshape_1"
# Change to this
input_layer = "Mul"
output_layer = "final_result"
Once that’s done just rerun your script and it should all work. Thanks to the following post for the solution: https://github.com/tensorflow/tensorflow/issues/12736
Just a quick post on how to resolve an error I came across while testing out tensorflow:
Traceback (most recent call last):
File "C:\Users\Chris-PC\Desktop\images-to-use\attempt2\tensorflow\examples\label_image\label_image.py", line 112, in <module>
graph = load_graph(model_file)
File "C:\Users\Chris-PC\Desktop\images-to-use\attempt2\tensorflow\examples\label_image\label_image.py", line 30, in load_graph
with open(model_file, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'tensorflow/examples/label_image/data/inception_v3_2016_08_28_frozen.pb'
All you need to do is download the following file and place it in the directory in the error message: https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz
Just a batch script I came across that allows you to rename all files in a directory with sequential numbers. Really handy for things like tensorflow. All you need to do is create a batch file in the directory containing the following:
for %%a in (*.jpg) do (
set /a i+=1
ren "%%a" "!i!.new"
ren *.new *.jpg
Thanks to this stackoverflow post: https://superuser.com/a/350633/124014