Added iOS interactive segmenter options

This commit is contained in:
Prianka Liz Kariat 2023-11-30 02:05:23 +05:30
parent bb4906bcd3
commit 3532503354
3 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# Copyright 2023 The MediaPipe Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package(default_visibility = ["//mediapipe/tasks:internal"])
licenses(["notice"])
objc_library(
name = "MPPInteractiveSegmenterOptions",
srcs = ["sources/MPPInteractiveSegmenterOptions.m"],
hdrs = ["sources/MPPInteractiveSegmenterOptions.h"],
deps = [
"//mediapipe/tasks/ios/core:MPPTaskOptions",
],
)

View File

@ -0,0 +1,41 @@
// Copyright 2023 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#import <Foundation/Foundation.h>
#import "mediapipe/tasks/ios/core/sources/MPPTaskOptions.h"
NS_ASSUME_NONNULL_BEGIN
@class MPPInteractiveSegmenter;
/** Options for setting up a `InteractiveSegmenter`. */
NS_SWIFT_NAME(InteractiveSegmenterOptions)
@interface MPPInteractiveSegmenterOptions : MPPTaskOptions <NSCopying>
/**
* The locale to use for display names specified through the TFLite Model Metadata, if any. Defaults
* to English.
*/
@property(nonatomic, copy) NSString *displayNamesLocale;
/** Represents whether to output confidence masks. */
@property(nonatomic) BOOL shouldOutputConfidenceMasks;
/** Represents whether to output category mask. */
@property(nonatomic) BOOL shouldOutputCategoryMask;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,38 @@
// Copyright 2023 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#import "mediapipe/tasks/ios/vision/interactive_segmenter/sources/MPPInteractiveSegmenterOptions.h"
@implementation MPPInteractiveSegmenterOptions
- (instancetype)init {
self = [super init];
if (self) {
_displayNamesLocale = @"en";
_shouldOutputConfidenceMasks = YES;
}
return self;
}
- (id)copyWithZone:(NSZone *)zone {
MPPInteractiveSegmenterOptions *interactiveSegmenterOptions = [super copyWithZone:zone];
interactiveSegmenterOptions.shouldOutputConfidenceMasks = self.shouldOutputConfidenceMasks;
interactiveSegmenterOptions.shouldOutputCategoryMask = self.shouldOutputCategoryMask;
interactiveSegmenterOptions.displayNamesLocale = self.displayNamesLocale;
return interactiveSegmenterOptions;
}
@end