+
    QV-j±¢  ã                   ó²  € ^ RI t ^ RIt^ RIHt ^ RIHtHt ^ RIHt ^ RI	H
t
Ht ^ RIt^ RIt^RIHtHtHtHtHtHtHtHtHt ^RIHtHtHtHtHtHt ^RI H!t! ]! 4       '       d   ^ RI"t#^ RI$t#]#PJ                  PL                  t']! 4       '       dÀ   ^ R	I(H)t)H*t* ^ R
I+H,t, ^ RI-H.t. ]'P^                  ],P`                  ]'Pb                  ],Pb                  ]'Pd                  ],Pd                  ]'Pf                  ],Pf                  ]'Ph                  ],Ph                  ]'Pj                  ],Pj                  /t6]6Po                  4        U Uu/ uF  w  rWbK	  	  upp t8M/ t6/ t8]! 4       '       d   ^ RI9t9]Pt                  ! ];4      t<]R]Pz                  R]>R,          ]>]Pz                  ,          ]>R,          3,          t? ! R R]4      t@ ! R R]4      tA]B]C]D]C,          ]>]B,          ,          3,          tER tF ! R R]4      tGR tHR tIR R ltJR tKR tLR tMR R ltNRKR R lltORKR  R! lltPRKR" R# lltQR$ R% ltRRLR& R' lltSRLR( R) lltTRLR* R+ lltUR, R- ltVR. R/ ltW]@P°                  3R0 R1 lltYR2 R3 ltZR4 R5 lt[R6 R7 lt\R8 R9 lt]RLR: R; llt^]!! RMR<7      RLR= R> ll4       t_RLR? R@ llt`RNRA RB llta ! RC RD4      tbRE RF ltcRG RH ltd]! 4        ! RI RJ4      4       teR# u upp i )Oé    N)ÚIterable)Ú	dataclassÚfields)ÚBytesIO)ÚAnyÚUnion)	ÚExplicitEnumÚis_numpy_arrayÚis_torch_availableÚis_torch_tensorÚis_torchvision_availableÚis_vision_availableÚloggingÚrequires_backendsÚto_numpy)ÚIMAGENET_DEFAULT_MEANÚIMAGENET_DEFAULT_STDÚIMAGENET_STANDARD_MEANÚIMAGENET_STANDARD_STDÚOPENAI_CLIP_MEANÚOPENAI_CLIP_STD)Úrequires)ÚImageReadModeÚdecode_image)ÚInterpolationMode)Úpil_to_tensorúPIL.Image.Imageútorch.Tensorc                   ó   € ] tR t^UtRtRtRtR# )ÚChannelDimensionÚchannels_firstÚchannels_last© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__ÚFIRSTÚLASTÚ__static_attributes__r#   ó    Úi/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/transformers/image_utils.pyr    r    U   s   † Ø€EØ„Dr+   r    c                   ó   € ] tR t^ZtRtRtRtR# )ÚAnnotationFormatÚcoco_detectionÚcoco_panopticr#   N)r$   r%   r&   r'   ÚCOCO_DETECTIONÚCOCO_PANOPTICr*   r#   r+   r,   r.   r.   Z   s   † Ø%€NØ#„Mr+   r.   c                 ón   € \        4       ;'       d%    \        V \        P                  P                  4      # ©N)r   Ú
isinstanceÚPILÚImage©Úimgs   &r,   Úis_pil_imager:   b   s"   € ÜÓ ×EÐE¤Z°´S·Y±Y·_±_Ó%EÐEr+   c                   ó"   € ] tR t^ftRtRtRtRtR# )Ú	ImageTypeÚpillowÚtorchÚnumpyr#   N)r$   r%   r&   r'   r6   ÚTORCHÚNUMPYr*   r#   r+   r,   r<   r<   f   s   † Ø
€CØ€EØ„Er+   r<   c                 óö   € \        V 4      '       d   \        P                  # \        V 4      '       d   \        P                  # \        V 4      '       d   \        P                  # \        R \        V 4       24      h)zUnrecognized image type )	r:   r<   r6   r   r@   r
   rA   Ú
ValueErrorÚtype©Úimages   &r,   Úget_image_typerG   l   sX   € Ü�E×ÒÜ�}‰}ÐÜ�u×ÒÜ�‰ÐÜ�e×ÒÜ�‰ÐÜ
Ð/´°U³¨}Ð=Ó
>Ð>r+   c                 ód   € \        V 4      ;'       g    \        V 4      ;'       g    \        V 4      # r4   )r:   r
   r   r8   s   &r,   Úis_valid_imagerI   v   s'   € Ü˜Ó×KÐK¤¨sÓ 3×KÐK´ÀsÓ7KÐKr+   c                ó$   € V ^8„  d   QhR\         /# )é   Úimages)Úlist)Úformats   "r,   Ú__annotate__rO   z   s   € ÷ Eñ E¤Dñ Er+   c                 ó~   € T ;'       d5    \         ;QJ d    R  V  4       F  '       d   K   R# 	  R# ! R  V  4       4      # )c              3   ó8   "  € T F  p\        V4      x € K  	  R # 5ir4   )rI   )Ú.0rF   s   & r,   Ú	<genexpr>Ú*is_valid_list_of_images.<locals>.<genexpr>{   s   é € ÐD¹V°Eœ.¨×/Ð/»Vùó   ‚FT©Úall)rL   s   &r,   Úis_valid_list_of_imagesrX   z   s3   € Ø×DÐD—c“cÑD¹VÓD—c”cÐD’cÐD�cÑD¹VÓDÓDÐDr+   c                 ó~  € \        V ^ ,          \        4      '       d   V  UUu. uF  q F  q"NK  	  K  	  upp# \        V ^ ,          \        P                  4      '       d   \        P                  ! V ^ R7      # \        V ^ ,          \
        P                  4      '       d   \
        P                  ! V ^ R7      # R# u uppi )r   ©Úaxis)ÚdimN)r5   rM   ÚnpÚndarrayÚconcatenater>   ÚTensorÚcat)Ú
input_listÚsublistÚitems   &  r,   Úconcatenate_listre   ~   s‡   € Ü�*˜Q•-¤×&Ò&Ù$.ÔC¡J˜º7°4’¹7‘¡JÒCÐCÜ	�J˜q•M¤2§:¡:×	.Ò	.Ü�~Š~˜j¨qÔ1Ð1Ü	�J˜q•M¤5§<¡<×	0Ò	0Ü�yŠy˜¨Ô+Ð+ñ 
1ùó Ds   £B9c                 ó¢   € \        V \        \        34      '       d    V  F  p\        V4      '       d   K   R # 	  R# \	        V 4      '       g   R # R# )FT)r5   rM   ÚtupleÚvalid_imagesrI   )Úimgsr9   s   & r,   rh   rh   ‡   sC   € ä�$œœu˜×&Ò&ÛˆCÜ ×$Ô$Úñ ñ ô ˜D×!Ò!ÙÙr+   c                 ób   € \        V \        \        34      '       d   \        V ^ ,          4      # R# )r   F)r5   rM   rg   rI   r8   s   &r,   Ú
is_batchedrk   “   s%   € Ü�#œœe�}×%Ò%Ü˜c !�fÓ%Ð%Ùr+   c                óD   € V ^8„  d   QhR\         P                  R\        /# )rK   rF   Úreturn)r]   r^   Úbool)rN   s   "r,   rO   rO   ™   s   € ÷ 5ñ 5œ2Ÿ:™:ð 5¬$ñ 5r+   c                ó¸   € V P                   \        P                  8X  d   R# \        P                  ! V 4      ^ 8¬  ;'       d    \        P                  ! V 4      ^8*  # )zN
Checks to see whether the pixel values have already been rescaled to [0, 1].
F)Údtyper]   Úuint8ÚminÚmaxrE   s   &r,   Úis_scaled_imagert   ™   sA   € ð ‡{�{”b—h‘hÔÙô �6Š6�%‹=˜AÑ×4Ð4¤"§&¢&¨£-°1Ñ"4Ð4r+   c                óF   € V ^8„  d   QhR\         R\        \        ,          /# )rK   Úexpected_ndimsrm   )ÚintrM   Ú
ImageInput)rN   s   "r,   rO   rO   ¤   s   € ÷ #ñ #´ð #¼DÄÕ<Lñ #r+   c           	     ód  € \        V 4      '       d   V # \        V 4      '       d   V .# \        V 4      '       db   V P                  V^,           8X  d   \	        V 4      p V # V P                  V8X  d   V .p V # \        RV^,            RV RV P                   R24      h\        R\        V 4       R24      h)aê  
Ensure that the output is a list of images. If the input is a single image, it is converted to a list of length 1.
If the input is a batch of images, it is converted to a list of images.

Args:
    images (`ImageInput`):
        Image or batch of images to turn into a list of images.
    expected_ndims (`int`, *optional*, defaults to 3):
        Expected number of dimensions for a single input image. If the input image has a different number of
        dimensions, an error is raised.
z%Invalid image shape. Expected either z or z dimensions, but got z dimensions.z]Invalid image type. Expected either PIL.Image.Image, numpy.ndarray, or torch.Tensor, but got Ú.)rk   r:   rI   ÚndimrM   rC   rD   )rL   rv   s   &&r,   Úmake_list_of_imagesr|   ¤   sÎ   € ô �&×ÒØˆô �F×Òàˆxˆä�f×ÒØ�;‰;˜.¨1Õ,Ô,ä˜&“\ˆFð ˆð �[‰[˜NÔ*à�XˆFð ˆô	 Ø7¸ÈÕ8JÐ7KÈ4ÐP^ÐO_ð `Ø—K‘K�= ð.óð ô
 Ø
