Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Runs model with set parameters.

Component Version macOS Windows Linux Server iOS SDK
CoreML 7.4 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "CoreML.PredictionFromFeatures"; CoreMLRef )   More


Parameter Description Example
CoreMLRef The reference number to the model. $Model


Returns JSON or error.


Runs model with set parameters.
Returns JSON with the result from the model.

The result is stored for later query result images via CoreML.ResultImage.

See also Vision.ClassifyImage to use Vision framework from Apple to classify images with Apple's model.


Run model:

If [ Length ( $$ML ) = 0 ]
    Show Custom Dialog [ "Please load model first." ]
    Exit Script [ Text Result: "" ]
End If
Set Variable [ $r ; Value: MBS("CoreML.Clear"; $$ML) ]
# The Resnet50 model we use for testing, needs a specific image size
Set Variable [ $r ; Value: MBS("CoreML.AddImageParameter"; $$ML; "image"; CoreML::Input Picture) ]
Set Variable [ $r ; Value: MBS("CoreML.PredictionFromFeatures"; $$ML) ]
If [ MBS("IsError") ]
    Show Custom Dialog [ "Failed to process" ; $r ]
    Set Field [ CoreML::Output ; $r ]
    Show Custom Dialog [ "Result" ; MBS( "JSON.GetPathItem"; $r; "classLabel";1 ) ]
End If

See also

Example Databases

This function checks for a license.

Created 16th September 2017, last changed 17th October 2019

CoreML.OpenModel - CoreML.Release