beagleboard / beaglebone-ai

BeagleBone AI - the fast track for embedded machine learning
Creative Commons Attribution 4.0 International
137 stars 54 forks source link

SW: need Tensorflow/Python integration with TIDL #2

Open jadonk opened 5 years ago

jadonk commented 4 years ago

Tensorflow Lite support is on the roadmap for 2020Q1.

pra-dan commented 4 years ago

With the release of TIDL 3.15.1, TensorFlow and TensorFlow Lite has been added to the supported frameworks among Caffe, TensorFlow Lite and ONNX although, not yet a verified model like the Jacinto11, MobileNetV2 ,etc.

The model import feature of TIDL there is provides constraint on the supported operators and layers. Irrespective of the framework, the supported layers are

Pooling Layer (Average and Max Pooling)
ReLU Layer
Element Wise Layer (Add, Max, Product)
Inner Product Layer (Fully Connected Layer)
Soft Max Layer
Bias Layer
Deconvolution Layer
Concatenate layer
ArgMax Layer
Scale Layer
PReLU Layer
Batch Normalization layer
ReLU6 Layer
Crop layer
Slice layer
Flatten layer
Split Layer
Detection Output Layer

But for the supported operators, during the import process, some operators/layers are combined or converted into TIDL layers. For TensorFlow specifically, the supported operators are:

TensorFlow Operator TIDL Layer
Placeholder TIDL_DataLayer
Conv2D TIDL_ConvolutionLayer
DepthwiseConv2dNative TIDL_ConvolutionLayer
BiasAdd TIDL_BiasLayer
Add TIDL_EltWiseLayer
Mul TIDL_ScaleLayer
FusedBatchNorm TIDL_BatchNormLayer
Relu TIDL_ReLULayer
Relu6 TIDL_ReLULayer
MaxPool TIDL_PoolingLayer
AvgPool TIDL_PoolingLayer
ConcatV2 TIDL_ConcatLayer
Slice TIDL_SliceLayer
Squeeze See note below
Reshape See note below
Softmax TIDL_SoftMaxLayer
Pad TIDL_PadLayer
Mean TIDL_PoolingLayer
Whereas for TensorFlow Lite, TensorFlow Operator TIDL Layer
Placeholder TIDL_DataLayer
CONV_2D TIDL_ConvolutionLayer
TRANSPOSE_CONV TIDL_Deconv2DLayer
DEPTHWISE_CONV_2D TIDL_ConvolutionLayer
ADD TIDL_EltWiseLayer
MUL TIDL_ScaleLayer
RELU TIDL_ReLULayer
RELU6 TIDL_ReLULayer
MAX_POOL_2D TIDL_PoolingLayer
AVERAGE_POOL_2D TIDL_PoolingLayer
CONCATENATION TIDL_ConcatLayer
RESHAPE See note below
SOFTMAX TIDL_SoftMaxLayer
ARG_MAX TIDL_ArgMaxLayer
PAD TIDL_PadLayer
MEAN TIDL_PoolingLayer
FULLY_CONNECTED TIDL_InnerProductLayer

Note:

“Reshape” and “Squeeze” are supported by being coalesced into other layers: If “Reshape” immediately follows “Squeeze”, they both are coalesced into TIDL_FlattenLayer. If “Reshape” immediately follows “AvgPool”, “Reshape” is coalesced into TIDL_PoolingLayer. If “Reshape” immediately follows TIDL_InnerProductLayer, it is coalesced into TIDL_InnerProductLayer.

Source: Official docs for TIDL: Foundational Components

matthewanderson23 commented 4 years ago

Any updates on whether TF Lite support is imminent?