Ë
    [²j8!  ã                   ó  — 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/ia-enhanced/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)Nz“Accepts ``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-   „ ð7˜6ð 7 fó 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=
ß?gÉv¾Ÿ/Ý?g–C‹lçûÙ?©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Š   € Ü�h‰h�s˜D×,Ñ,¸D×<NÑ<NÐZ^×ZhÑZhÔiˆÜ�m‰m˜C §¡Ó0ˆÜ˜#œvÔ&Ü—/‘/ #Ó&ˆCÜ×#Ñ# C¬¯©Ó5ˆÜ�k‰k˜# D§I¡I°4·8±8Ô<ˆØˆ
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ˆØÐ+¨D¯N©NÐ+;Ð<Ñ<ˆØÐ-¨d×.>Ñ.>Ð-?Ð@Ñ@ˆØ˜; t§y¡y kÐ2Ñ2ˆØ˜: d§h¡h ZÐ0Ñ0ˆØÐ/°×0BÑ0BÐ/CÐDÑDˆØ˜ÑˆØÐr   c                 óŠ   — d| j                   › d| j                  › d| j                  › d| j                  › d| j                  › d�S )Nú‘Accepts ``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]   € ð7Ø7;×7GÑ7GÐ6HÐHaÐbf×btÑbtÐauð v9Ø9=¿¹Ð8Hð I?Ø?C¿y¹y¸kÈÐ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Ø$(ò#ð ð#ð ð	#ð
 �E˜3�JÑð#ð �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   )gFë¨j‚¨Û?gñõµ.5BÙ?g�¥½ÁØ?)grá@H0Í?gcÙ=yXÌ?gD¾K©KÆË?)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   )ÚdimTéÿÿÿÿr=   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  € ØˆØ�8‰8�aŠ<Ø—-‘- A�-Ó&ˆCØˆLàŸ	™	‰ˆˆ1ˆa��AØ�h‰h�r˜1˜a Ó#ˆô
 �h‰h�s˜D×,Ñ,¸D×<NÑ<NÐZ_Ô`ˆÜ�m‰m˜C §¡Ó0ˆÜ×#Ñ# C¬¯©Ó5ˆÜ�k‰k˜# D§I¡I°4·8±8Ô<ˆØ�~‰~‰ˆˆ1Ø�h‰h�q˜!˜Q  1Ó%ˆØ�k‰k˜!˜Q  1 aÓ(ˆáØ—+‘+ !�+Ó$ˆ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 )NzŽAccepts 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   € ð7Ø7;×7GÑ7GÐ6HÐHaÐbf×btÑbtÐauð v9Ø9=¿¹Ð8Hð I?Ø?C¿y¹y¸kÈÐ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 ™: u¨S°#¨X¡Ð6Ñ7ð	+ð
 �E˜3�JÑð+ð �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Ð,C˜K™=ÈˆÔÜ˜“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ÔmˆCÜ˜#œvÔ&Ü—/‘/ #Ó&ˆCÜ×#Ñ# C¬¯©Ó5ˆÜ�k‰k˜# D§I¡I°4·8±8Ô<ˆØˆ
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×.>Ñ.>Ð-?Ð@Ñ@ˆØ˜; t§y¡y kÐ2Ñ2ˆØ˜: d§h¡h ZÐ0Ñ0ˆØÐ/°×0BÑ0BÐ/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   € ð7Ø7;×7GÑ7GÐ6HÐHaÐbf×btÑbtÐauð vhØhl×hqÑhqÐgrð sØ—X‘X�J˜cð#ð	
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‘]ð#ð �E˜3�JÑð	#ð
 �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ä×$Ñ$ T¬5¯;©;Ó7ˆÜ×$Ñ$ T¬5¯;©;Ó7ˆô �{‰{˜4¢oº?ÔKˆÜ�{‰{˜4¢oº?ÔKˆà�‰Ó ˆØ�‰Ó ˆà�TˆzÐr   c                 ó4   — | j                   j                  dz   S r    r!   r$   s    r   r%   zOpticalFlow.__repr__Ò   r&   r   c                  ó   — 	 y)Nz”Accepts ``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ð ¨&ð °U¸6À6¸>Ñ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ò€ô
�b—i‘iô 
ô ,
˜"Ÿ)™)ô ,
ô^:
˜"Ÿ)™)ô :
ôz)
˜2Ÿ9™9ô )
ôX
�"—)‘)õ 
r   