Ë
    /æjØe  ã                   óæ  — U d Z ddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZ ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddlm!Z! ddlm"Z" ddlm#Z# ddlm$Z$ ddl%m&Z& ddl%m'Z' ddl(m)Z) ddl(m*Z* ddl+m,Z, ddl+m-Z- ddl+m.Z. ddl+m/Z/ ddl+m0Z0 dZ1ejd                  ejf                  ejh                  ejj                  ejl                  ejn                  e'jp                  dœZ9de:de
ee:      fd „Z;ejx                   G d!„ d"ejz                  «      «       Z>i d#e>j~                  “d$e>j€                  “d%e>j‚                  “d&e>j„                  “d'e>j†                  “d(e>j„                  “d)e>j„                  “d*e>j†                  “d+e>j†                  “d,e>jˆ                  “d-e>jŠ                  “d.e>jŒ                  “d/e>jŽ                  “d0e>j�                  “d1e>j�                  “d2e>j�                  “d3e>j�                  “i d4e>j�                  “d5e>j�                  “d6e>j�                  “d7e>j�                  “d8e>j�                  “d9e>j�                  “d:e>j�                  “d;e>j�                  “d<e>j�                  “d=e>j�                  “d>e>j�                  “d?e>j’                  “d@e>j”                  “dAe>j–                  “dBe>j–                  “dCe>j–                  “dDe>j–                  “¥e>j–                  e>j–                  e>j–                  e>j–                  e>j–                  e>j–                  e>j�                  e>j�                  e>j–                  dEœ	¥ZLee:d"f   eMdF<    G dG„ dH«      ZNy)Ia­  MediaPipe SolutionBase module.

