Convert ONNX (Open Neural Network Exchange)models into Apple CoreML format.
Project description
This tool converts ONNX models to Apple CoreML format.
Installation
pip install -U onnx-coreml
Dependencies
click
numpy
coremltools (0.6.3+)
onnx (0.2.1+)
How to use
Using this library you can implement converter for your models. To implement converters you should use single function “convert” from onnx_coreml:
from onnx_coreml import convert
This function is simple enough to be self-describing:
def convert(model,
mode=None,
image_input_names=[],
preprocessing_args={},
image_output_names=[],
deprocessing_args={},
class_labels=None,
predicted_feature_name='classLabel')
Parameters
Returns
model: A coreml model.
CLI
Also you can use command-line script for simplicity:
convert-onnx-to-coreml [OPTIONS] ONNX_MODEL
Currently supported
Models
Models from https://github.com/onnx/models are supported and tested.
Operators
List of ONNX operators that can be converted into their CoreML equivalent:
Conv
Relu
Reshape
Transpose
MaxPool
AveragePool
FC
BatchNormalization
Add
Sum
Mul
LeakyRelu
Concat
GlobalAveragePool
GlobalMaxPool
Softmax
Gemm
LRN
Some of operators are partially compatible because CoreML doesn’t support broadcasting, gemm for arbitrary tensors, etc.
License
Copyright (c) 2017 Prisma Labs, Inc. All rights reserved.
Use of this source code is governed by the MIT License that can be found in the LICENSE.txt file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for onnx_coreml-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33473ac96169dfa66af15542b851697589899c173b6e9e8741fc47734e9eca62 |
|
MD5 | 37eeab457a06b133a38504f4d3041b70 |
|
BLAKE2b-256 | 2a93c50f07182b0c967a63cf83f75e835ac61e9314db15b73685accb3a210dd4 |