r/iOSProgramming • • Jun 25 '26

Discussion [UPDATE] - Feedback on using coreML for insane on-device performances

Post image
106 Upvotes

Hi everyone, a few months ago I made a post about how using CoreML for on-device AI models was a great experience.

My workflow was:

  1. Picture taken
  2. Pre-processing
  3. YOLO-like model for bounding boxes
  4. Post-processing
  5. Embeddings for each image using CLIP

In the demo I show here, it's 40 inferences in less than a second (pre and post-processing included)!

I started experimenting with ONNX models at first. My app was made in Flutter and I did not want any platform-specific code.

My experience with ONNX was not great**:** a lot of operations were not running on the neural engine but on the CPU instead, which did cause a really slow inference time. I also had issues with FP16 quantization: the FP16 model refused to run on ONNX.

In addition to that, Dart and Flutter are not made for heavy workloads. My pre-processing was way too slow for what I wanted.

To give you some numbers, on my first iterations, a single card scan was about 1.2 seconds long. Too much.

After that I decided to switch my detection engine to native:

  • 1 - Exporting to CoreML FP16 format was one line,
  • 2 - Inference speed went from 250ms to 10ms!

Because of that, I was finally able to work on the interface and deploy the Skanit app. I made it free because I had almost no costs.

PROS:

  • Super fast
  • No backend costs
  • Privacy

CONS:

  • Model updates must be done via an app update
  • You cannot use a big model**,** accuracy loss
  • Different pre-processing code and models for each platform (with different performance)
  • App experience depends on the user**'s** device (super true for Android users)

I hope you found it interesting!

ps, I know there is a mistake on one card here, surely because i was scanning my laptop screen instead of real cards :)