+
    œ°³j1  ã                   ó   € ^ RI t ^ RIHu Hu Ht ^RIHt ^RIH	t	 ^RI
HtHt ^RIHtHtHt ^RIHtHt ^RIHtHtHt ^RIHt ^R	IHt ]P8                  ! ]4      t]]! RR
7       ! R R]4      4       4       tR.t R# )é    N)ÚTorchvisionBackend)ÚBatchFeature)Úgroup_images_by_shapeÚreorder_images)ÚIMAGENET_DEFAULT_MEANÚIMAGENET_DEFAULT_STDÚSizeDict)ÚImagesKwargsÚUnpack)Úauto_docstringÚis_torchdynamo_compilingÚlogging)Ú
TensorType)Úrequires)Úbackendsc                   ó¦   a a€ ] tR t^&t o^t]t]tRRRR/t	RRRR/t
RtRtRtRtRtV3R lR ltV3R lR ltV3R	 lV 3R
 lltR tR tRtVtV ;t# )ÚSLANeXtImageProcessorÚheighti   ÚwidthTc                ó(   <€ V ^8„  d   QhRRRS[ RR/# )é   Úimageútorch.TensorÚsizeÚreturn)r	   )ÚformatÚ__classdict__s   "€Úu/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/slanext/image_processing_slanext.pyÚ__annotate__Ú"SLANeXtImageProcessor.__annotate__4   s3   ø€ ÷ @dñ @dàð@dñ ð@dð 
ñ	@dó    c                óÀ  € VP                   w  r4rVVP                  W4,          WV4      pVP                  p\        VP                  VP
                  4      \        WV4      ,          p\        WX,          4      p	\        Wh,          4      p
\        P                  ! V
\        P                  VR 7      pVR,           \        V4      \        V
4      ,          ,          R,
          pVP                  4       P                  \        P                  4      pWÍP                  4       ,
          p\        P                  ! V^ 8  \        P                  ! V4      V4      p\        P                  ! V^ 8  \        P                  ! V4      V4      p\        P                  ! WÖ^,
          8¬  \        P                   ! V4      V4      p\        P                  ! WÖ^,
          8¬  \        P"                  ! WÖ^,
          4      V4      pVR,          R,           P                  4       P                  \        P                  4      pRV,
          p\        P                  ! V	\        P                  VR 7      pVR,           \        V4      \        V	4      ,          ,          R,
          pVP                  4       P                  \        P                  4      pVVP                  4       ,
          p\        P                  ! V^ 8  \        P                  ! V4      V4      p\        P                  ! V^ 8  \        P                  ! V4      V4      p\        P                  ! VV^,
          8¬  \        P                   ! V4      V4      p\        P                  ! VV^,
          8¬  \        P"                  ! VV^,
          4      V4      pVR,          R,           P                  4       P                  \        P                  4      pRV,
          pVP%                  ^ ^ÿ4      P                  \        P&                  4      pVP                  \        P                  4      pVP)                  4       pV^,           P)                  4       pVP)                  4       pV^,           P)                  4       pVRVR,          VR,          3,          pVRVR,          VR,          3,          pVRVR,          VR,          3,          pVRVR,          VR,          3,          p VP                  ^V	^4      p!VP                  ^V	^4      p"VP                  ^^V
4      p#VP                  ^^V
4      p$V"V$V,          V#V,          ,           ,          V!V$V,          V#V ,          ,           ,          ,           p%V%R,           ^,	          p%V%P%                  ^ ^ÿ4      P                  \        P&                  4      p&V&P                  W4Wš4      P                  VP*                  R7      # ))ÚdtypeÚdeviceg      à?i   ºNNN)r#   )r%   N)Nr%   i    )ÚshapeÚviewr$   Úmaxr   r   ÚroundÚtorchÚarangeÚfloat32ÚfloatÚfloorÚtoÚint32ÚwhereÚ
zeros_likeÚ	ones_likeÚ	full_likeÚclampÚuint8Úlongr#   )'Úselfr   r   Ú
batch_sizeÚchannelsr   r   r$   ÚscaleÚtarget_heightÚtarget_widthÚ
target_colÚsrc_colÚsrc_col_floorÚsrc_col_fracÚweight_rightÚweight_leftÚ
target_rowÚsrc_rowÚsrc_row_floorÚsrc_row_fracÚweight_bottomÚ
weight_topÚimage_uint8Úimage_int32Úcol_leftÚ	col_rightÚrow_topÚ
row_bottomÚpixel_top_leftÚpixel_top_rightÚpixel_bottom_leftÚpixel_bottom_rightÚweight_bottom_3dÚweight_top_3dÚweight_right_3dÚweight_left_3dÚinterpÚresults'   &&&                                    r   Ú_resizeÚSLANeXtImageProcessor._resize4   s‚  € ð
 /4¯k©kÑ+ˆ