gÔhlÐmsÓhtÐguÐuvÐwóð r+   c                óh   € V ^8„  d   QhR\         \        ,          \        ,          R\        R\        /# ©rK   rL   rv   rm   ©rM   rx   rw   )rN   s   "r,   rO   rO   Ê   s5   € ÷ #Lñ #LÜ”ÕœzÕ)ð#Läð#Lô ñ#Lr+   c                óp  € \        V \        \        34      '       d�   \        ;QJ d    R V  4       F  '       d   K   RM	  RM! R V  4       4      '       dV   \        ;QJ d    R V  4       F  '       d   K   RM	  RM! R V  4       4      '       d   V  UUu. uF  q" F  q3NK  	  K  	  upp# \        V \        \        34      '       d~   \	        V 4      '       dm   \        V ^ ,          4      '       g   V ^ ,          P                  V8X  d   V # V ^ ,          P                  V^,           8X  d   V  UUu. uF  q" F  q3NK  	  K  	  upp# \        V 4      '       dI   \        V 4      '       g   V P                  V8X  d   V .# V P                  V^,           8X  d   \        V 4      # \        RV  24      hu uppi u uppi )a×  
Ensure that the output is a flat list of images. If the input is a single image, it is converted to a list of length 1.
If the input is a nested list of images, it is converted to a flat list of images.
Args:
    images (`Union[list[ImageInput], ImageInput]`):
        The input image.
    expected_ndims (`int`, *optional*, defaults to 3):
        The expected number of dimensions for a single input image.
Returns:
    list: A list of images or a 4d array of images.
c              3   óN   "  € T F  p\        V\        \        34      x € K  	  R # 5ir4   ©r5   rM   rg   ©rR   Úimages_is   & r,   rS   Ú+make_flat_list_of_images.<locals>.<genexpr>Ü   ó   é € ÐKÁF¸”
˜8¤d¬E ]×3Ð3ÃFùó   ‚#%FTc              3   óV   "  € T F  p\        V4      ;'       g    V'       * x € K!  	  R # 5ir4   ©rX   rƒ   s   & r,   rS   r…   Ý   ó%   é € ÐYÑRXÀhÔ'¨Ó1×AÐA¸´\ÔAÓRXùó   ‚)™)z*Could not make a flat list of images from ©	r5   rM   rg   rW   rX   r:   r{   rI   rC   )rL   rv   Úimg_listr9   s   &&  r,   Úmake_flat_list_of_imagesrŽ   Ê   sI  € ô" 	�6œD¤%˜=×)Ò)ß‹CÑKÁFÓK�C�CŠCÑKÁFÓK×KÒKß‹CÑYÑRXÓY�C�CŠCÑYÑRXÓY×YÒYá$*Ô?¡F˜²h¨s’±h‘¡FÒ?Ð?ä�&œ4¤˜-×(Ò(Ô-DÀV×-LÒ-LÜ˜˜q�	×"Ò" f¨Q¥i§n¡n¸Ô&FØˆMØ�!�9�>‰>˜^¨aÕ/Ô/Ù(.ÔC©˜Hº(°3’C¹(‘C©ÒCÐCä�f×ÒÜ˜×Ò 6§;¡;°.Ô#@Ø�8ˆOØ�;‰;˜.¨1Õ,Ô,Ü˜“<Ðä
ÐAÀ&ÀÐJÓ
KÐKùó @ùó Ds   ÂF,Ä/F2c                ó~   € V ^8„  d   QhR\         \        ,          \        ,          R\        R\         \        ,          /# r~   r   )rN   s   "r,   rO   rO   ð   s:   € ÷ $vñ $vÜ”ÕœzÕ)ð$väð$vô 
Œ*Õñ$vr+   c                ó0  € \        V \        \        34      '       dw   \        ;QJ d    R V  4       F  '       d   K   RM	  RM! R V  4       4      '       d=   \        ;QJ d    R V  4       F  '       d   K   RM	  RM! R V  4       4      '       d   V # \        V \        \        34      '       d   \	        V 4      '       dn   \        V ^ ,          4      '       g   V ^ ,          P                  V8X  d   V .# V ^ ,          P                  V^,           8X  d   V  Uu. uF  p\        V4      NK  	  up# \        V 4      '       dK   \        V 4      '       g   V P                  V8X  d   V ..# V P                  V^,           8X  d   \        V 4      .# \        R4      hu upi )aO  
Ensure that the output is a nested list of images.
Args:
    images (`Union[list[ImageInput], ImageInput]`):
        The input image.
    expected_ndims (`int`, *optional*, defaults to 3):
        The expected number of dimensions for a single input image.
Returns:
    list: A list of list of images or a list of 4d array of images.
c              3   óN   "  € T F  p\        V\        \        34      x € K  	  R # 5ir4   r‚   rƒ   s   & r,   rS   Ú-make_nested_list_of_images.<locals>.<genexpr>  r†   r‡   FTc              3   óV   "  € T F  p\        V4      ;'       g    V'       * x € K!  	  R # 5ir4   r‰   rƒ   s   & r,   rS   r’     rŠ   r‹   z]Invalid input type. Must be a single image, a list of images, or a list of batches of images.rŒ   )rL   rv   rF   s   && r,   Úmake_nested_list_of_imagesr”   ð   s*  € ô  	�6œD¤%˜=×)Ò)ß‹CÑKÁFÓK�C�CŠCÑKÁFÓK×KÒKß‹CÑYÑRXÓY�C�CŠCÑYÑRXÓY×YÒYàˆô �&œ4¤˜-×(Ò(Ô-DÀV×-LÒ-LÜ˜˜q�	×"Ò" f¨Q¥i§n¡n¸Ô&FØ�8ˆOØ�!�9�>‰>˜^¨aÕ/Ô/Ù-3Ó4©V E”D˜–K©VÑ4Ð4ô �f×ÒÜ˜×Ò 6§;¡;°.Ô#@Ø�H�:ÐØ�;‰;˜.¨1Õ,Ô,Ü˜“L�>Ð!ä
ÐtÓ
uÐuùò 5s   ÄFc                ó8   € V ^8„  d   QhR\         P                  /# ©rK   rm   )r]   r^   )rN   s   "r,   rO   rO     s   € ÷ ñ œ2Ÿ:™:ñ r+   c                 ó  € \        V 4      '       g   \        R \        V 4       24      h\        4       '       dA   \	        V \
        P                  P                  4      '       d   \        P                  ! V 4      # \        V 4      # )zInvalid image type: )
rI   rC   rD   r   r5   r6   r7   r]   Úarrayr   r8   s   &r,   Úto_numpy_arrayr™     sY   € Ü˜#×ÒÜÐ/´°S³	¨{Ð;Ó<Ð<ä×Ò¤¨C´·±·±×!AÒ!AÜ�xŠx˜‹}ÐÜ�C‹=Ðr+   c                óŽ   € V ^8„  d   QhR\         P                  R\        \        \        R3,          ,          R,          R\        /# )rK   rF   Únum_channels.Nrm   )r]   r^   rw   rg   r    )rN   s   "r,   rO   rO      s?   € ÷ $Añ $AÜ�:‰:ð$AÜ%(¬5´°c°­?Õ%:¸TÕ%Að$Aäñ$Ar+   c                ór  € Ve   TMRp\        V\        4      '       d   V3MTpV P                  ^8X  d   ^ ^r2MBV P                  ^8X  d   ^^r2M-V P                  ^8X  d   ^^r2M\        RV P                   24      hV P                  V,          V9   dL   V P                  V,          V9   d4   \
        P                  RV P                   R24       \        P                  # V P                  V,          V9   d   \        P                  # V P                  V,          V9   d   \        P                  # \        R4      h)a7  
Infers the channel dimension format of `image`.

Args:
    image (`np.ndarray`):
        The image to infer the channel dimension of.
    num_channels (`int` or `tuple[int, ...]`, *optional*, defaults to `(1, 3)`):
        The number of channels of the image.

Returns:
    The channel dimension of the image.
