+
    åûjÿ  ã                   óÈ   a € R t0 t ^ RIHt ^ RIt^ RIHt ^ RIHt ^ RIHtH	t	 ^ RI
Ht / t] ^ k ]! RR4      R	.]R
&   ]! RR4      R.]R&    ! R R]P                  4      tR# )é    )ÚDictN)Únn)ÚKORNIA_CHECK_SHAPE)Úhf_urlÚload_state_dict_from_url)Ú_DescriptorSequentialÚsosnetzsosnet_32x32_liberty.pthzVhttps://github.com/yuruntian/SOSNet/raw/master/sosnet-weights/sosnet_32x32_liberty.pthÚlibzsosnet_32x32_hpatches_a.pthzYhttps://github.com/yuruntian/SOSNet/raw/master/sosnet-weights/sosnet_32x32_hpatches_a.pthÚhp_ac                   ó`   a a€ ] tR t^&t oRt^ tRV3R lV 3R llltRV3R lR lltRtVt	V ;t
# )	ÚSOSNeta³  Describe 32 x 32 grayscale patches with SOSNet, trained with second-order similarity.

``sosnet = SOSNet()`` builds the network with its pretrained weights (trained on Liberty), in eval mode, and
``descs = sosnet(patches)`` takes grayscale patches ``(B, 1, 32, 32)`` and returns unit-norm descriptors
``(B, 128)``. It has the convolution stack of :class:`HardNet`, preceded by an ``InstanceNorm2d``, and was trained
with a second-order similarity regularisation. To describe LAFs on an image, pass it to :class:`LAFDescriptor`.
This is based on the original code from paper "SOSNet: Second Order Similarity Regularization for Local
Descriptor Learning".

Convention:
    - See the Convention block on :class:`~kornia.feature.HardNet`.

Args:
    pretrained: Download and set pretrained weights to the model.

Shape:
    - Input: ``(B, 1, 32, 32)``
    - Output: ``(B, 128)``

See Also:
    - :class:`HardNet`: the same convolution stack, trained without the second-order regularisation.
    - :class:`HyNet`: a descriptor of the same patches with FRN layers, which subtract no mean.
    - :class:`HardNet8`: the wider follow-up of HardNet, with a PCA to 128 dimensions.
    - :class:`TFeat`: a shallow network for the same patches that also starts with an ``InstanceNorm2d``, without
      L2 normalisation.
    - :class:`LAFDescriptor`: runs a patch descriptor such as this one on a patch per LAF of an image.

Note:
    With float16 weights, the final BatchNorm keeps its running statistics in float32.
    Convert the model to float16 before calling ``torch.jit.script``.

Examples:
    >>> input = torch.rand(8, 1, 32, 32)
    >>> sosnet = SOSNet(pretrained=False).eval()
    >>> descs = sosnet(input) # 8x128

c                ó$   <€ V ^8„  d   QhRS[ RR/# )é   Ú
pretrainedÚreturnN)Úbool)ÚformatÚ__classdict__s   "€ÚQC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\feature\sosnet.pyÚ__annotate__ÚSOSNet.__annotate__O   s   ø€ ÷ ñ ¡4ð °4ñ ó    c                óR  <€ \         SV `  4        \        \        P                  ! ^RR7      \        P
                  ! ^^ ^^RR7      \        P                  ! ^ RR7      \        P                  ! 4       \        P
                  ! ^ ^ ^^RR7      \        P                  ! ^ RR7      \        P                  ! 4       \        P
                  ! ^ ^@^^^RR7      \        P                  ! ^@RR7      \        P                  ! 4       \        P
                  ! ^@^@^^RR7      \        P                  ! ^@RR7      \        P                  ! 4       \        P
                  ! ^@^€^^^RR7      \        P                  ! ^€RR7      \        P                  ! 4       \        P
                  ! ^€^€^^RR7      \        P                  ! ^€RR7      \        P                  ! 4       \        P                  ! R4      \        P
                  ! ^€^€^RR7      \        P                  ! ^€RR7      4      V n	        \        P                  ! \        P                  ! RRR	R
R7      4      V n        V'       dR   \        \        R,          \        P                   ! R4      R7      pV P#                  VRR7       V P%                  4        R# R# )é   F)Úaffine)Úkernel_sizeÚpaddingÚbias)r   Ústrider   r   gš™™™™™¹?)r   r   é   g      p@g      à?g        )ÚalphaÚbetaÚkr
   Úcpu)Úmap_locationT)ÚstrictN)ÚsuperÚ__init__r   r   ÚInstanceNorm2dÚConv2dÚBatchNorm2dÚReLUÚDropoutÚlayersÚ