MediaPipe SolutionBase is the common base class for the high-level MediaPipe
Solution APIs such as BlazeFace, hand tracking, and BlazePose. The SolutionBase
class contains the shared logic among the high-level Solution APIs including
graph initialization, processing image/audio data, and graph shutdown. Thus,
users can easily create new MediaPipe Solution APIs on top of the SolutionBase
class.
é    N)ÚAnyÚIterableÚListÚMappingÚ
NamedTupleÚOptionalÚUnion)Ú
containers)Ú
descriptor)Úmessage)Ú#constant_side_packet_calculator_pb2)Ú#image_transformation_calculator_pb2)Ú$tensors_to_detections_calculator_pb2)Ú"landmarks_smoothing_calculator_pb2)Úlogic_calculator_pb2)Úthresholding_calculator_pb2)Úcalculator_pb2)Úbody_rig_pb2)Úclassification_pb2)Údetection_pb2)Úlandmark_pb2)Úrect_pb2)Úannotation_data_pb2)Ú-lift_2d_frame_annotation_to_3d_calculator_pb2)Úpacket_creator)Úpacket_getter)Úcalculator_graph)Úimage_frame)Úpacket)Úresource_util)Úvalidated_graph_configé   )ÚConstantSidePacketCalculatorÚImageTransformationCalculatorÚLandmarksSmoothingCalculatorÚLogicCalculatorÚThresholdingCalculatorÚTensorsToDetectionsCalculatorÚ#Lift2DFrameAnnotationTo3DCalculatorÚoneof_type_nameÚreturnc                 óÜ   — | j                  d«      rV| j                  d«      rE| t        d«      t        d«        }|j                  d«      D �cg c]  }|j	                  «       ‘Œ c}S y c c}w )NzOneOf<ú>ú,)Ú
startswithÚendswithÚlenÚsplitÚstrip)r*   Úcomma_separated_typesÚns      úa/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/mediapipe/python/solution_base.pyÚtype_names_from_oneofr7   R   s_   € Ø×Ñ Ô)¨o×.FÑ.FÀsÔ.KØ+¬C°«M¼3¸s»8¸)ÐDÐØ4×:Ñ:¸3Ó?Ö@˜!ˆA�G‰G�IÒ@Ð@Ø	ùò As   ÁA)c                   ó^   — e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZededd fd„«       Zy)ÚPacketDataTypez:The packet data types supported by the SolutionBase class.ÚstringÚboolÚ	bool_listÚintÚint_listÚfloatÚ
float_listÚmatrixÚimageÚ
image_listr   ÚprotoÚ
proto_listÚregistered_namer+   c                 ó°   — 	 t         |    S # t        $ rA}t        | «      }|r-|D ](  }|t         j                  «       v sŒt         |   c cY d }~S  |‚d }~ww xY w©N)ÚNAME_TO_TYPEÚKeyErrorr7   Úkeys)rF   ÚeÚnamesr5   s       r6   Úfrom_registered_namez#PacketDataType.from_registered_namek   s`   € ðÜ˜/Ñ*Ð*øÜò Ü# OÓ4€eÙ	Øò 	#ˆAØ”,×#Ñ#Ó%Ò%Ü ‘?×"ð	#ð €gûðús%   ‚ ‹	A”(A½
AÁAÁAÁAN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚSTRINGÚBOOLÚ	BOOL_LISTÚINTÚINT_LISTÚFLOATÚ
FLOAT_LISTÚAUDIOÚIMAGEÚ
IMAGE_LISTÚIMAGE_FRAMEÚPROTOÚ
PROTO_LISTÚstaticmethodÚstrrN   © ó    r6   r9   r9   Z   sg   „ áBØ€&Ø	€$Ø€)Ø€#Ø€(Ø
€%Ø€*Ø
€%Ø
€%Ø€*Ø€+Ø
€%Ø€*àð	¨Cð 	Ð4Dò 	ó ñ	rc   r9   r:   r;   z::std::vector<bool>r=   z::std::vector<int>Úint64Úint64_tz::std::vector<int64>z::std::vector<int64_t>r?   z::std::vector<float>z::mediapipe::Matrixz::mediapipe::ImageFramez::mediapipe::Classificationz::mediapipe::ClassificationListz)::mediapipe::ClassificationListCollectionz::mediapipe::Detectionz::mediapipe::DetectionListz::mediapipe::Landmarkz::mediapipe::LandmarkListz#::mediapipe::LandmarkListCollectionz::mediapipe::NormalizedLandmarkz::mediapipe::FrameAnnotationz::mediapipe::Triggerz::mediapipe::Rectz::mediapipe::NormalizedRectz#::mediapipe::NormalizedLandmarkListz-::mediapipe::NormalizedLandmarkListCollectionz::mediapipe::Imagez!::std::vector<::mediapipe::Image>z*::std::vector<::mediapipe::Classification>z.::std::vector<::mediapipe::ClassificationList>z%::std::vector<::mediapipe::Detection>z)::std::vector<::mediapipe::DetectionList>)	z$::std::vector<::mediapipe::Landmark>z(::std::vector<::mediapipe::LandmarkList>z.::std::vector<::mediapipe::NormalizedLandmark>z2::std::vector<::mediapipe::NormalizedLandmarkList>z ::std::vector<::mediapipe::Rect>z*::std::vector<::mediapipe::NormalizedRect>z::mediapipe::Jointz::mediapipe::JointListz%::std::vector<::mediapipe::JointList>rI   c                   ó¤  — e Zd ZdZ	 	 	 	 	 	 	 d!dee   deej                     deeee	f      dee
j                     deeee	f      deee      d	eeeef      fd
„Zdeej"                  eeeej"                  e
j                  f   f   f   defd„Zd"d„Zd"d„Z	 	 	 d#dej.                  deeee	f      deee      d	eeeef      fd„Zdej                  deee	f   ddfd„Zde
j                  deee	f   de
j                  fd„Zdej8                  de
j                  ddfd„Zdede	dej>                  fd„Z dedej>                  de	fd„Z!d„ Z"d „ Z#y)$ÚSolutionBaseaÅ  The common base class for the high-level MediaPipe Solution APIs.

  The SolutionBase class contains the shared logic among the high-level solution
  APIs including graph initialization, processing image/audio data, and graph
  shutdown.

  Example usage:
    with solution_base.SolutionBase(
        binary_graph_path='mediapipe/modules/hand_landmark/hand_landmark_tracking_cpu.binarypb',
        side_inputs={'num_hands': 2}) as hand_tracker:
      # Read an image and convert the BGR image to RGB.
      input_image = cv2.cvtColor(cv2.imread('/tmp/hand.png'), COLOR_BGR2RGB)
      results = hand_tracker.process(input_image)
      print(results.palm_detections)
      print(results.multi_hand_landmarks)
  NÚbinary_graph_pathÚgraph_configÚcalculator_paramsÚgraph_optionsÚside_inputsÚoutputsÚstream_type_hintsc           	      ób  ‡ — t        |«      t        |«      k(  rt        d«      ‚t        j                  j	                  t        j
                  j                  t        «      j                  t        j                  «      dd «      }t        j                  |«       t        j                  «       }	|r1|	j                  t        j
                  j	                  ||«      ¬«       n|	j                  |¬«       ‰ j                  |	|||«      }
