+
    QV-j�  ã                   ó  a € R t0 t ^ RIHt ^ RIHtHtHtHt ^ RIH	t	 ^RI
Ht ^RIHtHt ^RIHt ]! 4       '       d   ^ RIHt ^RI
Ht ]]R	]3,          ,          t] ^ k  ! R
 R]4      t ! R R]4      tR R lt ! R R]4      tR# )é    )ÚSequence)ÚAnyÚ	TypeAliasÚ	TypedDictÚUnion)Úoverload)Úis_pil_image)Úis_vision_availableÚrequires_backends)ÚPipeline)ÚImage)Ú
load_imagezImage.Imagec                   ó,   a € ] tR t^"t o V 3R ltRtV tR# )ÚKeypointc                ó2   <€ V ^8„  d   Qh/ S[ ;R&   S[ ;R&   # )é   ÚxÚy)Úfloat)ÚformatÚ__classdict__s   "€Úy/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/transformers/pipelines/keypoint_matching.pyÚ__annotate__ÚKeypoint.__annotate__"   s   ø‡ ‚ Ù�Hñ á�Hò ó    © N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r   "   ó   ø‡ ‡ „ r   r   c                   ó,   a € ] tR t^'t o V 3R ltRtV tR# )ÚMatchc                ó>   <€ V ^8„  d   Qh/ S[ ;R&   S[ ;R&   S[;R&   # )r   Úkeypoint_image_0Úkeypoint_image_1Úscore)r   r   )r   r   s   "€r   r   ÚMatch.__annotate__'   s'   ø‡ ‚ ÙÑñ áÑñ ñ �Lò r   r   Nr   r%   s   @r   r(   r(   '   r&   r   r(   c                ó\   € V ^8„  d   QhR\         R\        \        \        ,          ,          /# )r   ÚimagesÚreturn)r   r   Ú	ImagePair)r   s   "r   r   r   -   s$   € ÷ $ñ $¤ð $¬´(¼9Õ2EÕ)Fñ $r   c                 óz  a€ RpR o\        V \        4      '       d–   \        V 4      ^8X  dD   \        ;QJ d    V3R lV  4       F  '       d   K   RM	  RM! V3R lV  4       4      '       d   V .# \        ;QJ d    V3R lV  4       F  '       d   K   RM	  RM! V3R lV  4       4      '       d   V # \	        V4      h)ú-Input images must be a one of the following :c                óH   € \        V 4      ;'       g    \        V \        4      # )z"images is a PIL Image or a string.)r	   Ú
isinstanceÚstr)Úimages   &r   Ú_is_valid_imageÚ-validate_image_pairs.<locals>._is_valid_image4   s   € ä˜EÓ"×<Ð<¤j°¼Ó&<Ð<r   c              3   ó4   <"  € T F  pS! V4      x € K  	  R # 5i©Nr   ©Ú.0r7   r8   s   & €r   Ú	<genexpr>Ú'validate_image_pairs.<locals>.<genexpr>9   s   øé € Ð#QÉ&À¡_°U×%;Ð%;Ë&ùó   ƒFTc              3   óô   <"  € T Fm  p\        V\        4      ;'       dQ    \        V4      ^8H  ;'       d;    \        ;QJ d    V3R lV 4       F  '       d   K   RM	  RM! V3R lV 4       4      x € Ko  	  R# 5i)r   c              3   ó4   <"  € T F  pS! V4      x € K  	  R # 5ir;   r   r<   s   & €r   r>   Ú1validate_image_pairs.<locals>.<genexpr>.<genexpr>>   s   øé € ÐC¹
¨u‘O E×*Ð*»
ùr@   FTN)r5   r   ÚlenÚall)r=   Ú
image_pairr8   s   & €r   r>   r?   ;   sk   øé € ð 
ñ %�
ô �z¤8Ó,÷ Dð DÜ�J“ 1Ñ$÷Dð Dç“ÔC¹
ÓC——’ÔC¹
ÓCÓCôDó %ùs   ƒA8ŸA8µA8ÁA8Á A8)r3   z - A pair of images.z - A list of pairs of images.)r5   r   rD   rE   Ú
ValueError)r/   Úerror_messager8   s   & @r   Úvalidate_image_pairsrI   -   s–   ø€ ð€Mò=ô �&œ(×#Ò#Üˆv‹;˜!Ô§£Ô#QÉ&Ó#Q§§¢Ô#QÉ&Ó#Q× QÒ QØ�8ˆOß‹3ô 
ñ %ó	
�3�3Š3ô 
ñ %ó	
÷ 
ò 
ð ˆMÜ
�]Ó
#Ð#r   c                   óÒ   a a€ ] tR t^Et oRtRtRtRtRtV 3R lt	RR lt
]RV3R lR ll4       t]RV3R lR	 ll4       tRV3R
 lV 3R llltRR ltR tRV3R lR lltRtVtV ;t# )ÚKeypointMatchingPipelinezz
