Search code examples
pythonpython-3.xtensorflowkerasfacenet

TypeError: Cannot create initializer for non-floating point type . When running "train_tripletloss.py"


I am new at tensorflow and models training. I am using the face recognition algorithm based on yolo and facenet. i am now trying to train my own model. But i get an error everytime I do so. I would be very grateful to you if you help me solve it. Thank you in advance. here is the link to the code : https://github.com/AzureWoods/faceRecognition-yolo-facenet/blob/master/train_tripletloss.py

here is t the error:

  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.

Solution

  • Try add image = tf.to_float(image) in train_tripleloss.py where the below screenshot indicates.

    enter image description here