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
{{ message }}
This repository was archived by the owner on Feb 7, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+43-80Lines changed: 43 additions & 80 deletions
Original file line number
Diff line number
Diff line change
@@ -4,72 +4,30 @@
4
4
5
5
This tool converts [ONNX](https://onnx.ai/) models to Apple Core ML format. To convert Core ML models to ONNX, use [ONNXMLTools](https://github.com/onnx/onnxmltools).
6
6
7
-
There's a comprehensive [Tutorial](https://github.com/onnx/tutorials/tree/master/examples/CoreML/ONNXLive/README.md) showing how to convert PyTorch style transfer models through ONNX to Core ML models and run them in an iOS app. You can find example for PyTorch model conversion [here](https://github.com/onnx/onnx-coreml/tree/master/examples).
7
+
There's a comprehensive [Tutorial](https://github.com/onnx/tutorials/tree/master/examples/CoreML/ONNXLive/README.md) showing
8
+
how to convert PyTorch style transfer models through ONNX to Core ML models and run them in an iOS app.
8
9
9
-
## [New] release onnx-coreml converter with Core ML 3
10
-
11
-
To try out the new onnx-coreml 1.0 converter with Core ML 3 (>= iOS 13, >= macOS 15),
12
-
install coremltools 3.0 and coremltools 1.0
10
+
To get the latest version of `onnx-coreml` from PyPI:
13
11
14
12
```shell
15
-
pip install coremltools==3.0
16
-
pip install onnx-coreml==1.0
17
-
```
18
-
19
-
Since 1.0 beta 3, the flag `disable_coreml_rank5_mapping` (which was part of beta 2) has been removed and instead replaced by
20
-
the generic argument `minimum_ios_deployment_target` which can be used to target different versions of Core ML/iOS.
21
-
The argument `minimum_ios_deployment_target` takes a string specifying the target deployment iOS version e.g. '11.2', '12' and '13'.
22
-
By default, the converter uses the value of '12'.
23
-
24
-
For example:
25
-
26
-
```python
27
-
from onnx_coreml import convert
28
-
ml_model = convert(model='my_model.onnx', minimum_ios_deployment_target='13') # to use Core ML 3
13
+
pip install --upgrade onnx-coreml
14
+
pip install --upgrade coremltools # onnx-coreml depends on the coremltools package
29
15
```
30
16
31
-
## Installation
17
+
For the latest changes please see the [release notes](https://github.com/onnx/onnx-coreml/releases).
32
18
33
-
### Install From PyPI
34
-
35
-
```bash
36
-
pip install -U onnx-coreml
37
-
```
19
+
To get the latest version from source (master branch of this repository), please see the [installation section](#Installation).
38
20
39
-
### Install From Source
21
+
##Usage
40
22
41
-
To get the latest version of the converter, install from source by cloning the repository along with its submodules and running the install.sh script. That is,
23
+
Please see the ONNX conversion section in the [Neural network guide](https://github.com/apple/coremltools/blob/master/docs/NeuralNetworkGuide.md)
There are a few [notebook examples](https://github.com/apple/coremltools/tree/master/examples/neural_network_inference)
27
+
as well for reference.
48
28
49
-
### Install From Source (for contributors)
50
29
51
-
To get the latest version of the converter, install from source by cloning the repository along with its submodules and running the install-develop.sh script. That is,
To convert models use single function `convert` from onnx_coreml:
69
-
70
-
```python
71
-
from onnx_coreml import convert
72
-
```
30
+
### Parameters
73
31
74
32
```python
75
33
defconvert(model,
@@ -85,31 +43,6 @@ def convert(model,
85
43
minimum_ios_deployment_target='12')
86
44
```
87
45
88
-
The function returns a Core ML model instance that can be saved to a `.mlmodel` file, e.g.:
89
-
90
-
```python
91
-
mlmodel = convert(onnx_model)
92
-
mlmodel.save('model.mlmodel')
93
-
```
94
-
95
-
Core ML model spec can be obtained from the model instance, which can be used to update model properties such as output names, input names etc. For e.g.:
Please see the ONNX conversion section in the [Neural network guide](https://github.com/apple/coremltools/blob/master/docs/NeuralNetworkGuide.md) on how to use the converter.
108
-
109
-
There are several [notebook examples](https://github.com/apple/coremltools/tree/master/examples/neural_network_inference/onnx_converter) as well for reference.
110
-
111
-
### Parameters
112
-
113
46
```
114
47
__model__: ONNX model | str
115
48
An ONNX model with parameters loaded in onnx package or path to file
The command-line script currently doesn't support all options mentioned above. For more advanced use cases, you have to call the python function directly.
198
131
132
+
133
+
## Installation
134
+
135
+
### Install From PyPI
136
+
137
+
```bash
138
+
pip install -U onnx-coreml
139
+
```
140
+
141
+
### Install From Source
142
+
143
+
To get the latest version of the converter, install from source by cloning the repository along with its submodules and running the install.sh script. That is,
To get the latest version of the converter, install from source by cloning the repository along with its submodules and running the install-develop.sh script. That is,
0 commit comments