
    Ph                     `    d dl mZmZmZ d dlmZ d dlmZm	Z	  G d de	      Z
 G d de	      Zy)	    )AnyDictUnion)
tv_tensors)
functional	Transformc                        e Zd ZdZej
                  fZdeeej                  f   ddf fdZ
dej
                  deeef   dej
                  fdZ xZS )	ConvertBoundingBoxFormata_  Convert bounding box coordinates to the given ``format``, eg from "CXCYWH" to "XYXY".

    Args:
        format (str or tv_tensors.BoundingBoxFormat): output bounding box format.
            Possible values are defined by :class:`~torchvision.tv_tensors.BoundingBoxFormat` and
            string values match the enums, e.g. "XYXY" or "XYWH" etc.
    formatreturnNc                 v    t         |           t        |t              rt        j
                  |   }|| _        y N)super__init__
isinstancestrr   BoundingBoxFormatr   )selfr   	__class__s     jC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torchvision/transforms/v2/_meta.pyr   z!ConvertBoundingBoxFormat.__init__   s/    fc"11&9F    inptparamsc                 D    t        j                  || j                        S )N)
new_format)Fconvert_bounding_box_formatr   r   r   r   s      r   
_transformz#ConvertBoundingBoxFormat._transform   s    ,,TdkkJJr   )__name__
__module____qualname____doc__r   BoundingBoxes_transformed_typesr   r   r   r   r   r   r   __classcell__)r   s   @r   r
   r
      so     %224uS**F*F%FG D Kz77 Kc3h KT^TlTl Kr   r
   c                   p    e Zd ZdZej
                  fZdej
                  deee	f   dej
                  fdZ
y)ClampBoundingBoxeszClamp bounding boxes to their corresponding image dimensions.

    The clamping is done according to the bounding boxes' ``canvas_size`` meta-data.

    r   r   r   c                 ,    t        j                  |      S r   )r   clamp_bounding_boxesr   s      r   r   zClampBoundingBoxes._transform%   s    %%d++r   N)r    r!   r"   r#   r   r$   r%   r   r   r   r    r   r   r(   r(      sG     %224,z77 ,c3h ,T^TlTl ,r   r(   N)typingr   r   r   torchvisionr   torchvision.transforms.v2r   r   r   r
   r(   r+   r   r   <module>r/      s+    # # " @Ky K*
, 
,r   