Download and compile CoreMLModel from the server

MLBoy
1 min readFeb 18, 2022

How to download and use the model

There are cases where you don’t want to bundle your model with your app

There are cases where you do not want to bundle the CoreML model with the app due to the size of the app or the system.

CoreML model can be downloaded from the server and used

You can put the CoreML model on any server and download it to your device the first time you launch the app.

procedure

Download mlmodel with URLSession.

Compile the model you wrote locally.

After compiling, you will have a mlmodelc file locally (compiledModelURL).

Move the compiled model file to a directory where you can save it for future use.

Initialize the MLModel from the compiled model file.

Now you can initialize the model from the permanent URL from the next time onwards.

Delete the downloaded mlmodel that you no longer need.

🐣

I’m a freelance engineer.
Work consultation
Please feel free to contact us with a brief development description.
rockyshikoku@gmail.com

I am making an app that uses Core ML and ARKit.
We send machine learning / AR related information.

GitHub

Twitter
Medium

--

--