+
    QV-jã  ã                   óü   € ^ RI HtHtHt ^RIHtHtHtHtH	t	 ^RI
HtHt ]! 4       '       d   ^ RIHt ^RIHt ]! 4       '       d   ^RIHt ]P&                  ! ]4      t]! ]! RR7      4       ! R	 R
]4      4       tR# )é    )ÚAnyÚUnionÚoverload)Úadd_end_docstringsÚis_torch_availableÚis_vision_availableÚloggingÚrequires_backends)ÚPipelineÚbuild_pipeline_init_args)ÚImage)Ú
load_image)Ú(MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMEST)Úhas_image_processorc                   ó¶   a a€ ] tR t^t oRtRtRtRtRtV 3R lt	]
V3R lR l4       t]
V3R lR l4       tV3R	 lV 3R
 lltRR ltRR ltR tR tRtVtV ;t# )ÚDepthEstimationPipelinea`  
Depth estimation pipeline using any `AutoModelForDepthEstimation`. This pipeline predicts the depth of an image.

Example:

```python
>>> from transformers import pipeline

>>> depth_estimator = pipeline(task="depth-estimation", model="LiheYoung/depth-anything-base-hf")
>>> output = depth_estimator("http://images.cocodataset.org/val2017/000000039769.jpg")
>>> # This is a tensor with the values being the depth expressed in meters for each pixel
>>> output["predicted_depth"].shape
torch.Size([1, 384, 384])
```

Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial)