|r‰ j                  |
|«       |r‰ j!                  |
j"                  |«       t%        j&                  |
¬«      ‰ _        d‰ _        i ‰ _        dt.        dt0        j2                  d	dfˆ fd
„}‰ j4                  j7                  «       D ]  }‰ j(                  j9                  ||d«       Œ! |xs i j;                  «       D ��ci c]%  \  }}|‰ j=                  ‰ j>                  |   |«      “Œ' c}}‰ _         ‰ j(                  jC                  ‰ j@                  «       yc c}}w )a  Initializes the SolutionBase object.

    Args:
      binary_graph_path: The path to a binary mediapipe graph file (.binarypb).
      graph_config: A CalculatorGraphConfig proto message or its text proto
        format.
      calculator_params: A mapping from the
        {calculator_name}.{options_field_name} str to the field value.
      graph_options: The graph options protobuf for the mediapipe graph.
      side_inputs: A mapping from the side packet name to the packet raw data.
      outputs: A list of the graph output stream names to observe. If the list
        is empty, all the output streams listed in the graph config will be
        automatically observed by default.
      stream_type_hints: A mapping from the stream name to its packet type hint.

    Raises:
      FileNotFoundError: If the binary graph file can't be found.
      RuntimeError: If the underlying calculator graph can't be successfully
        initialized or started.
      ValueError: If any of the following:
        a) If not exactly one of 'binary_graph_path' or 'graph_config' arguments
        is provided.
        b) If the graph validation process contains error.
        c) If the registered type name of the streams and side packets can't be
        found.
        d) If the calculator options of the calculator listed in
        calculator_params is not allowed to be modified.
        e) If the calculator options field is a repeated field but the field
        value to be set is not iterable.
        f) If not all calculator params are valid.
    zBMust provide exactly one of 'binary_graph_path' or 'graph_config'.Néýÿÿÿ)rh   )ri   r   Ústream_nameÚoutput_packetr+   c                 ó$   •— |‰j                   | <   y rH   )Ú_graph_outputs)rq   rr   Úselfs     €r6   Úcallbackz'SolutionBase.__init__.<locals>.callbacký   s   ø€ Ø)6€d×Ñ˜+Ò&rc   T)"r;   Ú
