东方耀AI技术分享

标题: TypeError: Object of type 'float32' is not JSON serializable [打印本页]

作者: 东方耀    时间: 2020-3-26 12:14
标题: TypeError: Object of type 'float32' is not JSON serializable
# 在使用json.dump时遇到报错TypeError: Object of type 'float32' is not JSON serializable
# json.dumps(str(a)),添加str()即可
# json.dump(result_dict, f, indent=4)




或者 转换类型为float64即可  


predict_results = predict_results.astype(np.float64)


作者: lyh    时间: 2020-3-27 16:02
问题解决了 非常感谢
作者: lyh    时间: 2020-3-28 19:59

问题解决了 非常感谢
作者: lyh    时间: 2020-3-28 20:01

问题解决了 非常感谢
作者: lyh    时间: 2020-3-28 20:09
感谢楼主的分享
作者: 栀子花    时间: 2020-4-5 00:13

感谢楼主的分享
作者: lixinwei    时间: 2020-4-7 11:10

感谢楼主的分享




欢迎光临 东方耀AI技术分享 (http://www.ai111.vip/) Powered by Discuz! X3.4