onnx_coreml convert

為{幸葍}努か 提交于 2019-12-13 04:10:16
from onnx_coreml import convert
def convert(model,
            mode=None,
            image_input_names=[],
            preprocessing_args={},
            image_output_names=[],
            deprocessing_args={},
            class_labels=None,
            predicted_feature_name='classLabel',
            add_custom_layers=False,
            custom_conversion_functions={},
            minimum_ios_deployment_target='12')

The function returns a Core ML model instance that can be saved to a .mlmodel file

Parameters

__model__: ONNX model | str
      An ONNX model with parameters loaded in onnx package or path to file
      with models.

__mode__: str ('classifier', 'regressor' or None)
      Mode of the converted coreml model:
      'classifier', a NeuralNetworkClassifier spec will be constructed.
      'regressor', a NeuralNetworkRegressor spec will be constructed.

__image_input_names__: list of strings
      Name of the inputs to be defined as image type. Otherwise, by default all inputs are MultiArray type.

__preprocessing_args__: dict
      Specify preprocessing parameters, that are be applied to all the image inputs specified through the "image_input_names" parameter.
      'is_bgr', 'red_bias', 'green_bias', 'blue_bias', 'gray_bias',
      'image_scale' keys with the same meaning as coremltools set_pre_processing_parameters: https://apple.github.io/coremltools/generated/coremltools.models.neural_network.builder.html#coremltools.models.neural_network.builder.NeuralNetworkBuilder.set_pre_processing_parameters

__image_output_names__: list of strings
      Name of the outputs to be defined as image type. Otherwise, by default all outputs are MultiArray type.

__deprocessing_args__: dict
      Same as 'preprocessing_args' but for the outputs.

 

From: onnx/onnx-coreml

https://pypi.org/project/onnx-coreml/

 

 

 

 

 

 

 

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!