z(Unsupported number of image dimensions: z4The channel dimension is ambiguous. Got image shape zú. Assuming channels are the first dimension. Use the [input_data_format](https://huggingface.co/docs/transformers/main/internal/image_processing_utils#transformers.image_transforms.rescale.input_data_format) parameter to assign the channel dimension.z(Unable to infer channel dimension format©é   é   )
r5   rw   r{   rC   ÚshapeÚloggerÚwarningr    r(   r)   )rF   r›   Ú	first_dimÚlast_dims   &&  r,   Úinfer_channel_dimension_formatr¥      s  € ð $0Ò#;‘<À€LÜ&0°¼s×&CÒ&C�L‘?È€Là‡z�z�Q„Ø ‘8Ø	�‰�qŒØ ‘8Ø	�‰�qŒØ ‘8äÐCÀEÇJÁJÀ<ÐPÓQÐQà‡{�{�9Õ Ô-°%·+±+¸hÕ2GÈ<Ô2WÜ�‰ØBÀ5Ç;Á;À-ð  PJð  Kô	
ô  ×%Ñ%Ð%Ø	�‰�YÕ	 <Ô	/Ü×%Ñ%Ð%Ø	�‰�XÕ	 ,Ô	.Ü×$Ñ$Ð$Ü
Ð?Ó
@Ð@r+   c                ót   € V ^8„  d   QhR\         P                  R\        \        ,          R,          R\        /# )rK   rF   Úinput_data_formatNrm   )r]   r^   r    Ústrrw   )rN   s   "r,   rO   rO   G  s8   € ÷ Fñ F¤b§j¡jð FÔEUÔX[ÕE[Ð^bÕEbð FÔnqñ Fr+   c                óÜ   € Vf   \        V 4      pV\        P                  8X  d   V P                  ^,
          # V\        P                  8X  d   V P                  ^,
          # \        RV 24      h)ar  
Returns the channel dimension axis of the image.

Args:
    image (`np.ndarray`):
        The image to get the channel dimension axis of.
    input_data_format (`ChannelDimension` or `str`, *optional*):
        The channel dimension format of the image. If `None`, will infer the channel dimension from the image.

Returns:
    The channel dimension axis of the image.
úUnsupported data format: )r¥   r    r(   r{   r)   rC   )rF   r§   s   &&r,   Úget_channel_dimension_axisr«   G  sd   € ð Ò Ü:¸5ÓAÐØÔ,×2Ñ2Ô2Ø�z‰z˜A�~ÐØ	Ô.×3Ñ3Ô	3Ø�z‰z˜A�~ÐÜ
Ð0Ð1BÐ0CÐDÓ
EÐEr+   c                ó€   € V ^8„  d   QhR\         P                  R\        R,          R\        \        \        3,          /# )rK   rF   Úchannel_dimNrm   )r]   r^   r    rg   rw   )rN   s   "r,   rO   rO   ]  s=   € ÷ Dñ Dœ"Ÿ*™*ð DÔ3CÀdÕ3Jð DÔV[Ô\_ÔadÐ\dÕVeñ Dr+   c                ó(  € Vf   \        V 4      pV\        P                  8X  d'   V P                  R,          V P                  R,          3# V\        P                  8X  d'   V P                  R,          V P                  R,          3# \        RV 24      h)a]  
Returns the (height, width) dimensions of the image.

Args:
    image (`np.ndarray`):
        The image to get the dimensions of.
    channel_dim (`ChannelDimension`, *optional*):
        Which dimension the channel dimension is in. If `None`, will infer the channel dimension from the image.

Returns:
    A tuple of the image's height and width.
rª   éþÿÿÿéÿÿÿÿéýÿÿÿ)r¥   r    r(   r    r)   rC   )rF   r­   s   &&r,   Úget_image_sizer²   ]  s{   € ð ÒÜ4°UÓ;ˆàÔ&×,Ñ,Ô,Ø�{‰{˜2� §¡¨B¥Ð/Ð/Ø	Ô(×-Ñ-Ô	-Ø�{‰{˜2� §¡¨B¥Ð/Ð/äÐ4°[°MÐBÓCÐCr+   c          
      óŒ   € V ^8„  d   QhR\         \        \        3,          R\        R\        R\         \        \        3,          /# )rK   Ú
image_sizeÚ
max_heightÚ	max_widthrm   )rg   rw   )rN   s   "r,   rO   rO   u  s@   € ÷ !ñ !Ü”cœ3�h•ð!äð!ô ð!ô Œ3”ˆ8…_ñ	!r+   c                óŠ   € V w  r4W,          pW$,          p\        WV4      p\        W7,          4      p\        WG,          4      p	W‰3# )a“  
Computes the output image size given the input image and the maximum allowed height and width. Keep aspect ratio.
Important, even if image_height < max_height and image_width < max_width, the image will be resized
to at least one of the edges be equal to max_height or max_width.

For example:
    - input_size: (100, 200), max_height: 50, max_width: 50 -> output_size: (25, 50)
    - input_size: (100, 200), max_height: 200, max_width: 500 -> output_size: (200, 400)

Args:
    image_size (`tuple[int, int]`):
        The image to resize.
    max_height (`int`):
        The maximum allowed height.
    max_width (`int`):
        The maximum allowed width.
)rr   rw   )
r´   rµ   r¶   ÚheightÚwidthÚheight_scaleÚwidth_scaleÚ	min_scaleÚ
new_heightÚ	new_widths
   &&&       r,   Ú#get_image_size_for_max_height_widthr¿   u  sH   € ð, �M€FØÕ&€LØÕ#€KÜ�LÓ.€IÜ�VÕ'Ó(€JÜ�EÕ%Ó&€IØÐ Ð r+   c                ó\   € V ^8„  d   QhR\         \        ,          R\        \        ,          /# )rK   Úvaluesrm   )r   r   rM   )rN   s   "r,   rO   rO   ”  s"   € ÷ 8ñ 8œx¬�}ð 8´´cµñ 8r+   c                óP   € \        V !   Uu. uF  p\        V4      NK  	  up# u upi )zG
Return the maximum value across all indices of an iterable of values.
)Úziprs   )rÁ   Úvalues_is   & r,   Úmax_across_indicesrÅ   ”  s$   € ô +.¨vª,Ó7©,˜hŒC�ŽM©,Ñ7Ð7ùÒ7s   Œ#c                ó¬   € V ^8„  d   QhR\         \        R\        P                  3,          ,          R\        \
        ,          R\         \        ,          /# )rK   rL   r   r§   rm   )rM   r   r]   r^   r¨   r    rw   )rN   s   "r,   rO   rO   ›  sA   € ÷ #ñ #Ü”�~¤r§z¡zÐ1Õ2Õ3ð#ÜHKÔN^ÕH^ð#ä	Œ#…Yñ#r+   c                ó.  € V\         P                  8X  d+   \        V  Uu. uF  q"P                  NK  	  up4      w  r4pWE3# V\         P                  8X  d+   \        V  Uu. uF  q"P                  NK  	  up4      w  rEpWE3# \        RV 24      hu upi u upi )z@
Get the maximum height and width across all images in a batch.
z"Invalid channel dimension format: )r    r(   rÅ   r    r)   rC   )rL   r§   r9   Ú_rµ   r¶   s   &&    r,   Úget_max_height_widthrÉ   ›  sš   € ð Ô,×2Ñ2Ô2Ü#5ÉFÓ6SÉFÀS·y´yÉFÑ6SÓ#TÑ ˆ�yð
 Ð"Ð"ð	 
Ô.×3Ñ3Ô	3Ü#5ÉFÓ6SÉFÀS·y´yÉFÑ6SÓ#TÑ ˆ
˜qð Ð"Ð"ô Ð=Ð>OÐ=PÐQÓRÐRùò	 7Tùâ6Ss   ŸBÁBc                óh   € V ^8„  d   QhR\         \        \        \        ,          3,          R\        /# ©rK   Ú
annotationrm   ©Údictr¨   rM   rg   rn   )rN   s   "r,   rO   rO   ª  s(   € ÷ ñ ´4¼¼TÄE½\Ð8IÕ3Jð Ìtñ r+   c                 ó  € \        V \        4      '       do   R V 9   dh   RV 9   da   \        V R,          \        \        34      '       d>   \	        V R,          4      ^ 8X  g%   \        V R,          ^ ,          \        4      '       d   R# R# )Úimage_idÚannotationsTF©r5   rÎ   rM   rg   Úlen©rÌ   s   &r,   Ú"is_valid_annotation_coco_detectionrÕ   ª  si   € ä�:œt×$Ò$Ø˜*Ô$Ø˜ZÔ'Ü�z -Õ0´4¼°-×@Ò@ô �
˜=Õ)Ó*¨aÔ/´:¸jÈÕ>WÐXYÕ>ZÔ\`×3aÒ3añ Ùr+   c                óh   € V ^8„  d   QhR\         \        \        \        ,          3,          R\        /# rË   rÍ   )rN   s   "r,   rO   rO   ¹  s(   € ÷ ñ ´$´s¼DÄ5½LÐ7HÕ2Ið Ìdñ r+   c                 ó  € \        V \        4      '       dv   R V 9   do   RV 9   dh   RV 9   da   \        V R,          \        \        34      '       d>   \	        V R,          4      ^ 8X  g%   \        V R,          ^ ,          \        4      '       d   R# R# )rÐ   Úsegments_infoÚ	file_nameTFrÒ   rÔ   s   &r,   Ú!is_valid_annotation_coco_panopticrÚ   ¹  sq   € ä�:œt×$Ò$Ø˜*Ô$Ø˜zÔ)Ø˜:Ô%Ü�z /Õ2´T¼5°M×BÒBô �
˜?Õ+Ó,°Ô1´ZÀ
È?Õ@[Ð\]Õ@^Ô`d×5eÒ5eñ Ùr+   c                ó~   € V ^8„  d   QhR\         \        \        \        \        ,          3,          ,          R\
        /# ©rK   rÑ   rm   ©r   rÎ   r¨   rM   rg   rn   )rN   s   "r,   rO   rO   É  s2   € ÷ Oñ O´(¼4ÄÄTÌEÅ\Ð@QÕ;RÕ2Sð OÔX\ñ Or+   c                 ój   € \         ;QJ d    R  V  4       F  '       d   K   R# 	  R# ! R  V  4       4      # )c              3   ó8   "  € T F  p\        V4      x € K  	  R # 5ir4   )rÕ   ©rR   Úanns   & r,   rS   Ú3valid_coco_detection_annotations.<locals>.<genexpr>Ê  s   é € ÐNÁ+¸3Ô1°#×6Ð6Ã+ùrU   FTrV   ©rÑ   s   &r,   Ú valid_coco_detection_annotationsrä   É  s+   € ß‹3ÑNÁ+ÓN�3Œ3ÐNŠ3ÐNˆ3ÑNÁ+ÓNÓNÐNr+   c                ó~   € V ^8„  d   QhR\         \        \        \        \        ,          3,          ,          R\
        /# rÜ   rÝ   )rN   s   "r,   rO   rO   Í  s2   € ÷ Nñ N´¼$¼sÄDÌ5ÅLÐ?PÕ:QÕ1Rð NÔW[ñ Nr+   c                 ój   € \         ;QJ d    R  V  4       F  '       d   K   R# 	  R# ! R  V  4       4      # )c              3   ó8   "  € T F  p\        V4      x € K  	  R # 5ir4   )rÚ   rà   s   & r,   rS   Ú2valid_coco_panoptic_annotations.<locals>.<genexpr>Î  s   é € ÐMÁ¸#Ô0°×5Ð5ÃùrU   FTrV   rã   s   &r,   Úvalid_coco_panoptic_annotationsré   Í  s+   € ß‹3ÑMÁÓM�3Œ3ÐMŠ3ÐMˆ3ÑMÁÓMÓMÐMr+   c                ó\   € V ^8„  d   QhR\         \        R3,          R\        R,          RR/# )rK   rF   r   ÚtimeoutNrm   ©r   r¨   Úfloat)rN   s   "r,   rO   rO   Ñ  s5   € ÷ *ñ *Ü”Ð'Ð'Õ(ð*ä�T�\ð*ð ñ*r+   c           
     óÚ  € \        \        R.4       \        V \        4      '       Ed:   V P	                  R4      '       g   V P	                  R4      '       dJ   \
        P                  P                  \        \        P                  ! WRR7      P                  4      4      p M÷\        P                  P                  V 4      '       d!   \
        P                  P                  V 4      p M²V P	                  R4      '       d   V P                  R4      ^,          p  \         P"                  ! V P%                  4       4      p\
        P                  P                  \        V4      4      p M5\        V \
        P                  P                  4      '       g   \+        R4      h\
        P,                  P/                  V 4      p V P1                  R4      p V #   \&         d   p\)        RT  R	T 24      hR
