test.py 文件源码

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

项目:keras-squeezenet 作者: rcmalli 项目源码 文件源码
def testTFwPrediction(self):
        keras.backend.set_image_dim_ordering('tf')
        model = SqueezeNet()
        img = image.load_img('images/cat.jpeg', target_size=(227, 227))
        x = image.img_to_array(img)
        x = np.expand_dims(x, axis=0)
        x = preprocess_input(x)
        preds = model.predict(x)
        decoded_preds = decode_predictions(preds)
        #print('Predicted:', decoded_preds)
        self.assertIn(decoded_preds[0][0][1], 'tabby')
        #self.assertAlmostEqual(decode_predictions(preds)[0][0][2], 0.82134342)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号