You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-15Lines changed: 42 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,50 +12,79 @@ Tf2onnx is in its early development. Mileage will vary since TensorFlow supports
12
12
# Status
13
13
Basic net and conv nets should work. A list of models that pass tests can be found [here](tests/run_pretrained_models.yaml)
14
14
15
-
# Installation
15
+
# Prerequisites
16
+
17
+
## Install TensorFlow
16
18
If you don't have tensorflow installed already, install the desired tensorflow build, for example:
17
19
```
18
20
pip install tensorflow
19
21
or
20
22
pip install tensorflow-gpu
21
23
```
22
-
24
+
## Install Caffe2 [**Optional**]
23
25
If you want to run unit tests against the Caffe2 onnx backend, build and install Caffe2 following the instructions here: ```
24
26
https://caffe2.ai/```
25
-
We tested with tensorflow 1.5,1.6,1.7,1.8 and anaconda 3.5,3.6.
27
+
28
+
## Python Version
29
+
We tested with tensorflow 1.5,1.6,1.7,1.8 and anaconda **3.5,3.6**.
30
+
31
+
# Installation
26
32
27
33
Once dependencies are installed, from the tensorflow-onnx folder call:
34
+
28
35
```
29
36
python setup.py install
30
-
```
31
37
or
32
-
```
33
38
python setup.py develop
34
39
```
40
+
tensorflow-onnx requires onnx-1.2.2 or better and will install/upgrade onnx if needed.
35
41
36
42
To create a distribution:
37
43
```
38
44
python setup.py sdist
39
45
```
40
46
41
-
tensorflow-onnx requires onnx-1.2.2 or better and will install/upgrade onnx if needed.
42
-
43
47
# Usage
48
+
49
+
To convert a TensorFlow model, tf2onnx expects a ```frozen TensorFlow graph``` and the user needs to specify inputs and outputs for the graph by passing the input and output
50
+
names with ```--inputs INPUTS``` and ```--outputs OUTPUTS```.
- input: frozen TensorFlow graph, which can be got with [freeze graph tool](#freeze_graph).
66
+
- output: the target onnx file path.
67
+
- inputs/outputs: Tensorflow graph's input/output names, which can be got with [summarize graph tool](#summarize_graph).
68
+
- target: There are different onnx versions and workarounds for runtimes that can be set with ```--target TARGET```. The default is onnx-1.1 and caffe2 which generates a graph
69
+
that can be executed on a onnx-1.0/onnx-1.1 runtime, like caffe2 and winml.
70
+
71
+
Usage example (run following commands in tensorflow-onnx root directory):
To convert a TensorFlow model, tf2onnx expects a ```frozen TensorFlow graph``` and the user needs to specify inputs and outputs for the graph by passing the input and output
54
-
names with ```--inputs INPUTS``` and ```--outputs OUTPUTS```.
81
+
## <aname="summarize_graph"></a>Tool to Get Graph Inputs & Outputs
82
+
55
83
To find the inputs and outputs for the TensorFlow graph the model developer will know or you can consult TensorFlow's [summarize_graph](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/graph_transforms) tool, for example:
There are different onnx versions and workarounds for runtimes that can be set with ```--target TARGET```. The default is onnx-1.1 and caffe2 which generates a graph
74
-
that can be executed on a onnx-1.0/onnx-1.1 runtime, like caffe2 and winml.
0 commit comments