§
    ß©ºj5U  ã                  ó  — U d Z ddlmZ ddlZddlZddlmZmZ ddlm	Z	m
Z
 ddlmZ ddlmZmZmZmZmZmZ ddl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rddl"Z#ddl$m%Z% ddlm&Z& ddlm'Z( ed         Z)dddddœZ*de+d<    e	dd¬¦  «         G d„ d¦  «        ¦   «         Z, e	dd¬¦  «         G d„ d¦  «        ¦   «         Z- e	dd¬¦  «         G d„ d¦  «        ¦   «         Z.ee/ef         e/z  ej0        e/         z  ez  Z1de+d<    e	d¬¦  «         G d„ d¦  «        ¦   «         Z2edddddd d!ddd"œ	dNd8„¦   «         Z3edddddd d!dd9œdOd;„¦   «         Z3dddddd d!ddd"œ	dPd>„Z3dQd@„Z4dRdC„Z5dSdD„Z6dTdG„Z7dUdI„Z8dVdJ„Z9dWdK„Z:dXdM„Z;dS )Yu2  LRP / oLRP public surface.

Wraps the Rust ``vernier._core.optimal_lrp_*`` FFI entry points into a
single dispatching :func:`optimal_lrp` function plus the
:class:`LrpReport` / :class:`LrpPerClass` / :class:`LrpConfig` Python
dataclasses callers hold onto.

The Rust crate is the source of semantic truth (validated against the
numpy oracle at ``tests/python/oracle/lrp/oracle.py`` per ADR-0043);
this module is data conversion + dispatch only.

Per-kernel default thresholds come from ADR-0044 â€” they are mirrored
here as Python constants so callers reading
``optimal_lrp(...)`` need not chase the Rust source to know what
``tp_threshold=None`` resolves to. The defaults table in ADR-0044 is
the canonical home; if it changes there, change it here.

Partitioned LRP (ADR-0046 phase-1 follow-up): :func:`optimal_lrp`
accepts a ``manifest=`` keyword that routes through the per-kernel
``evaluate_*_partitioned_lrp`` FFI surfaces and returns a
:class:`PartitionedLrpReport` carrying the overall LRP report plus a
slices :class:`polars.DataFrame` keyed on ``(axis, value)``.
é    )ÚannotationsN)ÚMappingÚSequence)Ú	dataclassÚfield)Úcached_property)ÚTYPE_CHECKINGÚAnyÚLiteralÚNoReturnÚ	TypeAliasÚoverload)	Úevaluate_bbox_partitioned_lrpÚ!evaluate_boundary_partitioned_lrpÚ"evaluate_keypoints_partitioned_lrpÚevaluate_segm_partitioned_lrpÚlrp_default_tau_gridÚoptimal_lrp_bboxÚoptimal_lrp_boundaryÚoptimal_lrp_keypointsÚoptimal_lrp_segm)Úarrow_to_dataframe)Ú
ParityMode)ÚDetectionsInput)ÚCocoDataset)Ú_LrpReportDict)ÚbboxÚsegmÚboundaryÚ	keypointsg      à?zdict[KernelName, float]Ú_DEFAULT_TP_THRESHOLDT)ÚfrozenÚslotsc                  ó2   — e Zd ZU dZded<   ded<   ded<   dS )	Ú	LrpConfiguA  Resolved LRP configuration recorded on every :class:`LrpReport`.

    Mirrors :class:`vernier_core::lrp::LrpConfig` (see
    ``crates/vernier-core/src/lrp/mod.rs``). The fields carry the
    *resolved* values the call ran under â€” never ``None`` â€” so a
    report screenshot is self-describing per ADR-0044.

    ``tau_grid_len`` is the number of points in the tau grid (not the
    grid itself â€” that would inflate every report by 101 floats on the
    default path). Callers that need the grid back call
    :func:`default_tau_grid` or held onto their own override.
    ÚfloatÚtp_thresholdÚintÚtau_grid_lenÚ
