
    %`i8!                        d Z ddlmZmZ ddlZddlmZmZ ddlmZ	m
Z
 g dZ G d d	ej                  Z G d
 dej                  Z G d dej                  Z G d dej                  Z G d dej                  ZdS )z
This file is part of the private API. Please do not use directly these classes as they will be modified on
future versions without warning. The classes should be accessed only via the transforms argument of Weights.
    )OptionalUnionN)nnTensor   )
functionalInterpolationMode)ObjectDetectionImageClassificationVideoClassificationSemanticSegmentationOpticalFlowc                   6    e Zd ZdedefdZdefdZdefdZdS )r
   imgreturnc                     t          |t                    st          j        |          }t          j        |t
          j                  S N)
isinstancer   Fpil_to_tensorconvert_image_dtypetorchfloatselfr   s     s/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/torchvision/transforms/_presets.pyforwardzObjectDetection.forward   s8    #v&& 	'/#&&C$S%+666    c                      | j         j        dz   S Nz()	__class____name__r   s    r   __repr__zObjectDetection.__repr__       ~&--r   c                     	 dS )NzAccepts ``PIL.Image``, batched ``(B, C, H, W)`` and single ``(C, H, W)`` image ``torch.Tensor`` objects. The images are rescaled to ``[0.0, 1.0]``. r$   s    r   describezObjectDetection.describe    s    9	
 	
r   N)r#   
__module____qualname__r   r   strr%   r)   r(   r   r   r
   r
      sl        76 7f 7 7 7 7
.# . . . .
# 
 
 
 
 
 
r   r
   c                        e Zd Zdddej        dddededeed	f         d
eed	f         dedee	         ddf fdZ
dedefdZdefdZdefdZ xZS )r      g
ףp=
?gv/?gCl?gZd;O?gy&1?g?T)resize_sizemeanstdinterpolation	antialias	crop_sizer1   r2   .r3   r4   r5   r   Nc                    t                                                       |g| _        |g| _        t	          |          | _        t	          |          | _        || _        || _        d S r   )	super__init__r6   r1   listr2   r3   r4   r5   )r   r6   r1   r2   r3   r4   r5   r"   s          r   r9   zImageClassification.__init__(   s[     	#'=JJ	99*"r   r   c                 Z   t          j        || j        | j        | j                  }t          j        || j                  }t          |t                    st          j	        |          }t          j
        |t          j                  }t          j        || j        | j                  }|S Nr4   r5   r2   r3   )r   resizer1   r4   r5   center_cropr6   r   r   r   r   r   r   	normalizer2   r3   r   s     r   r   zImageClassification.forward:   s    hsD,D<NZ^ZhiiimC00#v&& 	'/#&&C#C55k#DI48<<<
r   c                     | j         j        dz   }|d| j         z  }|d| j         z  }|d| j         z  }|d| j         z  }|d| j         z  }|dz  }|S N(z
    crop_size=
    resize_size=

    mean=	
    std=
    interpolation=
)r"   r#   r6   r1   r2   r3   r4   r   format_strings     r   r%   zImageClassification.__repr__C       /#5<DN<<<@d.>@@@2ty2220dh000D0BDDDr   c                 X    d| j          d| j         d| j         d| j         d| j         dS )NAccepts ``PIL.Image``, batched ``(B, C, H, W)`` and single ``(C, H, W)`` image ``torch.Tensor`` objects. The images are resized to ``resize_size=`` using ``interpolation=.``, followed by a central crop of ``crop_size=]``. Finally the values are first rescaled to ``[0.0, 1.0]`` and then normalized using ``mean=`` and ``std=``.r1   r4   r6   r2   r3   r$   s    r   r)   zImageClassification.describeM   ss    e7;7Ge ebfbte e9=e e @Dye e X\W_e e e	
r   )r#   r*   r+   r	   BILINEARinttupler   r   boolr9   r   r   r,   r%   r)   __classcell__r"   s   @r   r   r   '   s       
 "7!6+<+E$(# # # # 	#
 E3J# 5#:# )# D># 
# # # # # #$6 f    #    
# 
 
 
 
 
 
 
 
r   r   c                        e Zd Zddej        ddeeef         deee         eeef         f         deedf         deedf         d	ed
df fdZ	de
d
e
fdZd
efdZd
efdZ xZS )r   )gFj?g.5B?g?)gr@H0?gc=yX?gDKK?)r2   r3   r4   r6   r1   r2   .r3   r4   r   Nc                    t                                                       t          |          | _        t          |          | _        t          |          | _        t          |          | _        || _        d S r   )r8   r9   r:   r6   r1   r2   r3   r4   )r   r6   r1   r2   r3   r4   r"   s         r   r9   zVideoClassification.__init__W   s`     	i,,JJ	99*r   vidc                 :   d}|j         dk     r|                    d          }d}|j        \  }}}}}|                    d|||          }t	          j        || j        | j        d          }t	          j        || j	                  }t	          j
        |t          j                  }t	          j        || j        | j                  }| j	        \  }}|                    |||||          }|                    dd	d
