onnx2keras
onnx2keras copied to clipboard
Keranify all the things.
It would be nice if the created model would be keras backend agnostic.
This can be done by replacing all currently used tensorflow code with keras.backend code.
I already ported some (easy) code and was able to convert s3fd and run it with the tensorflow and plaidml backends. Plaidml supports AMD cards which is the real reason for this.
I am going to do this work anyway, but it would be nice to have it merged into this project if possible. If this is something you'd be interested in here is what would need to be done (and i would happily send PRs for this):
- Replace all tensorflow backend code in lambda layers with K function alternatives.
- Change
ensure_tf_typeto return K.constants - Set the appropriate output_shape for all Lambda layers as the guessing which is done in plaidml and theano might be wrong and in the best case leads to warnings.
- Ensure layer names do NOT start with a digit as this trips up plaidml (at least at the moment). It might be best to only do this when requested via parameter.
This might be solved as soon as the functionality for the
name_policyis implemented .?
For the interested, here my current version: https://github.com/SleepProgger/onnx2keras/tree/keranified_testing Everything in elementwise_layers and operation_layers should support tensorflow + plaidml now. There is still some stuff to do, especially in padding_layers and convolution_layers.
Hey @SleepProgger.
Thank you again for support of this project. Actually, I've never heard about plaidml before, it looks really promising.
I'm going to implement the name_policy functionality as soon as possible, so it will be not a problem at all.
Awesome. I am pretty happy to have found this project, Saves a lot of time (when it works that is).
If this is something you'd be interested in expect some PRs the coming weeks.
My end goal is to support all onnx operators (or at least most of it) Also unit tests would probably be a really good idea. Maybe created by something like https://github.com/alibaba/sionnx
Theano backend support is tricky and not really required in my eyes, so i'd focus on implementations that work on plaidml and tensorflow backends.