KernelNameÚkernelN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__© ó    ú\/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/vernier/_lrp.pyr%   r%   M   sB   € € € € € € ðð ð ÐÐÑØÐÐÑØÐÐÑÐÐr2   r%   c                  óh   — e Zd ZU dZded<   ded<   ded<   ded<   ded<   ded	<   edd„¦   «         ZdS )ÚLrpPerClassuÌ  Per-class entry on an :class:`LrpReport`.

    Mirrors :class:`vernier_core::lrp::LrpPerClass`. Per ADR-0043,
    fields are ``float`` for classes with at least one TP at the
    optimal tau, ``float('nan')`` for the per-class-NaN states the
    oracle defines:

    - Classes with no positive (non-crowd / non-ignore) GTs report
      every field as ``NaN``. These are excluded from the headline
      means.
    - "All-FN" classes (positive GTs exist but no TP at any tau)
      report ``olrp = 1.0, tau = NaN, olrp_loc = NaN, olrp_fp = NaN
      or 0.0`` depending on whether any FPs surfaced, ``olrp_fn =
      1.0``. These ARE included in the headline mean â€” the worst-case
      is a real result, not missing data.

    The Rust side returns ``None`` for the missing states; this
    wrapper translates to ``NaN`` so the surface mirrors the oracle's
    output shape directly. Use :meth:`is_empty_class` to test for the
    "no positive GTs" state explicitly.
    r(   Úcategory_idr&   ÚolrpÚolrp_locÚolrp_fpÚolrp_fnÚtauÚreturnÚboolc                ó4   — t          j        | j        ¦  «        S )zN``True`` when this class has no positive GTs (all fields
        are ``NaN``).)ÚmathÚisnanr7   ©Úselfs    r3   Úis_empty_classzLrpPerClass.is_empty_class€   s   € õ Œz˜$œ)Ñ$Ô$Ð$r2   N)r<   r=   )r,   r-   r.   r/   r0   ÚpropertyrC   r1   r2   r3   r5   r5   a   sy   € € € € € € ðð ð, ÐÐÑØ€K€K�KØ€O€O�OØ€N€N�NØ€N€N�NØ€J€J�Jàð%ð %ð %ñ „Xð%ð %ð %r2   r5   c                  ór   — e Zd ZU dZded<   ded<   ded<   ded<   ded<   d	ed
<   ded<   edd„¦   «         ZdS )Ú	LrpReportu6  Output of an LRP pass â€” the headline numbers, per-class
    breakdown, and the resolved configuration.

    Mirrors :class:`vernier_core::lrp::LrpReport`. Per ADR-0043:

    - ``olrp`` is the **mean of per-class oLRP across classes with at
      least one positive GT.** All-FN classes (oLRP = 1.0) contribute
      to the mean; classes with no positive GTs do not.
    - ``loc`` / ``fp`` means are over classes with at least one TP at
      the optimal tau.
    - ``fn`` mean uses the same denominator as ``olrp`` â€” all-FN
      classes contribute their ``fn_rate = 1.0``.

    The per-class table is the actionable surface: each
    :class:`LrpPerClass` row carries the deployable :attr:`~LrpPerClass.tau`
    a practitioner would set on the model. The aggregated numbers are
    quick comparators between runs.
    r&   r7   ÚlocÚfpÚfnzlist[LrpPerClass]Ú	per_classr(   Ún_empty_classesr%   ÚconfigÚdúMapping[str, Any]r<   c                óØ  — |d         }|d         }g }|D ]œ}|                      t          t          |d         ¦  «        t          |d         ¦  «        t          |d         ¦  «        t          |d         ¦  «        t          |d         ¦  «        t          |d         ¦  «        ¬	¦  «        ¦  «         Œ� | t	          |d         ¦  «        t	          |d
         ¦  «        t	          |d         ¦  «        t	          |d         ¦  «        |t          |d         ¦  «        t          t	          |d         ¦  «        t          |d         ¦  «        t          |d         ¦  «        ¬¦  «        ¬¦  «        S )u”   Build an :class:`LrpReport` from the FFI dict.

        Internal helper â€” the supported construction path is
        :func:`optimal_lrp`.
        rL   rJ   r6   r7   r8   r9   r:   r;   )r6   r7   r8   r9   r:   r;   rG   rH   rI   rK   r'   r)   r+   )r'   r)   r+   )r7   rG   rH   rI   rJ   rK   rL   )Úappendr5   r(   Ú_opt_to_nanr&   r%   Ú_kernel_name)ÚclsrM   Úconfig_dÚper_class_rawrJ   Úentrys         r3   Ú