dd          }|r|                    d          }|S )NF   r   )dimTr=   r>      r         )ndim	unsqueezeshapeviewr   r?   r1   r4   r@   r6   r   r   r   rA   r2   r3   permutesqueeze)r   r^   need_squeezeNTCHWs           r   r   zVideoClassification.forwardg   s   8a<<--A-&&CL	1aAhhr1a##
 hsD,D<NZ_```mC00#C55k#DI48<<<~1hhq!Q1%%kk!Q1a(( 	%++!+$$C
r   c                     | j         j        dz   }|d| j         z  }|d| j         z  }|d| j         z  }|d| j         z  }|d| j         z  }|dz  }|S rC   rJ   rK   s     r   r%   zVideoClassification.__repr__   rM   r   c                 X    d| j          d| j         d| j         d| j         d| j         dS )NzAccepts batched ``(B, T, C, H, W)`` and single ``(T, C, H, W)`` video frame ``torch.Tensor`` objects. The frames are resized to ``resize_size=rP   rQ   rR   rS   zP``. Finally the output dimensions are permuted to ``(..., C, T, H, W)`` tensors.rU   r$   s    r   r)   zVideoClassification.describe   ss    H7;7GH HbfbtH H9=H H @DyH H X\W_H H H	
r   )r#   r*   r+   r	   rV   rX   rW   r   r   r9   r   r   r,   r%   r)   rZ   r[   s   @r   r   r   V   s        #?!=+<+E+ + + c?+ 5:uS#X67	+
 E3J+ 5#:+ )+ 
+ + + + + + 6 f    0#    
# 
 
 
 
 
 
 
 
r   r   c                        e Zd Zddej        dddee         deedf         deedf         d	ed
ee	         ddf fdZ
dedefdZdefdZdefdZ xZS )r   r/   r0   T)r2   r3   r4   r5   r1   r2   .r3   r4   r5   r   Nc                    t                                                       ||gnd | _        t          |          | _        t          |          | _        || _        || _        d S r   )r8   r9   r1   r:   r2   r3   r4   r5   )r   r1   r2   r3   r4   r5   r"   s         r   r9   zSemanticSegmentation.__init__   s[     	,7,CK==JJ	99*"r   r   c                 Z   t          | j        t                    r't          j        || j        | j        | j                  }t          |t                    st          j        |          }t          j	        |t          j                  }t          j        || j        | j                  }|S r<   )r   r1   r:   r   r?   r4   r5   r   r   r   r   r   rA   r2   r3   r   s     r   r   zSemanticSegmentation.forward   s    d&-- 	n(3 0@R^b^lmmmC#v&& 	'/#&&C#C55k#DI48<<<
r   c                     | j         j        dz   }|d| j         z  }|d| j         z  }|d| j         z  }|d| j         z  }|dz  }|S )NrD   rE   rF   rG   rH   rI   )r"   r#   r1   r2   r3   r4   rK   s     r   r%   zSemanticSegmentation.__repr__   sw    /#5@d.>@@@2ty2220dh000D0BDDDr   c           	      H    d| j          d| j         d| j         d| j         d	S )NrO   rP   rR   rS   rT   )r1   r4   r2   r3   r$   s    r   r)   zSemanticSegmentation.describe   sR    #7;7G# #bfbt# #hlhq# # X# # #	
r   )r#   r*   r+   r	   rV   r   rW   rX   r   rY   r9   r   r   r,   r%   r)   rZ   r[   s   @r   r   r      s       
 #8!6+<+E$(# # # c]# E3J	#
 5#:# )# D># 
# # # # # # 6 f    #    
# 
 
 
 
 
 
 
 
r   r   c                   J    e Zd Zdededeeef         fdZdefdZdefdZdS )r   img1img2r   c                    t          |t                    st          j        |          }t          |t                    st          j        |          }t          j        |t
          j                  }t          j        |t
          j                  }t          j        |g dg d          }t          j        |g dg d          }|                                }|                                }||fS )N)      ?r}   r}   r>   )	r   r   r   r   r   r   r   rA   
contiguous)r   rz   r{   s      r   r   zOpticalFlow.forward   s    $'' 	)?4((D$'' 	)?4((D$T5;77$T5;77 {4ooo???KKK{4ooo???KKK    Tzr   c                      | j         j        dz   S r    r!   r$   s    r   r%   zOpticalFlow.__repr__   r&   r   c                     	 dS )NzAccepts ``PIL.Image``, batched ``(B, C, H, W)`` and single ``(C, H, W)`` image ``torch.Tensor`` objects. The images are rescaled to ``[-1.0, 1.0]``.r(   r$   s    r   r)   zOpticalFlow.describe   s    :	
 	
r   N)	r#   r*   r+   r   rX   r   r,   r%   r)   r(   r   r   r   r      s|        F & U66>5J    $.# . . . .
# 
 
 
 
 
 
r   r   )__doc__typingr   r   r   r   r    r   r   r	   __all__Moduler
   r   r   r   r   r(   r   r   <module>r      s\   
 # " " " " " " "          0 0 0 0 0 0 0 0  
 
 
 
 
bi 
 
 
 ,
 ,
 ,
 ,
 ,
") ,
 ,
 ,
^:
 :
 :
 :
 :
") :
 :
 :
z)
 )
 )
 )
 )
29 )
 )
 )
X
 
 
 
 
") 
 
 
 
 
r   