[Android] [TensorFlow Lite]TensorFlow Lite 介绍

TensorFlow Lite guide

TensorFlow Lite is a set of tools that can help developers run TensorFlow models on mobile devices, embedded devices, and IoT devices. It supports device-side machine learning inference, with low latency and small binary files.

TensorFlow Lite includes two main components:

  • TensorFlow Lite interpreter , which can run specially optimized models on many different types of hardware such as mobile phones, embedded Linux devices, and microcontrollers.
  • TensorFlow Lite converter , which can convert TensorFlow models into an efficient form for use by the interpreter, and can introduce optimizations to reduce the size of binary files and improve performance.

Machine learning at the edge

TensorFlow Lite is designed to allow you to easily perform machine learning on devices at the "edge" of the network without having to send data back and forth between the device and the server. For developers, performing machine learning on the device side helps:

  • Reduce latency: data does not need to go to and from the server
  • Protect privacy: No data will leave the device
  • Reduced connections: no internet connection required
  • Reduce power consumption: network connection is very power-hungry

TensorFlow Lite supports a variety of devices, from ultra-small microcontrollers to powerful mobile phones

 

Create your own Android application

If you want to quickly write your Android code, we recommend using the Android image classification code example as a starting point.

The following section contains some useful information on how to use TensorFlow Lite on Android.

Use TensorFlow Lite AAR in JCenter

If you want to use TensorFlow Lite in your Android application, we recommend using hosted JCenter AAR in TensorFlow Lite .

You can build.gradlespecify it in your dependencies like this :

dependencies {
    implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly'
}

This AAR contains all the binary files in the Android ABIs . You can reduce the binary file size of your application by including only the ABIs you need to support.

We recommend that most developers Jane deleted x86, x86_64and arm32the ABIs. You can use the following Gradle configurations, this configuration includes only the armeabi-v7aand arm64-v8athe live configuration that covers most of the modern Android devices.

android {
    defaultConfig {
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a'
        }
    }
}

Guess you like

Origin blog.csdn.net/xfb1989/article/details/110132061