_from_dictzLrpReport._from_dict¤   s^  € ð �X”;ˆØ˜+œˆØ')ˆ	Ø"ð 
	ð 
	ˆEØ×ÒÝÝ # E¨-Ô$8Ñ 9Ô 9Ý$ U¨6¤]Ñ3Ô3Ý(¨¨zÔ):Ñ;Ô;Ý'¨¨iÔ(8Ñ9Ô9Ý'¨¨iÔ(8Ñ9Ô9Ý# E¨%¤LÑ1Ô1ðñ ô ñ	ô 	ð 	ð 	ð ˆsÝ�q˜”yÑ!Ô!Ý�a˜”h‘”Ý�Q�t”W‰~Œ~Ý�Q�t”W‰~Œ~ØÝ Ð"3Ô 4Ñ5Ô5ÝÝ" 8¨NÔ#;Ñ<Ô<Ý  ¨.Ô!9Ñ:Ô:Ý# H¨XÔ$6Ñ7Ô7ðñ ô ð
ñ 
ô 
ð 	
r2   N)rM   rN   r<   rF   )r,   r-   r.   r/   r0   ÚclassmethodrW   r1   r2   r3   rF   rF   ‡   sˆ   € € € € € € ðð ð& €K€K�KØ€J€J�JØ€I€I�IØ€I€I�IØ Ð Ð Ñ ØÐÐÑØÐÐÑàð 
ð  
ð  
ñ „[ð 
ð  
ð  
r2   rF   r   ÚLrpManifest)r"   c                  ón   — e Zd ZU dZded<   ded<   ded<    edd¬	¦  «        Zd
ed<   edd„¦   «         ZdS )ÚPartitionedLrpReporta³  Output of a partitioned :func:`optimal_lrp` call (ADR-0046).

    Carries an ``overall`` :class:`LrpReport` bit-identical to the
    un-partitioned call, plus a :attr:`slices` :class:`polars.DataFrame`
    with one row per ``(axis, value)`` cell in the partition. ``slices``
    is lazily materialized from the Arrow ``RecordBatch`` the FFI
    returns via the zero-copy PyCapsule path; pyarrow is the only
    runtime dependency.
    rF   Úoverallr(   Úoverall_n_imagesÚoverall_n_detectionsNF)ÚdefaultÚreprzobject | NoneÚ_slices_batchr<   úpl.DataFramec                ó,   — t          | j        d¦  «        S )zçOne row per ``(axis, value)`` partition cell, with the four
        headline LRP stats (``olrp``, ``olrp_loc``, ``olrp_fp``,
        ``olrp_fn``) as columns. Read via :mod:`polars` zero-copy from
        the underlying Arrow batch.Úslices)r   ra   rA   s    r3   rd   zPartitionedLrpReport.slicesæ   s   € õ " $Ô"4°hÑ?Ô?Ð?r2   )r<   rb   )	r,   r-   r.   r/   r0   r   ra   r   rd   r1   r2   r3   r[   r[   Ï   sŒ   € € € € € € ðð ð ÐÐÑàÐÐÑàÐÐÑð $) 5°¸EÐ#BÑ#BÔ#B€MÐBÐBÐBÑBàð@ð @ð @ñ „_ð@ð @ð @r2   r[   éd   Ú	correctedF)	Úiour'   Útau_gridÚmax_dets_per_imageÚuse_catsÚparity_modeÚcast_inputsÚmanifestÚ
cross_axesÚgtúbytes | CocoDatasetÚdtr   rg   Úobjectr'   úfloat | Nonerh   úSequence[float] | Noneri   r(   rj   r=   rk   r   rl   rm   ÚNonern   r<   c       	        ó   — d S ©Nr1   ©ro   rq   rg   r'   rh   ri   rj   rk   rl   rm   rn   s              r3   Úoptimal_lrpry   ï   s	   € ð �r2   )rg   r'   rh   ri   rj   rk   rl   rn   úSequence[Sequence[str]] | Nonec       	        ó   — d S rw   r1   rx   s              r3   ry   ry      s	   € ð ˜3r2   úLrpManifest | Noneú LrpReport | PartitionedLrpReportc       	        ó6  — t          |¦  «        }t          |¦  «        }|�|nt          |         }|�t          |¦  «        nt	          ¦   «         }|	�t          || ||||||||	|
¦  «        S t          || |||||||¦	  «	        }t                               |¦  «        S )uÂ  LRP / oLRP error decomposition (Oksuz et al., ECCV 2018; TPAMI 2021).

    Splits a detection model's performance into a single number (oLRP)
    plus three components â€” ``oLRP_Loc`` / ``oLRP_FP`` / ``oLRP_FN`` â€”
    minimised over a per-class confidence threshold ``tau``. The
    metric's headline deliverable is the *(number, threshold)* pair:
    ``tau`` is the deployable cutoff a practitioner would set on the
    model to get the reported behaviour.

    ``gt`` is the GT JSON bytes (the same shape pycocotools' ``COCO``
    constructor consumes) or a :class:`vernier.CocoDataset` handle
    (ADR-0020, ADR-0060). ``dt`` is anything
    :meth:`vernier.instance.Evaluator.evaluate` accepts: the detections
    JSON bytes (the shape ``COCO.loadRes`` consumes), columnar
    :class:`vernier.instance.Detections`, result dicts, or an ``(N, 7)`` matrix
    (ADR-0030, ADR-0057). The pair
    :func:`vernier.adapters.coco_inputs` returns is therefore read here
    unchanged (ADR-0064).

    A handle saves the GT JSON parse, and the mask kernels reuse and
    fill its per-annotation caches. A handle built by
    :meth:`vernier.CocoDataset.from_lvis_json` is refused: LRP has no
    LVIS federated disposition.

    ``cast_inputs`` converts array dtypes rather than refusing them,
    exactly as on :class:`vernier.instance.Evaluator`; it defaults to
    ``False`` and has no effect on the bytes route.

    ``iou`` selects the kernel: ``Bbox()`` (default), ``Segm()``,
    ``Boundary(dilation_ratio=...)``, or ``Keypoints(sigmas=...)``.
    Unlike TIDE (ADR-0024 deferral), LRP supports the keypoints kernel
    â€” per ADR-0045 the structural objections that deferred TIDE-on-OKS
    do not transfer.

    ``tp_threshold`` is the IoU/OKS floor above which a matched pair
    is a TP. ``None`` resolves to the per-kernel default from
    ADR-0044: ``0.5`` for every kernel.

    ``tau_grid`` is the confidence-threshold grid scanned for the
    argmin. ``None`` resolves to the canonical 101-point grid
    ``0.00, 0.01, ..., 1.00`` (per ADR-0044 â€” matches deployment
    granularity practitioners tune confidence cutoffs at).

    ``max_dets_per_image`` defaults to ``100`` (the largest rung of
    the standard COCO detection ladder). ``use_cats`` defaults to
    ``True`` (per-class evaluation); set ``False`` for class-agnostic
    decomposition.

    ``parity_mode`` follows :class:`vernier.Evaluator`. Note that LRP
    has no pycocotools analogue â€” per ADR-0043 the three-tier
    disposition model does NOT extend to this metric â€” but the flag
    is accepted because the underlying matching engine reads it for
    crowd / ignore semantics that both strict and corrected paths
    honour identically for the LRP-specific quirk set.

    ``manifest=`` opts into ADR-0046 partitioned LRP. Accepts a dict
    (canonical JSON-records shape), a file path (``.json``), or any
    object exposing the Arrow PyCapsule Interface. Returns a
    :class:`PartitionedLrpReport` whose ``.overall`` is bit-identical
    to the un-partitioned call and whose ``.slices`` is a
    :class:`polars.DataFrame` with one row per ``(axis, value)`` cell.
    ``cross_axes=`` opts joint cells in (per ADR-0046 Â§E2; marginals
    are the default).

    Returns an :class:`LrpReport` carrying the four aggregated
    numbers, the per-class breakdown (one row per class â€” including
    the deployable ``tau``), and the resolved :class:`LrpConfig` â€”
    or a :class:`PartitionedLrpReport` when ``manifest`` is supplied.
    )	Ú_resolve_iouÚ_kernel_forr!   ÚlistÚdefault_tau_gridÚ_dispatch_partitionedÚ	_dispatchrF   rW   )ro   rq   rg   r'   rh   ri   rj   rk   rl   rm   rn   Úiou_kindr+   Úresolved_tpÚresolved_gridÚraws                   r3   ry   ry     sÊ   € õf ˜CÑ Ô €HÝ˜Ñ"Ô"€FØ".Ð":�,�,Õ@UÐV\Ô@]€KØ3;Ð3G¥ h¡¤ ÕM]ÑM_ÔM_€MàÐÝ$ØØØØØØØØØØØñ
