Ë
    ëÓ^j->  ã                  ó  — U d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl	Z
ddlmZ ddlmZ ddlmZ dd	lmZ  e«       Z eed
e«      j,                  Zg d¢Zded<   g d¢Zded<   dd„Zdd„Zdd„Z	 d	 	 	 	 	 	 	 dd„Z	 d	 	 	 	 	 	 	 dd„Zy)a`  TFLite inference helpers for RF-DETR exported models.

These functions handle interpreter creation, image preprocessing, and decoding of detection and segmentation-mask
outputs without requiring PyTorch or the RF-DETR training stack: only ``tflite-runtime`` (or ``tensorflow``), ``numpy``,
``supervision``, and ``Pillow`` are needed at inference time.
é    )ÚannotationsN)ÚPath)ÚAny)ÚNDArray)ÚImage)Ú
Detections)Ú
get_loggerÚ
Resampling)g
×£p=
ß?gÉv¾Ÿ/Ý?g–C‹lçûÙ?zlist[float]Ú_IMAGENET_MEAN)gZd;ßOÍ?gyé&1¬Ì?gÍÌÌÌÌÌÌ?Ú_IMAGENET_STDc           	     óœ  — d}g }dD ]H  \  }}t        j                  t        «      5  t        t	        j
                  |«      |«      }	 ddd«        n |€'dj                  d„ |D «       «      }t        d|› d�«      ‚ |t        | «      ¬	«      }|j                  «        |j                  «       }|j                  «       }t        j                  d
|d   d   |d   d   j                  «       |D ],  }	t        j                  d|	d   |	j!                  dd«      «       Œ. |S # 1 sw Y   nxY w|j                  |j                  d«      d   «       �ŒG)aw  Load a TFLite model, allocate tensors, and log I/O shapes.

    Tries ``tflite_runtime`` first (lightweight; preferred on edge devices), then falls back to ``tensorflow.lite``
    (pre-installed on Colab / full TF environments).

    Args:
        model_path: Path to the ``.tflite`` model file.

    Returns:
        An allocated TFLite interpreter ready for inference.
    N))zai_edge_litert.interpreterÚInterpreter)ztflite_runtime.interpreterr   )ztensorflow.liter   ú.r   z, c              3  ó(   K  — | ]
  }d |› d �–— Œ y­w)ú'N© )Ú.0Úps     új/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/rfdetr/export/_tflite/inference.pyú	<genexpr>z&_create_interpreter.<locals>.<genexpr><   s   è ø€ Ò8¨A  1 # QœxÑ8ùs   ‚zVTFLite inference requires 'ai_edge_litert', 'tflite-runtime', or 'tensorflow' (tried: zN). Install one: `pip install ai_edge_litert`  OR  `pip install tflite-runtime`)Ú
model_pathzInput  : %s  %sÚshapeÚdtypezOutput : %s  name=%sÚnameú	<unnamed>)Ú
contextlibÚsuppressÚImportErrorÚgetattrÚ	importlibÚimport_moduleÚappendÚsplitÚjoinÚstrÚallocate_tensorsÚget_input_detailsÚget_output_detailsÚloggerÚdebugÚ__name__Úget)
r   Ú_InterpreterÚ_triedÚ_pkgÚ_attrÚ
_tried_strÚinterpÚinp_detÚout_detÚods
             r   Ú_create_interpreterr6   $   sX  € ð €LØ€Fðò *‰ˆˆeô
 × Ñ ¤Ó-ñ 	Ü"¤9×#:Ñ#:¸4Ó#@À%ÓHˆLØ÷	ñ 	ð*ð ÐØ—Y‘YÑ8°Ô8Ó8ˆ
ÜðØ!�lð #ZðZó
ð 	
ñ ¤S¨£_Ô5€FØ
×ÑÔØ×&Ñ&Ó(€GØ×'Ñ'Ó)€GÜ
‡L�LÐ" G¨A¡J¨wÑ$7¸À¹ÀGÑ9L×9UÑ9UÔVØò WˆÜ�‰Ð+¨R°©[¸"¿&¹&ÀÈÓ:UÕVðWà€M÷'	ð 	úð 	�‰�d—j‘j “o aÑ(Ö)s   ¦!DÄD&	c                ó  — | j                   d   | j                   d   }}t        j                  |t        j                  ¬«      dz   ||z  z  dz
  }t        j                  |t        j                  ¬«      dz   ||z  z  dz
  }t        j                  |d|dz
  «      }t        j                  |d|dz
  «      }t        j
                  |«      j                  t        j                  «      }t        j
                  |«      j                  t        j                  «      }t        j                  |dz   |dz
  «      }	t        j                  |dz   |dz
  «      }
||z
  dd…df   }||z
  ddd…f   }| d|dd…df   |ddd…f   f   }| d|dd…df   |
ddd…f   f   }| d|	dd…df   |ddd…f   f   }| d|	dd…df   |
ddd…f   f   }d|z
  d|z
  |z  ||z  z   z  |d|z
  |z  ||z  z   z  z   }t        j                  |t        j                  ¬«      S )	aL  Numpy bilinear resize matching ``F.interpolate(mode="bilinear", align_corners=False)``.

    Half-pixel center convention. Used by ``_decode_masks`` only when ``torch`` is not importable.

    Args:
        src: Source array of shape ``(K, src_h, src_w)``.
        out_h: Target height in pixels.
        out_w: Target width in pixels.

    Returns:
        Float32 array of shape ``(K, out_h, out_w)``.

    Note:
        Replaces ``PIL.Image.resize(BILINEAR)``, which uses a corner-aligned half-pixel convention and
        produced border-pixel discrepancies vs ``F.interpolate``.
    éþÿÿÿéÿÿÿÿ©r   g      à?ç        é   N.)
r   ÚnpÚarangeÚfloat32ÚclipÚfloorÚastypeÚint64ÚminimumÚasarray)ÚsrcÚout_hÚout_wÚsrc_hÚsrc_wÚsrc_yÚsrc_xÚy0Úx0Úy1Úx1ÚdyÚdxÚaÚbÚcÚdÚouts                     r   Ú_bilinear_resize_half_pixelrX   M   sö  € ð" —9‘9˜R‘= #§)¡)¨B¡-ˆ5€EÜ�Y‰Y�u¤B§J¡JÔ/°#Ñ5¸%À%¹-ÑHÈ3ÑN€EÜ�Y‰Y�u¤B§J¡JÔ/°#Ñ5¸%À%¹-ÑHÈ3ÑN€EÜ�G‰G�E˜3 ¨¡	Ó*€EÜ�G‰G�E˜3 ¨¡	Ó*€EÜ	�‰�%‹×	Ñ	¤§¡Ó	)€BÜ	�‰�%‹×	Ñ	¤§¡Ó	)€BÜ	�‰�B˜‘F˜E A™IÓ	&€BÜ	�‰�B˜‘F˜E A™IÓ	&€BØ
�"‰*’a˜�gÑ	€BØ
�"‰*�dšA�gÑ	€BØˆC�’A�t�G‘˜b ¢q ™kÐ)Ñ*€AØˆC�’A�t�G‘˜b ¢q ™kÐ)Ñ*€AØˆC�’A�t�G‘˜b ¢q ™kÐ)Ñ*€AØˆC�’A�t�G‘˜b ¢q ™kÐ)Ñ*€AØˆr‰6�q˜2‘v ‘l R¨!¡VÑ+Ñ
,¨r°a¸"±fÀ±\ÀBÈÁFÑ5JÑ/KÑ
K€CÜ�:‰:�c¤§¡Ô,Ð,ó    c                óæ  — | j                   dk7  rt        d| j                  › d�«      ‚|\  }}| j                  d   dk(  r(t        j                  d||ft        j
                  ¬«      S 	 ddl}ddlmc m	} |j                  «       5  |j                  | j                  t        j                  «      «      j                  d«      }|j                  |||fdd¬	«      }ddd«       t        j                   j#                  d«      j%                  «       t        j                  ¬«      }|d
kD  S # 1 sw Y   ŒPxY w# t&        $ r1 t)        | j                  t        j                  «      ||«      }Y |d
kD  S w xY w)aþ  Upsample mask logits to image size and threshold at zero.

    Matches ``PostProcess.forward``: bilinear upsample with ``align_corners=False`` followed by ``> 0``.
    Uses ``torch.nn.functional.interpolate`` when torch is importable for bit-exact parity, and falls
    back to the pure-NumPy ``_bilinear_resize_half_pixel`` otherwise.

    Args:
        mask_logits: Raw mask logits of shape ``(K, Hm, Wm)``.
        out_size: Target ``(width, height)`` in pixels.

    Returns:
        Boolean mask array of shape ``(K, height, width)``.

    Raises:
        ValueError: If *mask_logits* is not rank-3.

    Note:
        ``out_size`` follows PIL convention ``(width, height)``; the returned array uses
        NumPy/PyTorch convention ``(K, height, width)``.
    é   z4_decode_masks expects rank-3 (K, Hm, Wm); got shape za. This usually means the rank-4 mask-output heuristic in _run_inference matched the wrong tensor.r   r:   NÚbilinearF)ÚsizeÚmodeÚalign_cornersr;   )ÚndimÚ
ValueErrorr   r=   ÚzerosÚbool_ÚtorchÚtorch.nn.functionalÚnnÚ
functionalÚno_gradÚ
from_numpyrB   r?   Ú	unsqueezeÚinterpolaterE   ÚsqueezeÚnumpyr   rX   )Úmask_logitsÚout_sizeÚwidthÚheightrd   Ú_FÚtÚresizeds           r   Ú_decode_masksru   q   sW  € ð* ×Ñ˜1ÒÜØBÀ;×CTÑCTÐBUð Vnð nó
ð 	
ð �M€Eˆ6Ø×Ñ˜Ñ˜qÒ Ü�x‰x˜˜F EÐ*´"·(±(Ô;Ð;ð	]Ûß(Ð(à�]‰]‹_ñ 	^Ø× Ñ  ×!3Ñ!3´B·J±JÓ!?Ó@×JÑJÈ1ÓMˆAØ—‘˜q¨° ¸ZÐW\�Ó]ˆA÷	^ô (*§z¡z°!·)±)¸A³,×2DÑ2DÓ2FÌbÏjÉjÔ'Yˆð �S‰=Ð÷	^ð 	^ûô ò ]Ü-¨k×.@Ñ.@ÄÇÁÓ.LÈfÐV[Ó\‰Ø�S‰=Ðð]ús,   Á)D6 ÂAD*ÃA
D6 Ä*D3Ä/D6 Ä63E0Å/E0c                ó$  — |\  }}|dk(  rdnd}| j                  |«      }d}	 ddl}ddlmc m}	 |j                  «       5  |	j                  |«      }
|	j                  |
t        |«      «      }
t        |«      D �cg c]  }t        |dz     ‘Œ }}t        |«      D �cg c]  }t        |dz     ‘Œ }}|	j                  |
||«      }
ddd«       t        j                  
j                  d«      j!                  «       j#                  «       t        j$                  ¬«      }|�7t        j                  |j)                  dddd«      t        j$                  ¬«      S t        j*                  |j                  ||ft,        «      t        j$                  ¬«      d	z  }|j.                  dk(  r|dd…dd…t        j0                  f   }t        j*                  t        |«      D �cg c]  }t        |dz     ‘Œ c}t        j$                  ¬«      }t        j*                  t        |«      D �cg c]  }t        |dz     ‘Œ c}t        j$                  ¬«      }||z
  |z  t        j0                     S c c}w c c}w # 1 sw Y   �Œ©xY w# t&        $ r Y �Œhw xY wc c}w c c}w )
a!  Resize and ImageNet-normalise an image to match ``RFDETR.predict()``.

    Uses ``torchvision.transforms.functional`` when importable for bit-exact parity, and falls back
    to ``PIL.Image.resize`` with BILINEAR for torch-free deployments.

    Args:
        pil_img: Source PIL image at native resolution.
        hw: Target ``(height, width)`` from the interpreter's input shape.
        channels: Channel count (3 for RGB, 1 for grayscale).

    Returns:
        Float32 array of shape ``(1, height, width, channels)`` in NHWC.

    Note:
        The PIL fallback uses BILINEAR resize, which does not perfectly match PyTorch's ``F.resize``
        (different coordinate conventions). For bit-exact parity with ``RFDETR.predict()``, ensure
        ``torch`` and ``torchvision`` are importable.
    r<   ÚLÚRGBNr   r[   r:   é   g     ào@)Úconvertrd   Ú!torchvision.transforms.functionalÚ
transformsrg   rh   Ú	to_tensorÚresizeÚlistÚranger   r   Ú	normalizer=   rE   rj   Úcpurm   r?   r   Ú	transposeÚarrayÚ_PIL_BILINEARr`   Únewaxis)Úpil_imgÚhwÚchannelsrq   rp   Úpil_modeÚpil_rgbÚ
nchw_floatrd   rr   rs   ÚiÚ	mean_listÚstd_listÚarrÚmeanÚstds                    r   Ú_preprocess_imager“   ›   s
  € ð. �M€FˆEØ !’m‰s¨€HØ�o‰o˜hÓ'€Gà-1€Jðãß6Ð6à�]‰]‹_ñ 	5Ø—‘˜WÓ%ˆAØ—	‘	˜!œT "›XÓ&ˆAÜ8=¸h»ÖH°1œ¨¨A©Ó.ÐHˆIÐHÜ6;¸H³oÖF°œ a¨!¡eÓ,ÐFˆHÐFØ—‘˜Q 	¨8Ó4ˆA÷	5ô —Z‘Z §¡¨A£× 2Ñ 2Ó 4× :Ñ :Ó <ÄBÇJÁJÔOˆ
