MLKitObjectDetectionCustom 框架参考

MLKCustomObjectDetectorOptions


@interface MLKCustomObjectDetectorOptions : MLKCommonObjectDetectorOptions

自定义模型对象检测器的配置。

  • 对象检测器返回的标签的置信度阈值。返回的标签 对象检测器的置信度将大于或等于指定阈值。通过 阈值是一个浮点值,并且必须在 [0, 1] 范围内。如果未设置或存在无效值 那么系统将使用模型元数据指定的任何分类器阈值。如果模型 不包含任何元数据或元数据未指定分类器阈值, 阈值为 0.0

    声明

    Objective-C

    @property (nonatomic, nullable) NSNumber *classificationConfidenceThreshold;
  • 为检测到的对象返回的标签数量上限。必须为正数。如果未设置,或者 设置的值无效,系统将使用默认值 10

    声明

    Objective-C

    @property (nonatomic) NSInteger maxPerObjectLabelCount;
  • 使用指定的 LocalModelCustomObjectDetectorOptions classificationConfidenceThreshold 属性设置为 nil。如果该属性保持未设置状态,它将使用 模型元数据中包含的置信度阈值(如果有)。如果不存在 将改用值0.0

    声明

    Objective-C

    - (nonnull instancetype)initWithLocalModel:(nonnull MLKLocalModel *)localModel;

    参数

    localModel

    存储在设备本地的自定义对象分类模型。

    返回值

    具有指定 LocalModel 的新 CustomObjectDetectorOptions 实例。

  • 使用指定的 CustomRemoteModelCustomObjectDetectorOptions classificationConfidenceThreshold 属性设置为 nil。如果该属性保持未设置状态,它将使用 模型元数据中包含的置信度阈值(如果有)。如果不存在 将改用值0.0

    声明

    Objective-C

    - (nonnull instancetype)initWithRemoteModel:
        (nonnull MLKCustomRemoteModel *)remoteModel;

    参数

    remoteModel

    远程存储在服务器上的自定义对象分类模型以及 已下载到设备上

    返回值

    具有指定 CustomRemoteModel 的新 CustomObjectDetectorOptions 实例。

  • 不可用。

    声明

    Objective-C

    - (nonnull instancetype)init;