Ë
    ëÓ^j-'  ã                  ó8  — d Z ddlmZ g d¢ZddlmZ ddlmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ  e«       Z edd	d
¬«       G d„ de«      «       Z G d„ de«      Z G d„ de«      Z G d„ de«      Z  G d„ de«      Z! edd	d
¬«       G d„ de«      «       Z" G d„ de«      Z# G d„ de«      Z$ edd	d
¬«       G d„ de$«      «       Z% G d„ de$«      Z& G d „ d!e$«      Z' G d"„ d#e$«      Z( G d$„ d%e$«      Z) G d&„ d'e$«      Z* G d(„ d)e$«      Z+y)*aV  Concrete RF-DETR model variant classes.

All classes inherit from :class:`~rfdetr.detr.RFDETR` which remains defined in ``rfdetr.detr``. Backward-compatible
access from ``rfdetr.detr`` is provided via lazy ``__getattr__`` re-exports, so importing ``rfdetr.variants`` no longer
depends on a fragile eager ``detr -> variants`` import sequence.
é    )Úannotations)Ú
RFDETRBaseÚRFDETRKeypointPreviewÚ
RFDETRNanoÚRFDETRSmallÚRFDETRMediumÚRFDETRLargeÚRFDETRLargeDeprecatedÚ	RFDETRSegÚRFDETRSegPreviewÚRFDETRSegNanoÚRFDETRSegSmallÚRFDETRSegMediumÚRFDETRSegLargeÚRFDETRSegXLargeÚRFDETRSeg2XLarge)Údeprecated_class)ÚKeypointTrainConfigÚModelConfigÚRFDETRBaseConfigÚRFDETRKeypointPreviewConfigÚRFDETRLargeConfigÚRFDETRLargeDeprecatedConfigÚRFDETRMediumConfigÚRFDETRNanoConfigÚRFDETRSeg2XLargeConfigÚRFDETRSegLargeConfigÚRFDETRSegMediumConfigÚRFDETRSegNanoConfigÚRFDETRSegPreviewConfigÚRFDETRSegSmallConfigÚRFDETRSegXLargeConfigÚRFDETRSmallConfigÚSegmentationTrainConfig)ÚRFDETR)Ú
get_loggerNz1.7.0z2.0.0)ÚtargetÚdeprecated_inÚ	remove_inc                  ó   — e Zd ZdZdZeZy)r   z¥Train an RF-DETR Base model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``.
    zrfdetr-baseN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úsizer   Ú_model_config_class© ó    úZ/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/rfdetr/variants.pyr   r   <   s   „ ñð €DØ*Ñr2   r   c                  ó   — e Zd ZdZdZeZy)r   z¥Train an RF-DETR Nano model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``.
    zrfdetr-nanoN)r+   r,   r-   r.   r/   r   r0   r1   r2   r3   r   r   L   s   „ ñð €DØ*Ñr2   r   c                  ó   — e Zd ZdZdZeZeZy)r   zÈTrain or run inference with the RF-DETR keypoint preview model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``.
    zrfdetr-keypoint-previewN)	r+   r,   r-   r.   r/   r   r0   r   Ú_train_config_classr1   r2   r3   r   r   W   s   „ ñð %€DØ5ÐØ-Ñr2   r   c                  ó   — e Zd ZdZdZeZy)r   z¦Train an RF-DETR Small model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``.
    zrfdetr-smallN)r+   r,   r-   r.   r/   r#   r0   r1   r2   r3   r   r   c   s   „ ñð €DØ+Ñr2   r   c                  ó   — e Zd ZdZdZeZy)r   z§Train an RF-DETR Medium model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``.
    zrfdetr-mediumN)r+   r,   r-   r.   r/   r   r0   r1   r2   r3   r   r   n   s   „ ñð €DØ,Ñr2   r   c                  ó   — e Zd ZdZdZeZy)r
   z¾Train an RF-DETR Large model using the legacy config.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``.
    úrfdetr-largeN)r+   r,   r-   r.   r/   r   r0   r1   r2   r3   r
   r
   y   s   „ ñð €DØ5Ñr2   r
   c                  ó@   ‡ — e Zd ZdZdZedd„«       Zˆ fd„Zdd„Zˆ xZ	S )r	   z¦Train an RF-DETR Large model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``.
    r:   c                ó¶   ‡— t        | «      j                  «       Šd‰v ryt        | t        «      rd‰v S t        | t        «      rd}t        ˆfd„|D «       «      S y)aá  Return whether initialization should retry with deprecated Large config.

        The fallback is only for known checkpoint/config incompatibilities from deprecated Large weights. Runtime issues
        such as CUDA OOM must fail fast and must not trigger a second initialization attempt.

        Args:
            exc: Exception raised by initial ``RFDETR`` initialization.

        Returns:
            ``True`` when retrying with deprecated config is expected to help.
        zout of memoryFÚ
