tflite


Nametflite JSON
Version 2.10.0 PyPI version JSON
download
home_pagehttps://zhenhuaw.me/tflite
SummaryParsing TensorFlow Lite Models (*.tflite) Easily
upload_time2022-11-12 15:43:34
maintainer
docs_urlNone
author王振华(Zhenhua WANG)
requires_python!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<4,>=2.7
licenseApache License 2.0
keywords tflite tensorflow
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Easily Parse TFLite Models with Python
======================================

![Build and Test](https://github.com/zhenhuaw-me/tflite/workflows/Build%20and%20Test/badge.svg)

This [`tflite` package](https://pypi.org/project/tflite/) parses TensorFlow Lite (TFLite) models (`*.tflite`), which are built by [TFLite converter](https://www.tensorflow.org/lite/convert). For background, please refer to [Introducing TFLite Parser Python Package](https://zhenhuaw.me/blog/2020/introducing-tflite-parser-package.html).


## Usage

Install the package and use it like what you build from the TensorFlow codebase.
It's recommended to install the version that same as the TensorFlow that generates the TFLite model.

```sh
pip install tensorflow==2.3.0
pip install tflite==2.3.0
```

The raw API of `tflite` can be found in [this documentation](https://zhenhuaw.me/tflite/docs/).
The [MobileNet test](tests/test_mobilenet.py) can serve as a usage example of parsing models.


## Enhancements

The generated python package is not friendly to use sometimes.
We have introduced several enhancements:

* **Easy import**: A single `import tflite` ([example](https://github.com/zhenhuaw-me/tflite/blob/master/tests/test_mobilenet.py)) to replace importing every classes and funtions in `tflite` ([example](tests/test_original_import.py)).
* **Builtin opcode helper**: The opcode is _encoded_ as digits which is hard to parse for human. Two APIs added to make it easy to use.
  * [`tflite.opcode2name()`](https://github.com/zhenhuaw-me/tflite/blob/master/tflite/utils.py#L1): get the type name of given opcode.
  * [`tflite.BUILTIN_OPCODE2NAME`](https://github.com/zhenhuaw-me/tflite/blob/master/tflite/utils.py#L9): a dict that maps the opcode to name of all the builtin operators.


## Compatibility Handling

TensorFlow sometimes leaves compability hanlding of the TFLite model to the users.
As these are API breaking change that can be easily fixed, we do this in the `tflite` package.

* [`tflite.OperatorCode.BuiltinCode()`](https://github.com/zhenhuaw-me/tflite/blob/master/tflite/OperatorCode.py#L43): maintains API compability in `2.4.0`, see [this issue](https://github.com/tensorflow/tensorflow/issues/46663).


## Contributing Updates

As the operator definition may change across different TensorFlow versions, this package needs to be updated accordingly. If you notice that the package is out of date, please feel free to contribute new versions. This is pretty simple, instructions as below.

1. [Fork the repository](https://help.github.com/en/github/getting-started-with-github/fork-a-repo), and download it.
2. Install additional depdendency via `pip install -r requirements.txt`. And install [flatbuffer compiler](https://google.github.io/flatbuffers/flatbuffers_guide_using_schema_compiler.html) (you may need to [manually build it](https://google.github.io/flatbuffers/flatbuffers_guide_building.html)).
3. Generate the code for update. Tools have been prepared, there are prompt for actions.
    1. [Download](scripts/update-schema.sh) `schema.fbs` for a new version.
    2. [Update](scripts/gen-op-list.py) the builtin operator mapping.
    3. [Update](scripts/update-importing.py) the classes and functions import of submodules.
    4. [Update](scripts/gen-doc.sh) the API document.
    5. Update the versioning in [`__init__.py`](tflite/__init__.py).
    6. [Build](scripts/build-wheel.sh) and [test](tests) (simply `pytest`) around. Don't forget to re-install the newly built `tflite` package before testing it.
4. Push your change and open [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests).
5. The maintainer will take the responsibility to upload change to PyPI when merged.


## Resources

* [PyPI page](https://pypi.org/project/tflite/).
* [GitHub page](https://github.com/zhenhuaw-me/tflite).
* [Module list](https://zhenhuaw.me/tflite/docs).
* [TensorFlow Lite converter](https://www.tensorflow.org/lite/convert).


## License

Apache License Version 2.0 as TensorFlow's.


## Disclaimer

The `schema.fbs` is obtained from TensorFlow directly. Maintainer of this package had tried to [contact](assets/disclaimer.eml) TensorFlow maintainers for licensing issues, but received no reply. Ownership or maintainship is open to transfer or close if there were any issue.

            

Raw data

            {
    "_id": null,
    "home_page": "https://zhenhuaw.me/tflite",
    "name": "tflite",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<4,>=2.7",
    "maintainer_email": "",
    "keywords": "tflite,tensorflow",
    "author": "\u738b\u632f\u534e(Zhenhua WANG)",
    "author_email": "hi@zhenhuaw.me",
    "download_url": "https://files.pythonhosted.org/packages/0d/a8/8e84e361b77733157e04bac54b1479f877f3185cdc0dbbc412823fbfc7c8/tflite-2.10.0.tar.gz",
    "platform": null,
    "description": "Easily Parse TFLite Models with Python\n======================================\n\n![Build and Test](https://github.com/zhenhuaw-me/tflite/workflows/Build%20and%20Test/badge.svg)\n\nThis [`tflite` package](https://pypi.org/project/tflite/) parses TensorFlow Lite (TFLite) models (`*.tflite`), which are built by [TFLite converter](https://www.tensorflow.org/lite/convert). For background, please refer to [Introducing TFLite Parser Python Package](https://zhenhuaw.me/blog/2020/introducing-tflite-parser-package.html).\n\n\n## Usage\n\nInstall the package and use it like what you build from the TensorFlow codebase.\nIt's recommended to install the version that same as the TensorFlow that generates the TFLite model.\n\n```sh\npip install tensorflow==2.3.0\npip install tflite==2.3.0\n```\n\nThe raw API of `tflite` can be found in [this documentation](https://zhenhuaw.me/tflite/docs/).\nThe [MobileNet test](tests/test_mobilenet.py) can serve as a usage example of parsing models.\n\n\n## Enhancements\n\nThe generated python package is not friendly to use sometimes.\nWe have introduced several enhancements:\n\n* **Easy import**: A single `import tflite` ([example](https://github.com/zhenhuaw-me/tflite/blob/master/tests/test_mobilenet.py)) to replace importing every classes and funtions in `tflite` ([example](tests/test_original_import.py)).\n* **Builtin opcode helper**: The opcode is _encoded_ as digits which is hard to parse for human. Two APIs added to make it easy to use.\n  * [`tflite.opcode2name()`](https://github.com/zhenhuaw-me/tflite/blob/master/tflite/utils.py#L1): get the type name of given opcode.\n  * [`tflite.BUILTIN_OPCODE2NAME`](https://github.com/zhenhuaw-me/tflite/blob/master/tflite/utils.py#L9): a dict that maps the opcode to name of all the builtin operators.\n\n\n## Compatibility Handling\n\nTensorFlow sometimes leaves compability hanlding of the TFLite model to the users.\nAs these are API breaking change that can be easily fixed, we do this in the `tflite` package.\n\n* [`tflite.OperatorCode.BuiltinCode()`](https://github.com/zhenhuaw-me/tflite/blob/master/tflite/OperatorCode.py#L43): maintains API compability in `2.4.0`, see [this issue](https://github.com/tensorflow/tensorflow/issues/46663).\n\n\n## Contributing Updates\n\nAs the operator definition may change across different TensorFlow versions, this package needs to be updated accordingly. If you notice that the package is out of date, please feel free to contribute new versions. This is pretty simple, instructions as below.\n\n1. [Fork the repository](https://help.github.com/en/github/getting-started-with-github/fork-a-repo), and download it.\n2. Install additional depdendency via `pip install -r requirements.txt`. And install [flatbuffer compiler](https://google.github.io/flatbuffers/flatbuffers_guide_using_schema_compiler.html) (you may need to [manually build it](https://google.github.io/flatbuffers/flatbuffers_guide_building.html)).\n3. Generate the code for update. Tools have been prepared, there are prompt for actions.\n    1. [Download](scripts/update-schema.sh) `schema.fbs` for a new version.\n    2. [Update](scripts/gen-op-list.py) the builtin operator mapping.\n    3. [Update](scripts/update-importing.py) the classes and functions import of submodules.\n    4. [Update](scripts/gen-doc.sh) the API document.\n    5. Update the versioning in [`__init__.py`](tflite/__init__.py).\n    6. [Build](scripts/build-wheel.sh) and [test](tests) (simply `pytest`) around. Don't forget to re-install the newly built `tflite` package before testing it.\n4. Push your change and open [Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests).\n5. The maintainer will take the responsibility to upload change to PyPI when merged.\n\n\n## Resources\n\n* [PyPI page](https://pypi.org/project/tflite/).\n* [GitHub page](https://github.com/zhenhuaw-me/tflite).\n* [Module list](https://zhenhuaw.me/tflite/docs).\n* [TensorFlow Lite converter](https://www.tensorflow.org/lite/convert).\n\n\n## License\n\nApache License Version 2.0 as TensorFlow's.\n\n\n## Disclaimer\n\nThe `schema.fbs` is obtained from TensorFlow directly. Maintainer of this package had tried to [contact](assets/disclaimer.eml) TensorFlow maintainers for licensing issues, but received no reply. Ownership or maintainship is open to transfer or close if there were any issue.\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Parsing TensorFlow Lite Models (*.tflite) Easily",
    "version": "2.10.0",
    "split_keywords": [
        "tflite",
        "tensorflow"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c5fd04acc67854ccf9d4af2088d7505d",
                "sha256": "89cb9f57df0f5345f8fad1381e0fae6180ded687113eb552cfbb60a05edc002c"
            },
            "downloads": -1,
            "filename": "tflite-2.10.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c5fd04acc67854ccf9d4af2088d7505d",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<4,>=2.7",
            "size": 123566,
            "upload_time": "2022-11-12T15:43:32",
            "upload_time_iso_8601": "2022-11-12T15:43:32.453698Z",
            "url": "https://files.pythonhosted.org/packages/92/8d/20f655ab797c65613edcfc7354a80f288444f561c419bc638fe501c5f292/tflite-2.10.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "b0b3f5e7edbbd2b39bd3bf524e180ec4",
                "sha256": "6818a5d7776958b803944ba0a1f4c4395559606d9e795d67ac467a8a3904757d"
            },
            "downloads": -1,
            "filename": "tflite-2.10.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b0b3f5e7edbbd2b39bd3bf524e180ec4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<4,>=2.7",
            "size": 37960,
            "upload_time": "2022-11-12T15:43:34",
            "upload_time_iso_8601": "2022-11-12T15:43:34.098505Z",
            "url": "https://files.pythonhosted.org/packages/0d/a8/8e84e361b77733157e04bac54b1479f877f3185cdc0dbbc412823fbfc7c8/tflite-2.10.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-11-12 15:43:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "tflite"
}
        
Elapsed time: 0.01952s