MediaPipeTasksText Framework Reference

MPPCategory


@interface MPPCategory : NSObject

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.

  • The index of the label in the corresponding label file. Set to -1 if the index is not set.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSInteger index;
  • Confidence score for this class.

    Declaration

    Objective-C

    @property (nonatomic, readonly) float score;
  • The label of this category object.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *categoryName;
  • The display name of the label, which may be translated for different locales. For example, a label, “apple”, may be translated into Spanish for display purpose, so that the display name is “manzana”.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *displayName;
  • Initializes a new ResultCategory with the given index, score, category name and display name.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithIndex:(NSInteger)index
                                    score:(float)score
                             categoryName:(nullable NSString *)categoryName
                              displayName:(nullable NSString *)displayName;

    Parameters

    index

    The index of the label in the corresponding label file.

    score

    The probability score of this label category.

    categoryName

    The label of this category object.

    displayName

    The display name of the label.

    Return Value

    An instance of ResultCategory initialized with the given index, score, category name and display name.

  • Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_UNAVAILABLE;
  • Undocumented

    Declaration

    Objective-C

    + (instancetype)new NS_UNAVAILABLE;