类型错误:无法为非浮点类型创建初始值设定项运行“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