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
Swift
class BaseOptions : 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
Swift
class ResultCategory : NSObject
-
Represents the list of classification for a given classifier head. Typically used as a result for classification tasks.
Declaration
Swift
class Classifications : NSObject
-
Represents the classification results of a model. Typically used as a result for classification tasks.
Declaration
Swift
class ClassificationResult : NSObject
-
Classifier options shared across MediaPipe iOS classification tasks.
Declaration
Swift
class ClassifierOptions : NSObject, NSCopying
-
The value class representing a landmark connection.
Declaration
Swift
class Connection : 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
Swift
class NormalizedKeypoint : NSObject
-
Represents one detected object in the results of
ObjectDetector
.Declaration
Swift
class Detection : 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
Swift
class FaceDetector : NSObject
- image input of size
-
Options for setting up a
FaceDetector
.Declaration
Swift
class FaceDetectorOptions : TaskOptions, NSCopying
-
Represents the detection results generated by
FaceDetector
.Declaration
Swift
class FaceDetectorResult : TaskResult
-
@brief Class that performs face landmark detection on images.
The API expects a TFLite model with mandatory TFLite Model Metadata.
Declaration
Swift
class FaceLandmarker : NSObject
-
Options for setting up a
FaceLandmarker
.Declaration
Swift
class FaceLandmarkerOptions : TaskOptions, NSCopying
-
A matrix that can be used for tansformations.
Declaration
Swift
class TransformMatrix : NSObject
-
Represents the detection results generated by
FaceLandmarker
.Declaration
Swift
class FaceLandmarkerResult : TaskResult
-
@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
Swift
class GestureRecognizer : NSObject
-
Options for setting up a
GestureRecognizer
.Declaration
Swift
class GestureRecognizerOptions : TaskOptions, NSCopying
-
Represents the gesture recognition results generated by
GestureRecognizer
.Declaration
Swift
class GestureRecognizerResult : TaskResult
-
@brief Performs hand landmarks detection on images.
This API expects a pre-trained hand landmarks model asset bundle.
Declaration
Swift
class HandLandmarker : NSObject
-
Options for setting up a
HandLandmarker
.Declaration
Swift
class HandLandmarkerOptions : TaskOptions, NSCopying
-
Represents the hand landmarker results generated by
HandLandmarker
.Declaration
Swift
class HandLandmarkerResult : TaskResult
-
An image used in on-device machine learning using MediaPipe Task library.
Declaration
Swift
class MPImage : 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)
N
classes 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. Thedisplay_name
field is filled from the AssociatedFile (if any) whose locale matches thedisplay_names_locale
field of theImageClassifierOptions
used at creation time (“en” by default, i.e. English). If none of these are available, only theindex
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
Swift
class ImageClassifier : NSObject
- image input of size
-
Options for setting up a
ImageClassifier
.Declaration
Swift
class ImageClassifierOptions : TaskOptions, NSCopying
-
Represents the classification results generated by
ImageClassifier
. *Declaration
Swift
class ImageClassifierResult : TaskResult
-
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
Swift
class Landmark : 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
Swift
class NormalizedLandmark : NSObject
-
@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. Thedisplay_name
field is filled from the AssociatedFile (if any) whose locale matches thedisplay_names_locale
field of theObjectDetectorOptions
used at creation time (“en” by default, i.e. English). If none of these are available, only theindex
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
Swift
class ObjectDetector : NSObject
- image input of size
-
Options for setting up a
ObjectDetector
.Declaration
Swift
class ObjectDetectorOptions : TaskOptions, NSCopying
-
Represents the detection results generated by
ObjectDetector
.Declaration
Swift
class ObjectDetectorResult : TaskResult
-
MediaPipe Tasks options base class. Any MediaPipe task-specific options class should extend this class.
Declaration
Swift
class TaskOptions : NSObject, NSCopying
-
MediaPipe Tasks result base class. Any MediaPipe task result class should extend this class.
Declaration
Swift
class TaskResult : NSObject, NSCopying