TfLite

Stay organized with collections Save and categorize content based on your preferences.
public class TfLite extends Object

Entry point for the TensorFlow Lite (TFLite) Java API provided by Google Play services.

Once the initialization has finished successfully, you can use the regular Tensorflow Lite APIs. To benefit from the Google Play services runtime, remember to initialize your InterpreterApi instance with options.setRuntime(FROM_SYSTEM) or options.setRuntime(PREFER_SYSTEM_OVER_APPLICATION).

For more information about this API, see the TensorFlow Lite guide.

Public Method Summary

static TfLiteClient
getClient(Context context)
Returns a TfLiteClient instance that can eventually be used as an argument for OptionalModuleApi.
static Task<Void>
initialize(Context context)
Initializes the TFLite API with the default options (which are to disable loading the GPU delegate).
static Task<Void>
initialize(Context context, TfLiteInitializationOptions options)
Initializes the TFLite API with the specified options.

Inherited Method Summary

Public Methods

public static TfLiteClient getClient (Context context)

Returns a TfLiteClient instance that can eventually be used as an argument for OptionalModuleApi.

public static Task<Void> initialize (Context context)

Initializes the TFLite API with the default options (which are to disable loading the GPU delegate). TFLite API methods should only be called after the task returned by this method has successfully completed.

This method returns a Task<Void>, so you should wait for the task to be completed, but the return value of the Task is irrelevant.

public static Task<Void> initialize (Context context, TfLiteInitializationOptions options)

Initializes the TFLite API with the specified options. TFLite API methods should only be called after the task returned by this method has successfully completed.

This method returns a Task<Void>. Make sure to call TFLite API methods only after the Task has successfully completed. The return value of the Task, though, is irrelevant (will always be null).