From 8570136f80109f73003279067c1944801115a826 Mon Sep 17 00:00:00 2001 From: Prianka Liz Kariat Date: Fri, 6 Jan 2023 13:47:33 +0530 Subject: [PATCH] Removed convenience initializer in MPPClassificationResult --- .../containers/sources/MPPClassificationResult.h | 12 ------------ .../containers/sources/MPPClassificationResult.m | 6 ------ .../utils/sources/MPPClassificationResult+Helpers.mm | 10 ++++------ 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/mediapipe/tasks/ios/components/containers/sources/MPPClassificationResult.h b/mediapipe/tasks/ios/components/containers/sources/MPPClassificationResult.h index 17fea4e53..c38f42552 100644 --- a/mediapipe/tasks/ios/components/containers/sources/MPPClassificationResult.h +++ b/mediapipe/tasks/ios/components/containers/sources/MPPClassificationResult.h @@ -89,18 +89,6 @@ NS_SWIFT_NAME(ClassificationResult) **/ @property(nonatomic, readonly) NSInteger timestampMs; -/** - * Initializes a new `MPPClassificationResult` with the given array of classifications. This method - * must be used when no time stamp needs to be specified. It sets the property `timestampMs` to -1. - * - * @param classifications An Aaray of `MPPClassifications` objects containing classifier - * predictions per classifier head. - * - * @return An instance of MPPClassificationResult initialized with the given array of - * classifications. - **/ -- (instancetype)initWithClassifications:(NSArray *)classifications; - /** * Initializes a new `MPPClassificationResult` with the given array of classifications and time * stamp (in milliseconds). diff --git a/mediapipe/tasks/ios/components/containers/sources/MPPClassificationResult.m b/mediapipe/tasks/ios/components/containers/sources/MPPClassificationResult.m index 6cf75234e..6d42d22ca 100644 --- a/mediapipe/tasks/ios/components/containers/sources/MPPClassificationResult.m +++ b/mediapipe/tasks/ios/components/containers/sources/MPPClassificationResult.m @@ -48,10 +48,4 @@ return self; } -- (instancetype)initWithClassifications:(NSArray *)classifications { - return [self initWithClassifications:classifications timestampMs:-1]; - - return self; -} - @end diff --git a/mediapipe/tasks/ios/components/containers/utils/sources/MPPClassificationResult+Helpers.mm b/mediapipe/tasks/ios/components/containers/utils/sources/MPPClassificationResult+Helpers.mm index 9ad284790..7cad3e155 100644 --- a/mediapipe/tasks/ios/components/containers/utils/sources/MPPClassificationResult+Helpers.mm +++ b/mediapipe/tasks/ios/components/containers/utils/sources/MPPClassificationResult+Helpers.mm @@ -54,15 +54,13 @@ using ClassificationResultProto = } MPPClassificationResult *classificationResult; + NSInteger timeStampMs; if (classificationResultProto.has_timestamp_ms()) { - classificationResult = [[MPPClassificationResult alloc] initWithClassifications:classifications timestampMs:(NSInteger)classificationResultProto.timestamp_ms()]; + timeStampMs = (NSInteger)classificationResultProto.timestamp_ms(); } - else { - classificationResult = [[MPPClassificationResult alloc] initWithClassifications:classifications]; - } - - return classificationResult; + + return [[MPPClassificationResult alloc] initWithClassifications:classifications timestampMs:timeStampMs];; } @end