
    ڧg>!                        d Z ddlmZ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Tuple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     [/var/www/html/ai-engine/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_sizer2   r3   .r4   r5   r6   r   Nc                    t                                                       |g| _        |g| _        t	          |          | _        t	          |          | _        || _        || _        d S r   )	super__init__r7   r2   listr3   r4   r5   r6   )r   r7   r2   r3   r4   r5   r6   r#   s          r   r:   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r5   r6   r3   r4   )r   resizer2   r5   r6   center_cropr7   r   r   r   r   r   r   	normalizer3   r4   r   s     r   r   zImageClassification.forward9   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$   r7   r2   r3   r4   r5   r   format_strings     r   r&   zImageClassification.__repr__B       /#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=``.r2   r5   r7   r3   r4   r%   s    r   r*   zImageClassification.describeL   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intr   r   r   boolr:   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?)r3   r4   r5   r7   r2   r3   .r4   r5   r   Nc                    t                                                       t          |          | _        t          |          | _        t          |          | _        t          |          | _        || _        d S r   )r9   r:   r;   r7   r2   r3   r4   r5   )r   r7   r2   r3   r4   r5   r#   s         r   r:   zVideoClassification.__init__V   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@   r2   r5   rA   r7   r   r   r   rB   r3   r4   permutesqueeze)r   r^   need_squeezeNTCHWs           r   r   zVideoClassification.forwardf   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 rD   rK   rL   s     r   r&   zVideoClassification.__repr__~   rN   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=rQ   rR   rS   rT   zP``. Finally the output dimensions are permuted to ``(..., C, T, H, W)`` tensors.rV   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
   rW   r   rX   r   r   r:   r   r   r-   r&   r*   rZ   r[   s   @r   r   r   U   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   r0   r1   T)r3   r4   r5   r6   r2   r3   .r4   r5   r6   r   Nc                    t                                                       ||gnd | _        t          |          | _        t          |          | _        || _        || _        d S r   )r9   r:   r2   r;   r3   r4   r5   r6   )r   r2   r3   r4   r5   r6   r#   s         r   r:   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   r2   r;   r   r@   r5   r6   r   r   r   r   r   rB   r3   r4   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 )NrE   rF   rG   rH   rI   rJ   )r#   r$   r2   r3   r4   r5   rL   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 )NrP   rQ   rS   rT   rU   )r2   r5   r3   r4   r%   s    r   r*   zSemanticSegmentation.describe   sR    #7;7G# #bfbt# #hlhq# # X# # #	
r   )r$   r+   r,   r
   rW   r   rX   r   r   rY   r:   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   rB   
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   r   r   r-   r&   r*   r)   r   r   r   r      s|        F & U66>5J    $.# . . . .
# 
 
 
 
 
 
r   r   )__doc__typingr   r   r   r   r   r    r	   r   r
   __all__Moduler   r   r   r   r   r)   r   r   <module>r      sb    * ) ) ) ) ) ) ) ) )          0 0 0 0 0 0 0 0  
 
 
 
 
bi 
 
 
 ,
 ,
 ,
 ,
 ,
") ,
 ,
 ,
^:
 :
 :
 :
 :
") :
 :
 :
z)
 )
 )
 )
 )
29 )
 )
 )
X
 
 
 
 
") 
 
 
 
 
r   