MediaPipeTasksVision Framework Reference

Classes

The following classes are available globally.

  • Holds the base options that is used for creation of any type of task. It has fields with important information acceleration configuration, TFLite model source etc.

    Declaration

    Objective-C

    
    @interface MPPBaseOptions : NSObject <NSCopying>
  • Category is a util class that contains a label, its display name, a float value as score, and the index of the label in the corresponding label file. Typically it’s used as the result of classification tasks.

    Declaration

    Objective-C

    
    @interface MPPCategory : NSObject
  • Represents the list of classification for a given classifier head. Typically used as a result for classification tasks.

    Declaration

    Objective-C

    
    @interface MPPClassifications : NSObject
  • Represents the classification results of a model. Typically used as a result for classification tasks.

    Declaration

    Objective-C

    
    @interface MPPClassificationResult : NSObject
  • Classifier options shared across MediaPipe iOS classification tasks.

    Declaration

    Objective-C

    
    @interface MPPClassifierOptions : NSObject <NSCopying>
  • The value class representing a landmark connection.

    Declaration

    Objective-C

    
    @interface MPPConnection : NSObject
  • Normalized keypoint represents a point in 2D space with x, y coordinates. x and y are normalized to [0.0, 1.0] by the image width and height respectively.

    Declaration

    Objective-C

    
    @interface MPPNormalizedKeypoint : NSObject
  • Represents one detected object in the results of ObjectDetector.

    Declaration

    Objective-C

    
    @interface MPPDetection : NSObject
  • Represents the embedding for a given embedder head. Typically used in embedding tasks.

    One and only one of the two ‘floatEmbedding’ and ‘quantizedEmbedding’ will contain data, based on whether or not the embedder was configured to perform scala quantization.

    Declaration

    Objective-C

    
    @interface MPPEmbedding : NSObject
  • Represents the embedding results of a model. Typically used as a result for embedding tasks.

    Declaration

    Objective-C

    
    @interface MPPEmbeddingResult : NSObject
  • @brief Class that performs face detection on images.

    The API expects a TFLite model with mandatory TFLite Model Metadata.

    The API supports models with one image input tensor and one or more output tensors. To be more specific, here are the requirements:

    Input tensor (kTfLiteUInt8/kTfLiteFloat32)

    • image input of size [batch x height x width x channels].
    • batch inference is not supported (batch is required to be 1).
    • only RGB inputs are supported (channels is required to be 3).
    • if type is kTfLiteFloat32, NormalizationOptions are required to be attached to the metadata for input normalization.

    Output tensors must be the 4 outputs of a DetectionPostProcess op, i.e:(kTfLiteFloat32) (kTfLiteUInt8/kTfLiteFloat32)

    • locations tensor of size [num_results x 4], the inner array representing bounding boxes in the form [top, left, right, bottom].
    • BoundingBoxProperties are required to be attached to the metadata and must specify type=BOUNDARIES and coordinate_type=RATIO. (kTfLiteFloat32)
    • classes tensor of size [num_results], each value representing the integer index of a class.
    • scores tensor of size [num_results], each value representing the score of the detected face.
    • optional score calibration can be attached using ScoreCalibrationOptions and an AssociatedFile with type TENSOR_AXIS_SCORE_CALIBRATION. See metadata_schema.fbs [1] for more details. (kTfLiteFloat32)
    • integer num_results as a tensor of size [1]

    Declaration

    Objective-C

    
    @interface MPPFaceDetector : NSObject
  • Options for setting up a FaceDetector.

    Declaration

    Objective-C

    
    @interface MPPFaceDetectorOptions : MPPTaskOptions <NSCopying>
  • Represents the detection results generated by FaceDetector.

    Declaration

    Objective-C

    
    @interface MPPFaceDetectorResult : MPPTaskResult
  • @brief Class that performs face landmark detection on images.

    The API expects a TFLite model with mandatory TFLite Model Metadata.

    Declaration

    Objective-C

    
    @interface MPPFaceLandmarker : NSObject
  • Options for setting up a FaceLandmarker.

    Declaration

    Objective-C

    
    @interface MPPFaceLandmarkerOptions : MPPTaskOptions <NSCopying>
  • A matrix that can be used for tansformations.

    Declaration

    Objective-C

    
    @interface MPPTransformMatrix : NSObject
  • Represents the detection results generated by FaceLandmarker.

    Declaration

    Objective-C

    
    @interface MPPFaceLandmarkerResult : MPPTaskResult
  • Class that performs face stylization on images.

    Declaration

    Objective-C

    
    @interface MPPFaceStylizer : NSObject
  • Options for setting up a FaceStylizer.

    Declaration

    Objective-C

    
    @interface MPPFaceStylizerOptions : MPPTaskOptions <NSCopying>
  • Represents the stylized image generated by FaceStylizer.

    Declaration

    Objective-C

    
    @interface MPPFaceStylizerResult : MPPTaskResult
  • @brief Performs gesture recognition on images.

    This API expects a pre-trained TFLite hand gesture recognizer model or a custom one created using MediaPipe Solutions Model Maker. See https://developers.google.com/mediapipe/solutions/model_maker.

    Declaration

    Objective-C

    
    @interface MPPGestureRecognizer : NSObject
  • Options for setting up a GestureRecognizer.

    Declaration

    Objective-C

    
    @interface MPPGestureRecognizerOptions : MPPTaskOptions <NSCopying>
  • Represents the gesture recognition results generated by GestureRecognizer.

    Declaration

    Objective-C

    
    @interface MPPGestureRecognizerResult : MPPTaskResult
  • @brief Performs hand landmarks detection on images.

    This API expects a pre-trained hand landmarks model asset bundle.

    Declaration

    Objective-C

    
    @interface MPPHandLandmarker : NSObject
  • Options for setting up a HandLandmarker.

    Declaration

    Objective-C

    
    @interface MPPHandLandmarkerOptions : MPPTaskOptions <NSCopying>
  • Represents the hand landmarker results generated by HandLandmarker.

    Declaration

    Objective-C

    
    @interface MPPHandLandmarkerResult : MPPTaskResult
  • An image used in on-device machine learning using MediaPipe Task library.

    Declaration

    Objective-C

    
    @interface MPPImage : NSObject
  • @brief Performs classification on images.

    The API expects a TFLite model with optional, but strongly recommended, TFLite Model Metadata..

    The API supports models with one image input tensor and one or more output tensors. To be more specific, here are the requirements.

    Input tensor (kTfLiteUInt8/kTfLiteFloat32)

    • image input of size [batch x height x width x channels].
    • batch inference is not supported (batch is required to be 1).
    • only RGB inputs are supported (channels is required to be 3).
    • if type is kTfLiteFloat32, NormalizationOptions are required to be attached to the metadata for input normalization.

    At least one output tensor with: (kTfLiteUInt8/kTfLiteFloat32)

    • Nclasses and either 2 or 4 dimensions, i.e. [1 x N] or [1 x 1 x 1 x N]
    • optional (but recommended) label map(s) as AssociatedFiles with type TENSOR_AXIS_LABELS, containing one label per line. The first such AssociatedFile (if any) is used to fill the class_name field of the results. The display_name field is filled from the AssociatedFile (if any) whose locale matches the display_names_locale field of the ImageClassifierOptions used at creation time (“en” by default, i.e. English). If none of these are available, only the index field of the results will be filled.
    • optional score calibration can be attached using ScoreCalibrationOptions and an AssociatedFile with type TENSOR_AXIS_SCORE_CALIBRATION. See metadata_schema.fbs [1] for more details.

    Declaration

    Objective-C

    
    @interface MPPImageClassifier : NSObject
  • Options for setting up a ImageClassifier.

    Declaration

    Objective-C

    
    @interface MPPImageClassifierOptions : MPPTaskOptions <NSCopying>
  • Represents the classification results generated by ImageClassifier. *

    Declaration

    Objective-C

    
    @interface MPPImageClassifierResult : MPPTaskResult
  • @brief Performs embedding extraction on images.

    The API expects a TFLite model with optional, but strongly recommended, TFLite Model Metadata..

    The API supports models with one image input tensor and one or more output tensors. To be more specific, here are the requirements.

    Input image tensor (kTfLiteUInt8/kTfLiteFloat32)

    • image input of size [batch x height x width x channels].
    • batch inference is not supported (batch is required to be 1).
    • only RGB inputs are supported (channels is required to be 3).
    • if type is kTfLiteFloat32, NormalizationOptions are required to be attached to the metadata for input normalization.

    At least one output tensor (kTfLiteUInt8/kTfLiteFloat32) with shape [1 x N] where N is the number of dimensions in the produced embeddings.

    Declaration

    Objective-C

    
    @interface MPPImageEmbedder : NSObject
  • Options for setting up a ImageEmbedder.

    Declaration

    Objective-C

    
    @interface MPPImageEmbedderOptions : MPPTaskOptions <NSCopying>
  • Represents the embedding results generated by ImageEmbedder. *

    Declaration

    Objective-C

    
    @interface MPPImageEmbedderResult : MPPTaskResult
  • @brief Class that performs segmentation on images.

    The API expects a TFLite model with mandatory TFLite Model Metadata.

    Declaration

    Objective-C

    
    @interface MPPImageSegmenter : NSObject
  • Options for setting up a ImageSegmenter.

    Declaration

    Objective-C

    
    @interface MPPImageSegmenterOptions : MPPTaskOptions <NSCopying>
  • Represents the segmentation results generated by ImageSegmenter.

    Declaration

    Objective-C

    
    @interface MPPImageSegmenterResult : MPPTaskResult
  • @brief Class that performs interactive segmentation on images.

    Users can represent user interaction through RegionOfInterest, which gives a hint to InteractiveSegmenter to perform segmentation focusing on the given region of interest.

    The API expects a TFLite model with mandatory TFLite Model Metadata.

    Input tensor: (kTfLiteUInt8/kTfLiteFloat32)

    • image input of size [batch x height x width x channels].
    • batch inference is not supported (batch is required to be 1).
    • RGB and greyscale inputs are supported (channels is required to be 1 or 3).
    • if type is kTfLiteFloat32, NormalizationOptions are required to be attached to the metadata for input normalization. Output tensors: (kTfLiteUInt8/kTfLiteFloat32)
    • list of segmented masks.
    • if output_type is CATEGORY_MASK, uint8 Image, Image vector of size 1.
    • if output_type is CONFIDENCE_MASK, float32 Image list of size channels.
    • batch is always 1.

    An example of such model can be found at: https://tfhub.dev/tensorflow/lite-model/deeplabv3/1/metadata/2

    Declaration

    Objective-C

    
    @interface MPPInteractiveSegmenter : NSObject
  • Options for setting up a InteractiveSegmenter.

    Declaration

    Objective-C

    
    @interface MPPInteractiveSegmenterOptions : MPPTaskOptions <NSCopying>
  • Represents the segmentation results generated by ImageSegmenter.

    Declaration

    Objective-C

    
    @interface MPPInteractiveSegmenterResult : MPPTaskResult
  • Landmark represents a point in 3D space with x, y, z coordinates. The landmark coordinates are in meters. z represents the landmark depth, and the smaller the value the closer the world landmark is to the camera.

    Declaration

    Objective-C

    
    @interface MPPLandmark : NSObject
  • Normalized Landmark represents a point in 3D space with x, y, z coordinates. x and y are normalized to [0.0, 1.0] by the image width and height respectively. z represents the landmark depth, and the smaller the value the closer the landmark is to the camera. The magnitude of z uses roughly the same scale as x.

    Declaration

    Objective-C

    
    @interface MPPNormalizedLandmark : NSObject
  • The wrapper class for MediaPipe segmentation masks.

    Masks are stored as UInt8 * or float * objects. Every mask has an underlying type which can be accessed using dataType. You can access the mask as any other type using the appropriate properties. For example, if the underlying type is uInt8, in addition to accessing the mask using uint8Data, you can access float32Data to get the 32 bit float data (with values ranging from 0.0 to 1.0). The first time you access the data as a type different from the underlying type, an expensive type conversion is performed. Subsequent accesses return a pointer to the memory location for the same type converted array. As type conversions can be expensive, it is recommended to limit the accesses to data of types different from the underlying type.

    Masks that are returned from a MediaPipe Tasks are owned by by the underlying C++ Task. If you need to extend the lifetime of these objects, you can invoke the copy() method.

    Declaration

    Objective-C

    
    @interface MPPMask : NSObject <NSCopying>
  • @brief Class that performs object detection on images.

    The API expects a TFLite model with mandatory TFLite Model Metadata.

    The API supports models with one image input tensor and one or more output tensors. To be more specific, here are the requirements:

    Input tensor (kTfLiteUInt8/kTfLiteFloat32)

    • image input of size [batch x height x width x channels].
    • batch inference is not supported (batch is required to be 1).
    • only RGB inputs are supported (channels is required to be 3).
    • if type is kTfLiteFloat32, NormalizationOptions are required to be attached to the metadata for input normalization.

    Output tensors must be the 4 outputs of a DetectionPostProcess op, i.e:(kTfLiteFloat32) (kTfLiteUInt8/kTfLiteFloat32)

    • locations tensor of size [num_results x 4], the inner array representing bounding boxes in the form [top, left, right, bottom].
    • BoundingBoxProperties are required to be attached to the metadata and must specify type=BOUNDARIES and coordinate_type=RATIO. (kTfLiteFloat32)
    • classes tensor of size [num_results], each value representing the integer index of a class.
    • optional (but recommended) label map(s) can be attached as AssociatedFiles with type TENSOR_VALUE_LABELS, containing one label per line. The first such AssociatedFile (if any) is used to fill the class_name field of the results. The display_name field is filled from the AssociatedFile (if any) whose locale matches the display_names_locale field of the ObjectDetectorOptions used at creation time (“en” by default, i.e. English). If none of these are available, only the index field of the results will be filled. (kTfLiteFloat32)
    • scores tensor of size [num_results], each value representing the score of the detected object.
    • optional score calibration can be attached using ScoreCalibrationOptions and an AssociatedFile with type TENSOR_AXIS_SCORE_CALIBRATION. See metadata_schema.fbs [1] for more details. (kTfLiteFloat32)
    • integer num_results as a tensor of size [1]

    Declaration

    Objective-C

    
    @interface MPPObjectDetector : NSObject
  • Options for setting up a ObjectDetector.

    Declaration

    Objective-C

    
    @interface MPPObjectDetectorOptions : MPPTaskOptions <NSCopying>
  • Represents the detection results generated by ObjectDetector.

    Declaration

    Objective-C

    
    @interface MPPObjectDetectorResult : MPPTaskResult
  • @brief Performs pose landmarks detection on images.

    This API expects a pre-trained pose landmarks model asset bundle.

    Declaration

    Objective-C

    
    @interface MPPPoseLandmarker : NSObject
  • Options for setting up a PoseLandmarker.

    Declaration

    Objective-C

    
    @interface MPPPoseLandmarkerOptions : MPPTaskOptions <NSCopying>
  • Represents the pose landmarks deection results generated by PoseLandmarker.

    Declaration

    Objective-C

    
    @interface MPPPoseLandmarkerResult : MPPTaskResult
  • The Region-Of-Interest (ROI) to interact with in an interactive segmentation inference.

    An instance can contain erither contain a single normalized point pointing to the object that the user wants to segment or array of normalized key points that make up scribbles over the object that the user wants to segment.

    Declaration

    Objective-C

    
    @interface MPPRegionOfInterest : NSObject
  • MediaPipe Tasks options base class. Any MediaPipe task-specific options class should extend this class.

    Declaration

    Objective-C

    
    @interface MPPTaskOptions : NSObject <NSCopying>
  • MediaPipe Tasks result base class. Any MediaPipe task result class should extend this class.

    Declaration

    Objective-C

    
    @interface MPPTaskResult : NSObject <NSCopying>