
    bCi`                     Z   S SK Jr  S SKJr  S SKJrJr  S SKJrJ	r	J
r
Jr  S SKrSSKJrJrJr  SSKJrJrJrJrJr  SS	KJrJrJrJrJrJrJrJ r J!r!J"r"J#r#  SS
K$J%r%  SSK&J'r'J(r(J)r)J*r*J+r+J,r,  SSK-J.r.  \+" 5       (       a  SSKJ/r/  \)" 5       (       a  S SK0r0\*" 5       (       a  S SK1J2r3  SSKJ4r4  OSr4\,Rj                  " \65      r7\" SS9SSSSSSSSSSS\Rp                  4S\	\9   S\	\:   S\	\9   S\	\\:\;\:   4      S\	\\:\;\:   4      S\	\9   S\	\   S\	\9   S\	\   S\	S   S\	\\<\'4      S\4S jj5       r=S3S S!S"\	\>   S#S!4S$ jjr?S%\\   S#\;\   4S& jr@S'\;S!   S#\A\>S(4   4S) jrBS*\\R                  S!4   S+\>S#\;\\R                  S!4      4S, jrD " S- S.\
S/S09rE\( " S1 S2\5      5       rFg)4    )Iterable)deepcopy)	lru_cachepartial)AnyOptional	TypedDictUnionN   )BaseImageProcessorBatchFeatureget_size_dict)convert_to_rgbget_resize_output_image_sizeget_size_with_aspect_ratiogroup_images_by_shapereorder_images)ChannelDimension
ImageInput	ImageTypeSizeDictget_image_size#get_image_size_for_max_height_widthget_image_typeinfer_channel_dimension_formatmake_flat_list_of_imagesvalidate_kwargsvalidate_preprocess_arguments)Unpack)
TensorTypeauto_docstringis_torch_availableis_torchvision_availableis_vision_availablelogging)is_rocm_platform)PILImageResampling)
functional)pil_torch_interpolation_mapping
   maxsize
do_rescalerescale_factordo_normalize
image_mean	image_stddo_center_crop	crop_size	do_resizesizeinterpolationF.InterpolationModereturn_tensorsdata_formatc                     [        U UUUUUUUUU	S9
  U
b  U
S:w  a  [        S5      eU[        R                  :w  a  [        S5      eg)z
Checks validity of typically used arguments in an `ImageProcessorFast` `preprocess` method.
Raises `ValueError` if arguments incompatibility is caught.
)
r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   Nptz6Only returning PyTorch tensors is currently supported.z6Only channel first data format is currently supported.)r   
ValueErrorr   FIRST)r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r8   r9   s               b/home/james-whalen/.local/lib/python3.13/site-packages/transformers/image_processing_utils_fast.py"validate_fast_preprocess_argumentsr?   I   se    & "%!%# !n&<QRR&,,,QRR -    tensortorch.Tensoraxisreturnc                 l    Uc  U R                  5       $  U R                  US9$ ! [         a    U s $ f = f)z>
Squeezes a tensor, but only if the axis specified has dim 1.
)rC   )squeezer<   )rA   rC   s     r>   safe_squeezerG   p   s@     |~~~~4~(( s   $ 33valuesc                 P    [        U 6  Vs/ s H  n[        U5      PM     sn$ s  snf )zG
Return the maximum value across all indices of an iterable of values.
)zipmax)rH   values_is     r>   max_across_indicesrM   }   s$     +.v,7,hCM,777s   #images.c                 b    [        U  Vs/ s H  oR                  PM     sn5      u  p#nX44$ s  snf )z@
Get the maximum height and width across all images in a batch.
)rM   shape)rN   img_
max_height	max_widths        r>   get_max_height_widthrU      s3    
  22O992OPA9"" 3Ps   ,image
patch_sizec                     / n[        U [        R                  S9u  p4[        SX15       H9  n[        SXA5       H&  nU SS2XUU-   2XfU-   24   nUR	                  U5        M(     M;     U$ )a  
Divides an image into patches of a specified size.

Args:
    image (`Union[np.array, "torch.Tensor"]`):
        The input image.
    patch_size (`int`):
        The size of each patch.
Returns:
    list: A list of Union[np.array, "torch.Tensor"] representing the patches.
)channel_dimr   N)r   r   r=   rangeappend)rV   rW   patchesheightwidthijpatchs           r>   divide_to_patchesrb      sr     G"56F6L6LMMF1f)q%,A!QZ/^1CCDENN5! - *
 Nr@   c                      \ rS rSr% \\   \S'   \\\\	4      \S'   \\   \S'   \\
S      \S'   \\   \S'   \\\\	4      \S'   \\   \S	'   \\
\	\4      \S
'   \\   \S'   \\
\\\   4      \S'   \\
\\\   4      \S'   \\   \S'   \\\\	4      \S'   \\   \S'   \\
\\4      \S'   \\   \S'   \\
\\4      \S'   \S   \S'   \\   \S'   Srg)DefaultFastImageProcessorKwargs   r4   r5   default_to_square)r'   r7   resampler2   r3   r-   r.   r/   r0   r1   do_padpad_sizedo_convert_rgbr8   r9   input_data_formattorch.devicedevicedisable_grouping N)__name__
__module____qualname____firstlineno__r   bool__annotations__dictstrintr
   floatlistr    r   __static_attributes__ro   r@   r>   rd   rd      s#   ~
4S>
""~%uHIJJTN"S#X''U3:.//4. ud5k1233eT%[0122TNtCH~&&TN"U3
?344*++c+;&; <==^$$tn$r@   rd   F)totalc            !         ^  \ rS rSrSrSrSrSrSrSr	Sr
SrSrSrSrSrSrSrSr\R(                  rSrSrS/r\rSrS\\   4U 4S jjr\S\4S	 j5       r      SCS
SS\!S\"\#   S\"\$   S\S\"\   SS4S jjr%  SDSSS\!S\"S   S\SS4
S jjr&\'  SDSSS\(\#\#4   S\"S   S\SS4
S jj5       r)SSS\*SS4S jr+SSS\,\*\-\*   4   S\,\*\-\*   4   SS4S jr.\/" SS 9      SES!\"\   S"\"\,\*\0\*   4      S#\"\,\*\0\*   4      S$\"\   S%\"\*   S&\"S'   S\(4S( jj5       r1S
SS$\S%\*S!\S"\,\*\0\*   4   S#\,\*\0\*   4   SS4S) jr2SSS\!SS4S* jr3S\4S\44S+ jr5S\64S, jr7 SFS
\4S-\#S\44S. jjr8   SGS\4S/\"\   S0\"\,\$\4      S&\"S'   SS4
S1 jjr9    SHS
\4S/\"\   S0\"\,\$\4      S&\"S'   S-\#S\0S   4S2 jjr:       SIS\"\!   S3\"\!   S\"\!   S4\"\   S"\"\,\*\0\*   4      S#\"\,\*\0\*   4      S5\"\   S\64S6 jjr;            SJS$\"\   S%\"\*   S!\"\   S"\"\,\*\(\*   4      S#\"\,\*\(\*   4      S7\"\   S\"\!   S8\"\   S3\"\!   S\"S   S9\"\,\$\<4      S5\"\   4S: jjr=S
\4S\\   S\>4S; jr?\@S
\4S\\   S\>4S< j5       rASS=.S
\4S/\S0\S&\"\,\$S'4      S\\   S\>4S> jjrBS
\0S   S7\S\!S\"S   S8\S3\!S$\S%\*S!\S"\"\,\*\0\*   4      S#\"\,\*\0\*   4      S?\"\   S\"\!   S\"\   S9\"\,\$\<4      S\>4 S@ jrCU 4SA jrDSBrEU =rF$ )KBaseImageProcessorFast   NTgp?pixel_valueskwargsc                   > [         TU ]  " S0 UD6  U R                  U5      nUR                  SU R                  5      nUb#  [        X!R                  SU R                  5      S9OS U l        UR                  SU R                  5      nUb
  [        USS9OS U l        UR                  SU R                  5      nUb
  [        USS9OS U l        U R                  R                   HE  nUR                  US 5      nUb  [        XU5        M&  [        X[        [        XS 5      5      5        MG     [        U R                  R                  R                  5       5      U l        g )	Nr5   rf   r5   rf   r3   
param_nameri   r5   r   ro   )super__init__filter_out_unused_kwargspopr5   r   rf   r3   ri   valid_kwargsru   setattrr   getattrrz   keys_valid_kwargs_names)selfr   r5   r3   ri   keykwarg	__class__s          r>   r   BaseImageProcessorFast.__init__   s,   "6"..v6zz&$)),  tzzBUW[WmWm7no 		
 JJ{DNN;	MVMby[Ihl::j$--8OWOc8
Kim$$44CJJsD)E 5)8GDt,D#EF 5 $((9(9(I(I(N(N(P#Q r@   rD   c                     g)zf
`bool`: Whether or not this image processor is a fast processor (backed by PyTorch and TorchVision).
Tro   )r   s    r>   is_fastBaseImageProcessorFast.is_fast   s    
 r@   rN   rB   ri   
fill_valuepadding_modereturn_maskrn   c                    UbJ  UR                   (       a  UR                  (       d  [        SU S35      eUR                   UR                  4nO[        U5      n[	        XS9u  p0 n
0 nUR                  5        H  u  pUR                  SS nUS   US   -
  nUS   US   -
  nUS:  d  US:  a  [        SU S	U S35      eX:w  a  SSUU4n[        R                  " UUX4S
9nXU'   U(       d  Mv  [        R                  " U[        R                  S9SSSS2SS24   nSUSSUS   2SUS   24'   UX'   M     [        X5      nU(       a  [        X5      nUU4$ U$ )a  
Pads images to `(pad_size["height"], pad_size["width"])` or to the largest size in the batch.

Args:
    images (`torch.Tensor`):
        Images to pad.
    pad_size (`SizeDict`, *optional*):
        Dictionary in the format `{"height": int, "width": int}` specifying the size of the output image.
    fill_value (`int`, *optional*, defaults to `0`):
        The constant value used to fill the padded area.
    padding_mode (`str`, *optional*, defaults to "constant"):
        The padding mode to use. Can be any of the modes supported by
        `torch.nn.functional.pad` (e.g. constant, reflection, replication).
    return_mask (`bool`, *optional*, defaults to `False`):
        Whether to return a pixel mask to denote padded regions.
    disable_grouping (`bool`, *optional*, defaults to `False`):
        Whether to disable grouping of images by size.

Returns:
    `torch.Tensor`: The resized image.
NzCPad size must contain 'height' and 'width' keys only. Got pad_size=.rn   r   r   zrPadding dimensions are negative. Please make sure that the `pad_size` is larger than the image size. Got pad_size=z, image_size=)fillr   dtype.)r]   r^   r<   rU   r   itemsrP   Fpadtorch
zeros_likeint64r   )r   rN   ri   r   r   r   rn   r   grouped_imagesgrouped_images_indexprocessed_images_groupedprocessed_masks_groupedrP   stacked_images
image_sizepadding_heightpadding_widthpaddingstacked_masksprocessed_imagesprocessed_maskss                        r>   r   BaseImageProcessorFast.pad   s   > OO #fgofppq!rss 8H+F3H/DV/o,#% "$%3%9%9%;!E'--bc2J%a[:a=8N$QK*Q-7M!]Q%6 008zzlRSU  %a?!"~wZ!k.<U+{ % 0 0u{{ STWYZ\]_`T` aGHc?Z]?OjmOCD1>'.% &<( **BY,-D[O#_44r@   rV   r5   r6   r7   	antialiasc                 F   Ub  UO[         R                  R                  nUR                  (       aD  UR                  (       a3  [        UR                  5       SS UR                  UR                  5      nOUR                  (       a%  [        UUR                  S[        R                  S9nOUR                  (       aD  UR                  (       a3  [        UR                  5       SS UR                  UR                  5      nOJUR                  (       a*  UR                  (       a  UR                  UR                  4nO[        SU S35      e[         R"                  R%                  5       (       a!  ['        5       (       a  U R)                  XX45      $ [         R*                  " XX4S9$ )a  
Resize an image to `(size["height"], size["width"])`.

Args:
    image (`torch.Tensor`):
        Image to resize.
    size (`SizeDict`):
        Dictionary in the format `{"height": int, "width": int}` specifying the size of the output image.
    interpolation (`InterpolationMode`, *optional*, defaults to `InterpolationMode.BILINEAR`):
        `InterpolationMode` filter to use when resizing the image e.g. `InterpolationMode.BICUBIC`.

Returns:
    `torch.Tensor`: The resized image.
Nr   F)r5   rf   rk   zjSize must contain 'height' and 'width' keys, or 'max_height' and 'max_width', or 'shortest_edge' key. Got r   r6   r   )r   InterpolationModeBILINEARshortest_edgelongest_edger   r5   r   r   r=   rS   rT   r   r]   r^   r<   r   compileris_compilingr&   compile_friendly_resizeresize)r   rV   r5   r6   r   r   new_sizes          r>   r   BaseImageProcessorFast.resize7  s<   , *7)BH[H[HdHd$"3"3 2

RS!""!!H
 3''"'"2"8"8	H __:5::<;Ldoo_c_m_mnH[[TZZTZZ0H6  >>&&((-=-?-?//ZZxx}ZZr@   r   c                    U R                   [        R                  :X  a  U R                  5       S-  n [        R
                  " XX#S9n U S-  n [        R                  " U S:  SU 5      n [        R                  " U S:  SU 5      n U R                  5       R                  [        R                  5      n U $ [        R
                  " XX#S9n U $ )zk
A wrapper around `F.resize` so that it is compatible with torch.compile when the image is a uint8 tensor.
   r      r   )	r   r   uint8ry   r   r   whereroundto)rV   r   r6   r   s       r>   r   .BaseImageProcessorFast.compile_friendly_resizem  s     ;;%++% KKMC'EHHUM_ECKE KKS%8EKK	1e4EKKM$$U[[1E  HHUM_Er@   scalec                 
    X-  $ )z
Rescale an image by a scale factor. image = image * scale.

Args:
    image (`torch.Tensor`):
        Image to rescale.
    scale (`float`):
        The scaling factor to rescale pixel values by.

Returns:
    `torch.Tensor`: The rescaled image.
ro   )r   rV   r   r   s       r>   rescaleBaseImageProcessorFast.rescale  s    $ }r@   meanstdc                 0    [         R                  " XU5      $ )a  
Normalize an image. image = (image - image_mean) / image_std.

Args:
    image (`torch.Tensor`):
        Image to normalize.
    mean (`torch.Tensor`, `float` or `Iterable[float]`):
        Image mean to use for normalization.
    std (`torch.Tensor`, `float` or `Iterable[float]`):
        Image standard deviation to use for normalization.

Returns:
    `torch.Tensor`: The normalized image.
)r   	normalize)r   rV   r   r   r   s        r>   r    BaseImageProcessorFast.normalize  s    * {{5,,r@   r*   r+   r/   r0   r1   r-   r.   rm   rl   c                     U(       a=  U(       a6  [         R                  " X&S9SU-  -  n[         R                  " X6S9SU-  -  nSnX#U4$ )Nrm   g      ?F)r   rA   )r   r/   r0   r1   r-   r.   rm   s          r>   !_fuse_mean_std_and_rescale_factor8BaseImageProcessorFast._fuse_mean_std_and_rescale_factor  sI     ,j@C.DXYJY>#BVWIJj00r@   c           	          U R                  UUUUUUR                  S9u  pVnU(       a/  U R                  UR                  [        R
                  S9XV5      nU$ U(       a  U R                  X5      nU$ )z
Rescale and normalize images.
)r/   r0   r1   r-   r.   rm   r   )r   rm   r   r   r   float32r   )r   rN   r-   r.   r/   r0   r1   s          r>   rescale_and_normalize,BaseImageProcessorFast.rescale_and_normalize  sx     -1,R,R%!!)== -S -
)
z ^^FIIEMMI$BJZF  \\&9Fr@   c                    UR                   b  UR                  c  [        SUR                  5        35      eUR                  SS u  pEUR                   UR                  pvXu:  d  Xd:  an  Xu:  a  Xu-
  S-  OSXd:  a  Xd-
  S-  OSXu:  a
  Xu-
  S-   S-  OSXd:  a
  Xd-
  S-   S-  OS/n[
        R                  " XSS9nUR                  SS u  pEXu:X  a  Xd:X  a  U$ [        XF-
  S-  5      n	[        XW-
  S-  5      n
[
        R                  " XXU5      $ )	a  
Note: override torchvision's center_crop to have the same behavior as the slow processor.
Center crop an image to `(size["height"], size["width"])`. If the input size is smaller than `crop_size` along
any edge, the image is padded with 0's and then center cropped.

Args:
    image (`"torch.Tensor"`):
        Image to center crop.
    size (`dict[str, int]`):
        Size of the output image.

Returns:
    `torch.Tensor`: The center cropped image.
Nz=The size dictionary must have keys 'height' and 'width'. Got r      r   r   )r   g       @)	r]   r^   r<   r   rP   r   r   rx   crop)r   rV   r5   r   image_heightimage_widthcrop_height
crop_widthpadding_ltrbcrop_top	crop_lefts              r>   center_crop"BaseImageProcessorFast.center_crop  s+   ( ;;$**"4\]a]f]f]h\ijkk$)KK$4!"&++tzzZ#{'A3=3K)a/QR5@5O+1UV7A7O)A-!3UV9D9S+a/A5YZ	L EE%A6E(-BC(8%L([-H2c9:1S89	vveyzJJr@   c                     [        U5      $ )z
Converts an image to RGB format. Only converts if the image is of type PIL.Image.Image, otherwise returns the image
as is.
Args:
    image (ImageInput):
        The image to convert.

Returns:
    ImageInput: The converted image.
)r   )r   rV   s     r>   r   %BaseImageProcessorFast.convert_to_rgb  s     e$$r@   c                     U R                   c  U$ U R                    H4  nX!;   d  M
  [        R                  SU S35        UR                  U5        M6     U$ )z:
Filter out the unused kwargs from the kwargs dictionary.
z!This processor does not use the `z ` parameter. It will be ignored.)unused_kwargsloggerwarning_oncer   )r   r   
kwarg_names      r>   r   /BaseImageProcessorFast.filter_out_unused_kwargs  sW     %M,,J###&G
|Ss$tu

:& - r@   expected_ndimsc                 6    U R                  U5      n[        XS9$ )z
Prepare the images structure for processing.

Args:
    images (`ImageInput`):
        The input images to process.

Returns:
    `ImageInput`: The images with a valid nesting.
r   )fetch_imagesr   )r   rN   r   s      r>   _prepare_images_structure0BaseImageProcessorFast._prepare_images_structure$  s      ""6*'NNr@   rj   rk   c                    [        U5      nU[        R                  [        R                  [        R                  4;  a  [        SU 35      eU(       a  U R                  U5      nU[        R                  :X  a  [        R                  " U5      nO8U[        R                  :X  a$  [        R                  " U5      R                  5       nUR                  S:X  a  UR                  S5      nUc  [        U5      nU[        R                   :X  a!  UR#                  SSS5      R                  5       nUb  UR%                  U5      nU$ )NzUnsupported input image type r   r   r   )r   r   PILTORCHNUMPYr<   r   r   pil_to_tensorr   
from_numpy
contiguousndim	unsqueezer   r   LASTpermuter   )r   rV   rj   rk   rm   
image_types         r>   _process_image%BaseImageProcessorFast._process_image7  s    $E*
immY__iooNN<ZLIJJ''.E&OOE*E9??*$$U+668E ::?OOA&E $ >u E 0 5 55MM!Q*557E HHV$Er@   c           
      \   U R                  XS9n[        U R                  X#US9n[        U5      S:  =(       a    [	        US   [
        [        45      nU(       a+  U VV	s/ s H  o V	s/ s H
  o" U	5      PM     sn	PM     n
nn	U
$ U V	s/ s H
  o" U	5      PM     n
n	U
$ s  sn	f s  sn	nf s  sn	f )aZ  
Prepare image-like inputs for processing.

Args:
    images (`ImageInput`):
        The image-like inputs to process.
    do_convert_rgb (`bool`, *optional*):
        Whether to convert the images to RGB.
    input_data_format (`str` or `ChannelDimension`, *optional*):
        The input data format of the images.
    device (`torch.device`, *optional*):
        The device to put the processed images on.
    expected_ndims (`int`, *optional*):
        The expected number of dimensions for the images. (can be 2 for segmentation maps etc.)

Returns:
    List[`torch.Tensor`]: The processed images.
r   rj   rk   rm   r   )r   r   r  len
isinstancerz   tuple)r   rN   rj   rk   rm   r   process_image_partialhas_nested_structurenested_listrQ   r   s              r>   _prepare_image_like_inputs1BaseImageProcessorFast._prepare_image_like_inputs]  s    8 ///V 'lr!

  #6{QW:fQi$PU3WgmngmXc{ S{!6s!;{ Sgmn   GMMfs 5c :fM	 !TnMs   	B#(B9B#	B)B#r3   rf   r9   c           	         Uc  0 nUb  [        S0 [        XS9D6nUb  [        S0 [        USS9D6nUb  [        S0 [        USS9D6n[        U[        5      (       a  [	        U5      n[        U[        5      (       a  [	        U5      nUc  [
        R                  nXS'   X(S'   X8S'   XXS'   XhS'   XxS	'   UR                  S
5      n	[        U	[        [        45      (       a	  [        U	   OU	US'   U$ )z
Update kwargs that need further processing before being validated
Can be overridden by subclasses to customize the processing of kwargs.
r   r3   r   ri   r   r5   r0   r1   r9   rg   r6   ro   )r   r   r  rz   r  r   r=   r   r'   rx   r)   )
r   r5   r3   ri   rf   r0   r1   r9   r   rg   s
             r>   _further_process_kwargs.BaseImageProcessorFast._further_process_kwargs  s    >F\m[\D  T={#STIV-X*"UVHj$''z*Ji&&i(I*00Kv'{%z)|'{ +} ::j)9CHOacfNg9h9h+H5nv 	 r@   r4   r2   r8   c                 ,    [        UUUUUUUUU	U
UUS9  g)z0
validate the kwargs for the preprocess method.
)r-   r.   r/   r0   r1   r4   r5   r2   r3   r6   r8   r9   N)r?   )r   r-   r.   r/   r0   r1   r4   r5   r2   r3   r6   r8   r9   r   s                 r>   _validate_preprocess_kwargs2BaseImageProcessorFast._validate_preprocess_kwargs  s0    & 	+!)%!)')#	
r@   c                 .    U R                   " U/UQ70 UD6$ N)
preprocess)r   rN   argsr   s       r>   __call__BaseImageProcessorFast.__call__  s    v7777r@   c           	         [        UR                  5       U R                  S9  U R                   H  nUR                  U[	        XS 5      5        M!     UR                  S5      nUR                  S5      nUR                  S5      nU R                  " S0 UD6nU R                  " S0 UD6  UR                  S5        U R                  " U/UQ7XVUS.UD6$ )N)captured_kwargsvalid_processor_keysrj   rk   rm   r9   r  ro   )	r   r   r   
setdefaultr   r   r  r  _preprocess_image_like_inputs)r   rN   r  r   r   rj   rk   rm   s           r>   r  !BaseImageProcessorFast.preprocess  s     	DLdLde 22Jj'$D*IJ 3  $45"JJ':;H% --77 	((262 	

=!11

*8fl
pv
 	
r@   r   c                N    U R                  XX4S9nU R                  " U/UQ70 UD6$ )z
Preprocess image-like inputs.
To be overridden by subclasses when image-like inputs other than images should be processed.
It can be used for segmentation maps, depth maps, etc.
)rN   rj   rk   rm   )r  _preprocess)r   rN   rj   rk   rm   r  r   s          r>   r  4BaseImageProcessorFast._preprocess_image_like_inputs  s<     00L] 1 
 8888r@   rh   c           	         [        XS9u  nn0 nUR                  5        H"  u  nnU(       a  U R                  UX4S9nUUU'   M$     [        UU5      n[        UUS9u  nn0 nUR                  5        H8  u  nnU(       a  U R	                  UU5      nU R                  UXxXU5      nUUU'   M:     [        UU5      nU(       a  U R                  UXS9nU(       a  [        R                  " USS9OUn[        SU0US9$ )Nr   )rV   r5   r6   )ri   rn   r   )dimr   )datatensor_type)
r   r   r   r   r   r   r   r   stackr   )r   rN   r4   r5   r6   r2   r3   r-   r.   r/   r0   r1   rh   ri   rn   r8   r   r   r   resized_images_groupedrP   r   resized_imagesr   r   s                            r>   r   "BaseImageProcessorFast._preprocess  s&   ( 0EV/o,,!#%3%9%9%;!E>!%>!j,:"5) &< ((>@TU 0E^fv/w,,#% %3%9%9%;!E>!%!1!1.)!L!77
LV_N /=$U+ &< **BDXY#xx(88xoCQ5;;'7Q?Wg.2B!CQ_``r@   c                 l   > [         TU ]  5       nUR                  SS 5        UR                  SS 5        U$ )N_valid_processor_keysr   )r   to_dictr   )r   encoder_dictr   s     r>   r,  BaseImageProcessorFast.to_dict=  s7    w(0$7.5r@   )r   r3   ri   r5   )Nr   constantFF)NT)NNNNNN)   )NNN)NNNr0  )NNNNNNN)NNNNNNNNNNNN)Grp   rq   rr   rs   rg   r0   r1   r5   rf   r3   r4   r2   rh   ri   r-   r.   r/   rj   r8   r   r=   r9   rk   rm   model_input_namesrd   r   r   r   r   propertyrt   r   r   r   rx   rw   r   r   staticmethodr  r   ry   r   r
   r   r   r   rz   r   r   r   r   r   rv   r   r   r  r  r  r    r  r   r  r!   r  r  r   r,  r{   __classcell__)r   s   @r>   r~   r~      s   HJIDIINFHJNLNN"((KF'(2LMR(G!H R0    "$%&0!+0B B  B  SM	B 
 smB  B  #4.B  
B P :>4[4[ 4[   56	4[
 4[ 
4[l  :>	S/   56 	
 
 0 
 
(-- E8E?*+- 5(5/)*	- 
-. r (,:>9=%)*.+/1tn1 U5$u+#5671 E%e"456	1
 TN1 !1 (1 
1 1   	
  %e,- U+, 
8'K'K 'K
 
'KR%% 
% t    OO O 
	O, *.DH+/$$ !$ $E#/?*?$@A	$
 ($ 
$R *.DH+/* *  !*  $E#/?*?$@A	* 
 (*  *  
n	* \ $((,'+,0:>9=26.x . H%. 8$	.
 $D>. U5$u+#567. E%e"456. ./. 
.d &**.'+;?:>$(#')-(,9=;?26 
TN 
 ! 
 tn	 

 U5%,#678 
 E%u"567 
 D> 
 x  
 ! 
 H% 
   56 
 !sJ!78 
 ./ 
D8z 8FCb<c 8ht 8 
 
fEd>e 
jv 
 
@ 8<99 	9
 ,9 sN2349 899 
9(.a^$.a .a 	.a
   56.a .a .a .a .a .a U5$u+#567.a E%e"456.a .a 8$.a #4..a  !sJ!78!.a$ 
%.a` r@   r~   r  )Gcollections.abcr   copyr   	functoolsr   r   typingr   r   r	   r
   numpynpimage_processing_utilsr   r   r   image_transformsr   r   r   r   r   image_utilsr   r   r   r   r   r   r   r   r   r   r   processing_utilsr   utilsr    r!   r"   r#   r$   r%   utils.import_utilsr&   r'   r   torchvision.transforms.v2r(   r   r)   
get_loggerrp   r   r=   rt   ry   rz   rw   r?   rx   rG   rM   r  rU   ndarrayrb   rd   r~   ro   r@   r>   <module>rD     sv   %  ( 2 2  S S     %  1 /9< '+# 
		H	% 2!%&*#'6:59%)$( $#597;$4$:$:#S#SUO#S 4.#S ud5k123	#S
 eT%[012#S TN#S !#S ~#S 8
#S 12#S U3
?34#S "#S #SL
 
x} 
 
8x} 8c 8#n!5 #%S/ #^+,:=	%

N*
+,0%iu %, D
/ D
 D
r@   