Keypoint matching pipeline using any `AutoModelForKeypointMatching`. This pipeline matches keypoints between two images.
FTc                ó@   <€ \         SV `  ! V/ VB  \        V R 4       R# )ÚvisionN)ÚsuperÚ__init__r   )ÚselfÚargsÚkwargsÚ	__class__s   &*,€r   rO   Ú!KeypointMatchingPipeline.__init__O   s   ø€ Ü‰Ò˜$Ð) &Ò)Ü˜$ Ö)r   c                ó4   € / pVe   W#R&   / pVe   WR&   V/ V3# )NÚtimeoutÚ	thresholdr   )rP   rW   rV   Úpreprocess_paramsÚpostprocess_paramss   &&&  r   Ú_sanitize_parametersÚ-KeypointMatchingPipeline._sanitize_parametersS   s8   € ØÐØÒØ+2˜iÑ(ØÐØÒ Ø.7˜{Ñ+Ø  "Ð&8Ð8Ð8r   c          	      óB   <€ V ^8„  d   QhRS[ RS[RS[RS[S[,          /# ©r   ÚinputsrW   rR   r0   )r1   r   r   Úlistr(   )r   r   s   "€r   r   Ú%KeypointMatchingPipeline.__annotate__]   s$   ø€ ×dÑd™yÐd±UÐdÉCÐdÑTXÑY^ÕT_Ñdr   c                ó   € R # r;   r   ©rP   r^   rW   rR   s   &&&,r   Ú__call__Ú!KeypointMatchingPipeline.__call__\   s   € Ùadr   c          
      ób   <€ V ^8„  d   QhRS[ S[,          RS[RS[RS[ S[ S[,          ,          /# r]   ©r_   r1   r   r   r(   )r   r   s   "€r   r   r`   `   s/   ø€ ×pÑp™t¡I�Ðp¹5ÐpÑRUÐpÑZ^Ñ_cÑdiÕ_jÕZkÑpr   c                ó   € R # r;   r   rb   s   &&&,r   rc   rd   _   s   € Ùmpr   c                ó’   <€ V ^8„  d   QhRS[ S[,          S[,          RS[RS[RS[ S[,          S[ S[ S[,          ,          ,          /# r]   rf   )r   r   s   "€r   r   r`   b   sN   ø€ ÷ -ñ -á‘Y•¡)Õ+ð-ñ ð-ñ ð	-ñ
 