p?ii ; i)a  
Loads `image` to a PIL Image.

Args:
    image (`str` or `PIL.Image.Image`):
        The image to convert to the PIL Image format.
    timeout (`float`, *optional*):
        The timeout value in seconds for the URL request.

Returns:
    `PIL.Image.Image`: A PIL Image.
Úvisionúhttp://úhttps://T©rë   Úfollow_redirectsúdata:image/Ú,ú’Incorrect image source. Must be a valid URL starting with `http://` or `https://`, a valid path to an image file, or a base64 encoded string. Got ú. Failed with NzuIncorrect format used for image. Should be an url linking to an image, a base64 string, a local path, or a PIL image.ÚRGB)r   Ú
load_imager5   r¨   Ú
startswithr6   r7   Úopenr   ÚhttpxÚgetÚcontentÚosÚpathÚisfileÚsplitÚbase64ÚdecodebytesÚencodeÚ	ExceptionrC   Ú	TypeErrorÚImageOpsÚexif_transposeÚconvert)rF   rë   Úb64Úes   &&  r,   rù   rù   Ñ  s„  € ô  ”j 8 *Ô-Ü�%œ×ÓØ×Ñ˜I×&Ò&¨%×*:Ñ*:¸:×*FÒ*Fô —I‘I—N‘N¤7¬5¯9ª9°UÐ^bÔ+c×+kÑ+kÓ#lÓm‰EÜ�W‰W�^‰^˜E×"Ò"Ü—I‘I—N‘N 5Ó)‰Eà×Ñ ×.Ò.ØŸ™ CÓ(¨Õ+�ðÜ×(Ò(¨¯©«Ó8�ÜŸ	™	Ÿ™¤w¨s£|Ó4‘ô
 ˜œsŸy™yŸ™×/Ò/Üð Dó
ð 	
ô �L‰L×'Ñ'¨Ó.€EØ�M‰M˜%Ó €EØ€Løô ô Ü ð ið  joð  ipð  p~ð  @ð  ~Að  Bóð ûðús   ÄAG	 Ç	G*ÇG%Ç%G*)Úbackendsc                ó\   € V ^8„  d   QhR\         \        R3,          R\        R,          RR/# )rK   rF   r   rë   Nrm   r   rì   )rN   s   "r,   rO   rO   ÿ  s5   € ÷ *
ñ *
Ü”Ð'Ð'Õ(ð*
ä�T�\ð*
ð ñ*
r+   c                ó,  € ^ RI p\        V \        4      '       Edi   V P                  R4      '       g   V P                  R4      '       de   \        P
                  ! WRR7      P                  pVP                  ! \        V4      VP                  R7      p\        V\        P                  R7      # \        P                  P                  V 4      '       d   \        V \        P                  R7      # V P                  R4      '       d   V P!                  R	4      ^,          p  \"        P$                  ! V P'                  4       4      pTP                  ! \        T4      TP                  R7      p\        T\        P                  R7      # \        V \,        P.                  P.                  4      '       d:   \,        P0                  P3                  V 4      p \5        V P7                  R4      4      # \9        R4      h  \(         d   p\+        R
T  RT 24      hRp?ii ; i)aP  
Loads `image` directly to a `torch.Tensor` using torchvision.

Args:
    image (`str` or `PIL.Image.Image`):
        The image to convert to the PIL Image format.
    timeout (`float`, *optional*):
        The timeout value in seconds for the URL request.

Returns:
    `torch.Tensor`: A `[C, H, W]` uint8 tensor in RGB channel order.
