运行tflite模型时出现问题(tflite模型的结果是nan) [英] A problem when run tflite model(the result of tflite model is nan)

查看:44
本文介绍了运行tflite模型时出现问题(tflite模型的结果是nan)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我训练了一个模型将草图图片转换为彩色图片.在此处输入图片描述 中间是真实情况,左边是原始的,右边是预测.这个结果是由model.h5运行的,但是当我使用model.tflite运行程序时出现错误的结果.

I trained a model to convert sketch picture to color picture. enter image description here middle is ground truth, left is original and right is pridiction. This result was ran by model.h5 but there is a wrong result when i run program using model.tflite.

这是我的转换代码

tflite_convert --keras_model_file=G:/pix2pix/generator.h5 --output_file=G:/pix2pix/convert.tflite

这是model.tflite运行的结果

this is the result ran by model.tflite

[[[[nan nan nan] ...

推荐答案

我找到了有关此问题的解决方案.只需将 tf.keras.layers.bn 的属性fused 改为false.输出正确.

I find a solution about this question. Just change the attribute fused of tf.keras.layers.bn to false. The output is correct.

这篇关于运行tflite模型时出现问题(tflite模型的结果是nan)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