patch_size)zerror(s) in loading state_dictzsize mismatchzmissing key(s) in state_dictzunexpected key(s) in state_dictc              3  ó&   •K  — | ]  }|‰v –— Œ
 y ­w)Nr1   )Ú.0ÚmarkerÚmessages     €r3   ú	<genexpr>zDRFDETRLarge._should_fallback_to_deprecated_config.<locals>.<genexpr>«   s   øè ø€ ÒW¨V�v Ô(ÑWùs   ƒ)ÚstrÚlowerÚ
isinstanceÚ
ValueErrorÚRuntimeErrorÚany)ÚexcÚincompatible_state_dict_markersrA   s     @r3   Ú%_should_fallback_to_deprecated_configz1RFDETRLarge._should_fallback_to_deprecated_config’   s^   ø€ ô �c“(—.‘.Ó"ˆØ˜gÑ%ØÜ�cœ:Ô&Ø 7Ð*Ð*Ü�cœ<Ô(ð/Ð+ô ÓWÐ7VÔWÓWÐWØr2   c                ó
  •— d | _         d| _        t        j                  d   j                  }d|v xr |j                  d«      |k7  }	 t        ‰| �  d
i |¤Ž y # t        t        f$ r›}|s| j                  |«      s‚ || _         d| _        	 t        ‰| �  d
i |¤Ž t        j                  dddz  z   dz   «       n@# t        $ r4}t        j                  d| j                   |¬	«       | j                   |‚d }~ww xY wY d }~y d }~ww xY w)NFÚ
resolutionTzÈ
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=zÉ
WARNING: Automatically switched to deprecated model configuration, due to using deprecated weights. This will be removed in v1.9.0.
 Please retrain your model with the new weights and configuration.
=éd   ú
zŒRetry with deprecated RF-DETR Large configuration failed; re-raising the original initialization error for compatibility. Original error: %s)Úexc_infor1   )Ú
init_errorÚis_deprecatedr   Úmodel_fieldsÚdefaultÚgetÚsuperÚ__init__rF   rG   rK   ÚloggerÚwarningÚ	ExceptionÚ	exception)ÚselfÚkwargsÚ_default_resolutionÚ_custom_resolutionrI   Ú	retry_excÚ	__class__s         €r3   rW   zRFDETRLarge.__init__®   s$  ø€ ØˆŒØ"ˆÔô 0×<Ñ<¸\ÑJ×RÑRÐØ)¨VÐ3Òg¸¿
¹
À<Ó8PÐTgÑ8gÐð	5Ü‰GÑÑ&˜vÓ&øÜœLÐ)ò 	5Ù!¨×)SÑ)SÐTWÔ)XØØ!ˆDŒOØ!%ˆDÔð5Ü‘Ñ Ñ* 6Ò*Ü—‘ðð!ð
 ñ!ñð !%ñ%õøô ò 5Ü× Ñ ð)ð —O‘OØ&ð !ô ð —o‘o¨9Ð4ûð5úôûð	5ús<   ÁA ÁDÁ'"C=Â