Nrð   rñ   Trò   )rp   )Úmoderô   rõ   rö   r÷   rø   z`Incorrect format used for image. Should be a URL, a local path, a base64 string, or a PIL image.)r>   r5   r¨   rú   rü   rý   rþ   Ú
frombufferÚ	bytearrayrq   r   r   rø   rÿ   r   r  r  r  r  r  r  rC   r6   r7   r  r	  r   r
  r  )rF   rë   r>   ÚrawÚbufr  s   &&    r,   Úload_image_as_tensorr  þ  s§  € ó" ä�%œ×ÓØ×Ñ˜I×&Ò&¨%×*:Ñ*:¸:×*FÒ*FÜ—)’)˜EÀTÔJ×RÑRˆCØ×"Ò"¤9¨S£>¸¿¹ÔEˆCÜ ¬-×*;Ñ*;Ô<Ð<Ü�W‰W�^‰^˜E×"Ò"Ü ¬M×,=Ñ,=Ô>Ð>à×Ñ ×.Ò.ØŸ™ CÓ(¨Õ+�ðÜ×(Ò(¨¯©«Ó8�ð
 ×"Ò"¤9¨S£>¸¿¹ÔEˆCÜ ¬-×*;Ñ*;Ô<Ð<Ü	�Eœ3Ÿ9™9Ÿ?™?×	+Ò	+Ü—‘×+Ñ+¨EÓ2ˆÜ˜UŸ]™]¨5Ó1Ó2Ð2äØnó
ð 	
øô ô Ü ð ið  joð  ipð  p~ð  @ð  ~Að  Bóð ûðús   Ä$G2 Ç2HÇ=HÈHc                óÎ   € V ^8„  d   QhR\         \        \        \        R3,          R\        R,          R\         R\        R,          \        \        R,          ,          3,          /# )rK   rL   r   rë   Nrm   )r   rM   rg   r¨   rí   )rN   s   "r,   rO   rO   ,  sU   € ÷ 3ñ 3Ü”$œœsÐ$5Ð5Õ6ð3ÜAFÈÅð3ä
ÐœdÐ#4Õ5´t¼DÐARÕ<SÕ7TÐTÕUñ3r+   c                ól  € \        V \        \        34      '       d~   \        V 4      '       dQ   \        V ^ ,          \        \        34      '       d.   V  UUu. uF  q" Uu. uF  p\	        W1R7      NK  	  upNK   	  upp# V  Uu. uF  p\	        W1R7      NK  	  up# \	        WR7      # u upi u uppi u upi )zýLoads images, handling different levels of nesting.

Args:
  images: A single image, a list of images, or a list of lists of images to load.
  timeout: Timeout for loading images.

Returns:
  A single image, a list of images, a list of lists of images.
)rë   )r5   rM   rg   rÓ   rù   )rL   rë   Úimage_grouprF   s   &&  r,   Úload_imagesr  ,  s�   € ô �&œ4¤˜-×(Ò(Üˆv�;Š;œ: f¨Q¥i´$¼°×?Ò?ÙekÔlÑekÐVaÀ[ÓQÁ[¸E”Z ×7Á[ÔQÑekÒlÐláDJÓKÁF¸5”J˜u×6ÁFÑKÐKä˜&Ô2Ð2ùò	 RùÓlùâKs   ÁB+ÁB&Á3B+ÂB1Â&B+c                ó@  € V ^8„  d   QhR\         R,          R\        R,          R\         R,          R\        \        \        ,          ,          R,          R\        \        \        ,          ,          R,          R\         R,          R\        \        \
        3,          \
        ,          R,          R	\         R,          R
\        \        \
        3,          R,          R\         R,          R\        \        \
        3,          R,          R\        RR\
        3,          R,          /# )rK   Ú
do_rescaleNÚrescale_factorÚdo_normalizeÚ
image_meanÚ	image_stdÚdo_padÚpad_sizeÚdo_center_cropÚ	crop_sizeÚ	do_resizeÚsizeÚresampleÚPILImageResamplingr   )rn   rí   rM   rÎ   r¨   rw   r   )rN   s   "r,   rO   rO   A  s  € ÷ +^ñ +^Ü�t•ð+^ä˜D•Lð+^ô ˜•+ð+^ô œœU�Õ# dÕ*ð	+^ô
 ”tœE•{Õ" TÕ)ð+^ô �4�Kð+^ô ”3œ�8�nœsÕ" TÕ)ð+^ô ˜4•Kð+^ô ”Cœ�H�~ Õ$ð+^ô �d�{ð+^ô Œs”Cˆx�.˜4Õ
ð+^ô Ð(Ð*=¼sÐBÕCÀdÕJñ+^r+   c                ó   € V '       d   Vf   \        R4      hV'       d   Vf   \        R4      hV'       d   Ve   Vf   \        R4      hV'       d   Vf   \        R4      hV	'       d   V
e   Vf   \        R4      hR# R# )ao  
Checks validity of typically used arguments in an `ImageProcessor` `preprocess` method.
Raises `ValueError` if arguments incompatibility is caught.
Many incompatibilities are model-specific. `do_pad` sometimes needs `size_divisor`,
sometimes `size_divisibility`, and sometimes `size`. New models and processors added should follow
existing arguments when possible.

Nz=`rescale_factor` must be specified if `do_rescale` is `True`.zgDepending on the model, `size_divisor` or `pad_size` or `size` must be specified if `do_pad` is `True`.zP`image_mean` and `image_std` must both be specified if `do_normalize` is `True`.z<`crop_size` must be specified if `do_center_crop` is `True`.zA`size` and `resample` must be specified if `do_resize` is `True`.)rC   )r  r  r  r  r  r   r!  r"  r#  r$  r%  r&  s   &&&&&&&&&&&&r,   Úvalidate_preprocess_argumentsr)  A  s‚   € ÷, �nÒ,ÜÐXÓYÐYç�(Ò"ô Øuó
ð 	
÷ ˜Ò+¨yÒ/@ÜÐkÓlÐlç˜)Ò+ÜÐWÓXÐXç˜$Ò*¨xÒ/CÜÐ\Ó]Ð]ñ 0D�yr+   c                   ó†   a € ] tR tRt o RtR tRR ltR tV 3R lR ltRR	 lt	R
 t
RR ltRR ltR tR tRR ltRtV tR# )ÚImageFeatureExtractionMixinio  z<
Mixin that contain utilities for preparing image features.
c                óÐ   € \        V\        P                  P                  \        P                  34      '       g,   \        V4      '       g   \        R \        V4       R24      hR# R# )z	Got type zU which is not supported, only `PIL.Image.Image`, `np.ndarray` and `torch.Tensor` are.N)r5   r6   r7   r]   r^   r   rC   rD   ©ÚselfrF   s   &&r,   Ú_ensure_format_supportedÚ4ImageFeatureExtractionMixin._ensure_format_supportedt  sW   € Ü˜%¤#§)¡)§/¡/´2·:±:Ð!>×?Ò?ÌÐX]×H^ÒH^ÜØœD ›K˜=ð )&ð &óð ñ I_Ñ?r+   Nc                ó  € V P                  V4       \        V4      '       d   VP                  4       p\        V\        P
                  4      '       d»   Vf,   \        VP                  ^ ,          \        P                  4      pVP                  ^8X  d,   VP                  ^ ,          R9   d   VP                  ^^^ 4      pV'       d
   V^ÿ,          pVP                  \        P                  4      p\        P                  P                  V4      # V# )aÚ  
Converts `image` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if
needed.

Args:
    image (`PIL.Image.Image` or `numpy.ndarray` or `torch.Tensor`):
        The image to convert to the PIL Image format.
    rescale (`bool`, *optional*):
        Whether or not to apply the scaling factor (to make pixel values integers between 0 and 255). Will
        default to `True` if the image type is a floating type, `False` otherwise.
r�   )r/  r   r?   r5   r]   r^   ÚflatÚfloatingr{   r    Ú	transposeÚastyperq   r6   r7   Ú	fromarray)r.  rF   Úrescales   &&&r,   Úto_pil_imageÚ(ImageFeatureExtractionMixin.to_pil_image{  sº   € ð 	×%Ñ% eÔ,ä˜5×!Ò!Ø—K‘K“MˆEä�eœRŸZ™Z×(Ò(ØŠä$ U§Z¡Z°¥]´B·K±KÓ@�à�z‰z˜QŒ 5§;¡;¨q¥>°VÔ#;ØŸ™¨¨1¨aÓ0�ßØ ��Ø—L‘L¤§¡Ó*ˆEÜ—9‘9×&Ñ& uÓ-Ð-Øˆr+   c                óž   € V P                  V4       \        V\        P                  P                  4      '       g   V# VP	                  R4      # )zo
Converts `PIL.Image.Image` to RGB format.

Args:
    image (`PIL.Image.Image`):
        The image to convert.
rø   )r/  r5   r6   r7   r
  r-  s   &&r,   Úconvert_rgbÚ'ImageFeatureExtractionMixin.convert_rgb™  s;   € ð 	×%Ñ% eÔ,Ü˜%¤§¡§¡×1Ò1ØˆLà�}‰}˜UÓ#Ð#r+   c                ód   <€ V ^8„  d   QhRS[ P                  RS[S[,          RS[ P                  /# )rK   rF   Úscalerm   )r]   r^   rí   rw   )rN   Ú__classdict__s   "€r,   rO   Ú(ImageFeatureExtractionMixin.__annotate__§  s.   ø€ ÷ ñ ™RŸZ™Zð ±¹µð ÁÇ
Á
ñ r+   c                ó4   € V P                  V4       W,          # )z'
Rescale a numpy image by scale amount
)r/  )r.  rF   r>  s   &&&r,   r7  Ú#ImageFeatureExtractionMixin.rescale§  s   € ð 	×%Ñ% eÔ,Ø�}Ðr+   c                ó  € V P                  V4       \        V\        P                  P                  4      '       d   \        P
                  ! V4      p\        V4      '       d   VP                  4       pVf,   \        VP                  ^ ,          \        P                  4      MTpV'       d0   V P                  VP                  \        P                  4      R4      pV'       d%   VP                  ^8X  d   VP                  ^^ ^4      pV# )a{  
Converts `image` to a numpy array. Optionally rescales it and puts the channel dimension as the first
dimension.

Args:
    image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`):
        The image to convert to a NumPy array.
    rescale (`bool`, *optional*):
        Whether or not to apply the scaling factor (to make pixel values floats between 0. and 1.). Will
        default to `True` if the image is a PIL Image or an array/tensor of integers, `False` otherwise.
    channel_first (`bool`, *optional*, defaults to `True`):
        Whether or not to permute the dimensions of the image to put the channel dimension first.
