o
    h8!                     @   s   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	 d	ejZG d
d dejZG dd dejZG dd dejZG d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                   @   s:   e Zd ZdedefddZdefddZdefddZd	S )
r	   imgreturnc                 C   s"   t |ts
t|}t|tjS N)
isinstancer   Fpil_to_tensorconvert_image_dtypetorchfloatselfr    r   e/home/www/facesmatcher.com/frenv_anti/lib/python3.10/site-packages/torchvision/transforms/_presets.pyforward   s   

zObjectDetection.forwardc                 C      | j jd S Nz()	__class____name__r   r   r   r   __repr__      zObjectDetection.__repr__c                 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   r!   r   r   r   describe       zObjectDetection.describeN)r    
__module____qualname__r   r   strr"   r%   r   r   r   r   r	      s    r	   c                       s   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dZ
dedefddZdefddZdefddZ  ZS )r
      g
ףp=
?gv/?gCl?gZd;O?gy&1?g?T)resize_sizemeanstdinterpolation	antialias	crop_sizer-   r.   .r/   r0   r1   r   Nc                   s>   t    |g| _|g| _t|| _t|| _|| _|| _d S r   )	super__init__r2   r-   listr.   r/   r0   r1   )r   r2   r-   r.   r/   r0   r1   r   r   r   r4   (   s   




zImageClassification.__init__r   c                 C   s`   t j|| j| j| jd}t || j}t|tst 	|}t 
|tj}t j|| j| jd}|S Nr0   r1   r.   r/   )r   resizer-   r0   r1   center_cropr2   r   r   r   r   r   r   	normalizer.   r/   r   r   r   r   r   :   s   

zImageClassification.forwardc                 C   h   | j jd }|d| j 7 }|d| j 7 }|d| j 7 }|d| j 7 }|d| j 7 }|d7 }|S N(z
    crop_size=
    resize_size=

    mean=	
    std=
    interpolation=
)r   r    r2   r-   r.   r/   r0   r   format_stringr   r   r   r"   C      zImageClassification.__repr__c                 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=``.r-   r0   r2   r.   r/   r!   r   r   r   r%   M      zImageClassification.describe)r    r'   r(   r   BILINEARinttupler   r   boolr4   r   r   r)   r"   r%   __classcell__r   r   r6   r   r
   '   s0    

		
r
   c                       s   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dZ	de
d
e
fddZd
efddZd
efddZ  ZS )r   )gFj?g.5B?g?)gr@H0?gc=yX?gDKK?)r.   r/   r0   r2   r-   r.   .r/   r0   r   Nc                   s<   t    t|| _t|| _t|| _t|| _|| _d S r   )r3   r4   r5   r2   r-   r.   r/   r0   )r   r2   r-   r.   r/   r0   r6   r   r   r4   W   s   
	




zVideoClassification.__init__vidc                 C   s   d}|j dk r|jdd}d}|j\}}}}}|d|||}tj|| j| jdd}t|| j	}t
|tj}tj|| j| jd}| j	\}}||||||}|dd	d
dd}|ra|jdd}|S )NF   r   )dimTr8   r9      r         )ndimZ	unsqueezeshapeviewr   r:   r-   r0   r;   r2   r   r   r   r<   r.   r/   ZpermuteZsqueeze)r   rW   Zneed_squeezeNTCHWr   r   r   r   g   s    

zVideoClassification.forwardc                 C   r=   r>   rE   rF   r   r   r   r"      rH   zVideoClassification.__repr__c                 C   rI   )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=rK   rL   rM   rN   zP``. Finally the output dimensions are permuted to ``(..., C, T, H, W)`` tensors.rP   r!   r   r   r   r%      rQ   zVideoClassification.describe)r    r'   r(   r   rR   rT   rS   r   r   r4   r   r   r)   r"   r%   rV   r   r   r6   r   r   V   s(    



r   c                       s   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dZ
dedefddZdefddZdefddZ  ZS )r   r+   r,   T)r.   r/   r0   r1   r-   r.   .r/   r0   r1   r   Nc                   sB   t    |d ur|gnd | _t|| _t|| _|| _|| _d S r   )r3   r4   r-   r5   r.   r/   r0   r1   )r   r-   r.   r/   r0   r1   r6   r   r   r4      s   
	


zSemanticSegmentation.__init__r   c                 C   s^   t | jtrtj|| j| j| jd}t |tst|}t	|t
j}tj|| j| jd}|S r7   )r   r-   r5   r   r:   r0   r1   r   r   r   r   r   r<   r.   r/   r   r   r   r   r      s   

zSemanticSegmentation.forwardc                 C   sX   | j jd }|d| j 7 }|d| j 7 }|d| j 7 }|d| j 7 }|d7 }|S )Nr?   r@   rA   rB   rC   rD   )r   r    r-   r.   r/   r0   rF   r   r   r   r"      s   zSemanticSegmentation.__repr__c              	   C   s&   d| j  d| j d| j d| j d	S )NrJ   rK   rM   rN   rO   )r-   r0   r.   r/   r!   r   r   r   r%      s   zSemanticSegmentation.describe)r    r'   r(   r   rR   r   rS   rT   r   rU   r4   r   r   r)   r"   r%   rV   r   r   r6   r   r      s*    

		r   c                   @   sF   e Zd Zdededeeef fddZdefddZdefdd	Zd
S )r   img1img2r   c                 C   s   t |ts
t|}t |tst|}t|tj}t|tj}tj|g dg dd}tj|g dg dd}| }| }||fS )N)      ?rh   rh   r9   )	r   r   r   r   r   r   r   r<   
contiguous)r   rf   rg   r   r   r   r      s   



zOpticalFlow.forwardc                 C   r   r   r   r!   r   r   r   r"      r#   zOpticalFlow.__repr__c                 C   r$   )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!   r   r   r   r%      r&   zOpticalFlow.describeN)	r    r'   r(   r   rT   r   r)   r"   r%   r   r   r   r   r      s    r   )__doc__typingr   r   r   r   r    r   r   r   __all__Moduler	   r
   r   r   r   r   r   r   r   <module>   s    	/=,