ValueErrorÚosÚsepÚjoinÚpathÚabspathÚ__file__r2   r    Úset_resource_dirr!   ÚValidatedGraphConfigÚ
initializeÚ_initialize_graph_interfaceÚ_modify_calculator_optionsÚ_set_extensionrk   r   ÚCalculatorGraphÚ_graphÚ_simulated_timestamprt   ra   r   ÚPacketÚ_output_stream_type_inforK   Úobserve_output_streamÚitemsÚ_make_packetÚ_side_input_type_infoÚ_input_side_packetsÚ	start_run)ru   rh   ri   rj   rk   rl   rm   rn   Ú	root_pathÚvalidated_graphÚcanonical_graph_config_protorv   rq   ÚnameÚdatas   `              r6   Ú__init__zSolutionBase.__init__º   só  ø€ ôP ÐÓ¤$ |Ó"4Ò4ÜØ
NóPð Pô —‘—‘œBŸG™GŸO™O¬HÓ5×;Ñ;¼B¿F¹FÓCÀCÀRÐHÓI€IÜ×"Ñ" 9Ô-Ü,×AÑAÓC€OÙØ× Ñ ÜŸG™GŸL™L¨Ð4EÓFð !õ Hð × Ñ ¨lÐ Ô;à#'×#CÑ#CØ˜ gÐ/@ó$BÐ áØ
×%Ñ%Ð&BØ&7ô9áØ
×ÑÐ6×DÑDØ'ô)ô #×2Ñ2Ø1ô3€D„Kà !€DÔØ€DÔð7œcð 7´&·-±-ð 7ÀDõ 7ð ×4Ñ4×9Ñ9Ó;ò EˆØ
‡k�k×'Ñ'¨°X¸tÕDðEð
 'Ò,¨"×3Ñ3Ó5÷ áˆD�$ð 	ˆd×Ñ × :Ñ :¸4Ñ @À$ÓGÑGó €DÔð 	‡K�K×Ñ˜$×2Ñ2Õ3ùó	 s   Ç*H+Ú
input_datar+   c           
      óÐ  — | j                   j                  «        t        |t        j                  «      ri| j
                  €t        d«      ‚t        | j
                  j                  «       «      dk7  rt        d«      ‚t        t        | j
                  «      «      |i}n|}| xj                  dz  c_        | j                  €t        d«      ‚|j                  «       D �]5  \  }}| j
                  |   }|t        j                  k(  s|t        j                   k(  r&t#        d| j
                  |   j$                  › d�«      ‚|t        j&                  k(  s|t        j(                  k(  rh|j*                  d	   t,        k7  rt        d
«      ‚| j                  j/                  || j1                  ||«      j3                  | j                  «      ¬«       Œð| j                  j/                  || j1                  ||«      j3                  | j                  «      ¬«       �Œ8 | j                  j5                  «        | j6                  €t        d«      ‚t9        j:                  d| j6                  j                  «       «      }| j6                  j                  «       D ]U  }|| j                   v r8t=        ||| j?                  | j6                  |   | j                   |   «      «       ŒIt=        ||d«       ŒW |S )a+  Processes a set of RGB image data and output SolutionOutputs.

    Args:
      input_data: Either a single numpy ndarray object representing the solo
        image input of a graph or a mapping from the stream name to the image or
        proto data that represents every input streams of a graph.

    Raises:
      NotImplementedError: If input_data contains audio data or a list of proto
        objects.
      RuntimeError: If the underlying graph occurs any error.
      ValueError: If the input image data is not three channel RGB.

    Returns:
      A NamedTuple object that contains the output data of a graph run.
        The field names in the NamedTuple object are mapping to the graph output
        stream names.

    Examples:
      solution = solution_base.SolutionBase(graph_config=hand_landmark_graph)
      results = solution.process(cv2.imread('/tmp/hand0.png')[:, :, ::-1])
      print(results.detection)
      results = solution.process(
          {'video_in' : cv2.imread('/tmp/hand1.png')[:, :, ::-1]})
      print(results.hand_landmarks)
    Nz/_input_stream_type_info is None in SolutionBaseé   zQCan't process single image input since the graph has more than one input streams.i5‚  z_graph is None in SolutionBasezASolutionBase can only process non-audio and non-proto-list data. z type is not supported yet.é   z0Input image must contain three channel rgb data.)Ústreamr   z0_output_stream_type_info is None in SolutionBaseÚSolutionOutputs) rt   ÚclearÚ
isinstanceÚnpÚndarrayÚ_input_stream_type_inforw   r1   rK   ÚnextÚiterr†   r…   rŠ   r9   r_   rZ   ÚNotImplementedErrorr’   r]   r[   ÚshapeÚRGB_CHANNELSÚadd_packet_to_input_streamr‹   ÚatÚwait_until_idlerˆ   ÚcollectionsÚ
namedtupleÚsetattrÚ_get_packet_content)ru   r•   Ú
input_dictrq   r“   Úinput_stream_typeÚsolution_outputss          r6   ÚprocesszSolutionBase.process  s¸  € ð< 	×Ñ×ÑÔä�*œbŸj™jÔ)Ø	×	%Ñ	%Ð	-ÜÐJÓKÐKÜ	ˆT×)Ñ)×.Ñ.Ó0Ó	1°QÒ	6Üðó
ð 	
ô œ˜d×:Ñ:Ó;Ó<¸jÐI�jà€jð 	×Ò Ñ&ÕØ‡{�{ÐÜÐ7Ó8Ð8Ø'×-Ñ-Ó/ó JÑˆ�TØ×6Ñ6°{ÑCÐØ
œ~×8Ñ8Ò
8Ø
œ~×3Ñ3Ò
3ä!ØOØ×+Ñ+¨KÑ8×=Ñ=Ð>ð ?)ð*ó+ð 	+ð ¤×!;Ñ!;Ò;Ø¤×!5Ñ!5Ò5Ø�:‰:�a‰=œLÒ(ÜÐMÓNÐ
NØ�‰×.Ñ.ØØ×$Ñ$Ð%6Ø%)ó+ß+-©2¨d×.GÑ.GÓ+Hð 	/õ 	Jð
 	�‰×.Ñ.ØØ×$Ñ$Ð%6Ø%)ó+ß+-©2¨d×.GÑ.GÓ+Hð 	/ö 	Jð%Jð. 	‡K�K×ÑÔ!ð ×$Ñ$Ð,ÜÐIÓJÐJÜ"×-Ñ-Ø˜4×8Ñ8×=Ñ=Ó?óAÐà×4Ñ4×9Ñ9Ó;ò 5ˆØ	˜×+Ñ+Ñ	+ÜØ˜kØ×$Ñ$ T×%BÑ%BÀ;Ñ%OØ%)×%8Ñ%8¸Ñ%EóGõ	Hô
 	Ð  +¨tÕ4ð5ð Ðrc   c                 ó�   — | j                   €t        d«      ‚| j                   j                  «        d| _         d| _        d| _        y)ú+Closes all the input sources and the graph.Nz1Closing SolutionBase._graph which is already None)r…   rw   ÚcloserŸ   rˆ   ©ru   s    r6   r²   zSolutionBase.closef  s?   € à‡{�{ÐÜÐJÓKÐKØ‡K�K×ÑÔØ€D„KØ#'€DÔ Ø$(€DÕ!rc   c                 óœ   — | j                   r@| j                   j                  «        | j                   j                  | j                  «       yy)z!Resets the graph for another run.N)r…   r²   rŽ   r�   r³   s    r6   ÚresetzSolutionBase.reseto  s6   € à‡{‚{Ø
‡k�k×ÑÔØ
‡k�k×Ñ˜D×4Ñ4Õ5ð rc   r�   c                 óÚ  ‡‡‡— t        j                  «       }|j                  ‰j                  «       d„ Šˆˆˆfd„}|j                  D �ci c]  } ‰|«       ||«      “Œ c}| _        |s|j                  }n|}|D �ci c]  } ‰|«       ||«      “Œ c}| _        ˆˆfd„}	|xs i j                  «       D ��
ci c]  \  }}
 ‰|«       |	|«      “Œ c}
}| _	        |S c c}w c c}w c c}
}w )zSGets graph interface type information and returns the canonical graph config proto.c                 ó*   — | j                  d«      d   S )Nú:éÿÿÿÿ)r2   )Útag_index_names    r6   Úget_namez:SolutionBase._initialize_graph_interface.<locals>.get_name�  s   € Ø×!Ñ! #Ó& rÑ*Ð*rc   c                 óŽ   •—  ‰| «      }‰r|‰j                  «       v r‰|   S t        j                  ‰j                  |«      «      S rH   )rK   r9   rN   Úregistered_stream_type_name)Úpacket_tag_index_namerq   r»   rn   r�   s     €€€r6   Úget_stream_packet_typezHSolutionBase._initialize_graph_interface.<locals>.get_stream_packet_type‰  sP   ø€ ÙÐ2Ó3€kÙ	˜{Ð.?×.DÑ.DÓ.FÑFØ  Ñ-Ð-Ü×0Ñ0Ø
×
5Ñ
5°kÓ
BóDð Drc   c                 óX   •— t         j                  ‰j                   ‰| «      «      «      S rH   )r9   rN   Ú registered_side_packet_type_name)r¾   r»   r�   s    €€r6   Úget_side_packet_typezFSolutionBase._initialize_graph_interface.<locals>.get_side_packet_type¢  s-   ø€ Ü×0Ñ0Ø
×
:Ñ
:ÙÐ,Ó-ó/ó0ð 0rc   )
r   ÚCalculatorGraphConfigÚParseFromStringÚbinary_configÚinput_streamrŸ   Úoutput_streamrˆ   rŠ   rŒ   )ru   r�   rl   rm   rn   r‘   r¿   rº   Úoutput_streamsrÂ   Ú_r»   s    `  `      @r6   r�   z(SolutionBase._initialize_graph_interfaceu  s  ú€ ô $2×#GÑ#GÓ#IÐ Ø ×0Ñ0°×1NÑ1NÔOò+öDð ;×GÑGö$àñ 	�Ó Ñ"8¸Ó"HÑHò$€DÔ ñ
 Ø3×AÑA�nà€nð -ö%àñ 	�Ó Ñ"8¸Ó"HÑHò%€DÔ!õ0ð #.Ò"3°×!:Ñ!:Ó!<÷"áˆN˜Añ 	�Ó Ñ"6°~Ó"FÑFó"€DÔð (Ð'ùò7$ùò%ùó"s   ÁCÁ>C"Â9C'Úcalculator_graph_configc                 ó´  — d„ }d„ } ||«      }d}|j                   D �]Ÿ  }|j                  |vrŒt        j                  |j                  «      }|€t        d|j                  › d�«      ‚||j                     }	|j                  d«      r%|j                  rt        d|j                  › d	�«      ‚|j                  rÃd
}
|j                  D ]v  }|j                  j                  d«      d   }||j                  j                  k(  sŒ;|j                  |j                  «      } |||	«       |j                  «       |_        d}
 n |
sd |«       } |||	«       |j                  j                  «       j!                  |«       n* ||j"                  j$                  |j&                     |	«       |dz  }|t)        |«      k(  s�Œ  n |t)        |«      k  rt        d«      ‚y)zNModifies the CalculatorOptions of the calculators listed in calculator_params.c                 óð   — i }| j                  «       D ]`  \  }}|j                  d«      }t        |«      dk7  rt        d|› d�«      ‚|d   }|d   }||v r||   j	                  ||f«       ŒY||fg||<   Œb |S )Nú.r˜   z	The key "z&" in the calculator_params is invalid.r   r—   )rŠ   r2   r1   rw   Úappend)Úflat_mapÚ
nested_mapÚcompound_nameÚfield_valueÚcalculator_and_field_nameÚcalculator_nameÚ
field_names          r6   Ú!generate_nested_calculator_paramszRSolutionBase._modify_calculator_options.<locals>.generate_nested_calculator_params´  s­   € Ø€jØ(0¯©Ó(8ò 
DÑ
$ˆ-˜Ø$1×$7Ñ$7¸Ó$<Ð!ÜÐ(Ó)¨QÒ.ÜØ˜-˜Ð(NÐOóQð Qà3°AÑ6ˆØ.¨qÑ1ˆ
Ø˜jÑ(Ø
�_Ñ
%×
,Ñ
,¨j¸+Ð-FÕ
Gà*4°kÐ)BÐ(Cˆ*�_Ò
%ð
Dð Ðrc   c                 ó–  — |D ]Ä  \  }}|€| j                  |«       Œ| j                  j                  |   j                  }|t        j
                  j                  k(  r^t        |t        «      st        |› dt        |«      › d�«      ‚| j                  |«       |D ]  }t        | |«      j                  |«       Œ Œ¸t        | ||«       ŒÆ y )Nz6 is a repeated proto field but the value to be set is z, which is not iterable.)Ú
