diff --git a/mediapipe/tasks/cc/vision/face_landmarker/face_landmarker_graph.cc b/mediapipe/tasks/cc/vision/face_landmarker/face_landmarker_graph.cc index c9a9a19326..1d68718018 100644 --- a/mediapipe/tasks/cc/vision/face_landmarker/face_landmarker_graph.cc +++ b/mediapipe/tasks/cc/vision/face_landmarker/face_landmarker_graph.cc @@ -366,6 +366,14 @@ class FaceLandmarkerGraph : public core::ModelTaskGraph { .face_landmarks_detector_graph_options() .has_face_blendshapes_graph_options())); } + // If the has_face_blendshapes_graph_options() value in FaceLandmarksDetectorGraphOptions is true, + // the blendshape graph is created. However, FaceLandmarkerGraphOptions includes face_blendshapes_graph_options + // by default, which results in the creation of the blendshape graph regardless. + // Therefore, if output_blendshapes is set to 'false', face_blendshapes_graph_options need to be cleared. + if (!output_blendshapes) { + sc->MutableOptions() + ->mutable_face_landmarks_detector_graph_options()->clear_face_blendshapes_graph_options(); + } std::optional> norm_rect_in; if (HasInput(sc->OriginalNode(), kNormRectTag)) { norm_rect_in = graph.In(kNormRectTag).Cast();