Continuously train CoreML model after shipping
The .mlmodel file is compiled by Xcode into a .mlmodelc structure (which is actually a folder inside your app bundle).
Your app might be able to download a new .mlmodel from a server but I don't think you can run the Core ML compiler from inside your app.
Maybe it is possible for your app to download the compiled .mlmodelc data from a server, copy it into the app's Documents directory, and instantiate the model from that. Try it out. ;-)
(This assumes the App Store does not do any additional processing on the .mlmodelc data before it packages up your app and ships it to the user.)
Continuously train CoreML model after shipping
The .mlmodel file is compiled by Xcode into a .mlmodelc structure (which is actually a folder inside your app bundle).
Your app might be able to download a new .mlmodel from a server but I don't think you can run the Core ML compiler from inside your app.
Maybe it is possible for your app to download the compiled .mlmodelc data from a server, copy it into the app's Documents directory, and instantiate the model from that. Try it out. ;-)
(This assumes the App Store does not do any additional processing on the .mlmodelc data before it packages up your app and ships it to the user.)
Is it possible to train a CoreML model on device as the app runs?
It's now possible with Core ML 3.
https://developer.apple.com/videos/play/wwdc2019/704/
Skip to 9:00 to see it in action. If you just want the code, skip to 13:50.
CoreML - On device model training
Currently your options are:
- use Metal Performance Shaders to train on the device
- write your own training code
Neither is compatible with Core ML (although if you really wanted to, you could write your own mlmodel file and then compile it on the device).
Prepping to update a Core ML Model
If your Model is Named TestModel
a TestModelTrainingInput
class should be available.
let singleTrainingData = try TestModelTrainingInput(input: .init[1,2,3], output_true: .init([4,5,6]))
let trainingData = MLArrayBatchProvider(array: [singleTrainingData])
Related Topics
Programmatically Disabling Screenshot in App
Why Swift Closure Not Capture Self
Lazy Property Initialization in Swift
Add Skreferencenode/Skscene to Another Skscene in Spritekit
Fatal Error: Array Index Out of Range in Swift Xcode6
How to Request a Desktop Version of a Webpage Using Uiwebview in Swift 3.0
Declaring and Using Custom Attributes in Swift
Swift 2: !, ? -" Value of Optional Type "..." Not Unwrapped"
How to Get Iobluetoothdevice's Battery Level, Using Swift and Appkit (Xcode for MACos)
iOS 13: Threading Violation: Expected the Main Thread
Uitableview Scrolls to Top on Reload
Swift 4: Nsfilenamespboardtype Not Available. What to Use Instead for Registerfordraggedtypes
How to Compare Just the Time of a Date in Swift
How to Tell Which Guard Statement Failed