From dc7c018b3994e42143542a2da898096a9aa951dd Mon Sep 17 00:00:00 2001 From: Prianka Liz Kariat Date: Wed, 17 May 2023 22:03:10 +0530 Subject: [PATCH] Added clearing of all graph options protos in MPPGestureRecognizerOptions Helpers --- .../utils/sources/MPPGestureRecognizerOptions+Helpers.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mediapipe/tasks/ios/vision/gesture_recognizer/utils/sources/MPPGestureRecognizerOptions+Helpers.mm b/mediapipe/tasks/ios/vision/gesture_recognizer/utils/sources/MPPGestureRecognizerOptions+Helpers.mm index 111dabab..60af976f 100644 --- a/mediapipe/tasks/ios/vision/gesture_recognizer/utils/sources/MPPGestureRecognizerOptions+Helpers.mm +++ b/mediapipe/tasks/ios/vision/gesture_recognizer/utils/sources/MPPGestureRecognizerOptions+Helpers.mm @@ -42,12 +42,14 @@ using ClassifierOptionsProto = ::mediapipe::tasks::components::processors::proto - (void)copyToProto:(CalculatorOptionsProto *)optionsProto { GestureRecognizerGraphOptionsProto *gestureRecognizerGraphOptionsProto = optionsProto->MutableExtension(GestureRecognizerGraphOptionsProto::ext); + gestureRecognizerGraphOptionsProto->Clear(); [self.baseOptions copyToProto:gestureRecognizerGraphOptionsProto->mutable_base_options() withUseStreamMode:self.runningMode != MPPRunningModeImage]; HandLandmarkerGraphOptionsProto *handLandmarkerGraphOptionsProto = gestureRecognizerGraphOptionsProto->mutable_hand_landmarker_graph_options(); + handLandmarkerGraphOptionsProto->Clear(); handLandmarkerGraphOptionsProto->set_min_tracking_confidence(self.minTrackingConfidence); HandDetectorGraphOptionsProto *handDetectorGraphOptionsProto = @@ -68,6 +70,7 @@ using ClassifierOptionsProto = ::mediapipe::tasks::components::processors::proto if (self.cannedGesturesClassifierOptions) { GestureClassifierGraphOptionsProto *cannedGesturesClassifierOptionsProto = handGestureRecognizerGraphOptionsProto->mutable_canned_gesture_classifier_graph_options(); + cannedGesturesClassifierOptionsProto->Clear(); [self.cannedGesturesClassifierOptions copyToProto:cannedGesturesClassifierOptionsProto->mutable_classifier_options()]; } @@ -75,6 +78,7 @@ using ClassifierOptionsProto = ::mediapipe::tasks::components::processors::proto if (self.customGesturesClassifierOptions) { GestureClassifierGraphOptionsProto *customGesturesClassifierOptionsProto = handGestureRecognizerGraphOptionsProto->mutable_custom_gesture_classifier_graph_options(); + customGesturesClassifierOptionsProto->Clear(); [self.customGesturesClassifierOptions copyToProto:customGesturesClassifierOptionsProto->mutable_classifier_options()]; }