ô 
ð 	
õ ØØ
Ø
ØØØØØØñ
ô 
€Cõ ×Ò Ñ$Ô$Ð$r2   úlist[float]c                 ó8   — t          t          ¦   «         ¦  «        S )a`  Return the canonical 101-point tau grid from ADR-0044.

    The grid lives in :class:`vernier_core::lrp::LrpDefaults` and is
    surfaced through the FFI; this helper exists so callers wanting
    to inspect or override the default (e.g. ``tau_grid =
    optimal_lrp.default_tau_grid()[::5]``) can do so without reaching
    into private surfaces.
    )r�   r   r1   r2   r3   r‚   r‚   †  s   € õ Õ$Ñ&Ô&Ñ'Ô'Ð'r2   Úvaluer&   c                óB   — | €t          d¦  «        S t          | ¦  «        S )a'  Translate ``None`` (the FFI's "undefined" sentinel) to ``NaN``
    (the oracle's "undefined" sentinel). The Rust side uses
    ``Option<f64>`` because the dict layer is the language boundary;
    the user-facing surface uses ``NaN`` so per-class tables compare
    cleanly to oracle output.
    NÚnan)r&   ©r‹   s    r3   rQ   rQ   ’  s!   € ð €}Ý�U‰|Œ|ÐÝ�‰<Œ<Ðr2   c                ó*   — | €ddl m}  |¦   «         S | S )a  Late-bind ``iou=None`` to ``Bbox()``.

    Materialised inside the function rather than at the keyword
    default site to avoid a top-level import of :class:`vernier.Bbox`
    (circular import: ``vernier`` imports from ``vernier._lrp`` and
    vice versa).
    Nr   )ÚBbox)Úvernier.instancer�   )rg   r�   s     r3   r   r   ž  s+   € ð €{Ø)Ð)Ð)Ð)Ð)Ð)àˆt‰vŒvˆØ€Jr2   r…   r*   c                óœ   — ddl m}m}m}m} | x|d˜ x�\    dS  x|d˜ x�\    dS  x|d˜ x�\    dS  |d˜ x�\   dS  	 t          | ¦  «         dS )	z�Map a :data:`vernier.IouKind` instance to its lowercase
    :data:`KernelName`. Unlike TIDE this accepts ``Keypoints`` per
    ADR-0045.
    r   ©r�   ÚBoundaryÚ	KeypointsÚSegmr1   Nr   r   r   r    )r‘   r�   r”   r•   r–   Ú_reject_unknown_iou)r…   r�   r”   r•   r–   s        r3   r€   r€   ­  s«   € ð
 AÐ@Ð@Ð@Ð@Ð@Ð@Ð@Ð@Ð@Ð@Ð@à
ØˆTˆVˆVˆVˆV‰VˆVØ�6ð àˆTˆVˆVˆVˆV‰VˆVØ�6ð àˆXˆZˆZˆZˆZ‰ZˆZØ�:ð àˆ[ˆ[ˆ[ˆ[‰[Ø�;ð àÝ Ñ)Ô)Ð)Ð)Ð)r2   Ú_FFILrpReportDictc	                óR  — ddl m}	m}
m}m} |||||||f}| x|	d˜ x�\    t          |d|iŽS  x|d˜ x�\    t          |d|iŽS  x|
d˜ x�\  } t          g |¢|‘R d|iŽS  |d˜ x�2\  }d„ |                     ¦   «         D ¦   «         }t          g |¢|‘R d|iŽS  	 t          | ¦  «         dS )	z5Call the right ``vernier._core.optimal_lrp_*`` entry.r   r“   r1   Nrl   ©Údilation_ratio©Úsigmasc                óN   — i | ]"\  }}t          |¦  «        t          |¦  «        “Œ#S r1   ©r(   r�   ©Ú.0ÚkÚvs      r3   ú
<dictcomp>z_dispatch.<locals>.<dictcomp>ß  ó*   € Ð0\Ð0\Ð0\ÁTÀQÈµ°Q±´½¸a¹¼Ð0\Ð0\Ð0\r2   )r‘   r�   r”   r•   r–   r   r   r   Úitemsr   r—   )r…   ro   rq   rk   r'   rh   ri   rj   rl   r�   r”   r•   r–   ÚcommonÚrr�   Ú	sigma_maps                    r3   r„   r„   Á  sD  € ð AÐ@Ð@Ð@Ð@Ð@Ð@Ð@Ð@Ð@Ð@Ð@ð �"�k <°Ð;MÈxÐX€FØ
ØˆTˆVˆVˆVˆV‰VˆVÝ# VÐE¸ÐEÐEÐEð àˆTˆVˆVˆVˆV‰VˆVÝ# VÐE¸ÐEÐEÐEð à'ˆXÐ'Ð'Ð'Ð'Ñ' Q QÝ'ÐL¨ÐL°ÐLÐLÐLÀÐLÐLÐLð (àÐ%Ð%Ð%Ð%Ñ%˜fð 1]Ð0\ÈVÏ\Ê\É^Ì^Ð0\Ñ0\Ô0\ˆIÝ(ÐU¨&ÐU°)ÐUÐUÐUÈÐUÐUÐUð &ð Ý Ñ)Ô)Ð)Ð)Ð)r2   c                ó”  — ddl m}m}m}m} |
€dnd„ |
D ¦   «         }| x|d˜ x�\    t          |||||||||	|¬¦
  «
        }n� x|d˜ x�\    t          |||||||||	|¬¦
  «
        }ny x|d˜ x�\  } t          ||||||||||	|¬¦  «        }nS |d	˜ x�<\  }d
„ |                     ¦   «         D ¦   «         }t          ||||||||||	|¬¦  «        }n 	 t          | ¦  «         |j        }t                               |¦  «        }|                     ¦   «         }t          |t!          |j        ¦  «        t!          |j        ¦  «        |¬¦  «        S )z}Call the right ``vernier._core.evaluate_*_partitioned_lrp``
    entry and wrap the result in a :class:`PartitionedLrpReport`.r   r“   Nc                ó,   — g | ]}t          |¦  «        ‘ŒS r1   )r�   )r¡   Úaxess     r3   ú
<listcomp>z)_dispatch_partitioned.<locals>.<listcomp>ö  s   € Ð,OÐ,OÐ,O¸D­T°$©Z¬ZÐ,OÐ,OÐ,Or2   r1   )rk   r'   rh   ri   rj   rl   rm   rn   rš   )	rk   r'   rh   ri   rj   r›   rl   rm   rn   rœ   c                óN   — i | ]"\  }}t          |¦  «        t          |¦  «        “Œ#S r1   rŸ   r    s      r3   r¤   z)_dispatch_partitioned.<locals>.<dictcomp>"  r¥   r2   )	rk   r'   rh   ri   rj   r�   rl   rm   rn   )r\   r]   r^   ra   )r‘   r�   r”   r•   r–   r   r   r   r¦   r   r—   r\   rF   rW   Úslices_capsuler[   r(   r]   r^   )r…   ro   rq   rk   r'   rh   ri   rj   rl   rm   rn   r�   r”   r•   r–   ÚcrossÚprr¨   r�   r©   Úoverall_dictr\   Úslices_batchs                          r3   rƒ   rƒ   å  s  € ð AÐ@Ð@Ð@Ð@Ð@Ð@Ð@Ð@Ð@Ð@Ð@àÐ&ˆDˆDÐ,OÐ,OÀJÐ,OÑ,OÔ,O€Eà
ØˆTˆVˆVˆVˆV‰VˆVÝ.ØØØ'Ø)Ø!Ø#5Ø!Ø'Ø!Ø ðñ ô ˆBˆBð ð ˆTˆVˆVˆVˆV‰VˆVÝ.ØØØ'Ø)Ø!Ø#5Ø!Ø'Ø!Ø ðñ ô ˆBˆBð ð (ˆXÐ'Ð'Ð'Ð'Ñ' Q QÝ2ØØØ'Ø)Ø!Ø#5Ø!Ø Ø'Ø!Ø ðñ ô ˆBˆBð (ð Ð%Ð%Ð%Ð%Ñ%˜fØ0\Ð0\ÈVÏ\Ê\É^Ì^Ð0\Ñ0\Ô0\ˆIÝ3ØØØ'Ø)Ø!Ø#5Ø!Ø Ø'Ø!Ø ðñ ô ˆBˆBð &ð Ý Ñ)Ô)Ð)à”:€LÝ×"Ò" <Ñ0Ô0€GØ×$Ò$Ñ&Ô&€LÝØÝ˜RÔ0Ñ1Ô1Ý  Ô!8Ñ9Ô9Ø"ð	ñ ô ð r2   c                óp   — | xdk    r dS xdk    r dS xdk    r dS dk    rdS 	 t          d| ›d�¦  «        ‚)z1Narrow an arbitrary object to :data:`KernelName`.r   r   r   r    z(LRP FFI returned unexpected kernel name um   ; expected one of 'bbox' / 'segm' / 'boundary' / 'keypoints'. This is a vernier bug â€” please file an issue.)ÚRuntimeErrorrŽ   s    r3   rR   rR   >  sl   € à
ØˆVŠVˆVˆVØ�6ØˆVŠVˆVˆVØ�6ØˆZŠZˆZˆZØ�:ØŠ[ˆ[Ø�;ØÝð9¸5ð 9ð 9ð 9ñô ð r2   r   c                ó(   — t          d| ›d�¦  «        ‚)Nzunsupported iou kernel ud    for optimal_lrp; expected Bbox(), Segm(), Boundary(...), or Keypoints(...) â€” see vernier.IouKind.)Ú	TypeError)rg   s    r3   r—   r—   Q  s*   € Ý
ð	 #ð 	ð 	ð 	ñô ð r2   )ro   rp   rq   r   rg   rr   r'   rs   rh   rt   ri   r(   rj   r=   rk   r   rl   r=   rm   ru   rn   ru   r<   rF   )ro   rp   rq   r   rg   rr   r'   rs   rh   rt   ri   r(   rj   r=   rk   r   rl   r=   rm   rY   rn   rz   r<   r[   )ro   rp   rq   r   rg   rr   r'   rs   rh   rt   ri   r(   rj   r=   rk   r   rl   r=   rm   r|   rn   rz   r<   r}   )r<   r‰   )r‹   rs   r<   r&   )rg   rr   r<   rr   )r…   rr   r<   r*   )r…   rr   ro   rp   rq   r   rk   r   r'   r&   rh   r‰   ri   r(   rj   r=   rl   r=   r<   r˜   )r…   rr   ro   rp   rq   r   rk   r   r'   r&   rh   r‰   ri   r(   rj   r=   rl   r=   rm   rY   rn   rz   r<   r[   )r‹   rr   r<   r*   )rg   rr   r<   r   )<r/   Ú
__future__r   r?   ÚosÚcollections.abcr   r   Údataclassesr   r   Ú	functoolsr   Útypingr	   r
   r   r   r   r   Úvernier._corer   r   r   r   r   r   r   r   r   Úvernier._tablesr   Úvernier._typesr   ÚpolarsÚplÚvernier._array_typesr   r   r   r˜   r*   r!   r0   r%   r5   rF   ÚstrÚPathLikerY   r[   ry   r‚   rQ   r   r€   r„   rƒ   rR   r—   r1   r2   r3   ú<module>rÆ      s™  ððð ð ð0 #Ð "Ð "Ð "Ð "Ð "à €€€Ø 	€	€	€	Ø -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø %Ð %Ð %Ð %Ð %Ð %Ø MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ Mð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð /Ð .Ð .Ð .Ð .Ð .Ø %Ð %Ð %Ð %Ð %Ð %àð ØÐÐÐà4Ð4Ð4Ð4Ð4Ð4Ø)Ð)Ð)Ð)Ð)Ð)ðð ð ð ð ð ð Ð<Ô=€
ð ØØØð	2ð 2Ð ð ð ð ñ ð €�$˜dÐ#Ñ#Ô#ðð ð ð ð ñ ô ñ $Ô#ðð& €�$˜dÐ#Ñ#Ô#ð"%ð "%ð "%ð "%ð "%ñ "%ô "%ñ $Ô#ð"%ðJ €�$˜dÐ#Ñ#Ô#ð=
ð =
ð =
ð =
ð =
ñ =
ô =
ñ $Ô#ð=
ðH !  c Ô*¨SÑ0°2´;¸sÔ3CÑCÀcÑI€Ð IÐ IÐ IÑ Ið €�$ÐÑÔð@ð @ð @ð @ð @ñ @ô @ñ Ôð@ð> 
ð
 Ø!%Ø'+Ø!ØØ)ØØØðð ð ð ð ñ 
„ðð  
ð
 Ø!%Ø'+Ø!ØØ)Øà15ðð ð ð ð ñ 
„ðð( Ø!%Ø'+Ø!ØØ)ØØ#'Ø15ðr%ð r%ð r%ð r%ð r%ð r%ðj	(ð 	(ð 	(ð 	(ð	ð 	ð 	ð 	ðð ð ð ð*ð *ð *ð *ð(!*ð !*ð !*ð !*ðHVð Vð Vð Vðrð ð ð ð&ð ð ð ð ð r2   