ClearFieldÚ
DESCRIPTORÚfields_by_nameÚlabelr   ÚFieldDescriptorÚLABEL_REPEATEDrœ   r   rw   ÚtypeÚgetattrrÎ   rª   )Úcalculator_optionsÚoptions_field_listrÕ   rÒ   Úfield_labelÚelems         r6   Úmodify_options_fieldszFSolutionBase._modify_calculator_options.<locals>.modify_options_fieldsÃ  sÞ   € Ø%7ò AÑ
!ˆ*�kØÐØ
×
'Ñ
'¨
Õ
3à*×5Ñ5×DÑDØñß™%ð àœJ×6Ñ6×EÑEÒEÜ˜k¬8Ô4ÜØ�Lð !"Ü"& {Ó"3Ð!4Ð4LðNóOð Oð ×)Ñ)¨*Ô5Ø#ò C�ÜÐ(¨*Ó5×<Ñ<¸TÕBñCô Ð&¨
°KÕ@ñ%Arc   r   Nz$Modifying the calculator options of z is not supported.Úoptionsz(Cannot modify the calculator options of z5 because it has both options and node_options fields.Fú/r¹   Tr—   z$Not all calculator params are valid.)Únoder’   ÚCALCULATOR_TO_OPTIONSÚgetÚ
calculatorrw   ÚHasFieldÚnode_optionsÚtype_urlr2   rÙ   Ú	full_nameÚ
FromStringÚvalueÚSerializeToStringÚaddÚPackrå   Ú
ExtensionsÚextr1   )ru   rÊ   rj   rÖ   rä   Únested_calculator_paramsÚnum_modifiedrç   Úoptions_typerá   Únode_options_modifiedrã   Ú	type_namerà   s                 r6   r‚   z'SolutionBase._modify_calculator_options­  sô  € òòAñ*  AØó Ðð €LØ'×,Ñ,ó (ˆØ	�‰Ð2Ñ	2ØÜ*×.Ñ.¨t¯©Ó?€lØ	Ð	ÜØ2°4·9±9°+Ð=OÐPó
ð 	
ð 4°D·I±IÑ>ÐØ	�‰�yÔ	! d×&7Ò&7ÜØ6°t·y±y°kð B8ð 9ó:ð 	:ð 
×	Ò	à %ÐØ×%Ñ%ò 	ˆDØ—m‘m×)Ñ)¨#Ó.¨rÑ2ˆ)Ø˜,×1Ñ1×;Ñ;Ó;Ø!-×!8Ñ!8¸¿¹Ó!DÐÙ!Ð"4Ð6HÔIØ+×=Ñ=Ó?ˆDŒJØ$(Ð!Ùð	ñ %Ù+›~Ð
Ù
Ð 2Ð4FÔ
GØ
×
Ñ
×
Ñ
Ó
!×
&Ñ
&Ð'9Õ
:ñ 	˜dŸl™l×5Ñ5°l×6FÑ6FÑGØ0ô	2ð �aÑ€lð 
œÐ5Ó6Ô	6ÙðQ(ðR ”cÐ2Ó3Ò3ÜÐ=Ó>Ð>ð 4rc   Úoptions_messageÚvaluesc                 óš  — t        |d«      r|j                  «       }|D ]©  }|\  }}|j                  d«      }|}t        |«      dkD  r!t	        ||d   «      }|d= t        |«      dkD  rŒ!t	        ||d   «      }t        |d«      r|dd…= |j                  |«       Œ|t        |d«      r|j                  |«       Œšt        ||d   |«       Œ« |S )záSets protobuf field values.

    Args:
      options_message: the options protobuf message.
      values: field value pairs, where each field may be a "." separated path.

    Returns:
      the options protobuf message.
    rŠ   rÍ   r—   r   rÎ   NÚCopyFrom)ÚhasattrrŠ   r2   r1   rß   Úextendrþ   rª   )	ru   rû   rü   ÚpairÚfieldrð   ÚfieldsÚmÚvs	            r6   Úcreate_graph_optionsz!SolutionBase.create_graph_options  sÏ   € ô ˆv�wÔØ�|‰|‹~€fØò %ˆØ�n€uˆeØ�{‰{˜3Ó€fØ
€aÜ�‹K˜!ŠOÜ�A�v˜a‘yÓ!ˆØ�1ˆIô �‹K˜!‹Oô �!�V˜A‘YÓ
€aÜ	��HÔ	ØŠaˆDØ	�‰��Ü�1�jÔ!Ø	�
‰
�5Õä��6˜!‘9˜eÕ$ð%ð Ðrc   Úextension_listÚextension_valuec                 ó  — |D ]b  }|j                  |j                  «      sŒ t        |«      «       }|j                  |«       |j	                  |«       |j                  |«        y |j                  «       j                  |«       y)z:Sets one value in a repeated protobuf.Any extension field.N)ÚIsrÙ   rÞ   ÚUnpackÚ	MergeFromró   rò   )ru   r  r  Úextension_anyr  s        r6   rƒ   zSolutionBase._set_extension'  sz   € ð (ò ˆØ	×	Ñ	˜/×4Ñ4Õ	5Ø!ŒD�Ó!Ó#ˆØ×Ñ˜QÔØ	�‰�OÔ$Ø×Ñ˜1ÔÙðð ×ÑÓ×Ñ˜oÕ.rc   Úpacket_data_typer“   c                 ó  — |t         j                  k(  s|t         j                  k(  r= t        t        d|j
                  z   «      |t        j                  j                  ¬«      S  t        t        d|j
                  z   «      |«      S )NÚcreate_)Úimage_format)	r9   r]   r[   rß   r   rð   r   ÚImageFormatÚSRGB)ru   r  r“   s      r6   r‹   zSolutionBase._make_packet4  st   € àœN×6Ñ6Ò6ØœN×0Ñ0Ò0ØHŒW”^ YÐ1A×1GÑ1GÑ%GÓHØ
