Skip to content

Commit

Permalink
Set the default running model to Image for face stylizer.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 564511316
  • Loading branch information
MediaPipe Team authored and copybara-github committed Sep 11, 2023
1 parent 81481df commit 7a04d60
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mediapipe/tasks/python/vision/face_stylizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from mediapipe.tasks.python.core.optional_dependencies import doc_controls
from mediapipe.tasks.python.vision.core import base_vision_task_api
from mediapipe.tasks.python.vision.core import image_processing_options as image_processing_options_module
from mediapipe.tasks.python.vision.core import vision_task_running_mode as running_mode_module

_BaseOptions = base_options_module.BaseOptions
_FaceStylizerGraphOptionsProto = (
Expand Down Expand Up @@ -115,7 +116,10 @@ def create_from_options(cls, options: FaceStylizerOptions) -> 'FaceStylizer':
],
task_options=options,
)
return cls(task_info.generate_graph_config())
return cls(
task_info.generate_graph_config(),
running_mode=running_mode_module.VisionTaskRunningMode.IMAGE,
)

def stylize(
self,
Expand All @@ -141,7 +145,8 @@ def stylize(
RuntimeError: If face stylization failed to run.
"""
normalized_rect = self.convert_to_normalized_rect(
image_processing_options, image)
image_processing_options, image
)
output_packets = self._process_image_data({
_IMAGE_IN_STREAM_NAME: packet_creator.create_image(image),
_NORM_RECT_STREAM_NAME: packet_creator.create_proto(
Expand Down

0 comments on commit 7a04d60

Please sign in to comment.