def has_tomatoes(self, im_path):
# load the image
im = Image.open(im_path)
im = np.asarray(im, dtype=np.float32)
im = self.prepare_image(im)
# launch an inference with the image
pred = self.sess.run(
self.output_logits, feed_dict={
self.img_feed: im.eval(
session=self.sess)})
if np.argmax(pred) == 0:
print("NOT a tomato ! (confidence : ", pred[0, 0], "%)")
else:
print("We have a tomato ! (confidence : ", pred[0, 1], "%)")
评论列表
文章目录