Skip to content

Instantly share code, notes, and snippets.

@alexiscreuzot
Created August 22, 2018 11:20
Show Gist options
  • Save alexiscreuzot/846af04b4d437893bb08f3704b226647 to your computer and use it in GitHub Desktop.
Save alexiscreuzot/846af04b4d437893bb08f3704b226647 to your computer and use it in GitHub Desktop.
import sys
from onnx import onnx_pb
from onnx_coreml import convert
model_in = sys.argv[1]
model_out = sys.argv[2]
model_file = open(model_in, 'rb')
model_proto = onnx_pb.ModelProto()
model_proto.ParseFromString(model_file.read())
coreml_model = convert(model_proto, image_input_names=['inputImage'], image_output_names=['outputImage'])
coreml_model.save(model_out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment