GetModelAttributes
Returns metadata in JSON format about a named model that's currently loaded.
Format
GetModelAttributes ( modelName )
Parameters
modelName - the name of the model to evaluate. This value must match the name of a previously loaded model.
Data type returned
text
Originated in version
19.3.1
Description
You must first use the Configure Machine Learning Model script step to load a Core ML model before using GetModelAttributes.
The following is an example of what's returned for a model named TestModel that works with images.
{
    "APIVers": 1,
    "configuration" : 
    {
        "computeUnits" : "All"
    },
    "modelDescription" : 
    {
        "classLabels" : 
        [
            "British Shorthair",
            "tabby, tabby cat",
            . . .
            "Siberian Husky",
            "beagle"
        ],
        "inputDescriptions" : 
        [
            {
                "featureName" : "image",
                "isOptional" : 0,
                "pixelFormat" : 1111970369,
                "pixelsHigh" : 299,
                "pixelsWide" : 299,
                "sizeRange" : 
                {
                    "heightMax" : 9223372036854775808,
                    "heightMin" : 299,
                    "widthMax" : 9223372036854775808,
                    "widthMin" : 299
                },
                "type" : "image"
            }
        ],
        "metadata" : 
        {
            "author" : "Tenete Jantelli",
            "creatorDefined" : 
            {
                "com.apple.coreml.model.preview.type" : "imageClassifier",
                "com.apple.createml.app.tag" : "47",
                "com.apple.createml.app.version" : "2.0",
                "com.apple.createml.version" : "10.15.5"
            },
            "description" : "Dog and cat classifier",
            "license" : "",
            "version" : "1.0"
        },
        "outputDescriptions" : 
        [
            {
                "featureName" : "classLabel",
                "isOptional" : 0,
                "type" : "unknown"
            },
            {
                "featureName" : "classLabelProbs",
                "isOptional" : 0,
                "type" : "unknown"
            }
        ]
    },
    "modelName" : "TestModel"
}
                                            The attributes returned in the JSON object depend on what is in the model. In general, the top level of the JSON object contains the following JSON objects.
| JSON element | 
                                                         Description  | 
                                                
|---|---|
APIVers
                                                     | 
                                                    
                                                         Numeric value for the version of this JSON object's structure. If the structure of this JSON object changes in a subsequent release, this number will change.  | 
                                                
configuration
                                                     | 
                                                    
                                                         May contain only the  
  | 
                                                
modelDescription
                                                     | 
                                                    
                                                         May contain: 
  | 
                                                
modelName
                                                     | 
                                                    
                                                         Name that the Configure Machine Learning Model script step used to load the model.  | 
                                                
Notes
- This function is supported only on iOS, iPadOS, and macOS.
 
Example 1
This script loads a model and displays its attributes as the formatted JSON data shown above.
Configure Machine Learning Model [ Operation: Vision ; Name: "TestModel" ; From: Table::ModelContainerField ]
Set Variable [ $modelAttributes ; Value: 
    JSONFormatElements ( GetModelAttributes ( "TestModel" ) ) ]
Show Custom Dialog [ $modelAttributes ]
                                            Example 2
For a loaded model named TestModel, returns 1 if the model's first input description contains a sizeRange key.
Let ( [
    modelAttributes = GetModelAttributes ( "TestModel" ) ;
    firstInput = "modelDescription.inputDescriptions.[0]" ;
    inputKeys = JSONListKeys ( $modelAttributes ; firstInput ) ;
    keyCount = PatternCount ( inputKeys ; "sizeRange" )
] ; 
    If ( keyCount > 0 ; 1 ; 0 )
)