PacktPublishing / Neural-Network-Projects-with-Python

Neural Network Projects with Python, Published by Packt
MIT License
314 stars 189 forks source link

Issue with Ch.7 Code, plus a fix for a problem someone else had #10

Open bigearsjonny opened 3 years ago

bigearsjonny commented 3 years ago

siamese_nn.py line 28 gave an error of mismatched types, I changed the line to this to fix it: model.fit([np.float32(training_pairs[:, 0]), np.float32(training_pairs[:, 1])], np.float32(training_labels), batch_size=128, epochs=10)

Now, when I try to run face_recognition_system.py, I get a "SystemError: unknown opcode" message on line 25.

The Keras documentation says we need to supply a custom_objects paramter, and it is supplied, but obviously not correctly. model = load_model('siamese_nn.h5', custom_objects={'contrastive_loss': utils.contrastive_loss, 'euclidean_distance': utils.euclidean_distance})

Please help.

bigearsjonny commented 3 years ago

Ooops. I realize now that my fix for the model fit probably introduced the error in the model load.