diff --git a/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifier.h b/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifier.h index 10bccad3d..48498edca 100644 --- a/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifier.h +++ b/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifier.h @@ -22,19 +22,19 @@ NS_ASSUME_NONNULL_BEGIN /** * @brief Performs classification on text. - * + * * This API expects a TFLite model with (optional) [TFLite Model * Metadata](https://www.tensorflow.org/lite/convert/metadata")that contains the mandatory - * (described below) input tensors, output tensor, and the optional (but recommended) label + * (described below) input tensors, output tensor, and the optional (but recommended) label * items as AssociatedFiles with type TENSOR_AXIS_LABELS per output classification tensor. * - * Metadata is required for models with int32 input tensors because it contains the input - * process unit for the model's Tokenizer. No metadata is required for models with string + * Metadata is required for models with int32 input tensors because it contains the input + * process unit for the model's Tokenizer. No metadata is required for models with string * input tensors. * * Input tensors * - Three input tensors `kTfLiteInt32` of shape `[batch_size xbert_max_seq_len]` - * representing the input ids, mask ids, and segment ids. This input signature requires + * representing the input ids, mask ids, and segment ids. This input signature requires * a Bert Tokenizer process unit in the model metadata. * - Or one input tensor `kTfLiteInt32` of shape `[batch_size xmax_seq_len]` representing * the input ids. This input signature requires a Regex Tokenizer process unit in the @@ -44,12 +44,12 @@ NS_ASSUME_NONNULL_BEGIN * * At least one output tensor (`kTfLiteFloat32/kBool`) with: * - `N` classes and shape `[1 x N]` - * - optional (but recommended) label map(s) as AssociatedFiles with type + * - 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 `categoryName` field of the results. The `displayName` field is filled from the - * AssociatedFile (if any) whose locale matches the `displayNamesLocale` field of the - * `MPPTextClassifierOptions` used at creation time ("en" by default, i.e. English). If + * containing one label per line. The first such AssociatedFile (if any) is used to fill + * the `categoryName` field of the results. The `displayName` field is filled from the + * AssociatedFile (if any) whose locale matches the `displayNamesLocale` field of the + * `MPPTextClassifierOptions` 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. */ NS_SWIFT_NAME(TextClassifier) diff --git a/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifier.mm b/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifier.mm index aed05ec37..59b5423bb 100644 --- a/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifier.mm +++ b/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifier.mm @@ -62,11 +62,11 @@ static NSString *const kTaskGraphName = @"mediapipe.tasks.text.text_classifier.T _textTaskRunner = [[MPPTextTaskRunner alloc] initWithCalculatorGraphConfig:[taskInfo generateGraphConfig] error:error]; - + if (!_textTaskRunner) { return nil; - } - + } + self = [super init]; return self; diff --git a/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifierResult.h b/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifierResult.h index 63bb92352..6744a8e16 100644 --- a/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifierResult.h +++ b/mediapipe/tasks/ios/text/text_classifier/sources/MPPTextClassifierResult.h @@ -26,7 +26,7 @@ NS_SWIFT_NAME(TextClassifierResult) @property(nonatomic, readonly) MPPClassificationResult *classificationResult; /** - * Initializes a new `MPPTextClassifierResult` with the given `MPPClassificationResult` and + * Initializes a new `MPPTextClassifierResult` with the given `MPPClassificationResult` and * timestamp (in milliseconds). * * @param classificationResult The `MPPClassificationResult` instance containing one set of results diff --git a/mediapipe/tasks/ios/text/text_classifier/utils/sources/MPPTextClassifierOptions+Helpers.mm b/mediapipe/tasks/ios/text/text_classifier/utils/sources/MPPTextClassifierOptions+Helpers.mm index c370f11ef..de64d970c 100644 --- a/mediapipe/tasks/ios/text/text_classifier/utils/sources/MPPTextClassifierOptions+Helpers.mm +++ b/mediapipe/tasks/ios/text/text_classifier/utils/sources/MPPTextClassifierOptions+Helpers.mm @@ -50,7 +50,6 @@ using ClassifierOptionsProto = ::mediapipe::tasks::components::processors::proto for (NSString *category in self.categoryDenylist) { classifierOptionsProto->add_category_denylist(category.cppString); } - } @end