Difference between revisions of "Converting to TensorFlow Lite"

From
Jump to: navigation, search
m (Text replacement - "http://" to "https://")
 
(7 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
|description=Helpful resources for your journey with artificial intelligence; videos, articles, techniques, courses, profiles, and tools  
 
|description=Helpful resources for your journey with artificial intelligence; videos, articles, techniques, courses, profiles, and tools  
 
}}
 
}}
[http://www.youtube.com/results?search_query=tensorflow+lite+convert+artificial+intelligence+deep+learning Youtube search...]   
+
[https://www.youtube.com/results?search_query=tensorflow+lite+convert+lite.TFLiteConverter+artificial+intelligence+deep+learning Youtube search...]   
[http://www.google.com/search?q=tensorflow+lite+machine+learning+convert+ML+artificial+intelligence ...Google search]
+
[https://www.google.com/search?q=tensorflow+lite+lite.TFLiteConverter+machine+learning+convert+ML+artificial+intelligence ...Google search]
  
 
* [[TensorFlow]]
 
* [[TensorFlow]]
 
* [[TensorFlow Lite]]
 
* [[TensorFlow Lite]]
 +
* [[Watch me Build a Healthcare Startup]]
  
== TensorFlow Lite converter ==
+
== TensorFlow Lite converter: lite.TFLiteConverter ==
* [http://www.tensorflow.org/lite/convert TensorFlow Lite converter | TensorFlow]
+
* [https://www.tensorflow.org/api_docs/python/tf/lite/TFLiteConverter lite.TFLiteConverter | TensorFlow]
The TensorFlow Lite converter is used to convert TensorFlow models into an optimized FlatBuffer format, so that they can be used by the TensorFlow Lite interpreter.
+
The TensorFlow Lite converter is used to convert TensorFlow models; GraphDef or SavedModel into an optimized FlatBuffer format, so that they can be used by the TensorFlow Lite interpreter or graph visualization.
  
 +
# Converting a GraphDef from session.
 +
converter = lite.TFLiteConverter.from_session(sess, in_tensors, out_tensors)
 +
tflite_model = converter.convert()
 +
open("converted_model.tflite", "wb").write(tflite_model)
 +
 +
# Converting a GraphDef from file.
 +
converter = lite.TFLiteConverter.from_frozen_graph(
 +
  graph_def_file, input_arrays, output_arrays)
 +
tflite_model = converter.convert()
 +
open("converted_model.tflite", "wb").write(tflite_model)
 +
 +
# Converting a SavedModel.
 +
converter = lite.TFLiteConverter.from_saved_model(saved_model_dir)
 +
tflite_model = converter.convert()
 +
 +
# Converting a tf.keras model.
 +
converter = lite.TFLiteConverter.from_keras_model_file(keras_model)
 +
tflite_model = converter.convert()
 +
 +
<youtube>ICY4Lvhyobk</youtube>
 +
 +
 +
== TocoConverter (THIS FUNCTION IS DEPRECATED) ==
 +
* [[Colaboratory]]
 
<youtube>MZx1fhbL2q4</youtube>
 
<youtube>MZx1fhbL2q4</youtube>
 
<youtube>cWrb3qIFlCQ</youtube>
 
<youtube>cWrb3qIFlCQ</youtube>
 
== TocoConverter ==
 
<youtube>ICY4Lvhyobk</youtube>
 
<youtube>ICY4Lvhyobk</youtube>
 

Latest revision as of 06:31, 28 March 2023

Youtube search... ...Google search

TensorFlow Lite converter: lite.TFLiteConverter

The TensorFlow Lite converter is used to convert TensorFlow models; GraphDef or SavedModel into an optimized FlatBuffer format, so that they can be used by the TensorFlow Lite interpreter or graph visualization.

# Converting a GraphDef from session.
converter = lite.TFLiteConverter.from_session(sess, in_tensors, out_tensors)
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
# Converting a GraphDef from file.
converter = lite.TFLiteConverter.from_frozen_graph(
 graph_def_file, input_arrays, output_arrays)
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
# Converting a SavedModel.
converter = lite.TFLiteConverter.from_saved_model(saved_model_dir)
tflite_model = converter.convert()
# Converting a tf.keras model.
converter = lite.TFLiteConverter.from_keras_model_file(keras_model)
tflite_model = converter.convert()


TocoConverter (THIS FUNCTION IS DEPRECATED)