Tensorflow-Lite Model

This allows for accessing .tflite model files. A .tflite uses a binary format called a flatbuffer. The flatbuffer “schema” used by a .tflite model is defined in schema.fbs.

Example Usage

Example usage of this package is as follows:

# Import the TfliteModel class
from mltk.core import TfliteModel

# Load the .tflite
tflite_model = TfliteModel.load_flatbuffer_file(tflite_path)

# Generate a summary of the .tflite
summary = tflite_model.summary()

# Print the summary to the console
print(summary)

See the TfliteModel API examples for more examples.

API Reference

mltk.core.TfliteModel

Class to access a .tflite model flatbuffer's layers and tensors

mltk.core.TfliteLayer

Wrapper for TFLite flatbuffer layer

mltk.core.TfliteAddLayer

ADD operation TfliteLayer

mltk.core.TfliteConv2dLayer

CONV_2D operation TfliteLayer

mltk.core.TfliteConv2DLayerOptions

Convolution layer options

mltk.core.TfliteConvParams

Calculated Convolution Parameters

mltk.core.TfliteTransposeConvLayer

TRANSPOSE_CONV operation TfliteLayer

mltk.core.TfliteTransposeConvLayerOptions

Transpose convolution layer options

mltk.core.TfliteTransposeConvParams

Calculated Transpose Convolution Parameters

mltk.core.TfliteFullyConnectedLayer

FULLY_CONNECT operation TfliteLayer

mltk.core.TfliteFullyConnectedLayerOptions

Fully connection layer options

mltk.core.TfliteFullyConnectedParams

Calculated Full Connected Parameters

mltk.core.TfliteDepthwiseConv2dLayer

DEPTHWISE_CONV_2D operation TfliteLayer

mltk.core.TfliteDepthwiseConv2DLayerOptions

Depthwise Convolution options

mltk.core.TfliteDepthwiseConvParams

Calculated Depthwise Convolution Parameters

mltk.core.TflitePooling2dLayer

AVERAGE_POOL_2D or MAX_POOL_2D operation TfliteLayer

mltk.core.TflitePool2DLayerOptions

Pooling layer options

mltk.core.TflitePoolParams

Calculated Pooling Parameters

mltk.core.TfliteReshapeLayer

RESHAPE operation TfliteLayer

mltk.core.TfliteQuantizeLayer

QUANTIZE operation TfliteLayer

mltk.core.TfliteDequantizeLayer

DEQUANTIZE operation TfliteLayer

mltk.core.TfliteUnidirectionalLstmLayer

UNIDIRECTIONAL_SEQUENCE_LSTM operation TfliteLayer

mltk.core.TfliteUnidirectionalLstmLayerOptions

Fully connection layer options

mltk.core.TfliteTensor

Wrapper for TFLite flatbuffer tensor

mltk.core.TfliteShape

Wrapper for tensor shape.

mltk.core.TfliteQuantization

Wrapper for tensor quantization

mltk.core.TfliteActivation

Activation types

mltk.core.TflitePadding

Padding types

mltk.core.TfliteModelParameters

.tflite Model Parameters