§
    ­¸jè  ã                  óD  — U d Z ddlmZ ddlmZ ddlmZ  eddh¦  «        Zde	d<    ed	d
h¦  «        Z
de	d<   e
 edh¦  «        z  ez  Zde	d<    eh d£¦  «        Zde	d<    eh d£¦  «        Zde	d<   d0d„Zddœd1d!„Zdd"œd2d$„Zd3d'„Zd4d)„Z G d*„ d+¦  «        Zd5d.„Zd/S )6z6Shared helpers for dataset augmentation configuration.é    )Úannotations)ÚCallable)ÚAnyÚD4ÚSquareSymmetryzfrozenset[str]ÚD4_ALIAS_NAMESÚHorizontalFlipÚTimeReverseÚHORIZONTAL_FLIP_ALIAS_NAMESÚFlipÚHFLIP_TRANSFORM_NAMES>   ÚOneOfÚSomeOfÚ
SequentialÚCONTAINER_TRANSFORM_NAMES>   ÚsizeÚimage_idÚ	orig_sizeÚIMAGE_LEVEL_TARGET_FIELDSÚargsr   Úinclude_keypointsÚboolÚreturnúlist[int] | Nonec               ó0   — |rt          | dg ¦  «        pg ndS )a  Resolve the ``keypoint_flip_pairs`` sentinel for augmentation-pipeline gating.

    ``None`` (not ``[]``) signals a detection pipeline to
    ``AlbumentationsWrapper.from_config``, which preserves horizontal-flip
    augmentations. A list (possibly empty) signals a keypoint pipeline; an empty
    list means "keypoint pipeline with no flip pairs defined", which strips hflip
    augmentations to prevent incorrect keypoint annotations. See #1243.

    Args:
        args: Argument namespace optionally carrying a ``keypoint_flip_pairs`` attribute.
        include_keypoints: Whether the augmentation config will be applied to keypoint data.

    Returns:
        ``None`` for detection-only pipelines, otherwise the resolved flip-pair
        list (possibly empty).
    Úkeypoint_flip_pairsN)Úgetattr)r   r   s     új/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/rfdetr/datasets/_aug_utils.pyÚresolve_keypoint_flip_pairsr       s'   € ð" @QÐZ�G�DÐ/°Ñ4Ô4Ð:¸øÐVZÐZó    T)Úeditable_configÚaug_nameÚstrÚwarnúCallable[..., None]r!   ÚNonec               ó4   — |rd| › d�nd} |d| |¦  «         dS )a  Emit the standard warning for a disabled keypoint horizontal flip.

    Args:
        aug_name: Name of the disabled flip transform, for the warning text.
        warn: Warning sink, typically ``logger.warning``.
        editable_config: Whether the caller has an ``aug_config`` object the flip
            transform can be removed from. The torchvision-native default pipeline
            (``aug_config=None``) builds ``RandomHorizontalFlip`` directly and has
            no such config to point the user at.
    zRemove 'z?' from your augmentation config or provide keypoint_flip_pairs.z)Provide keypoint_flip_pairs to enable it.z¬Keypoint pipeline: '%s' performs a horizontal flip but no keypoint flip pairs were configured. The transform has been disabled to prevent incorrect keypoint annotations. %sN© )r"   r$   r!   Úremedys       r   Ú_warn_keypoint_hflip_disabledr*   4   sR   € ð$ ð	9Ð\�8Ð\Ð\Ð\Ð\à8ð ð
 	€Dð	ð 	Øñô ð ð ð r    )r   Úconfigc               ó¦   — |s| S t          | t          ¦  «        rt          | |¬¦  «        S t          | t          ¦  «        rt	          | |¬¦  «        S | S )a   Drop horizontal-flip transforms from keypoint augmentation configs.

    The helper preserves the input config shape: dictionary configs return
    dictionaries, and ordered list configs return lists. Container transforms are
    filtered recursively so nested hflip entries cannot survive inside
    ``OneOf``, ``SomeOf``, or ``Sequential``.

    Args:
        config: Augmentation config accepted by RF-DETR augmentation builders.
        include_keypoints: Whether the config will be applied to keypoint data.
        warn: Warning sink, typically ``logger.warning``.

    Returns:
        A filtered augmentation config with keypoint-unsafe hflip entries removed.
    ©r$   )Ú
