Skip to content

Commit bed3a2c

Browse files
authored
Use pypi onnx-coreml instead of manual install
1 parent 3738325 commit bed3a2c

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

examples/CoreML/ONNXLive/README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,9 @@ We are also using Python 3.6 for this tutorial, but other versions should work a
2121
python3.6 -m venv venv
2222
source ./venv/bin/activate
2323

24-
You need to install pytorch
24+
You need to install pytorch and the onnx->coreml converter
2525

26-
pip install torchvision
27-
28-
and the onnx->coreml converter
29-
30-
git clone https://github.com/onnx/onnx-coreml
31-
cd onnx-coreml
32-
git submodule update --recursive --init
33-
./install.sh
34-
cd ..
26+
pip install torchvision onnx-coreml
3527

3628
You will also need to install XCode if you want to run the iOS style transfer app on your iPhone.
3729
You can also convert models in Linux, however to run the iOS app itself, you will need a Mac.
@@ -98,14 +90,14 @@ We will need to mark these as images.
9890
So let's create a small python file and call it `onnx_to_coreml.py`. This can be created by using the touch command and edited with your favorite editor to add the following lines of code.
9991

10092
import sys
101-
from onnx import onnx_pb2
93+
from onnx import onnx_pb
10294
from onnx_coreml import convert
10395

10496
model_in = sys.argv[1]
10597
model_out = sys.argv[2]
10698

10799
model_file = open(model_in, 'rb')
108-
model_proto = onnx_pb2.ModelProto()
100+
model_proto = onnx_pb.ModelProto()
109101
model_proto.ParseFromString(model_file.read())
110102
coreml_model = convert(model_proto, image_input_names=['0'], image_output_names=['186'])
111103
coreml_model.save(model_out)

0 commit comments

Comments
 (0)