ð Ðä�z‰z˜*×.Ñ.¨q°!°Q¸Ó:Ä"Ç*Á*ÔMÐMô �(‰(�7—>‘> 5¨& /´=ÓAÌÏÉÔ
TÐW\Ñ
\€CØ
‡x�x�1‚}Ø’!’QœŸ
™
Ð"Ñ#ˆä�8‰8´E¸(³OÖD¨q”^ A¨¡EÓ*ÒDÌBÏJÉJÔW€DÜ
�(‰(´%¸³/ÖB¨Q”M ! a¡%Ó(ÒBÌ"Ï*É*Ô
U€Cà�4‰Z˜3Ñ¤§
¡
Ñ+Ð+ùò' IùÚF÷		5ñ 	5ûô ò Úðüò EùÚBsT   £I8 Á :I+Á:I!ÂI+ÂI&Â/I+ÃAI8 ÇJÈJÉ!
I+É+I5É0I8 É8	JÊJc           
     óÜ  — | j                  «       }| j                  «       }|d   d   \  }}}}t        j                  }	|d   d   }
|
|	k7  rt	        d|
j
                  › d�«      ‚t        j                  |«      }t        |t        |«      t        |«      ft        |«      «      }| j                  |d   d   |«       | j                  «        |D �cg c]  }t        |j                  dd«      «      ‘Œ }}t        d	„ t        |«      D «       d
