Reformatted code
This commit is contained in:
parent
b1ded2f700
commit
fe05a8d201
|
@ -22,19 +22,19 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Performs classification on text.
|
* @brief Performs classification on text.
|
||||||
*
|
*
|
||||||
* This API expects a TFLite model with (optional) [TFLite Model
|
* This API expects a TFLite model with (optional) [TFLite Model
|
||||||
* Metadata](https://www.tensorflow.org/lite/convert/metadata")that contains the mandatory
|
* 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.
|
* 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
|
* 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
|
* process unit for the model's Tokenizer. No metadata is required for models with string
|
||||||
* input tensors.
|
* input tensors.
|
||||||
*
|
*
|
||||||
* Input tensors
|
* Input tensors
|
||||||
* - Three input tensors `kTfLiteInt32` of shape `[batch_size xbert_max_seq_len]`
|
* - 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.
|
* a Bert Tokenizer process unit in the model metadata.
|
||||||
* - Or one input tensor `kTfLiteInt32` of shape `[batch_size xmax_seq_len]` representing
|
* - 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
|
* 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:
|
* At least one output tensor (`kTfLiteFloat32/kBool`) with:
|
||||||
* - `N` classes and shape `[1 x N]`
|
* - `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,
|
* TENSOR_AXIS_LABELS,
|
||||||
* containing one label per line. The first such AssociatedFile (if any) is used to fill
|
* 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
|
* the `categoryName` field of the results. The `displayName` field is filled from the
|
||||||
* AssociatedFile (if any) whose locale matches the `displayNamesLocale` field of the
|
* AssociatedFile (if any) whose locale matches the `displayNamesLocale` field of the
|
||||||
* `MPPTextClassifierOptions` used at creation time ("en" by default, i.e. English). If
|
* `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.
|
* none of these are available, only the `index` field of the results will be filled.
|
||||||
*/
|
*/
|
||||||
NS_SWIFT_NAME(TextClassifier)
|
NS_SWIFT_NAME(TextClassifier)
|
||||||
|
|
|
@ -62,11 +62,11 @@ static NSString *const kTaskGraphName = @"mediapipe.tasks.text.text_classifier.T
|
||||||
_textTaskRunner =
|
_textTaskRunner =
|
||||||
[[MPPTextTaskRunner alloc] initWithCalculatorGraphConfig:[taskInfo generateGraphConfig]
|
[[MPPTextTaskRunner alloc] initWithCalculatorGraphConfig:[taskInfo generateGraphConfig]
|
||||||
error:error];
|
error:error];
|
||||||
|
|
||||||
if (!_textTaskRunner) {
|
if (!_textTaskRunner) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -26,7 +26,7 @@ NS_SWIFT_NAME(TextClassifierResult)
|
||||||
@property(nonatomic, readonly) MPPClassificationResult *classificationResult;
|
@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).
|
* timestamp (in milliseconds).
|
||||||
*
|
*
|
||||||
* @param classificationResult The `MPPClassificationResult` instance containing one set of results
|
* @param classificationResult The `MPPClassificationResult` instance containing one set of results
|
||||||
|
|
|
@ -50,7 +50,6 @@ using ClassifierOptionsProto = ::mediapipe::tasks::components::processors::proto
|
||||||
for (NSString *category in self.categoryDenylist) {
|
for (NSString *category in self.categoryDenylist) {
|
||||||
classifierOptionsProto->add_category_denylist(category.cppString);
|
classifierOptionsProto->add_category_denylist(category.cppString);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user