œ[×4Ñ4×9Ñ9ô;ð ;ð IŒW”^ YÐ1A×1GÑ1GÑ%GÓHÈÓNÐNrc   rr   c                 óh  — |j                  «       ry|t        j                  k(  rt        j                  |«      S |t        j
                  k(  s|t        j                  k(  r1 t        t        d|j                  z   «      |«      j                  «       S  t        t        d|j                  z   «      |«      S )zþGets packet content from a packet by type.

    Args:
      packet_data_type: The supported packet data type.
      output_packet: The packet to get content from.

    Returns:
      Packet content by packet data type. None to indicate "no output".

    NÚget_)
Úis_emptyr9   rS   r   Úget_strr]   r[   rß   rð   Ú
numpy_view)ru   r  rr   s      r6   r«   z SolutionBase._get_packet_content=  s©   € ð ×ÑÔØØœ>×0Ñ0Ò0Ü×"Ñ" =Ó1Ð1Ø
œn×8Ñ8Ò
8Ø
œn×2Ñ2Ò
2ð-ŒW”] FØ%×+Ñ+ñ%,ó -Ø-:ó<ß<F¹J»LðIð EŒW”] FÐ-=×-CÑ-CÑ$CÓDØ
óð rc   c                 ó   — | S )zA "with" statement support.rb   r³   s    r6   Ú	__enter__zSolutionBase.__enter__V  s   € à€Krc   c                 ó$   — | j                  «        y)r±   N)r²   )ru   Úexc_typeÚexc_valÚexc_tbs       r6   Ú__exit__zSolutionBase.__exit__Z  s   € à‡J�J…Lrc   )NNNNNNN)r+   N)NNN)$rO   rP   rQ   rR   r   ra   r   rÃ   r   r   r   ÚMessager   r9   r”   r	   r�   rž   r   r¯   r²   rµ   r!   r   r�   r‚   r  r
   ÚRepeatedCompositeFieldContainerrƒ   r   r‡   r‹   r«   r  r  rb   rc   r6   rg   rg   ¨   sT  „ ñð& *.ØEIØ7;Ø15Ø15Ø%)ØBFñM4à! #™ðM4ð ˜^×AÑAÑBðM4ð " '¨#¨s¨(Ñ"3Ñ4ð	M4ð
 ˜gŸo™oÑ.ðM4ð ˜G C¨ HÑ-Ñ.ðM4ð ˜˜S™	Ñ"ðM4ð " '¨#¨~Ð*=Ñ">Ñ?óM4ðdXØ˜bŸj™j¨'°#°u¸R¿Z¹ZØ=D¿_¹_ð>Mñ 8Nð 3Nñ +Oð Oñ PðXð óXót)ó6ð 26Ø%)ØBFñ6(à-×BÑBð6(ð ˜G C¨ HÑ-Ñ.ð6(ð ˜˜S™	Ñ"ð	6(ð
 " '¨#¨~Ð*=Ñ">Ñ?ó6(ðpY?Ø%3×%IÑ%IðY?à   c Ñ*ðY?à/3óY?ðv°'·/±/ð Ø#*¨3°¨8Ñ#4ðØ9@¿¹óð>/Ø%/×%OÑ%Oð/à&-§o¡oð/à:>ó/ðO¨>ð OØðOØ!'§¡óOð°.ð Ø)/¯©ðØ;>óò2órc   rg   )OrR   r¨   Úenumrx   Útypingr   r   r   r   r   r   r	   Únumpyr�   Úgoogle.protobuf.internalr
   Úgoogle.protobufr   r   Úmediapipe.calculators.corer   Úmediapipe.calculators.imager   Úmediapipe.calculators.tensorr   Úmediapipe.calculators.utilr   r   r   Úmediapipe.frameworkr   Úmediapipe.framework.formatsr   r   r   r   r   Ú'mediapipe.modules.objectron.calculatorsr   r   Úmediapipe.pythonr   r   Ú$mediapipe.python._framework_bindingsr   r   r   r    r!   r¤   Ú#ConstantSidePacketCalculatorOptionsÚ$ImageTransformationCalculatorOptionsÚ#LandmarksSmoothingCalculatorOptionsÚLogicCalculatorOptionsÚThresholdingCalculatorOptionsÚ$TensorsToDetectionsCalculatorOptionsÚ*Lift2DFrameAnnotationTo3DCalculatorOptionsrè   ra   r7   ÚuniqueÚEnumr9   rS   rT   rU   rV   rW   rX   rY   rZ   r]   r^   r[   r\   r_   rI   Ú__annotations__rg   rb   rc   r6   ú<module>r:     sß  ðòó Û Û 	ß L× LÑ Lã å /Ý &Ý #õ KÝ KÝ MÝ IÝ ;Ý BÝ .Ý 4Ý :Ý 5Ý 4Ý 0Ý GÝ aå +Ý *Ý AÝ <Ý 7Ý >Ý Gà€ð 	,×OÑOà+ß	-Ñ	-à*×NÑNà×3Ñ3à#×AÑAà,ß	-Ñ	-à5ß	3Ñ	3ñ#Ð ð*¨3ð °8¸DÀ¹IÑ3Fó ð ‡�ô�T—Y‘Yó ó ðð8.0Øˆn×#Ñ#ð.0à