«      }t        d„ t        |«      D «       d
«      }|�|�€t         j#                  d|«       t        |«      D ��cg c]%  \  }}t%        |d   «      dk(  sŒ|d   d   dk(  sŒ$|‘Œ' }}}t        |«      D ��cg c]%  \  }}t%        |d   «      dk(  sŒ|d   d   dk7  sŒ$|‘Œ' }}}t%        |«      dk(  rt%        |«      dk(  r|d   }|d   }nQt%        |«      dk(  rt         j#                  d«       d}d}n)|D �cg c]  }t'        |d   «      ‘Œ }}t	        d|› �«      ‚| j)                  ||   d   «      d   }t+        |j-                  «       «      dkD  st+        |j/                  «       «      dk  rqt         j#                  dt+        |j-                  «       «      | j)                  ||   d   «      j0                  d   dz
  «       ||}}| j)                  ||   d   «      d   }| j)                  ||   d   «      dd
d
…d
d…f   }t         j#                  d|j0                  t+        |j/                  «       «      t+        |j-                  «       «      t+        |j3                  «       «      «       t        j4                  d|j6                  ¬«      }||t        j8                  |j;                  dd«       «      z   z  }|j-                  d¬«      }|j=                  d¬«      }t         j#                  dt+        |j/                  «       «      t+        |j-                  «       «      |t        ||kD  j?                  «       «      «       ||kD  }||   j@                  \  }}}}|jB                  \  } }!t        jD                  ||dz  z
  ||dz  z
  ||dz  z   ||dz  z   gd¬«      }"|"t        jF                  | |!| |!gt        j                  ¬«      z  }"t        d„ t        |«      D «       d