çp?)r/  r5   r6   r7   r]   r˜   r   r?   r2  Úintegerr7  r5  Úfloat32r{   r4  )r.  rF   r7  Úchannel_firsts   &&&&r,   r™   Ú*ImageFeatureExtractionMixin.to_numpy_array®  s­   € ð 	×%Ñ% eÔ,ä�eœSŸY™YŸ_™_×-Ò-Ü—H’H˜U“OˆEä˜5×!Ò!Ø—K‘K“MˆEà;Bº?”*˜UŸZ™Z¨�]¬B¯J©JÔ7ÐPWˆçØ—L‘L §¡¬b¯j©jÓ!9¸9ÓEˆEç˜UŸZ™Z¨1œ_Ø—O‘O A q¨!Ó,ˆEàˆr+   c                óø   € V P                  V4       \        V\        P                  P                  4      '       d   V# \	        V4      '       d   VP                  ^ 4      pV# \        P                  ! V^ R7      pV# )z•
Expands 2-dimensional `image` to 3 dimensions.

Args:
    image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`):
        The image to expand.
rZ   )r/  r5   r6   r7   r   Ú	unsqueezer]   Úexpand_dimsr-  s   &&r,   rK  Ú'ImageFeatureExtractionMixin.expand_dimsÎ  se   € ð 	×%Ñ% eÔ,ô �eœSŸY™YŸ_™_×-Ò-ØˆLä˜5×!Ò!Ø—O‘O AÓ&ˆEð ˆô —N’N 5¨qÔ1ˆEØˆr+   c                ó„  € V P                  V4       \        V\        P                  P                  4      '       d   V P	                  VRR7      pM‰V'       d‚   \        V\
        P                  4      '       d1   V P                  VP                  \
        P                  4      R4      pM1\        V4      '       d!   V P                  VP                  4       R4      p\        V\
        P                  4      '       d    \        V\
        P                  4      '       g0   \
        P                  ! V4      P                  VP                  4      p\        V\
        P                  4      '       g0   \
        P                  ! V4      P                  VP                  4      pMÕ\        V4      '       dÅ   ^ RIp\        W%P                  4      '       gF   \        V\
        P                  4      '       d   VP                   ! V4      pMVP"                  ! V4      p\        W5P                  4      '       gF   \        V\
        P                  4      '       d   VP                   ! V4      pMVP"                  ! V4      pVP$                  ^8X  d6   VP&                  ^ ,          R9   d   WR,          ,
          VR,          ,          # W,
          V,          # )a¥  
Normalizes `image` with `mean` and `std`. Note that this will trigger a conversion of `image` to a NumPy array
if it's a PIL Image.

Args:
    image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`):
        The image to normalize.
    mean (`list[float]` or `np.ndarray` or `torch.Tensor`):
        The mean (per channel) to use for normalization.
    std (`list[float]` or `np.ndarray` or `torch.Tensor`):
        The standard deviation (per channel) to use for normalization.
    rescale (`bool`, *optional*, defaults to `False`):
        Whether or not to rescale the image to be between 0 and 1. If a PIL image is provided, scaling will
        happen automatically.
T)r7  NrD  r�   )ºNNNNN)r/  r5   r6   r7   r™   r]   r^   r7  r5  rF  r   rí   r˜   rp   r>   r`   Ú
from_numpyÚtensorr{   r    )r.  rF   ÚmeanÚstdr7  r>   s   &&&&& r,   Ú	normalizeÚ%ImageFeatureExtractionMixin.normalizeâ  sÅ  € ð  	×%Ñ% eÔ,ä�eœSŸY™YŸ_™_×-Ò-Ø×'Ñ'¨°tÐ'Ó<‰E÷ Ü˜%¤§¡×,Ò,ØŸ™ U§\¡\´"·*±*Ó%=¸yÓI‘Ü  ×'Ò'ØŸ™ U§[¡[£]°IÓ>�ä�eœRŸZ™Z×(Ò(Ü˜d¤B§J¡J×/Ò/Ü—x’x “~×,Ñ,¨U¯[©[Ó9�Ü˜c¤2§:¡:×.Ò.Ü—h’h˜s“m×*Ñ*¨5¯;©;Ó7�øÜ˜U×#Ò#Ûä˜d§L¡L×1Ò1Ü˜d¤B§J¡J×/Ò/Ø ×+Ò+¨DÓ1‘Dà Ÿ<š<¨Ó-�DÜ˜c§<¡<×0Ò0Ü˜c¤2§:¡:×.Ò.Ø×*Ò*¨3Ó/‘CàŸ,š, sÓ+�Cà�:‰:˜Œ?˜uŸ{™{¨1�~°Ô7Ø Õ/Õ/°3°}Õ3EÕEÐEà•L CÕ'Ð'r+   c                ó(  € Ve   TM\         P                  pV P                  V4       \        V\        P
                  P
                  4      '       g   V P                  V4      p\        V\        4      '       d   \        V4      p\        V\        4      '       g   \        V4      ^8X  dÙ   V'       d-   \        V\        4      '       d   W"3MV^ ,          V^ ,          3pM¤VP                  w  rgWg8:  d   Wg3MWv3w  r‰\        V\        4      '       d   TMV^ ,          p
WŠ8X  d   V# T
\        W©,          V,          4      rËVe7   WZ8:  d   \        RV RV 24      hWÅ8”  d   \        W[,          V,          4      TrËWg8:  d   W¼3MWË3pVP                  W#R7      # )aÓ  
Resizes `image`. Enforces conversion of input to PIL.Image.

Args:
    image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`):
        The image to resize.
    size (`int` or `tuple[int, int]`):
        The size to use for resizing the image. If `size` is a sequence like (h, w), output size will be
        matched to this.

        If `size` is an int and `default_to_square` is `True`, then image will be resized to (size, size). If
        `size` is an int and `default_to_square` is `False`, then smaller edge of the image will be matched to
        this number. i.e, if height > width, then image will be rescaled to (size * height / width, size).
    resample (`int`, *optional*, defaults to `PILImageResampling.BILINEAR`):
        The filter to user for resampling.
    default_to_square (`bool`, *optional*, defaults to `True`):
        How to convert `size` when it is a single int. If set to `True`, the `size` will be converted to a
        square (`size`,`size`). If set to `False`, will replicate
        [`torchvision.transforms.Resize`](https://pytorch.org/vision/stable/transforms.html#torchvision.transforms.Resize)
        with support for resizing only the smallest edge and providing an optional `max_size`.
    max_size (`int`, *optional*, defaults to `None`):
        The maximum allowed for the longer edge of the resized image: if the longer edge of the image is
        greater than `max_size` after being resized according to `size`, then the image is resized again so
        that the longer edge is equal to `max_size`. As a result, `size` might be overruled, i.e the smaller
        edge may be shorter than `size`. Only used if `default_to_square` is `False`.

Returns:
    image: A resized `PIL.Image.Image`.
zmax_size = zN must be strictly greater than the requested size for the smaller edge size = )r&  )r'  ÚBILINEARr/  r5   r6   r7   r8  rM   rg   rw   rÓ   r%  rC   Úresize)r.  rF   r%  r&  Údefault_to_squareÚmax_sizer¹   r¸   ÚshortÚlongÚrequested_new_shortÚ	new_shortÚnew_longs   &&&&&&       r,   rW  Ú"ImageFeatureExtractionMixin.resize  sb  € ð<  (Ò3‘8Ô9K×9TÑ9Tˆà×%Ñ% eÔ,ä˜%¤§¡§¡×1Ò1Ø×%Ñ% eÓ,ˆEä�dœD×!Ò!Ü˜“;ˆDä�dœC× Ò ¤C¨£I°¤Nß Ü'1°$¼×'<Ò'<˜‘|À4ÈÅ7ÈDÐQRÍGÐBT‘à %§
¡
‘�à16´˜u™oÀvÀo‘�Ü.8¸¼s×.CÒ.C¡dÈÈaÍÐ#àÔ/Ø �Là&9¼3Ð?RÕ?YÐ\aÕ?aÓ;b˜8àÒ'ØÔ6Ü(Ø)¨(¨ð 4@Ø@D¸vðGóð ð  Ô*Ü.1°(Õ2FÈÕ2QÓ.RÐT\ 8à05´˜	Ñ,ÀhÐEZ�à�|‰|˜Dˆ|Ó4Ð4r+   c                óN  € V P                  V4       \        V\        4      '       g   W"3p\        V4      '       g!   \        V\        P
                  4      '       db   VP                  ^8X  d   V P                  V4      pVP                  ^ ,          R9   d   VP                  R,          MVP                  R,          pM&VP                  ^,          VP                  ^ ,          3pV^ ,          V^ ,          ,
          ^,          pWB^ ,          ,           pV^,          V^,          ,
          ^,          pWb^,          ,           p\        V\        P                  P                  4      '       d   VP                  WdWu34      # VP                  ^ ,          R9   pV'       gX   \        V\        P
                  4      '       d   VP                  ^^ ^4      p\        V4      '       d   VP                  ^^ ^4      pV^ 8¼  d0   WS^ ,          8:  d#   V^ 8¼  d   Ws^,          8:  d   VRWE1Wg13,          # VP                  RR \        V^ ,          V^ ,          4      \        V^,          V^,          4      3,           p	\        V\        P
                  4      '       d   \        P                   ! WR7      p