ˆN×Ñð.0ð ˜>×3Ñ3ð.0ð 
ˆ>×Ñð	.0ð
 ˜.×1Ñ1ð.0ð ˆ^×Ñð.0ð ˆ~×!Ñ!ð.0ð ˜N×3Ñ3ð.0ð ˜n×5Ñ5ð.0ð ˆ^×!Ñ!ð.0ð ˜N×5Ñ5ð.0ð ˜>×/Ñ/ð.0ð ˜~×9Ñ9ð.0ð " >×#7Ñ#7ð.0ð & ~×';Ñ';ð.0ð  0°×1EÑ1Eð!.0ð" ˜n×2Ñ2ñ#.0ð$ ! .×"6Ñ"6ð%.0ð& ˜^×1Ñ1ð'.0ð(   ×!5Ñ!5ð).0ð* *¨>×+?Ñ+?ð+.0ð, & ~×';Ñ';ð-.0ð. # N×$8Ñ$8ð/.0ð0 ˜N×0Ñ0ð1.0ð2 ˜×-Ñ-ð3.0ð4 " >×#7Ñ#7ð5.0ð6 *¨>×+?Ñ+?ð7.0ð8 4°^×5IÑ5Ið9.0ð: ˜.×.Ñ.ð;.0ð< (¨×)BÑ)Bð=.0ð> 1°.×2KÑ2Kð?.0ð@ 5°n×6OÑ6OðA.0ðB ,¨^×-FÑ-FðC.0ðD 0°×1JÑ1JñE.0ðF -;×,EÑ,EØ0>×0IÑ0IØ6D×6OÑ6Oà×!Ñ!à(6×(AÑ(AØ2@×2KÑ2KØ(×.Ñ.Ø,×2Ñ2Ø-;×-FÑ-Fò[.0€ˆg�cÐ+Ð+Ñ,ó .÷btò trc   