Load Checkpoint And Evaluate Single Image With Tensorflow Dnn
For research at university I am examining the oxford 17 flowers alexnet example. The example uses the API tflearn based on tensorflow. Training is working very well on my GPU, reac
Solution 1:
for save: model.save('name.tflearn')
for load: model.load('name.tflearn')
and for testing in loop just load the model and follow following code
files_path = '/your/test/images/directory/path'
img_files_path = os.path.join(files_path, '*.jpg')
img_files = sorted(glob(img_files_path))
for f in img_files:
try:
img = Image.open(f).convert('RGB')
img = ImageOps.fit(img, ((64, 64)), Image.ANTIALIAS)
img_arr = np.array(img)
img_arr = img_arr.reshape(-1, 64, 64, 3).astype("float")
pred = model.predict(img_arr)
print(" %s" % pred[0])
except:
continue
Post a Comment for "Load Checkpoint And Evaluate Single Image With Tensorflow Dnn"