This depth estimation pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"depth-estimation"`.

See the list of available models on [huggingface.co/models](https://huggingface.co/models?filter=depth-estimation).
FTc                ój   <€ \         SV `  ! V/ VB  \        V R 4       V P                  \        4       R# )ÚvisionN)ÚsuperÚ__init__r
   Úcheck_model_typer   )ÚselfÚargsÚkwargsÚ	__class__s   &*,€Úx/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/transformers/pipelines/depth_estimation.pyr   Ú DepthEstimationPipeline.__init__7   s.   ø€ Ü‰Ò˜$Ð) &Ò)Ü˜$ Ô)Ø×ÑÔFÖGó    c                óV   <€ V ^8„  d   QhRS[ S[R3,          RS[RS[S[S[3,          /# ©é   ÚinputszImage.Imager   Úreturn)r   Ústrr   Údict)ÚformatÚ__classdict__s   "€r   Ú__annotate__Ú$DepthEstimationPipeline.__annotate__=   s-   ø€ ×_Ñ_™u¡S¨-Ð%7Õ8Ð_ÁCÐ_ÉDÑQTÑVYÐQYÍNÑ_r   c                ó   € R # ©N© ©r   r"   r   s   &&,r   Ú__call__Ú DepthEstimationPipeline.__call__<   s   € Ù\_r   c          	      óv   <€ V ^8„  d   QhRS[ S[S[R3,          ,          RS[RS[ S[S[S[3,          ,          /# r    )Úlistr   r$   r   r%   )r&   r'   s   "€r   r(   r)   @   s:   ø€ ×kÑk™t¡E©#¨}Ð*<Õ$=Õ>ÐkÉ#ÐkÑRVÑW[Ñ\_ÑadÐ\dÕWeÕRfÑkr   c                ó   € R # r+   r,   r-   s   &&,r   r.   r/   ?   s   € Ùhkr   c          
      ó²   <€ V ^8„  d   QhRS[ S[S[S[,          RS[R,          3,          RS[RS[S[S[3,          S[S[S[S[3,          ,          ,          /# r    )r   r$   r1   r   r%   )r&   r'   s   "€r   r(   r)   B   sV   ø€ ÷ (2ñ (2Ù™C¡¡c¥¨M¹4ÀÕ;NÐNÕOð(2Ù[^ð(2á	‰c‘3ˆh�™$™t¡C© H�~Õ.Õ	.ñ(2r   c                ót   <€ RV9   d   VP                  R4      pVf   \        R4      h\        SV `  ! V3/ VB # )a(  
Predict the depth(s) of the image(s) passed as inputs.

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 image or a batch of images, 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.
    parameters (`Dict`, *optional*):
        A dictionary of argument names to parameter values, to control pipeline behaviour.
        The only parameter available right now is `timeout`, which is the length of time, in seconds,
        that the pipeline should wait before giving up on trying to download an image.
    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:
    A dictionary or a list of dictionaries containing result. If the input is a single image, will return a
    dictionary, if the input is a list of several images, will return a list of dictionaries corresponding to
    the images.

    The dictionaries contain the following keys:

    - **predicted_depth** (`torch.Tensor`) -- The predicted depth by the model as a `torch.Tensor`.
    - **depth** (`PIL.Image`) -- The predicted depth by the model as a `PIL.Image`.
ÚimageszECannot call the depth-estimation pipeline without an inputs argument!)ÚpopÚ
ValueErrorr   r.   )r   r"   r   r   s   &&,€r   r.   r/   B   sB   ø€ ðH �vÔØ—Z‘Z Ó)ˆFØŠ>ÜÐdÓeÐeÜ‰wÒ Ñ1¨&Ñ1Ð1r   c                ór   € / pVe   WR&   \        V\        4      '       d   RV9   d   VR,          VR&   V/ / 3# )NÚtimeout)Ú
isinstancer%   )r   r9   Ú
parametersr   Úpreprocess_paramss   &&&, r   Ú_sanitize_parametersÚ,DepthEstimationPipeline._sanitize_parametersl   sG   € ØÐØÒØ+2˜iÑ(Ü�j¤$×'Ò'¨I¸Ô,CØ+5°iÕ+@Ð˜iÑ(Ø  " bÐ(Ð(r   c                óª   € \        W4      pV P                  VR R7      pVP                  V P                  4      pVP                  RRR1,          VR&   V# )Úpt)r5   Úreturn_tensorsNÚtarget_sizeéÿÿÿÿ)r   Úimage_processorÚtoÚdtypeÚsize)r   Úimager9   Úmodel_inputss   &&& r   Ú
preprocessÚ"DepthEstimationPipeline.preprocesst   sP   € Ü˜5Ó*ˆØ×+Ñ+°5ÈÐ+ÓNˆØ#—‘ t§z¡zÓ2ˆØ&+§j¡j±°2°Õ&6ˆ�]Ñ#ØÐr   c                óT   € VP                  R 4      pV P                  ! R/ VB pW#R &   V# )rB   r,   )r6   Úmodel)r   rI   rB   Úmodel_outputss   &&  r   Ú_forwardÚ DepthEstimationPipeline._forward{   s1   € Ø"×&Ñ& }Ó5ˆØŸ
š
Ñ2 \Ñ2ˆØ'2�mÑ$ØÐr   c                ó  € V P                   P                  VVR ,          .4      p. pV F¾  pVR,          P                  4       P                  4       P	                  4       pWUP                  4       ,
          VP                  4       VP                  4       ,
          ,          p\        P                  ! V^ÿ,          P                  R4      4      pVP                  RVR,          RV/4       KÀ  	  \        V4      ^8X  d
   V^ ,          # T# )rB   Úpredicted_depthÚuint8Údepth)rD   Úpost_process_depth_estimationÚdetachÚcpuÚnumpyÚminÚmaxr   Ú	fromarrayÚastypeÚappendÚlen)r   rN   ÚoutputsÚformatted_outputsÚoutputrT   s   &&    r   ÚpostprocessÚ#DepthEstimationPipeline.postprocess�   sà   € Ø×&Ñ&×DÑDØð ˜=Õ)Ð*ó	
ˆð ÐÛˆFØÐ,Õ-×4Ñ4Ó6×:Ñ:Ó<×BÑBÓDˆEØŸY™Y›[Õ(¨U¯Y©Y«[¸5¿9¹9»;Õ-FÕGˆEÜ—O’O U¨S¥[×$8Ñ$8¸Ó$AÓBˆEà×$Ñ$Ð&7¸Ð@QÕ9RÐT[Ð]bÐ%cÖdñ ô (+¨7£|°qÔ'8Ð  Õ#ÐOÐ>OÐOr   r,   )NNr+   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú_load_processorÚ_load_image_processorÚ_load_feature_extractorÚ_load_tokenizerr   r   r.   r=   rJ   rO   rb   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r   r'   s   @@r   r   r      sl   ù‡ € ñð0 €OØ ÐØ#ÐØ€OõHð
 ß_ó Ø_àßkó Øk÷(2ó (2ôT)ôò÷Pò Pr   r   N)Útypingr   r   r   Úutilsr   r   r   r	   r
   Úbaser   r   ÚPILr   Úimage_utilsr   Úmodels.auto.modeling_autor   Ú
get_loggerrd   Úloggerr   r,   r   r   Ú<module>rx      st   ðß 'Ñ '÷õ ÷ 5ñ ×ÒÝå(á×ÒÝTà	×	Ò	˜HÓ	%€ñ Ñ,ÀÔFÓGôxP˜hó xPó HòxPr   