˜fØ—
‘
˜:Õ0°&Ó@ˆà—‘ˆä�D—K‘K §¡Ó,¬s°6Ó/AÕAˆÜ˜f�nÓ-ˆÜ˜U�]Ó+ˆä—\’\ ,´e·m±mÈFÔSˆ
Ø Õ#¬¨e«´u¸\Ó7JÕ(JÕKÈcÕQˆØŸ™›×*Ñ*¬5¯;©;Ó7ˆØ×!4Ñ!4Ó!6Õ6ˆä—{’{ =°1Ñ#4´e×6FÒ6FÀ|Ó6TÐVbÓcˆÜŸš M°AÑ$5´u×7GÒ7GÈÓ7VÐXeÓfˆÜ—{’{ =¸AµIÑ#=¼u¿ºÈ|Ó?\Ð^jÓkˆÜŸšØ Q�YÑ&¬¯ª¸ÈqÅyÓ(QÐS`ó
ˆð % tÕ+¨cÕ1×8Ñ8Ó:×=Ñ=¼e¿k¹kÓJˆØ˜\Õ)ˆä—\’\ -´u·}±}ÈVÔTˆ
Ø Õ#¬¨f«¼¸mÓ8LÕ(LÕMÐPSÕSˆØŸ™›×*Ñ*¬5¯;©;Ó7ˆØ ×!4Ñ!4Ó!6Õ6ˆÜ—{’{ =°1Ñ#4´e×6FÒ6FÀ|Ó6TÐVbÓcˆÜŸš M°AÑ$5´u×7GÒ7GÈÓ7VÐXeÓfˆÜ—{’{ =°F¸QµJÑ#>ÄÇÂÐP\Ó@]Ð_kÓlˆÜŸšØ˜V a�ZÑ'¬¯ª¸ÈÐQRÍ
Ó)SÐUbó
ˆð &¨Õ,¨sÕ2×9Ñ9Ó;×>Ñ>¼u¿{¹{ÓKˆØ˜MÕ)ˆ
à—k‘k ! SÓ)×,Ñ,¬U¯[©[Ó9ˆØ!—n‘n¤U§[¡[Ó1ˆØ ×%Ñ%Ó'ˆØ" QÕ&×,Ñ,Ó.ˆ	Ø×$Ñ$Ó&ˆØ# aÕ'×-Ñ-Ó/ˆ
à$ Q¨°Õ(8¸(À7Õ:KÐ%KÕLˆØ% a¨°Õ)9¸9ÀWÕ;MÐ&MÕNˆØ'¨¨:°gÕ+>ÀÈÕ@QÐ(QÕRÐØ(¨¨J°wÕ,?ÀÈ7ÕASÐ)SÕTÐà(×-Ñ-¨a°ÀÓBÐØ"Ÿ™¨¨=¸!Ó<ˆØ&×+Ñ+¨A¨q°,Ó?ˆØ$×)Ñ)¨!¨Q°Ó=ˆØØ˜^Õ+¨oÀÕ.OÕOõ
à Ð1BÕ BÀ_ÐWiÕEiÕ iÕjõkˆð ˜GÕ$¨Õ+ˆØ—‘˜a Ó%×(Ñ(¬¯©Ó5ˆà�{‰{˜:°ÓM×PÑPÐW\×WbÑWbÐPÓcÐcr!   c                 ó*  <€ V ^8„  d   QhRS[ R,          RS[RS[RRRS[RS[R	S[R
S[RS[RS[S[ S[,          ,          R,          RS[S[ S[,          ,          R,          RS[R,          RS[R,          RS[R,          RS[S[,          R,          RS[/# )r   Úimagesr   Ú	do_resizer   Úresamplez"tvF.InterpolationMode | int | NoneÚdo_center_cropÚ	crop_sizeÚ
do_rescaleÚrescale_factorÚdo_normalizeÚ
image_meanNÚ	image_stdÚdo_padÚpad_sizeÚdisable_groupingÚreturn_tensorsr   )ÚlistÚboolr	   r-   Ústrr   r   )r   r   s   "€r   r   r    v   sô   ø€ ÷ 0añ 0aá�^Õ$ð0añ ð0añ ð	0að
 7ð0añ ð0añ ð0añ ð0añ ð0añ ð0añ ™D¡�KÕ'¨$Õ.ð0añ ™4¡�;Õ&¨Õ-ð0añ �t•ð0añ ˜T•/ð0añ  �+ð0añ  ™jÕ(¨4Õ/ð!0añ$ 
ñ%0ar!   c           	     ó,  € Ve&   \        4       '       g   \        P                  R4       \        WR7      w  pp/ pVP	                  4        F&  w  ppV'       d   V P                  VVR7      pVVV&   K(  	  \        VV4      p\        VVR7      w  pp/ pVP	                  4        F9  w  ppV'       d   V P                  VV4      pV P                  VWxWšV4      pVVV&   K;  	  \        VV4      pV'       d   V P                  VWÞR7      p\        RV/VR7      # )Nz&Resampling is not supported in SLANeXt)ri   )r   r   )rh   ri   Úpixel_values)ÚdataÚtensor_type)r   ÚloggerÚwarning_oncer   ÚitemsrZ   r   Úcenter_cropÚrescale_and_normalizeÚpadr   )r8   r]   r^   r   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   ÚkwargsÚgrouped_imagesÚgrouped_images_indexÚresized_images_groupedr&   Ústacked_imagesÚresized_imagesÚprocessed_images_groupedÚprocessed_imagess   &&&&&&&&&&&&&&&&,        r   Ú_preprocessÚ!SLANeXtImageProcessor._preprocessv   s/  € ð& ÒÔ(@×(BÒ(BÜ×ÑÐ HÔIô 0EÀVÔ/oÑ,ˆÐ,Ø!#ÐØ%3×%9Ñ%9Ö%;Ñ!ˆE�>ßØ!%§¡°NÈ Ó!N�Ø,:Ð" 5Ó)ñ &<ô (Ð(>Ð@TÓUˆô 0EÀ^ÐfvÔ/wÑ,ˆÐ,Ø#%Ð Ø%3×%9Ñ%9Ö%;Ñ!ˆE�>ßØ!%×!1Ñ!1°.À)Ó!L�à!×7Ñ7Ø 
¸LÐV_óˆNð /=Ð$ UÓ+ñ &<ô *Ð*BÐDXÓYÐçØ#Ÿx™xÐ(8À8˜xÓoÐä .Ð2BÐ!CÐQ_Ô`Ð`r!   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# )r   rx   )r   r
   )r   r   s   "€r   r   r    ¨   s   ø€ ÷ ñ ¡©Õ!5ñ r!   c                óH   <€ \         SV `  ! R/ VB  V P                  4        R # )N© )ÚsuperÚ__init__Úinit_decoder)r8   rx   Ú	__class__s   &,€r   r†   ÚSLANeXtImageProcessor.__init__¨   s   ø€ Ü‰ÒÑ"˜6Ò"Ø×ÑÖr!   c                ó,  € . R	OpT\        ^4       Uu. uF  pRV^,            R2NK  	  up,          pT\        ^4       Uu. uF  pRV^,            R2NK  	  up,          pRV9  d   VP                  R4       RV9   d   VP                  R4       R.V,           R.,           p\        V4       UUu/ uF  w  r#W2bK	  	  uppV n        Wn        . R
OV n        V P                  R,          V n        V P                  R,          V n        R# u upi u upi u uppi )a•  
Initialize the decoder vocabulary for table structure recognition.

Builds a character dictionary mapping HTML table structure tokens (e.g., `<thead>`, `<tr>`, `<td>`, colspan/
rowspan attributes) to integer indices. The dictionary includes special `"sos"` (start-of-sequence) and
`"eos"` (end-of-sequence) tokens. Merged `<td></td>` tokens are used in place of standalone `<td>` tokens
when applicable.
ú<td>z
 colspan="Ú"z
 rowspan="ú	<td></td>ÚsosÚeosN)
z<thead>z</thead>z<tbody>z</tbody>z<tr>z</tr>r‹   ú<tdÚ>z</td>)r‹   r�   r�   )	ÚrangeÚappendÚremoveÚ	enumerateÚdictÚ	characterÚtd_tokenÚbos_idÚeos_id)r8   Údict_characterÚiÚchars   &   r   r‡   Ú"SLANeXtImageProcessor.init_decoder¬   sú   € ò
ˆð 	¼%À¼)ÓD¹)°Q˜Z¨¨A­ w¨aÓ0¹)ÑDÕDˆØ¼%À¼)ÓD¹)°Q˜Z¨¨A­ w¨aÓ0¹)ÑDÕDˆà˜nÔ,Ø×!Ñ! +Ô.Ø�^Ô#Ø×!Ñ! &Ô)à˜ >Õ1°U°GÕ;ˆÜ,5°nÔ,EÔFÑ,E¡ �T’WÑ,EÒFˆŒ	Ø'ŒÚ4ˆŒØ—i‘i Õ&ˆŒØ—i‘i Õ&ˆŽùò EùÚDùó Gs   “DÁ DÂ/Dc                óV  € VP                   V n        V P                  R,          p\        V P                  4      \        V P                  4      .p\        V P                  4      pVP                  ^R7      pVP                  ^R7      P                  p. pVP                  ^ ,          p\        V4       FÔ  p. p	. p
\        VP                  ^,          4       Fj  p\        WXV3,          4      pV^ 8”  d	   WÄ8X  d    MIWÃ9   d   K-  V P                  V,          pV	P                  V4       V
P                  W(V3,          4       Kl  	  VP                  V	4       \        P                  ! V
4      P                  4       P                  4       pKÖ  	  . ROV^ ,          ,           . RO,           pRVRX/# )a×  
Post-process the raw model outputs to decode the predicted table structure into an HTML token sequence.

Converts the model's predicted probability distributions over the structure vocabulary into a sequence of
HTML tokens representing the table structure. The decoded tokens are wrapped with `<html>`, `<body>`, and
`<table>` tags to form a complete HTML table structure.

Args:
    outputs ([`SLANeXtForTableRecognitionOutput`]):
        Raw outputs from the SLANeXt model. The `last_hidden_state` field contains the predicted probability
        distributions over the structure vocabulary at each decoding step, with shape
        `(batch_size, max_text_length, num_classes)`.

Returns:
    `dict`: A dictionary containing:
        - **structure** (`list[str]`): The predicted HTML table structure as a list of tokens, wrapped with
          `<html>`, `<body>`, and `<table>` tags.
        - **structure_score** (`float`): The mean confidence score across all predicted tokens.
:r   é   N)ÚdimÚ	structureÚstructure_score)z<html>z<body>z<table>)z</table>z</body>z</html>)Úlast_hidden_stateÚpredÚintr™   rš   Úargmaxr(   Úvaluesr&   r’   r—   r“   r*   ÚstackÚmeanÚitem)r8   ÚoutputsÚstructure_probsÚignored_tokensÚend_idxÚstructure_idxÚstructure_str_listr9   Úbatch_indexÚstructure_listÚ
score_listÚpositionÚchar_idxÚtextr£   r¢   s   &&              r   Úpost_process_table_recognitionÚ4SLANeXtImageProcessor.post_process_table_recognitionÐ   sq  € ð( ×-Ñ-ˆŒ	ØŸ)™) C�.ˆÜ˜dŸk™kÓ*¬C°·±Ó,<Ð=ˆÜ�d—k‘kÓ"ˆà'×.Ñ.°1Ð.Ó5ˆØ)×-Ñ-°!Ð-Ó4×;Ñ;ˆàÐØ"×(Ñ(¨Õ+ˆ
Ü  Ö,ˆKØˆNØˆJÜ! -×"5Ñ"5°aÕ"8Ö9�Ü˜}¸(Ð-BÕCÓD�Ø˜a”< HÔ$7ÙØÔ-ÙØ—~‘~ hÕ/�Ø×%Ñ% dÔ+Ø×!Ñ! /¸xÐ2GÕ"HÖIñ :ð ×%Ñ% nÔ5Ü#Ÿkšk¨*Ó5×:Ñ:Ó<×AÑAÓCŠOñ -ò 4Ð6HÈÕ6KÕKÒNpÕpˆ	Ø˜YÐ(9¸?ÐKÐKr!   )r™   r—   r–   rš   r¥   r˜   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r_   r   re   r   rf   r   rh   Údo_convert_rgbr^   rb   rd   rg   rZ   r€   r†   r‡   r¸   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)rˆ   r   s   @@r   r   r   &   sƒ   ù‡ € ð €HØ&€JØ$€IØ�c˜7 CÐ(€DØ˜#˜w¨Ð,€HØ€NØ€IØ€JØ€LØ€F÷@dð @d÷D0að 0a÷dó ò"'÷H.Lò .Lr!   r   )r*   )!r*   Ú$torchvision.transforms.v2.functionalÚ
transformsÚv2Ú
functionalÚtvFÚimage_processing_backendsr   Úimage_processing_utilsr   Úimage_transformsr   r   Úimage_utilsr   r   r	   Úprocessing_utilsr
   r   Úutilsr   r   r   Úutils.genericr   Úutils.import_utilsr   Ú
get_loggerrº   rr   r   Ú__all__r„   r!   r   Ú<module>rÑ      sz   ðó, ß 2Ó 2å ;Ý 2ß Eß PÑ Pß 4ß FÑ FÝ 'Ý *ð 
×	Ò	˜HÓ	%€ð Ù	�:ÔôVLÐ.ó VLó ó ðVLðr #Ð
#‚r!   