inference.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:dl-classification 作者: matthieuo 项目源码 文件源码
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], "%)")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号