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/
来源:CSDN
作者:tony2278
链接:https://blog.csdn.net/tony2278/article/details/103462516