keras-onnx | Convert tf.keras/Keras models to ONNX | Machine Learning library

 by   onnx Python Version: v1.7.0 License: Apache-2.0

kandi X-RAY | keras-onnx Summary

kandi X-RAY | keras-onnx Summary

keras-onnx is a Python library typically used in Artificial Intelligence, Machine Learning, Deep Learning, Tensorflow, Keras applications. keras-onnx has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can install using 'pip install keras-onnx' or download it from GitHub, PyPI.

The keras2onnx model converter enables users to convert Keras models into the ONNX model format. Initially, the Keras converter was developed in the project onnxmltools. keras2onnx converter development was moved into an independent repository to support more kinds of Keras models and reduce the complexity of mixing multiple converters. Most of the common Keras layers have been supported for conversion. Please refer to the Keras documentation or tf.keras docs for details on Keras layers. Windows Machine Learning (WinML) users can use WinMLTools which wrap its call on keras2onnx to convert the Keras models. If you want to use the keras2onnx converter, please refer to the WinML Release Notes to identify the corresponding ONNX opset number for your WinML version. keras2onnx has been tested on Python 3.5 - 3.8, with tensorflow 1.x/2.0 - 2.2 (CI build). It does not support Python 2.x.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              keras-onnx has a low active ecosystem.
              It has 374 star(s) with 117 fork(s). There are 16 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 102 open issues and 177 have been closed. On average issues are closed in 25 days. There are 3 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of keras-onnx is v1.7.0

            kandi-Quality Quality

              keras-onnx has 0 bugs and 0 code smells.

            kandi-Security Security

              keras-onnx has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              keras-onnx code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              keras-onnx is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              keras-onnx releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              keras-onnx saves you 6554 person hours of effort in developing the same functionality from scratch.
              It has 13618 lines of code, 885 functions and 93 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed keras-onnx and discovered the below as its top functions. This is intended to give you an instant insight into keras-onnx implemented functionality, and help decide if they suit your requirements.
            • Convert detection layer
            • Returns the variable name for the given seed
            • Return a unique variable name
            • Get a local variable
            • Constructs a dense network
            • Block convolutional block
            • Multi - layer dense block
            • Create dense network
            • Map MXNet s ReverseV2 operator to onnx operator
            • Convert NMS layer to NMS layer
            • Convert tf_concat_v2
            • Convert a yolo model
            • Convert TensorV2 operator to onnx operator
            • Convert keras_advances
            • Convert keras activations to coreml
            • Convert a keras merge layer into a keras merge layer
            • Convert a tf_fill operator to onnx operator
            • Display a yolo image
            • Load the keras model
            • Convert a tf slice
            • Convert a keras model to onnx
            • Convert a tf Depth - wise operator
            • Convert tf_strided_slice to onnx operator
            • Convert tf space to batch
            • Convert a tf_batch operator to onnx
            • Constructs a dense network layer
            Get all kandi verified functions for this library.

            keras-onnx Key Features

            No Key Features are available at this moment for keras-onnx.

            keras-onnx Examples and Code Snippets

            No Code Snippets are available at this moment for keras-onnx.

            Community Discussions

            QUESTION

            Why keras2onnx.convert_keras() function keeps getting me error "'KerasTensor' object has no attribute 'graph'"
            Asked 2021-Mar-10 at 15:00

            I have a trained model (Which I trained myself), which is a .h5 format, It works fine by itself, but I need to convert it to .onnx format for deploying it inside Unity Engine, I searched how to convert .h5 models to .onnx format and stumbled upon keras2onnx library, and following some tutorials I got this:

            ...

            ANSWER

            Answered 2021-Mar-10 at 15:00

            Not directly answer's your question, but a workaround:
            You could try using the tf2onnx package for conversion.

            The flow is to:

            1. Export the model to Saved Model format.
            2. Convert exported Saved Model to ONNX.

            I had success converting the provided .h5 model:

            Source https://stackoverflow.com/questions/66560370

            QUESTION

            How to convert channel last keras model into channel first ONNX model
            Asked 2020-Oct-06 at 12:43

            I want to convert keras .h5 model into ONNX model. But my model is trained channel last and I want it channel first. I found that there is an argument in keras2onnx.convert_keras called channel_first_inputs but couldn't find any example on how to use it on their official site.

            I am doing this step as a part of the process of converting my keras model into .engine model. Is there any other way to do so without the need to onnx intermediate step?.

            Searching for the parameter name inside the keras2onnx code, I found the following usage

            • In Here: channel_first_inputs=['input_1']
            • In Here: channel_first_inputs=[model.input_names[0]]
            ...

            ANSWER

            Answered 2020-Oct-06 at 12:43

            I used channel_first_inputs=['input_1'] and it worked fine.

            Source https://stackoverflow.com/questions/64219974

            QUESTION

            How to get input tensor shape of an unknown PyTorch model
            Asked 2020-Jul-28 at 13:14

            I am writing a python script, which converts any deep learning models from popular frameworks (TensorFlow, Keras, PyTorch) to ONNX format. Currently I have used tf2onnx for tensorflow and keras2onnx for keras to ONNX conversion, and those work.

            Now PyTorch has integrated ONNX support, so I can save ONNX models from PyTorch directly. But the problem is I will need input tensor shape for that model, in order to save it in ONNX format. As you already might have guessed, I am writing this script to convert unknown deep learning models.

            Here is PyTorch's tutorial for ONNX conversion. There it's written:

            Limitations¶ The ONNX exporter is a trace-based exporter, which means that it operates by executing your model once, and exporting the operators which were actually run during this run. This means that if your model is dynamic, e.g., changes behavior depending on input data, the export won’t be accurate.

            Similarly, a trace is might be valid only for a specific input size (which is one reason why we require explicit inputs on tracing). Most of the operators export size-agnostic versions and should work on different batch sizes or input sizes. We recommend examining the model trace and making sure the traced operators look reasonable.


            The code snippet I am using is this:

            ...

            ANSWER

            Answered 2020-Jul-28 at 11:35

            you can follow this as a starting point to debug

            Source https://stackoverflow.com/questions/63131273

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install keras-onnx

            You can install latest release of Keras2ONNX from PyPi:.

            Support

            We welcome contributions in the form of feedback, ideas, or code.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/onnx/keras-onnx.git

          • CLI

            gh repo clone onnx/keras-onnx

          • sshUrl

            git@github.com:onnx/keras-onnx.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link