‰e�‘t™D¡�KÕ(Õ	(ñ-r   c                ó”   <€ Vf   \        R4      h\        V4      p\        SV `  ! V3RV/VB p\	        V4      ^8X  d
   V^ ,          # V# )a0  
Find matches between keypoints in two images.

Args:
    inputs (`str`, `list[str]`, `PIL.Image` or `list[PIL.Image]`):
        The pipeline handles three types of images:

        - A string containing a http link pointing to an image
        - A string containing a local path to an image
        - An image loaded in PIL directly

        The pipeline accepts either a single pair of images or a batch of image pairs, which must then be passed as a string.
        Images in a batch must all be in the same format: all as http links, all as local paths, or all as PIL
        images.

    threshold (`float`, *optional*, defaults to 0.0):
        The threshold to use for keypoint matching. Keypoints matched with a lower matching score will be filtered out.
        A value of 0 means that all matched keypoints will be returned.

    kwargs:
        `timeout (`float`, *optional*, defaults to None)`
            The maximum time in seconds to wait for fetching images from the web. If None, no timeout is set and
            the call may block forever.

Return:
    Union[list[Match], list[list[Match]]]:
        A list of matches or a list if a single image pair is provided, or of lists of matches if a batch
        of image pairs is provided. Each match is a dictionary containing the following keys:

        - **keypoint_image_0** (`Keypoint`): The keypoint in the first image (x, y coordinates).
        - **keypoint_image_1** (`Keypoint`): The keypoint in the second image (x, y coordinates).
        - **score** (`float`): The matching score between the two keypoints.
zFCannot call the keypoint-matching pipeline without an inputs argument!rW   )rG   rI   rN   rc   rD   )rP   r^   rW   rR   Úformatted_inputsÚoutputsrS   s   &&&,  €r   rc   rd   b   sY   ø€ ðN Š>ÜÐeÓfÐfÜ/°Ó7ÐÜ‘'Ò"Ð#3ÑS¸yÐSÈFÑSˆÜÐÓ  AÔ%Ø˜1•:ÐØˆr   c                óì   € V Uu. uF  p\        W2R 7      NK  	  ppV P                  VRR7      pVP                  V P                  4      pV Uu. uF  q3P                  NK  	  ppRVRV/pV# u upi u upi ))rV   Úpt)r/   Úreturn_tensorsÚmodel_inputsÚtarget_sizes)r   Úimage_processorÚtoÚdtypeÚsize)rP   r/   rV   r7   ro   rp   Úpreprocess_outputss   &&&    r   Ú
preprocessÚ#KeypointMatchingPipeline.preprocess‘   sx   € ÙBHÓIÁ&¸”*˜U×4Á&ˆÐIØ×+Ñ+°6È$Ð+ÓOˆØ#—‘ t§z¡zÓ2ˆÙ06Ó7± uŸ
œ
±ˆÐ7Ø,¨l¸NÈLÐYÐØ!Ð!ùò Jùò 8s   …A,ÁA1c                óX   € VR ,          pV P                   ! R/ VB pRVRVR,          ./pV# )ro   Úmodel_outputsrp   r   )Úmodel)rP   ru   ro   ry   Úforward_outputss   &&   r   Ú_forwardÚ!KeypointMatchingPipeline._forward™   s;   € Ø)¨.Õ9ˆØŸ
š
Ñ2 \Ñ2ˆØ*¨M¸>ÐL^Ð_mÕLnÐKoÐpˆØÐr   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# )r   r0   )r_   r(   )r   r   s   "€r   r   r`   Ÿ   s   ø€ ÷ ñ ¹TÁ%½[ñ r   c           	     ó   € VR ,          pVR,          pV P                   P                  W4VR7      pV^ ,          p. p\        VR,          VR,          VR,          4       Fž  w  rxp	\        V^ ,          P	                  4       V^,          P	                  4       R7      p\        V^ ,          P	                  4       V^,          P	                  4       R7      pVP                  \        WxV	P	                  4       R7      4       K   	  \        VR R	R
7      pV# )ry   rp   )rp   rW   Ú
keypoints0Ú
keypoints1Úmatching_scores)r   r   )r*   r+   r,   c                 ó   € V R ,          # )r,   r   )r   s   &r   Ú<lambda>Ú6KeypointMatchingPipeline.postprocess.<locals>.<lambda>¯   s   € ¸¸'¾
r   T)ÚkeyÚreverse)rq   Úpost_process_keypoint_matchingÚzipr   ÚitemÚappendr(   Úsorted)
rP   r{   rW   ry   rp   Úpostprocess_outputsÚpair_resultÚkp_0Úkp_1r,   s
   &&&       r   ÚpostprocessÚ$KeypointMatchingPipeline.postprocessŸ   sï   € Ø'¨Õ8ˆØ& ~Õ6ˆØ"×2Ñ2×QÑQØÀ	ð Ró 
Ðð 2°!Õ4ÐØˆÜ!$Ø Õ-Ø Õ-ØÐ 1Õ2ö"
ÑˆD˜ô
 ˜d 1�gŸl™l›n°°Qµ·±³Ô?ˆDÜ˜d 1�gŸl™l›n°°Qµ·±³Ô?ˆDØ×Ñœu°dÐY^×YcÑYcÓYeÔfÖgñ"
ô ˜[Ñ.BÈDÔQˆØÐr   r   )NN)g        r;   )r   r   r    r!   Ú__doc__Ú_load_processorÚ_load_image_processorÚ_load_feature_extractorÚ_load_tokenizerrO   rZ   r   rc   rv   r|   r‘   r#   r$   Ú__classcell__)rS   r   s   @@r   rK   rK   E   st   ù‡ € ñð €OØ ÐØ#ÐØ€Oõ*ô9ð ßdÑdó ØdàßpÑpó Øp÷-õ -ô^"ò÷÷ ò r   rK   c                ó@   € V ^8„  d   Qh/ ^ \         9   d
   \        ;R&   # )r   r1   )Ú__conditional_annotations__r   )r   s   "r   r   r      s   € × $Ñ $÷  ;Ò :Œ9Ñ :ò! %r   N)rš   Úcollections.abcr   Útypingr   r   r   r   Útyping_extensionsr   Úimage_utilsr	   Úutilsr
   r   Úbaser   ÚPILr   r   r6   r1   r   r(   rI   rK   r   )rš   s   @r   Ú<module>r¢      su   øð÷ %Ò $ß 3Ó 3å &å &ß :Ý ñ ×ÒÝå(ð    m°SÐ&8Õ 9Õ:€	Ó :ôˆyô ô
ˆIô õ$ô0k˜xö kr   