john-rocky / CoreML-Models

Converted CoreML Model Zoo.
1.37k stars 129 forks source link

Neural Engine usage #36

Open Weihaooooooo opened 1 year ago

Weihaooooooo commented 1 year ago

Hello,

Thanks so much for your conversion script and models. I enjoyed them a lot.

I am trying to deploy a U2Net model for on-device usage on an iPhone. However, I am not able to run the model on the neural engine.

The error message I got is:

doUnloadModel:options:qos:error:: model=_ANEModel: .....

I am aware of that the input needs to be fixed for the model to run on the neural engine. And apparently, the U2Net model has a fixed input of (1, 3, 320, 320).

Also, by openning the .mlmodel file in xcode. I am able to run the model on CPU, GPU, Neural engine respectively for generating the performance report. The image below shows the model can be run fully on the neural engine when compute unit is set to 'all'.

image

These got me more confused on how to run the model on iphone's neural engine within an compiled app. Are you able to run the models on neural engine? if so, would you be able to provide any advice on this?

Thanks again in advance!