Class

MLFeatureValue

A feature's value and its type bundled as a read-only instance.

Declaration

@interface MLFeatureValue : NSObject

Overview

A Core ML feature value, represented by MLFeatureValue, wraps both a data value and its type, represented by MLFeatureType. For every MLModel prediction, every input feature receives exactly one MLFeatureValue and every output feature produces exactly one MLFeatureValue. (See MLFeatureDescription for details about input and output features.)

However, the model and your app don't pass MLFeatureValue instances directly. Instead, your app uses an MLFeatureProvider to pass MLFeatureValue instances to the model's input features and another MLFeatureProvider to get MLFeatureValue instances from the model's output features.

If you use the dynamically generated interface for your Core ML model, you will use the model input and output interfaces specific to your model, instead of using MLFeatureValue, to manipulate values directly.

Topics

Creating Values with a Specific Type

+ featureValueWithInt64:

Wraps an integer as a value for this feature.

+ featureValueWithString:

Wraps a string as a value for a feature.

+ featureValueWithDictionary:error:

Wraps a dictionary as a value for a feature.

+ featureValueWithPixelBuffer:

Wraps a pixel buffer as a value for a feature.

+ featureValueWithDouble:

Wraps a double as a value for a feature.

+ featureValueWithMultiArray:

Wraps a multidimensional array as a value for a feature.

+ featureValueWithSequence:

Wraps a sequence as a value for a feature.

+ undefinedFeatureValueWithType:

Wraps an undefined value with a given type.

Creating Image Feature Values

+ featureValueWithCGImage:pixelsWide:pixelsHigh:pixelFormatType:options:error:

Wraps an image as a value for a feature, given an image, its width, and its height, in pixels.

+ featureValueWithCGImage:constraint:options:error:

Wraps an image as a value for a feature, given an image and its constraints.

+ featureValueWithImageAtURL:pixelsWide:pixelsHigh:pixelFormatType:options:error:

Wraps an image as a value for a feature, given an image’s URL, and its width and height, in pixels.

+ featureValueWithImageAtURL:constraint:options:error:

Wraps an image as a value for a feature, given an image’s URL and constraints.

MLFeatureValueImageOption

The initializer options to crop and scale an image when you create an image feature value.

MLImageConstraint

The width, height, and pixel format constraints of an image feature.

Accessing the Type

type

The type of this feature value.

MLFeatureType

The possible types for feature values, input features, and output features.

Accessing the Value

undefined

A Boolean value indicating whether the feature value is undefined.

int64Value

The integer wrapped in this feature value.

doubleValue

The double wrapped in this feature value.

stringValue

The string wrapped in this feature value.

dictionaryValue

The dictionary wrapped in this feature value.

imageBufferValue

The image, or pixelBuffer, wrapped in this feature value.

multiArrayValue

The multidimensional array wrapped in this feature value.

MLMultiArray

A multidimensional array used as a feature input or feature output for a model.

sequenceValue

The sequence wrapped in this feature value.

MLSequence

A sequence of data used as a feature input or feature output for a model.

Comparing Feature Values

- isEqualToFeatureValue:

Compares the feature value and its type.

Relationships

Inherits From

Conforms To

See Also

Model Features

MLFeatureProvider

An interface that represents a collection of values for either a model's input or its output.

MLDictionaryFeatureProvider

A convenience wrapper for the given dictionary of data.

MLBatchProvider

An interface that represents a collection of feature providers.

MLArrayBatchProvider

A convenience wrapper for batches of feature providers.