insightface icon indicating copy to clipboard operation
insightface copied to clipboard

does insightface support CoreML on Mac M1?

Open Chris-fullerton opened this issue 2 years ago • 3 comments

I know that get_default_providers() return ['CUDAExecutionProvider', 'CPUExecutionProvider'] here: https://github.com/deepinsight/insightface/blob/30295de48907e04077d6d22a9a8f580b525822ce/python-package/insightface/model_zoo/model_zoo.py#L70

but i am not sure whether insightface's default models: bafflo_l support CoreML, does it?

Chris-fullerton avatar Feb 13 '23 07:02 Chris-fullerton

you can check the document of onnxruntime

nttstar avatar Mar 22 '23 08:03 nttstar

import onnxruntime

# Create a session options object
options = onnxruntime.SessionOptions()

# Retrieve the available providers
providers = onnxruntime.get_available_providers()

# Print the list of available providers
print(f"Available ONNX Runtime providers: {providers}")

# Load the ONNX model
model_path = "/Users/xxx/.insightface/models/buffalo_l/det_10g.onnx"
model = onnxruntime.InferenceSession(model_path, providers=providers)

# Check if the CoreMLExecutionProvider is available
if "CoreMLExecutionProvider" in model.get_providers():
    print("CoreMLExecutionProvider is available")
else:
    print("CoreMLExecutionProvider is not available")

Available ONNX Runtime providers: ['CoreMLExecutionProvider', 'CPUExecutionProvider']
2023-03-23 20:04:14.396787 [W:onnxruntime:, helper.cc:61 IsInputSupported] Dynamic shape is not supported for now, for input:input.1
CoreMLExecutionProvider is available

@nttstar seems not support?

Dynamic shape is not supported for now, for input:input.1

changchiyou avatar Mar 23 '23 12:03 changchiyou

Support now with :

# Name                    Version                   Build  Channel
onnx                      1.15.0                   pypi_0    pypi
onnxruntime-silicon       1.16.0                   pypi_0    pypi

Same testing code as mentioned earlier:

Available ONNX Runtime providers: ['CoreMLExecutionProvider', 'CPUExecutionProvider']
2024-01-12 09:51:55.623409 [W:onnxruntime:, coreml_execution_provider.cc:81 GetCapability] CoreMLExecutionProvider::GetCapability, number of partitions supported by CoreML: 7 number of nodes in the graph: 153 number of nodes supported by CoreML: 129
CoreMLExecutionProvider is available

changchiyou avatar Jan 12 '24 01:01 changchiyou