blob: 836740a5c51c9926541daed73fddeb0d70a15360 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# tf2tfliteV2
_tf2tfliteV2_ is a TensorFlow to TensorFlow Lite model Converter.
## Where does V2 come from?
Even though we alreay have _tf2tflite_, we cannot cover all opeartors in TensorFlow. To expand coverage, we introduce _tf2tfliteV2_ which uses `TensorFlow Lite Converter`(by Google) internally.
## Prerequisite
- Frozen graph from TensorFlow 1.13.1
- Desired version of TensorFlow(You can use python virtualenv, docker, etc.)
## Example
```
python tf2tfliteV2.py \
> --v1 \
> --input_path=frozen_graph.pb \
> --output_path=converted.tflite \
> --input_arrays=model_inputs \
> --output_arrays=model_outputs
```
```
python tf2tfliteV2.py \
> --v2 \
> --input_path=frozen_graph.pb \
> --output_path=converted.tflite \
> --input_arrays=model_inputs \
> --output_arrays=model_outputs
```
## optional argument
```
-h, --help show this help message and exit
--v1 Use TensorFlow Lite Converter 1.x
--v2 Use TensorFlow Lite Converter 2.x
--input_path INPUT_PATH
Full filepath of the input file.
--output_path OUTPUT_PATH
Full filepath of the output file.
--input_arrays INPUT_ARRAYS
Names of the input arrays, comma-separated.
--input_shapes INPUT_SHAPES
Shapes corresponding to --input_arrays, colon-
separated.
--output_arrays OUTPUT_ARRAYS
Names of the output arrays, comma-separated.
```
|