+
    åûjË  ã                   ó(  a € R t0 t ^ RIHtHtHt ^ RIt^ RIHu Ht	 ^ RIHt ^ RI
HtHt R.t]! RR4      R.t] ^ k  ! R	 R
]P                  4      t ! R R]P                  4      t ! R R]P                  4      t ! R R]P&                  4      tR# )é    )ÚDictÚListÚUnionN)Únn)Úhf_urlÚload_state_dict_from_urlÚYuNetÚyunetzyunet_final.pthz7https://github.com/kornia/data/raw/main/yunet_final.pthc                   óB   a a€ ] tR t^#t oRV3R lV 3R llltRtVtV ;t# )Ú
ConvDPUnitc                ó0   <€ V ^8„  d   QhRS[ RS[ RS[RR/# ©é   Úin_channelsÚout_channelsÚ
withBNReluÚreturnN©ÚintÚbool)ÚformatÚ__classdict__s   "€ÚUC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\models\yunet\model.pyÚ__annotate__ÚConvDPUnit.__annotate__$   s*   ø€ ÷ ;ñ ;¡Cð ;±sð ;Éð ;ÐX\ñ ;ó    c                ó‚  <€ \         SV `  4        V P                  R \        P                  ! W^^^ R^R7      4       V P                  R\        P                  ! W"^^^RVR7      4       V'       dP   V P                  R\        P
                  ! V4      4       V P                  R\        P                  ! RR7      4       R# R# )Úconv1T©ÚbiasÚgroupsÚconv2ÚbnÚrelu©ÚinplaceN)ÚsuperÚ__init__Ú
add_moduler   ÚConv2dÚBatchNorm2dÚReLU©Úselfr   r   r   Ú	__class__s   &&&&€r   r(   ÚConvDPUnit.__init__$   sŠ   ø€ Ü‰ÑÔØ�‰˜¤§¢¨;ÀaÈÈAÐTXÐabÔ!cÔdØ�‰˜¤§¢¨<ÀqÈ!ÈQÐUYÐbnÔ!oÔpßØ�O‰O˜D¤"§.¢.°Ó">Ô?Ø�O‰O˜F¤B§G¢G°DÔ$9Ö:ñ r   © ©T©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r(   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r/   r   s   @@r   r   r   #   s   ù‡ € ÷;÷ ;õ ;r   r   c                   ó>   a a€ ] tR t^-t oV3R lV 3R lltRtVtV ;t# )Ú	Conv_headc                ó0   <€ V ^8„  d   QhRS[ RS[ RS[ RR/# )r   r   Úmid_channelsr   r   N)r   )r   r   s   "€r   r   ÚConv_head.__annotate__.   s0   ø€ ÷ Iñ I¡Cð I±sð IÉ#ð IÐRVñ Ir   c                óL  <€ \         SV `  4        V P                  R \        P                  ! W^^^R^R7      4       V P                  R\        P
                  ! V4      4       V P                  R\        P                  ! RR7      4       V P                  R\        W#4      4       R# )r   Tr   Úbn1r$   r%   r"   N)r'   r(   r)   r   r*   r+   r,   r   )r.   r   r?   r   r/   s   &&&&€r   r(   ÚConv_head.__init__.   sr   ø€ Ü‰ÑÔØ�‰˜¤§¢¨;ÀaÈÈAÐTXÐabÔ!cÔdØ�‰˜œrŸ~š~¨lÓ;Ô<Ø�‰˜¤§¢°Ô 5Ô6Ø�‰˜¤¨LÓ!GÖHr   r1   r3   r;   s   @@r   r=   r=   -   s   ù‡ € ÷I÷ Ió Ir   r=   c                   óB   a a€ ] tR t^6t oRV3R lV 3R llltRtVtV ;t# )ÚConv4layerBlockc                ó0   <€ V ^8„  d   QhRS[ RS[ RS[RR/# r   r   )r   r   s   "€r   r   ÚConv4layerBlock.__annotate__7   s0   ø€ ÷ Tñ T¡Cð T±sð TÉð TÐX\ñ Tr   c                ó”   <€ \         SV `  4        V P                  R \        WR4      4       V P                  R\        WV4      4       R# )r   Tr"   N)r'   r(   r)   r   r-   s   &&&&€r   r(   ÚConv4layerBlock.__init__7   s8   ø€ Ü‰ÑÔØ�‰˜¤¨KÀdÓ!KÔLØ�‰˜¤¨KÀzÓ!RÖSr   r1   r2   r3   r;   s   @@r   rE   rE   6   s   ù‡ € ÷T÷ Tõ Tr   rE   c                   óT   a a€ ] tR t^=t oRtV3R lV 3R lltV3R lR ltRtVtV ;t	# )r	   a  YuNet face detection model.

This is the underlying CNN model used by :py:class:`kornia.contrib.FaceDetector` for face detection.
The model architecture is based on the method described in :cite:`facedetect-yu`.

The input is a BGR image with pixel values in :math:`[0, 255]`, with no mean or standard deviation applied: the
pretrained weights were trained on such images (ShiqiYu/libfacedetection.train@74f3aa7 ``src/data.py:76, 90``)
and evaluated on images read with ``cv2.imread`` (``tasks/task1/datasets.py:53``, ``detect.py:100-106``).
:py:class:`kornia.contrib.FaceDetector` takes RGB in :math:`[0, 255]` and flips it to BGR before this model.

Args:
    phase: the phase of the model, either "train" or "test".
    pretrained: if True, loads pretrained weights from the official repository and returns the model in
        evaluation mode; otherwise the random weights stay in training mode.

Example:
    >>> model = YuNet("test", pretrained=True)
    >>> img = torch.rand(1, 3, 320, 320) * 255  # BGR in [0, 255]
    >>> out = model(img)

c                ó*   <€ V ^8„  d   QhRS[ RS[RR/# )r   ÚphaseÚ
pretrainedr   N)Ústrr   )r   r   s   "€r   r   ÚYuNet.__annotate__T   s"   ø€ ÷ $ñ $™cð $©tð $¸ñ $r   c           
     óò  <€ \         SV `  4        Wn        ^V n        \	        ^^^4      V n        \        ^^@4      V n        \        ^@^@4      V n        \        ^@^@4      V n	        \        ^@^@4      V n
        \        ^@^@4      V n        \        ^@^@4      V n        \        P                  ! \        ^@^3R4      \        ^@^"R4      \        ^@^"R4      \        ^@^3R4      4      V n        V P                  R8X  Ed5   V P!                  4        EF  p\#        V\        P$                  4      '       d‘   VP&                  e[   \        P(                  P+                  VP,                  P.                  4       VP&                  P.                  P1                  R4       KŒ  VP,                  P.                  P3                  ^ R4       K´  \#        V\        P4                  4      '       g   KÖ  VP,                  P.                  P1                  ^4       VP&                  P.                  P7                  4        EK"  	  V'       dK   \9        \:        \<        P>                  ! R4      R7      pV PA                  VRR	7       V PC                  4        R# R# )
r   FÚtrainNg{®Gáz”?g{®Gáz„?Úcpu)Úmap_locationT)Ústrict)"r'   r(   rL   Únum_classesr=   Úmodel0rE   Úmodel1Úmodel2Úmodel3Úmodel4Úmodel5Úmodel6r   Ú
SequentialÚheadÚmodulesÚ
isinstancer*   r    ÚinitÚxavier_normal_ÚweightÚdataÚfill_Únormal_r+   Úzero_r   Ú_urlÚtorchÚdeviceÚload_state_dictÚeval)r.   rL   rM   ÚmÚpretrained_dictr/   s   &&&  €r   r(   ÚYuNet.__init__T   s»  ø€ Ü‰ÑÔØŒ
ØˆÔä  2 rÓ*ˆŒÜ% b¨"Ó-ˆŒÜ% b¨"Ó-ˆŒÜ% b¨"Ó-ˆŒÜ% b¨"Ó-ˆŒÜ% b¨"Ó-ˆŒÜ% b¨"Ó-ˆŒä—M’MÜ˜BÐ 0°%Ó8Ü˜BÐ 0°%Ó8Ü˜BÐ 0°%Ó8Ü˜BÐ 0°%Ó8ó	
ˆŒ	ð �:‰:˜Õ Ø—\‘\—^�Ü˜a¤§¡×+Ò+Ø—v‘vÒ)ÜŸ™×.Ñ.¨q¯x©x¯}©}Ô=ØŸ™Ÿ™×)Ñ)¨$Ö/àŸ™Ÿ™×-Ñ-¨a°Ö6Ü ¤2§>¡>×2Ô2Ø—H‘H—M‘M×'Ñ'¨Ô*Ø—F‘F—K‘K×%Ñ%×'ñ $÷ Ü6´tÌ%Ï,Ê,ÐW\ÓJ]Ô^ˆOØ× Ñ  ¸Ð Ô>Ø�I‰IŽKñ r   c                ód   <€ V ^8„  d   QhRS[ P                  RS[S[S[ P                  3,          /# )r   Úxr   )ri   ÚTensorr   rN   )r   r   s   "€r   r   rO   z   s1   ø€ ÷ .Eñ .E™Ÿ™ð .E©$©s±E·L±LÐ/@Õ*Añ .Er   c           	     ó˜  € . . r2V P                  V4      p\        P                  ! V^4      pV P                  V4      pV P	                  V4      p\        P                  ! V^4      pV P                  V4      pVP                  V4       \        P                  ! V^4      pV P                  V4      pVP                  V4       \        P                  ! V^4      pV P                  V4      pVP                  V4       \        P                  ! V^4      pV P                  V4      pVP                  V4       \        V P                  4       FD  w  rEV! W$,          4      pVP                  VP                  ^ ^^^4      P                  4       4       KF  	  \        P                  ! V Uu. uF  qwP!                  ^4      NK  	  up^4      pVP#                  VP$                  ^ ,          VP$                  ^,          ^,          ^4      pVP'                  RRR7      w  ršpV P(                  R8X  d   \        P*                  ! V
RR7      p
RV	RV
RV/# u upi )am  Run YuNet face detection heads over an input image batch.

Args:
    x: Image tensor with shape ``(B, C, H, W)``, where :math:`B` is
        batch size, :math:`C` is channel count, :math:`H` is height,
        and :math:`W` is width.

Returns:
    Dictionary containing head outputs for locations, confidences, and
    landmarks at the configured detection scales.
)ÚdimÚtestÚlocÚconfÚiou)é   r   é   éÿÿÿÿ)rV   ÚFÚ
max_pool2drW   rX   rY   ÚappendrZ   r[   r\   Ú	enumerater^   ÚpermuteÚ
contiguousri   ÚcatÚflattenÚviewÚshapeÚsplitrL   Úsoftmax)r.   rq   Údetection_sourcesÚ	head_listÚiÚhÚx_tmpÚoÚ	head_dataÚloc_dataÚ	conf_dataÚiou_datas   &&          r   ÚforwardÚYuNet.forwardz   sÔ  € ð (*¨2˜9à�K‰K˜‹NˆÜ�LŠL˜˜AÓˆØ�K‰K˜‹NˆØ�K‰K˜‹NˆÜ�LŠL˜˜AÓˆØ�K‰K˜‹NˆØ× Ñ  Ô#ä�LŠL˜˜AÓˆØ�K‰K˜‹NˆØ× Ñ  Ô#ä�LŠL˜˜AÓˆØ�K‰K˜‹NˆØ× Ñ  Ô#ä�LŠL˜˜AÓˆØ�K‰K˜‹NˆØ× Ñ  Ô#ä˜dŸi™iÖ(‰DˆAÙÐ'Õ*Ó+ˆEØ×Ñ˜UŸ]™]¨1¨a°°AÓ6×AÑAÓCÖDñ )ô —I’I±YÓ?±Y°Ÿy™y¨ž|±YÑ?ÀÓCˆ	Ø—N‘N 9§?¡?°1Õ#5°y·±ÀqÕ7IÈRÕ7OÐQSÓTˆ	à(1¯©¸
È¨Ó(KÑ%ˆ˜Xà�:‰:˜ÔÜŸš i°RÔ8ˆIà�x ¨°E¸8ÐDÐDùò @s   Æ#I)
r^   rV   rW   rX   rY   rZ   r[   r\   rU   rL   )
r4   r5   r6   r7   Ú__doc__r(   r’   r8   r9   r:   r;   s   @@r   r	   r	   =   s'   ù‡ € ñ÷,$ó $÷L.E÷ .Eð .Er   c                óx   € V ^8„  d   Qh/ ^ \         9   d&   \        \        \        \        ,          3,          ;R&   # )r   rh   )Ú__conditional_annotations__r   rN   r   )r   s   "r   r   r      s+   € × $Ñ $÷ò „eŒC””c•ˆNÕñ ò %r   )r–   Útypingr   r   r   ri   Útorch.nn.functionalr   Ú
functionalr|   Úkornia.core.downloadr   r   Ú__all__rh   r]   r   r=   rE   ÚModuler	   r   )r–   s   @r   Ú<module>r�      sˆ   øð÷& %Ö $ã ß Ð Ý ç Aàˆ)€ñ ˆ7Ð%Ó&Ø=ð€ó ô;�—‘ô ;ôI�—‘ô IôT�b—m‘mô TôkEˆB�I‰Iö kEr   