«      }#|#€pt        |«      D ��cg c]  \  }}t%        |d   «      dk(  sŒ|‘Œ }$}}t%        |$«      dk(  r|$d   }#n-t%        |$«      dk\  rt         jI                  dt%        |$«      «       d
}%|#�;|jK                  «       r+| j)                  ||#   d   «      d   }&tM        |&|   | |!f«      }%tO        |"||   ||   jQ                  t        «      |%¬«      }'|'|fS c c}w c c}}w c c}}w c c}w c c}}w ) a   Preprocess one image, run TFLite inference, and decode detections.

    Reads input shape from the interpreter (NHWC ``float32``), resizes and normalises the image with ImageNet
    statistics, invokes the model, then decodes the ``dets`` / ``labels`` output tensors into a
    :class:`supervision.Detections` object with pixel-space ``xyxy`` boxes. For segmentation exports the ``masks``
    output is also decoded into ``Detections.mask``.

    Args:
        interp: Allocated TFLite interpreter returned by ``_create_interpreter``.
        image_path: Path to the input image (any format supported by Pillow).
        threshold: Confidence threshold; detections below this are discarded.

    Returns:
        A tuple of ``(detections, pil_img)`` where ``detections`` contains pixel-space ``xyxy`` boxes (and ``mask`` for
        segmentation models) and ``pil_img`` is the original PIL image at its original resolution.
    r   r   r   zF_run_inference only supports float32 input tensors, but model expects zV. Export the model with float32 quantization or implement input quantization manually.Úindexr   r   c              3  ób   K  — | ]'  \  }}d t        |j                  dd«      «      v sŒ$|–— Œ) y­w)Údetsr   Ú N©r%   r,   ©r   r�   r5   s      r   r   z!_run_inference.<locals>.<genexpr>ÿ   s-   è ø€ Ò]™E˜A˜r¸6ÄSÈÏÉÐPVÐXZÓI[ÓE\Ò;\”aÑ]ùó   ‚%/¨/Nc              3  ób   K  — | ]'  \  }}d t        |j                  dd«      «      v sŒ$|–— Œ) y­w)Úlabelsr   r˜   Nr™   rš   s      r   r   z!_run_inference.<locals>.<genexpr>   s-   è ø€ Ò`™U˜Q ¸HÌÈBÏFÉFÐSYÐ[]ÓL^ÓH_Ò<_”qÑ`ùr›   zXName-based output matching failed (available: %s). Falling back to shape-based matching.r[   r9   é   r<   ry   zKShape-based matching ambiguous. Using positional order (0=boxes, 1=logits).zµShape-based TFLite output matching failed. Expected exactly one rank-3 tensor with last dim == 4 (boxes) and one rank-3 tensor with last dim != 4 (logits). Available output shapes: g       @g       Àu…   Box tensor max=%.2f exceeds [0,1] â€” swapping boxes/logits assignment (num_classes==%d likely caused ambiguous positional fallback).z2Logits stats: shape=%s min=%.3f max=%.3f mean=%.3fr:   i¨ÿÿÿéX   )ÚaxisuG   Scores stats: min=%.3f max=%.3f â€” detections above threshold %.2f: %dc              3  ób   K  — | ]'  \  }}d t        |j                  dd«      «      v sŒ$|–— Œ) y­w)Úmasksr   r˜   Nr™   rš   s      r   r   z!_run_inference.<locals>.<genexpr>O  s-   è ø€ Ò]™5˜1˜b¸'ÄSÈÏÉÐPVÐXZÓI[ÓE\Ò:\”QÑ]ùr›   zyAmbiguous rank-4 outputs (%d candidates); skipping mask decode. Name your mask output to contain 'masks' to disambiguate.)ÚxyxyÚ