M"\        V4      '       d   VP#                  V	4      p
V	R,          V^ ,          ,
          ^,          pW³^ ,          ,           pV	R,          V^,          ,
          ^,          pWÓ^,          ,           pVX
RW¼1WÞ13&   WK,          pW[,          pWm,          pW},          pV
R\        ^ V4      \%        V
P                  R,          V4      1\        ^ V4      \%        V
P                  R,          V4      13,          p
V
# )	a=  
Crops `image` to the given size using a center crop. Note that if the image is too small to be cropped to the
size given, it will be padded (so the returned result has the size asked).

Args:
    image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor` of shape (n_channels, height, width) or (height, width, n_channels)):
        The image to resize.
    size (`int` or `tuple[int, int]`):
        The size to which crop the image.

Returns:
    new_image: A center cropped `PIL.Image.Image` or `np.ndarray` or `torch.Tensor` of shape: (n_channels,
    height, width).
:rž   NN:NrK   N.N)r    r�   r¯   r°   )r/  r5   rg   r   r]   r^   r{   rK  r    r%  r6   r7   Úcropr4  Úpermuters   Ú
zeros_likeÚ	new_zerosrr   )r.  rF   r%  Úimage_shapeÚtopÚbottomÚleftÚrightrG  Ú	new_shapeÚ	new_imageÚtop_padÚ
bottom_padÚleft_padÚ	right_pads   &&&            r,   Úcenter_cropÚ'ImageFeatureExtractionMixin.center_cropY  sè  € ð 	×%Ñ% eÔ,ä˜$¤×&Ò&Ø�<ˆDô ˜5×!Ò!¤Z°´r·z±z×%BÒ%BØ�z‰z˜QŒØ×(Ñ(¨Ó/�Ø-2¯[©[¸­^¸vÔ-E˜%Ÿ+™+ bž/È5Ï;É;ÐWYÍ?‰Kà Ÿ:™: a�=¨%¯*©*°Q­-Ð8ˆKà˜1�~  Q¥Õ'¨AÕ-ˆØ˜A•w•ˆØ˜A•  a¥Õ(¨QÕ.ˆØ˜A•w•ˆô �eœSŸY™YŸ_™_×-Ò-Ø—:‘:˜t¨%Ð8Ó9Ð9ð Ÿ™ A�¨&Ñ0ˆ÷ Ü˜%¤§¡×,Ò,ØŸ™¨¨1¨aÓ0�Ü˜u×%Ò%ØŸ™ a¨¨AÓ.�ð �!Œ8˜¨a¥.Ô0°T¸Q´YÀ5ÐXYÍNÔCZØ˜˜c˜j¨$¨*Ð4Õ5Ð5ð —K‘K  Ð$¬¨D°­G°[Àµ^Ó(DÄcÈ$ÈqÍ'ÐS^Ð_`ÕSaÓFbÐ'cÕcˆ	Ü�eœRŸZ™Z×(Ò(ÜŸš eÔ=‰IÜ˜U×#Ò#ØŸ™¨	Ó2ˆIà˜R•= ;¨q¥>Õ1°aÕ7ˆØ¨1�~Õ-ˆ
Ø˜b•M K°¥NÕ2°qÕ8ˆØ¨1�~Õ-ˆ	ØAFˆ	�#�wÐ)¨8Ð+=Ð=Ñ>à�ˆØÕˆØÕˆØÕˆàØ”�Q˜“œs 9§?¡?°2Õ#6¸Ó?Ð?ÄÀQÈÃÔPSÐT]×TcÑTcÐdfÕTgÐinÓPoÐAoÐoõ
ˆ	ð Ðr+   c                ó¸   € V P                  V4       \        V\        P                  P                  4      '       d   V P	                  V4      pVRRR1RR3,          # )ah  
Flips the channel order of `image` from RGB to BGR, or vice versa. Note that this will trigger a conversion of
`image` to a NumPy array if it's a PIL Image.

Args:
    image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`):
        The image whose color channels to flip. If `np.ndarray` or `torch.Tensor`, the channel dimension should
        be first.
NrN  r°   )r/  r5   r6   r7   r™   r-  s   &&r,   Úflip_channel_orderÚ.ImageFeatureExtractionMixin.flip_channel_order¤  sL   € ð 	×%Ñ% eÔ,ä�eœSŸY™YŸ_™_×-Ò-Ø×'Ñ'¨Ó.ˆEà‘T�r�T˜1˜a�ZÕ Ð r+   c           	     ó  € Ve   TM\         P                  P                  pV P                  V4       \	        V\         P                  P                  4      '       g   V P                  V4      pVP                  W#WEWgR7      # )aŽ  
Returns a rotated copy of `image`. This method returns a copy of `image`, rotated the given number of degrees
counter clockwise around its centre.

Args:
    image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`):
        The image to rotate. If `np.ndarray` or `torch.Tensor`, will be converted to `PIL.Image.Image` before
        rotating.