SequentialÚLocalResponseNormÚ	desc_normr   ÚurlsÚtorchÚdeviceÚload_state_dictÚeval)Úselfr   Úpretrained_dictÚ	__class__s   && €r   r(   ÚSOSNet.__init__O   sÁ  ø€ Ü‰ÑÔÜ+Ü×Ò˜a¨Ô.Ü�IŠI�a˜¨°A¸EÔBÜ�NŠN˜2 eÔ,Ü�GŠG‹IÜ�IŠI�b˜"¨!°Q¸UÔCÜ�NŠN˜2 eÔ,Ü�GŠG‹IÜ�IŠI�b˜"¨!°A¸qÀuÔMÜ�NŠN˜2 eÔ,Ü�GŠG‹IÜ�IŠI�b˜"¨!°Q¸UÔCÜ�NŠN˜2 eÔ,Ü�GŠG‹IÜ�IŠI�b˜#¨1°QÀÈÔNÜ�NŠN˜3 uÔ-Ü�GŠG‹IÜ�IŠI�c˜3¨A°q¸uÔEÜ�NŠN˜3 uÔ-Ü�GŠG‹IÜ�JŠJ�s‹OÜ�IŠI�c˜3¨A°EÔ:Ü�NŠN˜3 uÔ-ó-
ˆŒô0 Ÿš¤r×';Ò';¸CÀuÐSVÐZ]Ô'^Ó_ˆŒçÜ6´t¸Eµ{ÔQV×Q]ÒQ]Ð^cÓQdÔeˆOØ× Ñ  ¸Ð Ô>Ø�I‰IŽKñ r   c                óT   <€ V ^8„  d   QhRS[ P                  RS[RS[ P                  /# )r   ÚinputÚepsr   )r3   ÚTensorÚfloat)r   r   s   "€r   r   r   p   s*   ø€ ÷  ñ  ™UŸ\™\ð  ±ð  Á%Ç,Á,ñ  r   c                ón  € \        V. RO4       V P                  V4      pVP                  \        P                  \        P
                  39   dA   V P                  VP                  4       V,           4      P                  VP                  4      pMV P                  W2,           4      pVP                  ^4      # )zñCompute SOSNet descriptors for grayscale 32x32 patches.

Args:
    input: Input tensor with shape ``(B, 1, 32, 32)``.
    eps: Small constant added before normalization for stability.

Returns:
    Descriptor tensor with shape ``(B, 128)``.
)ÚBÚ1Ú32rC   )
r   r.   Údtyper3   Úfloat16Úbfloat16r1   r?   ÚtoÚflatten)r7   r<   r=   Údescrs   &&& r   ÚforwardÚSOSNet.forwardp   s   € ô 	˜5Ò"8Ô9Ø—‘˜EÓ"ˆð �;‰;œ5Ÿ=™=¬%¯.©.Ð9Ô9Ø—N‘N 5§;¡;£=°3Õ#6Ó7×:Ñ:¸5¿;¹;ÓG‰Eà—N‘N 5¥;Ó/ˆEØ�}‰}˜QÓÐr   )r1   r.   )T)g»½×Ùß|Û=)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
patch_sizer(   rJ   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r9   r   s   @@r   r   r   &   s,   ù‡ € ñ$ðL €J÷õ ÷B ÷  ò  r   r   c                óŽ   € V ^8„  d   Qh/ ^ \         9   d1   \        \        \        \        \        ,          ,          3,          ;R&   # )r   r2   )Ú__conditional_annotations__r   ÚstrÚlist)r   s   "r   r   r      s,   € × Ñ ÷ &Ò %„dŒ3””dœ3•i•ÐÕ Ñ %ò r   )rV   Útypingr   r3   r   Úkornia.core.checkr   Úkornia.core.downloadr   r   Úkornia.feature._normalizationr   r2   ÚModuler   r   )rV   s   @r   Ú<module>r^      sk   øð÷$ Ò ã Ý å 0ß AÝ ?à#%€Ó %á
ˆ8Ð/Ó0Ø\ð€€U�ñ
 ˆ8Ð2Ó3Ø_ð€€V�ôe ˆR�Y‰Yö e r   