-B8Â7C=Â8	C5Ã/C0Ã0C5Ã5C=Ã=Dc                óF   — | j                   st        di |¤ŽS t        di |¤ŽS )Nr1   )rR   r   r   )r\   r]   s     r3   Úget_model_configzRFDETRLarge.get_model_configÕ   s'   € Ø×!Ò!Ü$Ñ. vÑ.Ð.ä.Ñ8°Ñ8Ð8r2   )rI   rZ   ÚreturnÚbool)rd   r   )
r+   r,   r-   r.   r/   ÚstaticmethodrK   rW   rc   Ú__classcell__)ra   s   @r3   r	   r	   ‰   s,   ø„ ñð €Dàòó ðô6%5÷N9r2   r	   c                  ó   — e Zd ZdZeZy)r   zÓBase class for all RF-DETR segmentation models.

    Training accepts custom square integer ``resolution`` values. Most segmentation variants use multiples of 24;
    ``RFDETRSegNano`` uses multiples of 12.
    N)r+   r,   r-   r.   r$   r6   r1   r2   r3   r   r   Ü   s   „ ñð 2Ñr2   r   c                  ó   — e Zd ZdZdZeZy)r   zìTrain an RF-DETR Segmentation Preview model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``. Deprecated in v1.7.0, scheduled for removal in v2.0.0.
    zrfdetr-seg-previewN)r+   r,   r-   r.   r/   r    r0   r1   r2   r3   r   r   æ   s   „ ñð  €DØ0Ñr2   r   c                  ó   — e Zd ZdZdZeZy)r   zÕTrain an RF-DETR Segmentation Nano model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``; this variant uses multiples of 12.
    zrfdetr-seg-nanoN)r+   r,   r-   r.   r/   r   r0   r1   r2   r3   r   r   ö   s   „ ñð €DØ-Ñr2   r   c                  ó   — e Zd ZdZdZeZy)r   zÖTrain an RF-DETR Segmentation Small model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``; this variant uses multiples of 24.
    zrfdetr-seg-smallN)r+   r,   r-   r.   r/   r!   r0   r1   r2   r3   r   r     ó   „ ñð €DØ.Ñr2   r   c                  ó   — e Zd ZdZdZeZy)r   z×Train an RF-DETR Segmentation Medium model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``; this variant uses multiples of 24.
    zrfdetr-seg-mediumN)r+   r,   r-   r.   r/   r   r0   r1   r2   r3   r   r     ó   „ ñð €DØ/Ñr2   r   c                  ó   — e Zd ZdZdZeZy)r   zÖTrain an RF-DETR Segmentation Large model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``; this variant uses multiples of 24.
    zrfdetr-seg-largeN)r+   r,   r-   r.   r/   r   r0   r1   r2   r3   r   r     rl   r2   r   c                  ó   — e Zd ZdZdZeZy)r   z×Train an RF-DETR Segmentation XLarge model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``; this variant uses multiples of 24.
    zrfdetr-seg-xlargeN)r+   r,   r-   r.   r/   r"   r0   r1   r2   r3   r   r   "  rn   r2   r   c                  ó   — e Zd ZdZdZeZy)r   zØTrain an RF-DETR Segmentation 2XLarge model.

    Training accepts custom square integer ``resolution`` values. The value must be divisible by ``patch_size *
    num_windows``; this variant uses multiples of 24.
    zrfdetr-seg-2xlargeN)r+   r,   r-   r.   r/   r   r0   r1   r2   r3   r   r   -  s   „ ñð  €DØ0Ñr2   r   ),r.   Ú
__future__r   Ú__all__Ú	deprecater   Úrfdetr.configr   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   Úrfdetr.detrr%   Úrfdetr.utilities.loggerr&   rX   r   r   r   r   r   r
   r	   r   r   r   r   r   r   r   r   r1   r2   r3   ú<module>rx      sQ  ðñõ #ò€õ$ '÷÷ ÷ ÷ õ õ& Ý .á	‹€ñ ØØØôô
+�ó +óð
+ô+�ô +ô	.˜Fô 	.ô,�&ô ,ô-�6ô -ñ ØØØôô
6˜Fó 6óð
6ôP9�&ô P9ôf2�ô 2ñ ØØØôô
1�yó 1óð
1ô.�Iô .ô/�Yô /ô0�iô 0ô/�Yô /ô0�iô 0ô1�yõ 1r2   