一、说明
这里是用tf模块时候,最常见的错误,就是模块与当下程序所指的路径不一致。改出后做此记录。
二、错误再现
import tensorflow as tf
import sys
interesting_class = sys.argv[1:]
print("Interesting class: ", interesting_class)
# Read in the image_data
from os import listdir
from shutil import copyfile
from os.path import isfile, join
varPath = 'toScan/'
destDir = "scanned/"
imgFiles = [f for f in listdir(varPath) if isfile(join(varPath, f))]
# Loads label file, strips off carriage return
label_lines = [line.rstrip() for line
in tf.gfile.GFile("/tf_files/retrained_labels.txt")]
# Unpersists graph from file
with tf.gfile.FastGFile("/tf_files/retrained_graph.pb", 'rb')