-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot use my trained model after exporting it #30
Comments
I would modify src/neuralnets.py to use keras.models.load_model and save_model as *.hdf5 files, not *.json files. The problem with saving as json is there is not a function to load a json into a model with weights. I am able to load and save models as *.hdf5 files. Everything seems to run correctly, but when using the models to predict an emotion, I'm not getting correct answers. |
Also, copy over the predict function from FERModel |
Did you use 64x64 images or 48x48? I changed to 48x48 |
I had the exact same problem as Octo - i just used the precoded "convolutional_model.py" example, and wanted to try this newly trained model on the provided images. I tried to change the "export_model" as Daniel suggested. And just like Daniel, i can now load my model in fermodel.py by using the constructor FERModel(...). But when i try to predict with this model, i get the following results:
Can anyone help me with this? I've changed the export_model to:
I don't know if it has anything to do with all the warnings coming from executing your code:
|
@heshe Thank you for your comment. I can't answer your question, but for readability, could you please encapsulate the console logs in |
Hi
I managed to install EmoPy on my ubuntu 18.04.
I tested the pre-trained model (fermodel_example.py) and managed to run the convolutional_model.py without error.
then I also managed to train my model on a large database of images and export it to the /output directory using :
model.export_model('output/conv2d_model.json','output/conv2d_weights.h5',"output/conv2d_emotion_map.json",{"calm": 0, "anger": 1, "happiness": 2})
Then I changed the path on fermodel.py from :
model_file = 'models/conv_model_%s.hdf5' % model_suffix
emotion_map_file = 'models/conv_emotion_map_%s.json' % model_suffix
to my newly trained model output :
model_file = 'models/conv2d_weights.h5'
emotion_map_file = 'models/conv2d_emotion_map.json'
But when I run fermodel.py again I get this error:
can someone help me find a solution to this error.
Thanks
The text was updated successfully, but these errors were encountered: