onnx-tensorflow | Tensorflow Backend for ONNX | Machine Learning library

 by   onnx Python Version: v1.10.0 License: Non-SPDX

kandi X-RAY | onnx-tensorflow Summary

kandi X-RAY | onnx-tensorflow Summary

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

Open Neural Network Exchange (ONNX) is an open standard format for representing machine learning models. ONNX is supported by a community of partners who have implemented it in many frameworks and tools. TensorFlow Backend for ONNX makes it possible to use ONNX models as input for TensorFlow. The ONNX model is first converted to a TensorFlow model and then delegated for execution on TensorFlow to produce the output.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              onnx-tensorflow has a medium active ecosystem.
              It has 1164 star(s) with 296 fork(s). There are 53 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 244 open issues and 285 have been closed. On average issues are closed in 96 days. There are 9 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of onnx-tensorflow is v1.10.0

            kandi-Quality Quality

              onnx-tensorflow has 0 bugs and 0 code smells.

            kandi-Security Security

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

            kandi-License License

              onnx-tensorflow has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              onnx-tensorflow 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.
              onnx-tensorflow saves you 6622 person hours of effort in developing the same functionality from scratch.
              It has 15310 lines of code, 1013 functions and 213 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed onnx-tensorflow and discovered the below as its top functions. This is intended to give you an instant insight into onnx-tensorflow implemented functionality, and help decide if they suit your requirements.
            • Generate the support status file
            • Parse command line arguments
            • Train onnx model
            • Run the graph
            • Returns the train and test dataset
            • Update onnx model
            • Maximum pooling op
            • Calculate argmax
            • Calculate the argmax without padding
            • Get list of permissions from formats
            • Parse docstring
            • Train TF model
            • Generate API documentation
            • Converts a given file to Tensorflow graph
            • Convert onnx graph to Tensorflow ops
            • Creates Variables
            • Run onnx
            • Make a graph - like object
            • Calculate the coverage of the backend
            • Generate the cli script
            • Generate tensorflow dict
            • Load a tf node
            • Convert a graph definition to a tensorflow repos
            • Create TensorFlowNode
            • Create a dictionary of handler variables
            • Common method for common operator
            Get all kandi verified functions for this library.

            onnx-tensorflow Key Features

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

            onnx-tensorflow Examples and Code Snippets

            Implementing an ONNX backend
            C++dot img1Lines of Code : 79dot img1License : Permissive (Apache-2.0)
            copy iconCopy
            ---------- onnx coverage: ----------
            Operators (passed/loaded/total): 21/21/70
            ------------------------------------
            ╒════════════════════╤════════════════════╕
            │ Operator           │ Attributes         │
            │                    │ (name: #values)    │
            ╞═  
            10. Running a model from your favorite deep learning framework,Tensorflow
            Cdot img2Lines of Code : 36dot img2License : Non-SPDX (NOASSERTION)
            copy iconCopy
            import tensorflow as tf
            mnist = tf.keras.datasets.mnist
            
            (x_train, y_train),(x_test, y_test) = mnist.load_data()
            x_train, x_test = x_train / 255.0, x_test / 255.0
            
            model = tf.keras.models.Sequential([
              tf.keras.layers.Flatten(input_shape=(28, 28)),
              
            Introduction,Run Convert Tool,How to use
            C++dot img3Lines of Code : 16dot img3License : Permissive (Apache-2.0)
            copy iconCopy
            $ ./convert_tool -h
            [Convert Tools Info]: optional arguments:
                    -h    help            show this help message and exit
                    -f    input type      path to input float32 tmfile
                    -p    input structure path to the network structure of inpu  

            Community Discussions

            QUESTION

            Pytorch -> [Onnx -> tensorflow] -> tflite generates lots of redundant conv2d operators
            Asked 2021-Mar-19 at 20:58

            I am converting efficientnet from onnx to tensorflow for further conversion to tflite. The conversion from onnx to tensorflow yields strange results

            Onnx has 1 conv2d operator

            And after converting to tensorflow and later tflite model I get this stack of convs(All of them couldn't fit in the picture, there are 32 of the in total, as the number of kernels in onnx)

            I suspect the issue is with onnx-tf conversion. It seems like the conv2d output are split into 32 separate outputs, then they are processed individually on separate conv2d operator and then concatenated together.

            There are 2 connected issues on their github.

            First has a fix for depthwise convs but it can't be applied in my case

            https://github.com/onnx/onnx-tensorflow/issues/473

            https://github.com/onnx/onnx-tensorflow/issues/754

            Looking at the source of https://github.com/onnx/onnx-tensorflow/blob/master/onnx_tf/handlers/backend/conv_mixin.py They do indeed split the output produce separate convolutions and later concatenate them.

            Can this split to multiple convolutions be avoided?

            ...

            ANSWER

            Answered 2021-Mar-19 at 20:58

            After some additional digging I've found the following

            • My convs were depthwise(conv2d is depthwise in pytorch and onnx if it has groups parameter > 1)
            • This bunch of convs is an inefficient way of doing a depthwise conv. To do it efficiently we need to use tf.depthwiseconv

            To fix this in onnx-tf v1.7.0 you should apply a patch to onnx-tf source code posted here https://github.com/onnx/onnx-tensorflow/issues/473#issuecomment-533522917

            In current master branch there is an attempt to fix the issue by detecting depthwise convs but it currently contains a bug. To fix the bug in master branch you can apply a fix I posted here https://github.com/onnx/onnx-tensorflow/issues/754#issuecomment-801775203 I've used the master branch and the fix above resulting in a small graph with depthwise conv

            I've also created a fork with the fix above, so you can do

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install onnx-tensorflow

            ONNX-TF requires ONNX (Open Neural Network Exchange) as an external dependency, for any issues related to ONNX installation, we refer our users to ONNX project repository for documentation and help. Notably, please ensure that protoc is available if you plan to install ONNX via pip. The specific ONNX release version that we support in the master branch of ONNX-TF can be found here. This information about ONNX version requirement is automatically encoded in setup.py, therefore users needn't worry about ONNX version requirement when installing ONNX-TF. To install the latest version of ONNX-TF via pip, run pip install onnx-tf. Because users often have their own preferences for which variant of TensorFlow to install (i.e., a GPU version instead of a CPU version), we do not explicitly require tensorflow in the installation script. It is therefore users' responsibility to ensure that the proper variant of TensorFlow is available to ONNX-TF. Moreover, we require TensorFlow version == 2.6.0.
            Install ONNX master branch from source.
            Install TensorFlow >= 2.6.0 and tensorflow-addons. (Note TensorFlow 1.x is no longer supported)
            Run git clone https://github.com/onnx/onnx-tensorflow.git && cd onnx-tensorflow.
            Run pip install -e ..

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            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/onnx-tensorflow.git

          • CLI

            gh repo clone onnx/onnx-tensorflow

          • sshUrl

            git@github.com:onnx/onnx-tensorflow.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