confidenceÚclass_idÚmask))r'   r(   r=   r?   ra   r+   ÚPILImageÚopenr“   ÚintÚ
set_tensorÚinvoker%   r,   ÚnextÚ	enumerater)   r*   Úlenr   Ú
get_tensorÚfloatÚmaxÚminr   r‘   rE   r   Úexpr@   ÚargmaxÚsumÚTr]   Ústackr„   ÚwarningÚanyru   r   rB   )(r2   Ú
image_pathÚ	thresholdr3   r4   Ú_rq   rp   r‰   Úexpected_dtypeÚactual_dtyper‡   Ú
inp_tensorr5   Úavailable_output_namesÚ	boxes_idxÚ
logits_idxr�   Úshape_boxes_candidatesÚshape_logits_candidatesÚavailable_shapesÚ	boxes_cwhÚlogitsÚoneÚ
scores_allÚscoresÚclsÚkeepÚcxÚcyÚbwÚbhÚowÚohr£   Úmask_idxÚrank4_candidatesr¢   Ú	raw_masksÚ
detectionss(                                           r   Ú_run_inferencer×   Õ   s×  € ð* ×&Ñ&Ó(€GØ×'Ñ'Ó)€GØ!(¨¡¨GÑ!4Ñ€A€vˆu�hä—Z‘Z€NØ˜1‘:˜gÑ&€LØ�~Ò%ÜØTÐUa×UjÑUjÐTkð lcð có
ð 	
ô
 �m‰m˜JÓ'€GÜ" 7¬S°«[¼#¸e»*Ð,EÄsÈ8Ã}ÓU€Jà
×Ñ�g˜a‘j Ñ)¨:Ô6Ø
‡M�M„Oð JQÖQÀ2œc "§&¡&¨°Ó"=Õ>ÐQÐÐQÜÑ]¤Y¨wÓ%7Ô]Ð_cÓd€IÜÑ`¤i°Ó&8Ô`ÐbfÓg€JØÐ˜JÑ.ô 	�‰ØfØ"ô	
ô 2;¸7Ó1C×!v©¨¨2ÄsÈ2ÈgÉ;ÓGWÐ[\ÓG\ÐacÐdkÑalÐmoÑapÐtuÓau¢!Ð!vÐÑ!vÜ2;¸GÓ2D×"w©¨¨BÌÈBÈwÉKÓHXÐ\]ÓH]ÐbdÐelÑbmÐnpÑbqÐuvÓbv¢1Ð"wÐÑ"wÜÐ%Ó&¨!Ò+´Ð4KÓ0LÐPQÒ0QØ.¨qÑ1ˆIØ0°Ñ3‰JÜ�‹\˜QÒô �L‰LÐfÔgØˆIØ‰Jà<CÖD°b¤ R¨¡[Õ 1ÐDÐÐDÜð,à,<Ð+=ð?óð ð
 ×!Ñ! '¨)Ñ"4°WÑ"=Ó>¸qÑA€Iô ˆY�]‰]‹_Ó Ò#¤u¨Y¯]©]«_Ó'=ÀÒ'DÜ�‰ðMä�)—-‘-“/Ó"Ø×Ñ˜g jÑ1°'Ñ:Ó;×AÑAÀ"ÑEÈÑIô		
ð !+¨I�:ˆ	Ø×%Ñ% g¨iÑ&8¸Ñ&AÓBÀ1ÑEˆ	ð ×Ñ˜w zÑ2°7Ñ;Ó<¸QÂÀ3ÀBÀ3¸YÑG€Fô ‡L�LØ<Ø�‰Üˆf�j‰j‹lÓÜˆf�j‰j‹lÓÜˆf�k‰k‹mÓôô �*‰*�Q˜fŸl™lÔ
+€CØ˜œbŸf™f f§k¡k°#°rÓ&:Ð%:Ó;Ñ;Ñ<€JØ�^‰^ ˆ^Ó$€FØ
×
Ñ
 Ð
Ó
$€CÜ
‡L�LØQÜˆf�j‰j‹lÓÜˆf�j‰j‹lÓØÜˆV�iÑ×$Ñ$Ó&Ó'ôð �IÑ€Dà˜t‘_×&Ñ&�N€BˆˆB�Ø�\‰\�F€BˆÜ�8‰8�R˜"˜q™&‘[ " r¨A¡v¡+¨r°B¸±F©{¸BÀÀaÁ¹KÐHÈqÔQ€DØŒB�H‰H�b˜"˜b "Ð%¬R¯Z©ZÔ8Ñ8€Dô Ñ]¤I¨gÓ$6Ô]Ð_cÓd€HØÐÜ+4°WÓ+=×W¡% ! RÄÀRÈÁ[ÓAQÐUVÓAVšAÐWÐÑWÜÐÓ  AÒ%Ø'¨Ñ*‰HÜÐ!Ó" aÒ'Ü�N‰NðLäÐ$Ó%ôð
 €EØÐ §¡¤
Ø×%Ñ% g¨hÑ&7¸Ñ&@ÓAÀ!ÑDˆ	Ü˜i¨™o°°B¨xÓ8ˆä °&¸±,ÈÈTÉ×IYÑIYÔZ]ÓI^ÐejÔk€JØ�wÐÐùòE Rùó "wùÛ"wùò  Eùót Xs<   Ã"WÅWÅ.WÅ:WÆWÆ)WÆ5WÈW#ÔW(ÔW()r   ú
str | PathÚreturnr   )rF   úNDArray[np.float32]rG   r©   rH   r©   rÙ   rÚ   )rn   zNDArray[Any]ro   útuple[int, int]rÙ   zNDArray[np.bool_])r[   )r‡   zPILImage.Imagerˆ   rÛ   r‰   r©   rÙ   rÚ   )g333333Ó?)r2   r   rº   rØ   r»   r°   rÙ   z!tuple[Detections, PILImage.Image]) Ú__doc__Ú
__future__r   r   r    Úpathlibr   Útypingr   rm   r=   Únumpy.typingr   ÚPILr   r§   Úsupervisionr   Úrfdetr.utilities.loggerr	   r)   r   ÚBILINEARr…   r   Ú__annotations__r   r6   rX   ru   r“   r×   r   rY   r   ú<module>ræ      sÏ   ðòõ #ã Û Ý Ý ã Ý  Ý !Ý "å .á	‹€ñ ˜ ,°Ó9×BÑB€â3€�Ó 3Ú2€ˆ{Ó 2ó&óR!-óH'ðZ ð7,Øð7,àð7,ð ð7,ð ó	7,ðz ðKØðKàðKð ðKð 'ô	KrY   