Returns:
    image: A rotated `PIL.Image.Image`.
)r&  ÚexpandÚcenterÚ	translateÚ	fillcolor)r6   r7   ÚNEARESTr/  r5   r8  Úrotate)r.  rF   Úangler&  rv  rw  rx  ry  s   &&&&&&&&r,   r{  Ú"ImageFeatureExtractionMixin.rotateµ  sj   € ð  (Ò3‘8¼¿¹×9JÑ9Jˆà×%Ñ% eÔ,ä˜%¤§¡§¡×1Ò1Ø×%Ñ% eÓ,ˆEà�|‰|Ø¨VÈið ó 
ð 	
r+   r#   r4   )NT)F)NTN)Nr   NNN)r$   r%   r&   r'   Ú__doc__r/  r8  r;  r7  r™   rK  rS  rW  rp  rs  r{  r*   Ú__classdictcell__©r?  s   @r,   r+  r+  o  sQ   ø‡ € ñòôò<$÷ð ôò@ô(2(ôhA5òFIòV!÷"
ò 
r+   r+  c                óp   € V ^8„  d   QhR\         R\        \         R3,          R\        \        ,          RR/# )rK   Úannotation_formatÚsupported_annotation_formats.rÑ   rm   N)r.   rg   rM   rÎ   )rN   s   "r,   rO   rO   Î  s?   € ÷ ñ Ü'ðä"'Ô(8¸#Ð(=Õ">ðô ”d•ðð 
ñ	r+   c                 ó   € W9  d   \        R \         RV 24      hV \        P                  J d   \	        V4      '       g   \        R4      hV \        P
                  J d   \        V4      '       g   \        R4      hR# R# )zUnsupported annotation format: z must be one of zäInvalid COCO detection annotations. Annotations must a dict (single image) or list of dicts (batch of images) with the following keys: `image_id` and `annotations`, with the latter being a list of annotations in the COCO format.zòInvalid COCO panoptic annotations. Annotations must a dict (single image) or list of dicts (batch of images) with the following keys: `image_id`, `file_name` and `segments_info`, with the latter being a list of annotations in the COCO format.N)rC   rN   r.   r1   rä   r2   ré   )r‚  rƒ  rÑ   s   &&&r,   Úvalidate_annotationsr…  Î  sŒ   € ð
 Ô<ÜÐ:¼6¸(ÐBRÐSoÐRpÐqÓrÐràÔ,×;Ñ;Ó;Ü/°×<Ò<ÜðBóð ð Ô,×:Ñ:Ó:Ü.¨{×;Ò;ÜðMóð ñ <ñ ;r+   c                ó\   € V ^8„  d   QhR\         \        ,          R\         \        ,          /# )rK   Úvalid_processor_keysÚcaptured_kwargs)rM   r¨   )rN   s   "r,   rO   rO   ç  s&   € ÷ Lñ L¬$¬s­)ð LÄdÌ3Åiñ Lr+   c                 ó´   € \        V4      P                  \        V 4      4      pV'       d-   R P                  V4      p\        P	                  RV R24       R# R# )z, zUnused or unrecognized kwargs: rz   N)ÚsetÚ
differenceÚjoinr¡   r¢   )r‡  rˆ  Úunused_keysÚunused_key_strs   &&  r,   Úvalidate_kwargsr�  ç  sJ   € Ü�oÓ&×1Ñ1´#Ð6JÓ2KÓL€KßØŸ™ ;Ó/ˆä�‰Ð8¸Ð8HÈÐJÖKñ r+   c                   óš   a € ] tR tRt o RtRtRtRtRtRt	Rt
R tRR l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tRtV tR# )ÚSizeDictiï  z6
Hashable dictionary to store image size information.
Nc                óX   € \        W4      '       d   \        W4      # \        R V R24      h)úKey z not found in SizeDict.)ÚhasattrÚgetattrÚKeyError©r.  Úkeys   &&r,   Ú__getitem__ÚSizeDict.__getitem__ü  s-   € Ü�4×ÒÜ˜4Ó%Ð%Ü˜˜c˜UÐ"9Ð:Ó;Ð;r+   c                óX   € \        W4      '       d   \        W4      e   \        W4      # V# r4   ©r”  r•  )r.  r˜  Údefaults   &&&r,   rý   ÚSizeDict.get  s'   € Ü�4×Ò¤'¨$Ó"4Ò"@Ü˜4Ó%Ð%Øˆr+   c              #  óˆ   "  € \        V 4       F.  p\        WP                  4      pVf   K  VP                  V3x € K0  	  R # 5ir4   )r   r•  Úname)r.  ÚfÚvals   &  r,   Ú__iter__ÚSizeDict.__iter__  s4   é € ä˜–ˆAÜ˜$§¡Ó'ˆCØŒØ—f‘f˜c�kÔ!ó ùs
   ‚%A¬Ac                óœ   € \        V P                  V P                  V P                  V P                  V P
                  V P                  34      # r4   )Úhashr¸   r¹   Úlongest_edgeÚshortest_edgerµ   r¶   )r.  s   &r,   Ú__hash__ÚSizeDict.__hash__  s<   € Ü�T—[‘[ $§*¡*¨d×.?Ñ.?À×ASÑASÐUY×UdÑUdÐfj×ftÑftÐuÓvÐvr+   c                óB   € \        W4      ;'       d    \        W4      R J# r4   rœ  r—  s   &&r,   Ú__contains__ÚSizeDict.__contains__  s   € Ü�tÓ!×DÐD¤g¨dÓ&8ÀÐ&DÐDr+   c                ór   € \        W4      '       g   \        R V R24      h\        P                  WV4       R# )r“  z" is not a valid field of SizeDict.N)r”  r–  ÚobjectÚ__setattr__)r.  r˜  Úvalues   &&&r,   Ú__setitem__ÚSizeDict.__setitem__  s2   € Ü�t×!Ò!Ü˜T # Ð&HÐIÓJÐJÜ×Ñ˜4 eÖ,r+   c                óœ  a a€ \        S\        4      '       d   \        S 4      S8H  # \        S\        4      '       dŒ   \        ;QJ d     . V 3R  l\	        S 4       4       F  NK  	  5M! V 3R  l\	        S 4       4       4      \        ;QJ d"    . V3R l\	        S 4       4       F  NK  	  58H  # ! V3R l\	        S 4       4       4      8H  # \
        # )c              3   óP   <"  € T F  p\        SVP                  4      x € K  	  R # 5ir4   ©r•  r   )rR   r¡  r.  s   & €r,   rS   Ú"SizeDict.__eq__.<locals>.<genexpr>  s   øé € ÐE¹°1œ  q§v¡v×.Ð.»ùó   ƒ#&c              3   óP   <"  € T F  p\        SVP                  4      x € K  	  R # 5ir4   r¶  )rR   r¡  Úothers   & €r,   rS   r·    s#   øé € ð OÙ0<¨1”˜˜qŸv™v×&Ð&³ùr¸  )r5   rÎ   r‘  rg   r   ÚNotImplemented)r.  rº  s   ffr,   Ú__eq__ÚSizeDict.__eq__  s    ù€ Ü�eœT×"Ò"Ü˜“: Ñ&Ð&Ü�eœX×&Ò&ß”5ÔE¼¸t¼ÓE—5‘5ÔE¼¸t¼ÓEÓEÏÌô OÜ06°t´óOÏñ ð Èô OÜ06°t´óOó Jñ ð ô Ðr+   c                ó   <€ V ^8„  d   QhRR/# )rK   rm   r‘  r#   )rN   r?  s   "€r,   rO   ÚSizeDict.__annotate__!  s   ø€ ÷ ñ ˜zñ r+   c                ó°   € \        V\        \        ,          4      '       d1   \        V 4      pVP                  \        V4      4       \        R/ VB # \        # )Nr#   )r5   rÎ   r‘  Úupdater»  ©r.  rº  Úmergeds   && r,   Ú__or__ÚSizeDict.__or__!  s@   € Ü�eœT¤H�_×-Ò-Ü˜$“ZˆFØ�M‰Mœ$˜u›+Ô&ÜÑ%˜fÑ%Ð%ÜÐr+   c                ó    <€ V ^8„  d   QhRS[ /# r–   )rÎ   )rN   r?  s   "€r,   rO   r¿  (  s   ø€ ÷ ñ ¡ñ r+   c                óˆ   € \        V\        4      '       d(   \        V4      pVP                  \        V 4      4       V# \        # r4   )r5   rÎ   rÁ  r»  rÂ  s   && r,   Ú__ror__ÚSizeDict.__ror__(  s3   € Ü�eœT×"Ò"Ü˜%“[ˆFØ�M‰Mœ$˜t›*Ô%ØˆMÜÐr+   c                ó¶   <€ V ^8„  d   Qh/ S[ R,          ;R&   S[ R,          ;R&   S[ R,          ;R&   S[ R,          ;R&   S[ R,          ;R&   S[ R,          ;R&   # )rK   Nr¸   r¹   r§  r¨  rµ   r¶   )rw   )rN   r?  s   "€r,   rO   r¿  ï  sk   ø‡ ‚ ñ �$�JÑñ ñ ��:Ññ ñ ˜•*Ñ#ñ ñ ˜•:Ñ$ñ ñ �d•
Ñ!ñ ñ �T�zÑ ò r+   r#   r4   )r$   r%   r&   r'   r~  r¸   r¹   r§  r¨  rµ   r¶   r™  rý   r£  r©  r¬  r²  r¼  rÄ  rÈ  Ú__annotate_func__r*   r  r€  s   @r,   r‘  r‘  ï  sk   ø‡ € ñð €FØ€EØ#€LØ $€MØ!€JØ €Iò<ô
ò
"òwòEò-ò
÷ð ÷ð ÷s ƒ r+   r‘  )rŸ   r4   )Útorchvision)NNNNNNNNNNNN)fr  rÿ   Úcollections.abcr   Údataclassesr   r   Úior   Útypingr   r   rü   r?   r]   Úutilsr	   r
   r   r   r   r   r   r   r   Úutils.constantsr   r   r   r   r   r   Úutils.import_utilsr   Ú	PIL.Imager6   ÚPIL.ImageOpsr7   Ú
Resamplingr'  Útorchvision.ior   r   Útorchvision.transformsr   Ú!torchvision.transforms.functionalr   rz  ÚNEAREST_EXACTÚBOXrV  ÚHAMMINGÚBICUBICÚLANCZOSÚpil_torch_interpolation_mappingÚitemsÚtorch_pil_interpolation_mappingr>   Ú
get_loggerr$   r¡   r^   rM   rx   r    r.   rÎ   r¨   rw   ÚAnnotationTyper:   r<   rG   rI   rX   re   rh   rk   rt   r|   rŽ   r”   r™   r¥   r«   r²   r¿   rÅ   r(   rÉ   rÕ   rÚ   rä   ré   rù   r  r  r)  r+  r…  r�  r‘  )ÚkÚvs   00r,   Ú<module>ræ     s¤  ðó Û 	Ý $ß )Ý ß ã Û ÷
÷ 
õ 
÷÷ õ )ñ ×ÒÛÛàŸ™×-Ñ-Ðá×Òß:Ý8Ý?ð 	×"Ñ"Ð$5×$CÑ$CØ×ÑÐ 1× 5Ñ 5Ø×#Ñ#Ð%6×%?Ñ%?Ø×"Ñ"Ð$5×$=Ñ$=Ø×"Ñ"Ð$5×$=Ñ$=Ø×"Ñ"Ð$5×$=Ñ$=ð'Ð#ð 9X×8]Ñ8]Ô8_Ô&`Ñ8_±° q¢tÑ8_Ò&`Ñ#à&(Ð#Ø&(Ð#ñ ×ÒÛð 
×	Ò	˜HÓ	%€ð Ø�r—z‘z >°4Ð8IÕ3JÈDÐQS×Q[ÑQ[ÕL\Ð^bÐcqÕ^rÐrõ€
ô
�|ô ô
$�|ô $ð
 �c˜3 �9 t¨D¥zÕ1Ð1Õ2€òFô�ô ò?òLõEò,ò	òõ5÷#÷L#L÷L$võN÷$A÷NF÷,Dõ0!õ>8ð br×awÑaw÷#õõõ OõN÷*ñZ 
Ð#Ô$ö*
ó %ð*
÷Z3÷*+^÷\\
ñ \
õ~
õ2Lñ ƒ÷=ð =ó ò=ùó[ 'as   Ä>K