isinstanceÚlistÚ_filter_keypoint_hflip_entriesÚdictÚ_filter_keypoint_hflip_dict)r+   r   r$   s      r   Ú#filter_keypoint_hflip_augmentationsr3   R   sa   € ð* ð Øˆå�&�$ÑÔð AÝ-¨f¸4Ð@Ñ@Ô@Ð@å�&�$ÑÔð >Ý*¨6¸Ð=Ñ=Ô=Ð=à€Mr    Úentriesúlist[dict[str, Any]]c               óp  — g }| D ]°}t          |t          ¦  «        rt          |¦  «        dk    r|                     |¦  «         Œ@t	          t          |                     ¦   «         ¦  «        ¦  «        \  }}t          |||¬¦  «        }t          |t          ¦  «        rŒ™|                     ||i¦  «         Œ±|S )z/Filter ordered single-key augmentation entries.é   r-   )	r.   r1   ÚlenÚappendÚnextÚiterÚitemsÚ_filter_keypoint_hflip_itemÚ_DropAugmentation)r4   r$   Úfiltered_entriesÚentryr"   ÚparamsÚfiltered_paramss          r   r0   r0   s   s¼   € à-/ÐØð 	=ð 	=ˆÝ˜%¥Ñ&Ô&ð 	­#¨e©*¬*¸ª/¨/Ø×#Ò# EÑ*Ô*Ð*Øå¥ U§[¢[¡]¤]Ñ 3Ô 3Ñ4Ô4Ñˆ�&Ý5°hÀÈTÐRÑRÔRˆÝ�oÕ'8Ñ9Ô9ð 	ØØ×Ò ¨?Ð ;Ñ<Ô<Ð<Ð<ØÐr    údict[str, Any]c               ó˜   — i }|                       ¦   «         D ]2\  }}t          |||¬¦  «        }t          |t          ¦  «        rŒ-|||<   Œ3|S )z+Filter a mapping-style augmentation config.r-   )r<   r=   r.   r>   )r+   r$   Úfiltered_configr"   rA   rB   s         r   r2   r2   ƒ   s`   € à&(€OØ"ŸLšL™NœNð 4ð 4Ñˆ�&Ý5°hÀÈTÐRÑRÔRˆÝ�oÕ'8Ñ9Ô9ð 	ØØ$3ˆ˜Ñ!Ð!ØÐr    c                  ó   — e Zd ZdZdS )r>   z;Sentinel used when an augmentation entry should be removed.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r(   r    r   r>   r>   Ž   s   € € € € € ØEÐEÐEÐEr    r>   rA   úAny | _DropAugmentationc               óœ  — | t           v rt          | |¦  «         t          ¦   «         S | t          vr|S t	          |t
          ¦  «        r#t          ||¬¦  «        }|r|nt          ¦   «         S t	          |t          ¦  «        rd|vr|S |d         }t	          |t
          ¦  «        s|S t          ||¬¦  «        }|st          ¦   «         S i |¥d|i¥S )zCFilter one augmentation entry, recursing into supported containers.r-   Ú
transforms)r   r*   r>   r   r.   r/   r0   r1   )r"   rA   r$   Úfiltered_transformsrM   s        r   r=   r=   ’   sú   € ð Õ(Ð(Ð(Ý% h°Ñ5Ô5Ð5Ý Ñ"Ô"Ð"àÕ0Ð0Ð0Øˆå�&�$ÑÔð SÝ<¸VÈ$ÐOÑOÔOÐØ&9ÐRÐ"Ð"Õ?PÑ?RÔ?RÐRå�f�dÑ#Ô#ð  |¸6Ð'AÐ'AØˆà˜Ô%€JÝ�j¥$Ñ'Ô'ð Øˆå8¸È$ÐOÑOÔOÐØð #Ý Ñ"Ô"Ð"à8ˆfÐ8�lÐ$7Ð8Ð8Ð8r    N)r   r   r   r   r   r   )r"   r#   r$   r%   r!   r   r   r&   )r+   r   r   r   r$   r%   r   r   )r4   r5   r$   r%   r   r5   )r+   rC   r$   r%   r   rC   )r"   r#   rA   r   r$   r%   r   rK   )rJ   Ú
__future__r   Úcollections.abcr   Útypingr   Ú	frozensetr   Ú__annotations__r   r   r   r   r   r*   r3   r0   r2   r>   r=   r(   r    r   ú<module>rT      s×  ðð =Ð <Ð <à "Ð "Ð "Ð "Ð "Ð "à $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð ð "+ ¨DÐ2BÐ+CÑ!DÔ!D€Ð DÐ DÐ DÑ DØ.7¨iÐ9IÈ=Ð8YÑ.ZÔ.ZÐ Ð ZÐ ZÐ ZÑ Zð )DÀiÀiÐQWÐPXÑFYÔFYÑ(YÐ\jÑ(jÐ Ð jÐ jÐ jÑ jà,5¨IÐ6WÐ6WÐ6WÑ,XÔ,XÐ Ð XÐ XÐ XÑ Xð -6¨IÐ6WÐ6WÐ6WÑ,XÔ,XÐ Ð XÐ XÐ XÑ Xð[ð [ð [ð [ð0 !ð	ð ð ð ð ð ðB #ðð ð ð ð ð ðBð ð ð ð ð ð ð ðFð Fð Fð Fð Fñ Fô Fð Fð9ð 9ð 9ð 9ð 9ð 9r    