Added clearing of all graph options protos in MPPGestureRecognizerOptions Helpers

This commit is contained in:
Prianka Liz Kariat 2023-05-17 22:03:10 +05:30
parent d6d5a94845
commit dc7c018b39

View File

@ -42,12 +42,14 @@ using ClassifierOptionsProto = ::mediapipe::tasks::components::processors::proto
- (void)copyToProto:(CalculatorOptionsProto *)optionsProto { - (void)copyToProto:(CalculatorOptionsProto *)optionsProto {
GestureRecognizerGraphOptionsProto *gestureRecognizerGraphOptionsProto = GestureRecognizerGraphOptionsProto *gestureRecognizerGraphOptionsProto =
optionsProto->MutableExtension(GestureRecognizerGraphOptionsProto::ext); optionsProto->MutableExtension(GestureRecognizerGraphOptionsProto::ext);
gestureRecognizerGraphOptionsProto->Clear();
[self.baseOptions copyToProto:gestureRecognizerGraphOptionsProto->mutable_base_options() [self.baseOptions copyToProto:gestureRecognizerGraphOptionsProto->mutable_base_options()
withUseStreamMode:self.runningMode != MPPRunningModeImage]; withUseStreamMode:self.runningMode != MPPRunningModeImage];
HandLandmarkerGraphOptionsProto *handLandmarkerGraphOptionsProto = HandLandmarkerGraphOptionsProto *handLandmarkerGraphOptionsProto =
gestureRecognizerGraphOptionsProto->mutable_hand_landmarker_graph_options(); gestureRecognizerGraphOptionsProto->mutable_hand_landmarker_graph_options();
handLandmarkerGraphOptionsProto->Clear();
handLandmarkerGraphOptionsProto->set_min_tracking_confidence(self.minTrackingConfidence); handLandmarkerGraphOptionsProto->set_min_tracking_confidence(self.minTrackingConfidence);
HandDetectorGraphOptionsProto *handDetectorGraphOptionsProto = HandDetectorGraphOptionsProto *handDetectorGraphOptionsProto =
@ -68,6 +70,7 @@ using ClassifierOptionsProto = ::mediapipe::tasks::components::processors::proto
if (self.cannedGesturesClassifierOptions) { if (self.cannedGesturesClassifierOptions) {
GestureClassifierGraphOptionsProto *cannedGesturesClassifierOptionsProto = GestureClassifierGraphOptionsProto *cannedGesturesClassifierOptionsProto =
handGestureRecognizerGraphOptionsProto->mutable_canned_gesture_classifier_graph_options(); handGestureRecognizerGraphOptionsProto->mutable_canned_gesture_classifier_graph_options();
cannedGesturesClassifierOptionsProto->Clear();
[self.cannedGesturesClassifierOptions [self.cannedGesturesClassifierOptions
copyToProto:cannedGesturesClassifierOptionsProto->mutable_classifier_options()]; copyToProto:cannedGesturesClassifierOptionsProto->mutable_classifier_options()];
} }
@ -75,6 +78,7 @@ using ClassifierOptionsProto = ::mediapipe::tasks::components::processors::proto
if (self.customGesturesClassifierOptions) { if (self.customGesturesClassifierOptions) {
GestureClassifierGraphOptionsProto *customGesturesClassifierOptionsProto = GestureClassifierGraphOptionsProto *customGesturesClassifierOptionsProto =
handGestureRecognizerGraphOptionsProto->mutable_custom_gesture_classifier_graph_options(); handGestureRecognizerGraphOptionsProto->mutable_custom_gesture_classifier_graph_options();
customGesturesClassifierOptionsProto->Clear();
[self.customGesturesClassifierOptions [self.customGesturesClassifierOptions
copyToProto:customGesturesClassifierOptionsProto->mutable_classifier_options()]; copyToProto:customGesturesClassifierOptionsProto->mutable_classifier_options()];
} }