Open cWren0110 opened 7 years ago
I'm not sure but I think I've seen this error before and it was due to cached Python files and using different versions of Python. The issue is related to the fact that Lambda layers just save the wrapped function as it exists in memory when serialized. I would try deleting any *.pyc files in the project folder and see if that helps. I doubt it's invalid layer names since only defaults are used.
The ideal solution is to never serialize the model, just always construct the model programmatically and use save_weights
and load_weights
for the model state. However this is such an edge case problem that I prefer the convenience of serializing the model, particularly when the original model is coming from Darknet.
The environment I used for running the code is fully specified in the environment.yml.
Interesting... still no luck. Below is what I have tried
Are you running Linux or Mac? My next step is to commandeer a coworkers laptop to see if the OS is the cause, and if not I will reach out to the keras dev team.
I'm on Ubuntu 16.04 LTS. Yes, this could easily be a Windows compatibility issue as well and related to how Python runs on Windows.
There's many known issues with Lambda layers in Keras, particularly with serialization. I had to fix one myself to get this working for me. Keras uses the marshall
package to serialize the wrapped function.
Two other things that may work here:
See the 2nd answer in this SO article.
I am getting the following error when I use yad2k.py on yolov2:
I do not get the same error when I run yad2k.py on yolo-tiny.
I changed the code to only save the weights instead via
model.save_weights('{}'.format(output_path))
and did not receive any errors, but when I tried to convert the model to json viamodel.to_json()
I received virtually the same error. After doing some digging, people have suggested 2 possible issues:I am guessing you do not see this issue, since it is the example case in the readme, but would you mind checking, and if not posting the versions of the required packages that you are using?