微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

类型错误:无法为非浮点类型创建初始值设定项运行“train_tripletloss.py”时

如何解决类型错误:无法为非浮点类型创建初始值设定项运行“train_tripletloss.py”时

我是 tensorflow 和模型训练的新手。我正在使用基于 yolo 和 facenet 的人脸识别算法。我现在正在尝试训练我自己的模型。但是每次我这样做都会出错。 如果您能帮我解决,我将不胜感激。先感谢您。 这是代码链接https://github.com/AzureWoods/faceRecognition-yolo-facenet/blob/master/train_tripletloss.py

这里是错误

  File "C:\Users\user1\AppData\Roaming\Python\python36\site-packages\tensorflow_core\contrib\layers\python\layers\initializers.py",line 120,in _initializer
    raise TypeError('Cannot create initializer for non-floating point type.')
TypeError: Cannot create initializer for non-floating point type.

解决方法

尝试在 image = tf.to_float(image) 中添加 train_tripleloss.py,如下面的屏幕截图所示。

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。