-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components): Added converter components for Tensorflow Lite mode…
…ls (#4532)
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
components/_converters/TensorflowLiteModel/from_KerasModelHdf5/component.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Convert Keras HDF5 model to Tensorflow Lite model | ||
inputs: | ||
- {name: Model, type: KerasModelHdf5} | ||
outputs: | ||
- {name: Model, type: TensorflowLiteModel} | ||
metadata: | ||
annotations: | ||
author: Alexey Volkov <alexey.volkov@ark-kun.com> | ||
implementation: | ||
container: | ||
image: tensorflow/tensorflow:2.3.0 | ||
command: | ||
- sh | ||
- -exc | ||
- | | ||
model_path="$0" | ||
output_model_path="$1" | ||
mkdir -p "$(dirname "$output_model_path")" | ||
tflite_convert --keras_model_file "$model_path" --output_file "$output_model_path" | ||
- {inputPath: Model} | ||
- {outputPath: Model} |
22 changes: 22 additions & 0 deletions
22
components/_converters/TensorflowLiteModel/from_TensorflowSavedModel/component.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Convert Tensorflow SavedModel to Tensorflow Lite model | ||
inputs: | ||
- {name: Model, type: TensorflowSavedModel} | ||
outputs: | ||
- {name: Model, type: TensorflowLiteModel} | ||
metadata: | ||
annotations: | ||
author: Alexey Volkov <alexey.volkov@ark-kun.com> | ||
implementation: | ||
container: | ||
image: tensorflow/tensorflow:2.3.0 | ||
command: | ||
- sh | ||
- -exc | ||
- | | ||
model_path="$0" | ||
output_model_path="$1" | ||
mkdir -p "$(dirname "$output_model_path")" | ||
tflite_convert --saved_model_dir "$model_path" --output_file "$output_model_path" | ||
- {inputPath: Model} | ||
- {outputPath: Model} |