Skip to main content

A package to parse TFLite models (*.tflite)

Project description

The python package to parse TFLite models

TFLite models (*.tflite) are in FlatBuffers format. This tflite package is built to parse the TFLite models from the schema.fbs of TensorFlow.

Usage

Using this package, you can parse the TFLite models (*.tflite) in Python. One target of this package is to let people use it as the one originally built from schema.fbs.

Installation

This package can be installed via pip, and is versioning similar to TensorFlow package. And the version mapping is as below.

TensorFlow package version tflite package version
1.14.0 1.14.0.post1
1.15.0 1.15.0.post1
2.0.0 2.0.0.post2

It would be better if you use a correct version, such as:

pip install tensorflow==1.14.0
pip install tflite==1.14.0.post1

Easy Import

Basically, you can use this package just like the newly FlatBuffers generated one (example):

from tflite.Model import Model
# use Model

In addition, you may use the Easy Import (recommanded) to avoid too many imports per submodules (example). The easy import imports the classes and functions of one submodules into top module directly, e.g. import the {package}.{submodules}.{class or function} as {package}.{class or function}. For example, when building the Model object, tflite.Model.GetRootAsModel(buf, 0).

import tflite
# use tflite.Model

Development

Package users can safely ignore this part.

To develop this package, additional depdendency can be installed via pip install -r requirements.txt.

The tools directory holds some scripts to update the package to corresponding TensorFlow version. There are three steps currently:

  1. Download the schema.fbs change of a version.
  2. Update the classes and functions import of submodules.
  3. Update the versioning in setup.py.
  4. Build and Test around.
  5. Upload the package to PyPI.

Features could be added to make the parsing easy in the future.

Don't forget to re-install the newly built tflite package before testing it. You may also try source tools/source-me.sh rather than the annoying build and install process in development.

Resources

License

Apache License Version 2.0 as TensorFlow's.

Disclaimer

The schema.fbs is obtained from TensorFlow directly, which could be property of Google. Maitainer of this package has tried to contact one of the TensorFlow maitainers for legal or permission issues, but receiving no reply. Ownership or maitainship of this package is open to transfer or close if there were any issues.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tflite-2.0.0.post2-py2.py3-none-any.whl (77.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file tflite-2.0.0.post2-py2.py3-none-any.whl.

File metadata

  • Download URL: tflite-2.0.0.post2-py2.py3-none-any.whl
  • Upload date:
  • Size: 77.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for tflite-2.0.0.post2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 29f6fb6685e04566a48bb03dc676ba4a608c95d8f38b2c5e4f12ada1ff5fdcea
MD5 5835e53c6c8fa168c063befaf6f0c1fd
BLAKE2b-256 d1fe5b63837c6e9d60f9f60fdba7a87d8e913517d926d2ee39a2f87c5c814895

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page