
    h8!                        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y)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                   4    e Zd ZdedefdZdefdZdefdZy)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/eduruby.in/venv/lib/python3.12/site-packages/torchvision/transforms/_presets.pyforwardzObjectDetection.forward   s1    #v&//#&C$$S%++66    c                 4    | j                   j                  dz   S Nz()	__class____name__r   s    r   __repr__zObjectDetection.__repr__       ~~&&--r   c                      	 y)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
      s-    76 7f 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	        |      | _        || _        || _        y r   )	super__init__r6   r1   listr2   r3   r4   r5   )r   r6   r1   r2   r3   r4   r5   r"   s          r   r9   zImageClassification.__init__(   sH     	#'=J	9*"r   r   c                    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    hhsD,,D<N<NZ^ZhZhimmC0#v&//#&C##C5kk#DII488<
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+DNN+;<<-d.>.>-?@@;tyyk22:dhhZ00/0B0B/CDDr   c                     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   s]    77;7G7G6HHabfbtbtau v99=8H I??CyykW[W_W_V``c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+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        |      | _        || _        y r   )r8   r9   r:   r6   r1   r2   r3   r4   )r   r6   r1   r2   r3   r4   r"   s         r   r9   zVideoClassification.__init__W   sF     	i,J	9*r   vidc                 p   d}|j                   dk  r|j                  d      }d}|j                  \  }}}}}|j                  d|||      }t	        j
                  || j                  | j                  d      }t	        j                  || j                        }t	        j                  |t        j                        }t	        j                  || j                  | j                        }| j                  \  }}|j                  |||||      }|j!                  dd	d
dd      }|r|j#                  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   88a<--A-&CL		1aAhhr1a#
 hhsD,,D<N<NZ_`mmC0##C5kk#DII488<~~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                     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   sa    77;7G7G6HHabfbtbtau v99=8H I??CyykW[W_W_V` a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+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        |      | _        || _        || _        y r   )r8   r9   r1   r:   r2   r3   r4   r5   )r   r1   r2   r3   r4   r5   r"   s         r   r9   zSemanticSegmentation.__init__   sF     	,7,CK=J	9*"r   r   c                    t        | j                  t              r7t        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&&-((3 0 0@R@R^b^l^lmC#v&//#&C##C5kk#DII488<
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__   s    //#5-d.>.>-?@@;tyyk22:dhhZ00/0B0B/CDDr   c           	      p    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   sP    77;7G7G6HHabfbtbtau vhhlhqhqgr sXXJc#	
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+E$(# c]# E3J	#
 5#:# )# D># 
# 6 f # 
# 
r   r   c                   B    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y)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      }|j                         }|j                         }||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$$T5;;7 {{4o?K{{4o?K  Tzr   c                 4    | j                   j                  dz   S r    r!   r$   s    r   r%   zOpticalFlow.__repr__   r&   r   c                      	 y)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      sr   
 #   0
bii 
 ,
")) ,
^:
")) :
z)
299 )
X
")) 
r   