import{S as Ls,i as js,s as Os,e as t,k as m,w as _,t as n,M as Ns,c as a,d as o,m as c,a as s,x as b,h as i,b as p,G as e,g,y as v,q as y,o as $,B as x,v as As,L as Cs}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ss}from"../../chunks/Tip-hf-doc-builder.js";import{D as P}from"../../chunks/Docstring-hf-doc-builder.js";import{C as qs}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Sa}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as zs}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Fs(Q){let f,T,I,h,D;return h=new qs({props:{code:`# We can't instantiate directly the base class *ImageProcessingMixin* so let's show the examples on a
# derived class: *CLIPImageProcessor*
image_processor = CLIPImageProcessor.from_pretrained(
    "openai/clip-vit-base-patch32"
)  # Download image_processing_config from huggingface.co and cache.
image_processor = CLIPImageProcessor.from_pretrained(
    "./test/saved_model/"
)  # E.g. image processor (or model) was saved using *save_pretrained('./test/saved_model/')*
image_processor = CLIPImageProcessor.from_pretrained("./test/saved_model/preprocessor_config.json")
image_processor = CLIPImageProcessor.from_pretrained(
    "openai/clip-vit-base-patch32", do_normalize=False, foo=False
)
assert image_processor.do_normalize is False
image_processor, unused_kwargs = CLIPImageProcessor.from_pretrained(
    "openai/clip-vit-base-patch32", do_normalize=False, foo=False, return_unused_kwargs=True
)
assert image_processor.do_normalize is False
assert unused_kwargs == {"foo": False}`,highlighted:`<span class="hljs-comment"># We can&#x27;t instantiate directly the base class *ImageProcessingMixin* so let&#x27;s show the examples on a</span>
<span class="hljs-comment"># derived class: *CLIPImageProcessor*</span>
image_processor = CLIPImageProcessor.from_pretrained(
    <span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>
)  <span class="hljs-comment"># Download image_processing_config from huggingface.co and cache.</span>
image_processor = CLIPImageProcessor.from_pretrained(
    <span class="hljs-string">&quot;./test/saved_model/&quot;</span>
)  <span class="hljs-comment"># E.g. image processor (or model) was saved using *save_pretrained(&#x27;./test/saved_model/&#x27;)*</span>
image_processor = CLIPImageProcessor.from_pretrained(<span class="hljs-string">&quot;./test/saved_model/preprocessor_config.json&quot;</span>)
image_processor = CLIPImageProcessor.from_pretrained(
    <span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>, do_normalize=<span class="hljs-literal">False</span>, foo=<span class="hljs-literal">False</span>
)
<span class="hljs-keyword">assert</span> image_processor.do_normalize <span class="hljs-keyword">is</span> <span class="hljs-literal">False</span>
image_processor, unused_kwargs = CLIPImageProcessor.from_pretrained(
    <span class="hljs-string">&quot;openai/clip-vit-base-patch32&quot;</span>, do_normalize=<span class="hljs-literal">False</span>, foo=<span class="hljs-literal">False</span>, return_unused_kwargs=<span class="hljs-literal">True</span>
)
<span class="hljs-keyword">assert</span> image_processor.do_normalize <span class="hljs-keyword">is</span> <span class="hljs-literal">False</span>
<span class="hljs-keyword">assert</span> unused_kwargs == {<span class="hljs-string">&quot;foo&quot;</span>: <span class="hljs-literal">False</span>}`}}),{c(){f=t("p"),T=n("Examples:"),I=m(),_(h.$$.fragment)},l(l){f=a(l,"P",{});var E=s(f);T=i(E,"Examples:"),E.forEach(o),I=c(l),b(h.$$.fragment,l)},m(l,E){g(l,f,E),e(f,T),g(l,I,E),v(h,l,E),D=!0},p:Cs,i(l){D||(y(h.$$.fragment,l),D=!0)},o(l){$(h.$$.fragment,l),D=!1},d(l){l&&o(f),l&&o(I),x(h,l)}}}function Us(Q){let f,T,I,h,D;return h=new qs({props:{code:`from transformers import AutoImageProcessor

image processor = AutoImageProcessor.from_pretrained("bert-base-cased")

# Push the image processor to your namespace with the name "my-finetuned-bert".
image processor.push_to_hub("my-finetuned-bert")

# Push the image processor to an organization with the name "my-finetuned-bert".
image processor.push_to_hub("huggingface/my-finetuned-bert")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor

image processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)

<span class="hljs-comment"># Push the image processor to your namespace with the name &quot;my-finetuned-bert&quot;.</span>
image processor.push_to_hub(<span class="hljs-string">&quot;my-finetuned-bert&quot;</span>)

<span class="hljs-comment"># Push the image processor to an organization with the name &quot;my-finetuned-bert&quot;.</span>
image processor.push_to_hub(<span class="hljs-string">&quot;huggingface/my-finetuned-bert&quot;</span>)`}}),{c(){f=t("p"),T=n("Examples:"),I=m(),_(h.$$.fragment)},l(l){f=a(l,"P",{});var E=s(f);T=i(E,"Examples:"),E.forEach(o),I=c(l),b(h.$$.fragment,l)},m(l,E){g(l,f,E),e(f,T),g(l,I,E),v(h,l,E),D=!0},p:Cs,i(l){D||(y(h.$$.fragment,l),D=!0)},o(l){$(h.$$.fragment,l),D=!1},d(l){l&&o(f),l&&o(I),x(h,l)}}}function Rs(Q){let f,T;return{c(){f=t("p"),T=n("This API is experimental and may have some slight breaking changes in the next releases.")},l(I){f=a(I,"P",{});var h=s(f);T=i(h,"This API is experimental and may have some slight breaking changes in the next releases."),h.forEach(o)},m(I,h){g(I,f,h),e(f,T)},d(I){I&&o(f)}}}function Vs(Q){let f,T,I,h,D,l,E,sr,ko,Wr,Je,Mo,Jr,Be,zo,Br,F,X,nr,he,Co,ir,qo,Hr,U,ue,Lo,k,jo,mr,Oo,No,cr,Ao,So,dr,Fo,Uo,Gr,M,_e,Ro,lr,Vo,Wo,pr,Jo,Yr,z,be,Bo,gr,Ho,Go,fr,Yo,Kr,R,ve,Ko,hr,Qo,Qr,C,ye,Xo,q,Zo,ur,et,rt,_r,ot,tt,br,at,st,nt,vr,it,Xr,V,$e,mt,L,ct,yr,dt,lt,$r,pt,gt,xr,ft,ht,Zr,W,xe,ut,Ir,_t,eo,J,Ie,bt,B,vt,wr,yt,$t,Pr,xt,It,ro,H,we,wt,j,Pt,Er,Et,Tt,Tr,Dt,kt,Dr,Mt,zt,oo,G,Pe,Ct,Ee,qt,kr,Lt,jt,to,Y,Z,Mr,Te,Ot,zr,Nt,ao,u,De,At,Cr,St,Ft,ee,ke,Ut,Me,Rt,He,Vt,Wt,Jt,re,ze,Bt,Ce,Ht,Ge,Gt,Yt,Kt,N,qe,Qt,Le,Xt,Ye,Zt,ea,ra,oe,oa,te,je,ta,O,aa,qr,sa,na,Lr,ia,ma,jr,ca,da,la,A,Oe,pa,Ne,ga,Or,fa,ha,ua,ae,_a,S,Ae,ba,Se,va,Nr,ya,$a,xa,se,Ia,ne,Fe,wa,K,Pa,Ar,Ea,Ta,Ke,Da,ka,Ma,ie,Ue,za,Sr,Ca,qa,me,Re,La,Fr,ja,Oa,ce,Ve,Na,Ur,Aa,so;return l=new Sa({}),he=new Sa({}),ue=new P({props:{name:"transformers.image_transforms.center_crop",anchor:"transformers.image_transforms.center_crop",parameters:[{name:"image",val:": ndarray"},{name:"size",val:": typing.Tuple[int, int]"},{name:"data_format",val:": typing.Union[transformers.image_utils.ChannelDimension, str, NoneType] = None"},{name:"return_numpy",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.image_transforms.center_crop.image",description:`<strong>image</strong> (<code>np.ndarray</code>) &#x2014;
The image to crop.`,name:"image"},{anchor:"transformers.image_transforms.center_crop.size",description:`<strong>size</strong> (<code>Tuple[int, int]</code>) &#x2014;
The target size for the cropped image.`,name:"size"},{anchor:"transformers.image_transforms.center_crop.data_format",description:`<strong>data_format</strong> (<code>str</code> or <code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.
If unset, will use the inferred format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.image_transforms.center_crop.return_numpy",description:`<strong>return_numpy</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the cropped image as a numpy array. Used for backwards compatibility with the
previous ImageFeatureExtractionMixin method.<ul>
<li>Unset: will return the same type as the input image.</li>
<li><code>True</code>: will return a numpy array.</li>
<li><code>False</code>: will return a <code>PIL.Image.Image</code> object.</li>
</ul>`,name:"return_numpy"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_transforms.py#L375",returnDescription:`
<p>The cropped image.</p>
`,returnType:`
<p><code>np.ndarray</code></p>
`}}),_e=new P({props:{name:"transformers.image_transforms.center_to_corners_format",anchor:"transformers.image_transforms.center_to_corners_format",parameters:[{name:"bboxes_center",val:": TensorType"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_transforms.py#L503"}}),be=new P({props:{name:"transformers.image_transforms.corners_to_center_format",anchor:"transformers.image_transforms.corners_to_center_format",parameters:[{name:"bboxes_corners",val:": TensorType"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_transforms.py#L563"}}),ve=new P({props:{name:"transformers.image_transforms.id_to_rgb",anchor:"transformers.image_transforms.id_to_rgb",parameters:[{name:"id_map",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_transforms.py#L597"}}),ye=new P({props:{name:"transformers.image_transforms.normalize",anchor:"transformers.image_transforms.normalize",parameters:[{name:"image",val:": ndarray"},{name:"mean",val:": typing.Union[float, typing.Iterable[float]]"},{name:"std",val:": typing.Union[float, typing.Iterable[float]]"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = None"}],parametersDescription:[{anchor:"transformers.image_transforms.normalize.image",description:`<strong>image</strong> (<code>np.ndarray</code>) &#x2014;
The image to normalize.`,name:"image"},{anchor:"transformers.image_transforms.normalize.mean",description:`<strong>mean</strong> (<code>float</code> or <code>Iterable[float]</code>) &#x2014;
The mean to use for normalization.`,name:"mean"},{anchor:"transformers.image_transforms.normalize.std",description:`<strong>std</strong> (<code>float</code> or <code>Iterable[float]</code>) &#x2014;
The standard deviation to use for normalization.`,name:"std"},{anchor:"transformers.image_transforms.normalize.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format of the output image. If unset, will use the inferred format from the input.`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_transforms.py#L312"}}),$e=new P({props:{name:"transformers.image_transforms.pad",anchor:"transformers.image_transforms.pad",parameters:[{name:"image",val:": ndarray"},{name:"padding",val:": typing.Union[int, typing.Tuple[int, int], typing.Iterable[typing.Tuple[int, int]]]"},{name:"mode",val:": PaddingMode = <PaddingMode.CONSTANT: 'constant'>"},{name:"constant_values",val:": typing.Union[float, typing.Iterable[float]] = 0.0"},{name:"data_format",val:": typing.Union[transformers.image_utils.ChannelDimension, str, NoneType] = None"},{name:"input_data_format",val:": typing.Union[transformers.image_utils.ChannelDimension, str, NoneType] = None"}],parametersDescription:[{anchor:"transformers.image_transforms.pad.image",description:`<strong>image</strong> (<code>np.ndarray</code>) &#x2014;
The image to pad.`,name:"image"},{anchor:"transformers.image_transforms.pad.padding",description:`<strong>padding</strong> (<code>int</code> or <code>Tuple[int, int]</code> or <code>Iterable[Tuple[int, int]]</code>) &#x2014;
Padding to apply to the edges of the height, width axes. Can be one of three formats:<ul>
<li><code>((before_height, after_height), (before_width, after_width))</code> unique pad widths for each axis.</li>
<li><code>((before, after),)</code> yields same before and after pad for height and width.</li>
<li><code>(pad,)</code> or int is a shortcut for before = after = pad width for all axes.</li>
</ul>`,name:"padding"},{anchor:"transformers.image_transforms.pad.mode",description:`<strong>mode</strong> (<code>PaddingMode</code>) &#x2014;
The padding mode to use. Can be one of:<ul>
<li><code>&quot;constant&quot;</code>: pads with a constant value.</li>
<li><code>&quot;reflect&quot;</code>: pads with the reflection of the vector mirrored on the first and last values of the
vector along each axis.</li>
<li><code>&quot;replicate&quot;</code>: pads with the replication of the last value on the edge of the array along each axis.</li>
<li><code>&quot;symmetric&quot;</code>: pads with the reflection of the vector mirrored along the edge of the array.</li>
</ul>`,name:"mode"},{anchor:"transformers.image_transforms.pad.constant_values",description:`<strong>constant_values</strong> (<code>float</code> or <code>Iterable[float]</code>, <em>optional</em>) &#x2014;
The value to use for the padding if <code>mode</code> is <code>&quot;constant&quot;</code>.`,name:"constant_values"},{anchor:"transformers.image_transforms.pad.data_format",description:`<strong>data_format</strong> (<code>str</code> or <code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.
If unset, will use same as the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.image_transforms.pad.input_data_format",description:`<strong>input_data_format</strong> (<code>str</code> or <code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.
If unset, will use the inferred format of the input image.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_transforms.py#L627",returnDescription:`
<p>The padded image.</p>
`,returnType:`
<p><code>np.ndarray</code></p>
`}}),xe=new P({props:{name:"transformers.image_transforms.rgb_to_id",anchor:"transformers.image_transforms.rgb_to_id",parameters:[{name:"color",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_transforms.py#L586"}}),Ie=new P({props:{name:"transformers.image_transforms.rescale",anchor:"transformers.image_transforms.rescale",parameters:[{name:"image",val:": ndarray"},{name:"scale",val:": float"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = None"},{name:"dtype",val:" = <class 'numpy.float32'>"}],parametersDescription:[{anchor:"transformers.image_transforms.rescale.image",description:`<strong>image</strong> (<code>np.ndarray</code>) &#x2014;
The image to rescale.`,name:"image"},{anchor:"transformers.image_transforms.rescale.scale",description:`<strong>scale</strong> (<code>float</code>) &#x2014;
The scale to use for rescaling the image.`,name:"scale"},{anchor:"transformers.image_transforms.rescale.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format of the image. If not provided, it will be the same as the input image.`,name:"data_format"},{anchor:"transformers.image_transforms.rescale.dtype",description:`<strong>dtype</strong> (<code>np.dtype</code>, <em>optional</em>, defaults to <code>np.float32</code>) &#x2014;
The dtype of the output image. Defaults to <code>np.float32</code>. Used for backwards compatibility with feature
extractors.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_transforms.py#L91",returnDescription:`
<p>The rescaled image.</p>
`,returnType:`
<p><code>np.ndarray</code></p>
`}}),we=new P({props:{name:"transformers.image_transforms.resize",anchor:"transformers.image_transforms.resize",parameters:[{name:"image",val:""},{name:"size",val:": typing.Tuple[int, int]"},{name:"resample",val:": PILImageResampling = None"},{name:"reducing_gap",val:": typing.Optional[int] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = None"},{name:"return_numpy",val:": bool = True"}],parametersDescription:[{anchor:"transformers.image_transforms.resize.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to resize.`,name:"image"},{anchor:"transformers.image_transforms.resize.size",description:`<strong>size</strong> (<code>Tuple[int, int]</code>) &#x2014;
The size to use for resizing the image.`,name:"size"},{anchor:"transformers.image_transforms.resize.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
The filter to user for resampling.`,name:"resample"},{anchor:"transformers.image_transforms.resize.reducing_gap",description:`<strong>reducing_gap</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Apply optimization by resizing the image in two steps. The bigger <code>reducing_gap</code>, the closer the result to
the fair resampling. See corresponding Pillow documentation for more details.`,name:"reducing_gap"},{anchor:"transformers.image_transforms.resize.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format of the output image. If unset, will use the inferred format from the input.`,name:"data_format"},{anchor:"transformers.image_transforms.resize.return_numpy",description:`<strong>return_numpy</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return the resized image as a numpy array. If False a <code>PIL.Image.Image</code> object is
returned.`,name:"return_numpy"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_transforms.py#L251",returnDescription:`
<p>The resized image.</p>
`,returnType:`
<p><code>np.ndarray</code></p>
`}}),Pe=new P({props:{name:"transformers.image_transforms.to_pil_image",anchor:"transformers.image_transforms.to_pil_image",parameters:[{name:"image",val:": typing.Union[numpy.ndarray, ForwardRef('PIL.Image.Image'), ForwardRef('torch.Tensor'), ForwardRef('tf.Tensor'), ForwardRef('jnp.ndarray')]"},{name:"do_rescale",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.image_transforms.to_pil_image.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>numpy.ndarray</code> or <code>torch.Tensor</code> or <code>tf.Tensor</code>) &#x2014;
The image to convert to the <code>PIL.Image</code> format.`,name:"image"},{anchor:"transformers.image_transforms.to_pil_image.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to apply the scaling factor (to make pixel values integers between 0 and 255). Will default
to <code>True</code> if the image type is a floating type and casting to <code>int</code> would result in a loss of precision,
and <code>False</code> otherwise.`,name:"do_rescale"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_transforms.py#L121",returnDescription:`
<p>The converted image.</p>
`,returnType:`
<p><code>PIL.Image.Image</code></p>
`}}),Te=new Sa({}),De=new P({props:{name:"class transformers.ImageProcessingMixin",anchor:"transformers.ImageProcessingMixin",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L58"}}),ke=new P({props:{name:"from_dict",anchor:"transformers.ImageProcessingMixin.from_dict",parameters:[{name:"image_processor_dict",val:": typing.Dict[str, typing.Any]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ImageProcessingMixin.from_dict.image_processor_dict",description:`<strong>image_processor_dict</strong> (<code>Dict[str, Any]</code>) &#x2014;
Dictionary that will be used to instantiate the image processor object. Such a dictionary can be
retrieved from a pretrained checkpoint by leveraging the
<a href="/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin.to_dict">to_dict()</a> method.`,name:"image_processor_dict"},{anchor:"transformers.ImageProcessingMixin.from_dict.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>) &#x2014;
Additional parameters from which to initialize the image processor object.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L314",returnDescription:`
<p>The image processor object instantiated from those
parameters.</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin"
>ImageProcessingMixin</a></p>
`}}),ze=new P({props:{name:"from_json_file",anchor:"transformers.ImageProcessingMixin.from_json_file",parameters:[{name:"json_file",val:": typing.Union[str, os.PathLike]"}],parametersDescription:[{anchor:"transformers.ImageProcessingMixin.from_json_file.json_file",description:`<strong>json_file</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Path to the JSON file containing the parameters.`,name:"json_file"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L371",returnDescription:`
<p>The image_processor object
instantiated from that JSON file.</p>
`,returnType:`
<p>A image processor of type <a
  href="/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin"
>ImageProcessingMixin</a></p>
`}}),qe=new P({props:{name:"from_pretrained",anchor:"transformers.ImageProcessingMixin.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ImageProcessingMixin.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
This can be either:</p>
<ul>
<li>a string, the <em>model id</em> of a pretrained image_processor hosted inside a model repo on
huggingface.co. Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or
namespaced under a user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>a path to a <em>directory</em> containing a image processor file saved using the
<a href="/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin.save_pretrained">save_pretrained()</a> method, e.g.,
<code>./my_model_directory/</code>.</li>
<li>a path or url to a saved image processor JSON <em>file</em>, e.g.,
<code>./my_model_directory/preprocessor_config.json</code>.</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.ImageProcessingMixin.from_pretrained.cache_dir",description:`<strong>cache_dir</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model image processor should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"transformers.ImageProcessingMixin.from_pretrained.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force to (re-)download the image processor files and override the cached versions if
they exist.`,name:"force_download"},{anchor:"transformers.ImageProcessingMixin.from_pretrained.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received file. Attempts to resume the download if such a file
exists.`,name:"resume_download"},{anchor:"transformers.ImageProcessingMixin.from_pretrained.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}.</code> The proxies are used on each request.`,name:"proxies"},{anchor:"transformers.ImageProcessingMixin.from_pretrained.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, or not specified, will use
the token generated when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"use_auth_token"},{anchor:"transformers.ImageProcessingMixin.from_pretrained.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L82",returnDescription:`
<p>A image processor of type <a
  href="/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin"
>ImageProcessingMixin</a>.</p>
`}}),oe=new zs({props:{anchor:"transformers.ImageProcessingMixin.from_pretrained.example",$$slots:{default:[Fs]},$$scope:{ctx:Q}}}),je=new P({props:{name:"get_image_processor_dict",anchor:"transformers.ImageProcessingMixin.get_image_processor_dict",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ImageProcessingMixin.get_image_processor_dict.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
The identifier of the pre-trained checkpoint from which we want the dictionary of parameters.`,name:"pretrained_model_name_or_path"},{anchor:"transformers.ImageProcessingMixin.get_image_processor_dict.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can
specify the folder name here.`,name:"subfolder"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L216",returnDescription:`
<p>The dictionary(ies) that will be used to instantiate the image processor object.</p>
`,returnType:`
<p><code>Tuple[Dict, Dict]</code></p>
`}}),Oe=new P({props:{name:"push_to_hub",anchor:"transformers.ImageProcessingMixin.push_to_hub",parameters:[{name:"repo_id",val:": str"},{name:"use_temp_dir",val:": typing.Optional[bool] = None"},{name:"commit_message",val:": typing.Optional[str] = None"},{name:"private",val:": typing.Optional[bool] = None"},{name:"use_auth_token",val:": typing.Union[bool, str, NoneType] = None"},{name:"max_shard_size",val:": typing.Union[int, str, NoneType] = '10GB'"},{name:"create_pr",val:": bool = False"},{name:"**deprecated_kwargs",val:""}],parametersDescription:[{anchor:"transformers.ImageProcessingMixin.push_to_hub.repo_id",description:`<strong>repo_id</strong> (<code>str</code>) &#x2014;
The name of the repository you want to push your image processor to. It should contain your organization name
when pushing to a given organization.`,name:"repo_id"},{anchor:"transformers.ImageProcessingMixin.push_to_hub.use_temp_dir",description:`<strong>use_temp_dir</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to use a temporary directory to store the files saved before they are pushed to the Hub.
Will default to <code>True</code> if there is no directory named like <code>repo_id</code>, <code>False</code> otherwise.`,name:"use_temp_dir"},{anchor:"transformers.ImageProcessingMixin.push_to_hub.commit_message",description:`<strong>commit_message</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Message to commit while pushing. Will default to <code>&quot;Upload image processor&quot;</code>.`,name:"commit_message"},{anchor:"transformers.ImageProcessingMixin.push_to_hub.private",description:`<strong>private</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the repository created should be private.`,name:"private"},{anchor:"transformers.ImageProcessingMixin.push_to_hub.use_auth_token",description:`<strong>use_auth_token</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>). Will default to <code>True</code> if <code>repo_url</code>
is not specified.`,name:"use_auth_token"},{anchor:"transformers.ImageProcessingMixin.push_to_hub.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
Only applicable for models. The maximum size for a checkpoint before being sharded. Checkpoints shard
will then be each of size lower than this size. If expressed as a string, needs to be digits followed
by a unit (like <code>&quot;5MB&quot;</code>).`,name:"max_shard_size"},{anchor:"transformers.ImageProcessingMixin.push_to_hub.create_pr",description:`<strong>create_pr</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to create a PR with the uploaded files or directly commit.`,name:"create_pr"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/utils/hub.py#L703"}}),ae=new zs({props:{anchor:"transformers.ImageProcessingMixin.push_to_hub.example",$$slots:{default:[Us]},$$scope:{ctx:Q}}}),Ae=new P({props:{name:"register_for_auto_class",anchor:"transformers.ImageProcessingMixin.register_for_auto_class",parameters:[{name:"auto_class",val:" = 'AutoImageProcessor'"}],parametersDescription:[{anchor:"transformers.ImageProcessingMixin.register_for_auto_class.auto_class",description:`<strong>auto_class</strong> (<code>str</code> or <code>type</code>, <em>optional</em>, defaults to <code>&quot;AutoImageProcessor &quot;</code>) &#x2014;
The auto class to register this new image processor with.`,name:"auto_class"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L425"}}),se=new Ss({props:{warning:!0,$$slots:{default:[Rs]},$$scope:{ctx:Q}}}),Fe=new P({props:{name:"save_pretrained",anchor:"transformers.ImageProcessingMixin.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"push_to_hub",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ImageProcessingMixin.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory where the image processor JSON file will be saved (will be created if it does not exist).`,name:"save_directory"},{anchor:"transformers.ImageProcessingMixin.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
repository you want to push to with <code>repo_id</code> (will default to the name of <code>save_directory</code> in your
namespace).
kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin.push_to_hub">push_to_hub()</a> method.`,name:"push_to_hub"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L168"}}),Ue=new P({props:{name:"to_dict",anchor:"transformers.ImageProcessingMixin.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L359",returnDescription:`
<p>Dictionary of all the attributes that make up this image processor instance.</p>
`,returnType:`
<p><code>Dict[str, Any]</code></p>
`}}),Re=new P({props:{name:"to_json_file",anchor:"transformers.ImageProcessingMixin.to_json_file",parameters:[{name:"json_file_path",val:": typing.Union[str, os.PathLike]"}],parametersDescription:[{anchor:"transformers.ImageProcessingMixin.to_json_file.json_file_path",description:`<strong>json_file_path</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Path to the JSON file in which this image_processor instance&#x2019;s parameters will be saved.`,name:"json_file_path"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L411"}}),Ve=new P({props:{name:"to_json_string",anchor:"transformers.ImageProcessingMixin.to_json_string",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_processing_utils.py#L390",returnDescription:`
<p>String containing all the attributes that make up this feature_extractor instance in JSON format.</p>
`,returnType:`
<p><code>str</code></p>
`}}),{c(){f=t("meta"),T=m(),I=t("h1"),h=t("a"),D=t("span"),_(l.$$.fragment),E=m(),sr=t("span"),ko=n("Utilities for Image Processors"),Wr=m(),Je=t("p"),Mo=n(`This page lists all the utility functions used by the image processors, mainly the functional
transformations used to process the images.`),Jr=m(),Be=t("p"),zo=n("Most of those are only useful if you are studying the code of the image processors in the library."),Br=m(),F=t("h2"),X=t("a"),nr=t("span"),_(he.$$.fragment),Co=m(),ir=t("span"),qo=n("Image Transformations"),Hr=m(),U=t("div"),_(ue.$$.fragment),Lo=m(),k=t("p"),jo=n("Crops the "),mr=t("code"),Oo=n("image"),No=n(" to the specified "),cr=t("code"),Ao=n("size"),So=n(` 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 will always be of size `),dr=t("code"),Fo=n("size"),Uo=n(")."),Gr=m(),M=t("div"),_(_e.$$.fragment),Ro=m(),lr=t("p"),Vo=n("Converts bounding boxes from center format to corners format."),Wo=m(),pr=t("p"),Jo=n(`center format: contains the coordinate for the center of the box and its width, height dimensions
(center_x, center_y, width, height)
corners format: contains the coodinates for the top-left and bottom-right corners of the box
(top_left_x, top_left_y, bottom_right_x, bottom_right_y)`),Yr=m(),z=t("div"),_(be.$$.fragment),Bo=m(),gr=t("p"),Ho=n("Converts bounding boxes from corners format to center format."),Go=m(),fr=t("p"),Yo=n(`corners format: contains the coodinates for the top-left and bottom-right corners of the box
(top_left_x, top_left_y, bottom_right_x, bottom_right_y)
center format: contains the coordinate for the center of the box and its the width, height dimensions
(center_x, center_y, width, height)`),Kr=m(),R=t("div"),_(ve.$$.fragment),Ko=m(),hr=t("p"),Qo=n("Converts unique ID to RGB color."),Qr=m(),C=t("div"),_(ye.$$.fragment),Xo=m(),q=t("p"),Zo=n("Normalizes "),ur=t("code"),et=n("image"),rt=n(" using the mean and standard deviation specified by "),_r=t("code"),ot=n("mean"),tt=n(" and "),br=t("code"),at=n("std"),st=n("."),nt=m(),vr=t("p"),it=n("image = (image - mean) / std"),Xr=m(),V=t("div"),_($e.$$.fragment),mt=m(),L=t("p"),ct=n("Pads the "),yr=t("code"),dt=n("image"),lt=n(" with the specified (height, width) "),$r=t("code"),pt=n("padding"),gt=n(" and "),xr=t("code"),ft=n("mode"),ht=n("."),Zr=m(),W=t("div"),_(xe.$$.fragment),ut=m(),Ir=t("p"),_t=n("Converts RGB color to unique ID."),eo=m(),J=t("div"),_(Ie.$$.fragment),bt=m(),B=t("p"),vt=n("Rescales "),wr=t("code"),yt=n("image"),$t=n(" by "),Pr=t("code"),xt=n("scale"),It=n("."),ro=m(),H=t("div"),_(we.$$.fragment),wt=m(),j=t("p"),Pt=n("Resizes "),Er=t("code"),Et=n("image"),Tt=n(" to "),Tr=t("code"),Dt=n("(height, width)"),kt=n(" specified by "),Dr=t("code"),Mt=n("size"),zt=n(" using the PIL library."),oo=m(),G=t("div"),_(Pe.$$.fragment),Ct=m(),Ee=t("p"),qt=n("Converts "),kr=t("code"),Lt=n("image"),jt=n(` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if
needed.`),to=m(),Y=t("h2"),Z=t("a"),Mr=t("span"),_(Te.$$.fragment),Ot=m(),zr=t("span"),Nt=n("ImageProcessingMixin"),ao=m(),u=t("div"),_(De.$$.fragment),At=m(),Cr=t("p"),St=n(`This is an image processor mixin used to provide saving/loading functionality for sequential and image feature
extractors.`),Ft=m(),ee=t("div"),_(ke.$$.fragment),Ut=m(),Me=t("p"),Rt=n("Instantiates a type of "),He=t("a"),Vt=n("ImageProcessingMixin"),Wt=n(" from a Python dictionary of parameters."),Jt=m(),re=t("div"),_(ze.$$.fragment),Bt=m(),Ce=t("p"),Ht=n("Instantiates a image processor of type "),Ge=t("a"),Gt=n("ImageProcessingMixin"),Yt=n(` from the path to a JSON
file of parameters.`),Kt=m(),N=t("div"),_(qe.$$.fragment),Qt=m(),Le=t("p"),Xt=n("Instantiate a type of "),Ye=t("a"),Zt=n("ImageProcessingMixin"),ea=n(" from an image processor."),ra=m(),_(oe.$$.fragment),oa=m(),te=t("div"),_(je.$$.fragment),ta=m(),O=t("p"),aa=n("From a "),qr=t("code"),sa=n("pretrained_model_name_or_path"),na=n(`, resolve to a dictionary of parameters, to be used for instantiating a
image processor of type `),Lr=t("code"),ia=n("~image_processor_utils.ImageProcessingMixin"),ma=n(" using "),jr=t("code"),ca=n("from_dict"),da=n("."),la=m(),A=t("div"),_(Oe.$$.fragment),pa=m(),Ne=t("p"),ga=n(`Upload the image processor file to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),Or=t("code"),fa=n("repo_path_or_name"),ha=n("."),ua=m(),_(ae.$$.fragment),_a=m(),S=t("div"),_(Ae.$$.fragment),ba=m(),Se=t("p"),va=n(`Register this class with a given auto class. This should only be used for custom image processors as the ones
in the library are already mapped with `),Nr=t("code"),ya=n("AutoImageProcessor "),$a=n("."),xa=m(),_(se.$$.fragment),Ia=m(),ne=t("div"),_(Fe.$$.fragment),wa=m(),K=t("p"),Pa=n("Save an image processor object to the directory "),Ar=t("code"),Ea=n("save_directory"),Ta=n(`, so that it can be re-loaded using the
`),Ke=t("a"),Da=n("from_pretrained()"),ka=n(" class method."),Ma=m(),ie=t("div"),_(Ue.$$.fragment),za=m(),Sr=t("p"),Ca=n("Serializes this instance to a Python dictionary."),qa=m(),me=t("div"),_(Re.$$.fragment),La=m(),Fr=t("p"),ja=n("Save this instance to a JSON file."),Oa=m(),ce=t("div"),_(Ve.$$.fragment),Na=m(),Ur=t("p"),Aa=n("Serializes this instance to a JSON string."),this.h()},l(r){const d=Ns('[data-svelte="svelte-1phssyn"]',document.head);f=a(d,"META",{name:!0,content:!0}),d.forEach(o),T=c(r),I=a(r,"H1",{class:!0});var We=s(I);h=a(We,"A",{id:!0,class:!0,href:!0});var Rr=s(h);D=a(Rr,"SPAN",{});var Vr=s(D);b(l.$$.fragment,Vr),Vr.forEach(o),Rr.forEach(o),E=c(We),sr=a(We,"SPAN",{});var Fa=s(sr);ko=i(Fa,"Utilities for Image Processors"),Fa.forEach(o),We.forEach(o),Wr=c(r),Je=a(r,"P",{});var Ua=s(Je);Mo=i(Ua,`This page lists all the utility functions used by the image processors, mainly the functional
transformations used to process the images.`),Ua.forEach(o),Jr=c(r),Be=a(r,"P",{});var Ra=s(Be);zo=i(Ra,"Most of those are only useful if you are studying the code of the image processors in the library."),Ra.forEach(o),Br=c(r),F=a(r,"H2",{class:!0});var no=s(F);X=a(no,"A",{id:!0,class:!0,href:!0});var Va=s(X);nr=a(Va,"SPAN",{});var Wa=s(nr);b(he.$$.fragment,Wa),Wa.forEach(o),Va.forEach(o),Co=c(no),ir=a(no,"SPAN",{});var Ja=s(ir);qo=i(Ja,"Image Transformations"),Ja.forEach(o),no.forEach(o),Hr=c(r),U=a(r,"DIV",{class:!0});var io=s(U);b(ue.$$.fragment,io),Lo=c(io),k=a(io,"P",{});var de=s(k);jo=i(de,"Crops the "),mr=a(de,"CODE",{});var Ba=s(mr);Oo=i(Ba,"image"),Ba.forEach(o),No=i(de," to the specified "),cr=a(de,"CODE",{});var Ha=s(cr);Ao=i(Ha,"size"),Ha.forEach(o),So=i(de,` 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 will always be of size `),dr=a(de,"CODE",{});var Ga=s(dr);Fo=i(Ga,"size"),Ga.forEach(o),Uo=i(de,")."),de.forEach(o),io.forEach(o),Gr=c(r),M=a(r,"DIV",{class:!0});var Qe=s(M);b(_e.$$.fragment,Qe),Ro=c(Qe),lr=a(Qe,"P",{});var Ya=s(lr);Vo=i(Ya,"Converts bounding boxes from center format to corners format."),Ya.forEach(o),Wo=c(Qe),pr=a(Qe,"P",{});var Ka=s(pr);Jo=i(Ka,`center format: contains the coordinate for the center of the box and its width, height dimensions
(center_x, center_y, width, height)
corners format: contains the coodinates for the top-left and bottom-right corners of the box
(top_left_x, top_left_y, bottom_right_x, bottom_right_y)`),Ka.forEach(o),Qe.forEach(o),Yr=c(r),z=a(r,"DIV",{class:!0});var Xe=s(z);b(be.$$.fragment,Xe),Bo=c(Xe),gr=a(Xe,"P",{});var Qa=s(gr);Ho=i(Qa,"Converts bounding boxes from corners format to center format."),Qa.forEach(o),Go=c(Xe),fr=a(Xe,"P",{});var Xa=s(fr);Yo=i(Xa,`corners format: contains the coodinates for the top-left and bottom-right corners of the box
(top_left_x, top_left_y, bottom_right_x, bottom_right_y)
center format: contains the coordinate for the center of the box and its the width, height dimensions
(center_x, center_y, width, height)`),Xa.forEach(o),Xe.forEach(o),Kr=c(r),R=a(r,"DIV",{class:!0});var mo=s(R);b(ve.$$.fragment,mo),Ko=c(mo),hr=a(mo,"P",{});var Za=s(hr);Qo=i(Za,"Converts unique ID to RGB color."),Za.forEach(o),mo.forEach(o),Qr=c(r),C=a(r,"DIV",{class:!0});var Ze=s(C);b(ye.$$.fragment,Ze),Xo=c(Ze),q=a(Ze,"P",{});var le=s(q);Zo=i(le,"Normalizes "),ur=a(le,"CODE",{});var es=s(ur);et=i(es,"image"),es.forEach(o),rt=i(le," using the mean and standard deviation specified by "),_r=a(le,"CODE",{});var rs=s(_r);ot=i(rs,"mean"),rs.forEach(o),tt=i(le," and "),br=a(le,"CODE",{});var os=s(br);at=i(os,"std"),os.forEach(o),st=i(le,"."),le.forEach(o),nt=c(Ze),vr=a(Ze,"P",{});var ts=s(vr);it=i(ts,"image = (image - mean) / std"),ts.forEach(o),Ze.forEach(o),Xr=c(r),V=a(r,"DIV",{class:!0});var co=s(V);b($e.$$.fragment,co),mt=c(co),L=a(co,"P",{});var pe=s(L);ct=i(pe,"Pads the "),yr=a(pe,"CODE",{});var as=s(yr);dt=i(as,"image"),as.forEach(o),lt=i(pe," with the specified (height, width) "),$r=a(pe,"CODE",{});var ss=s($r);pt=i(ss,"padding"),ss.forEach(o),gt=i(pe," and "),xr=a(pe,"CODE",{});var ns=s(xr);ft=i(ns,"mode"),ns.forEach(o),ht=i(pe,"."),pe.forEach(o),co.forEach(o),Zr=c(r),W=a(r,"DIV",{class:!0});var lo=s(W);b(xe.$$.fragment,lo),ut=c(lo),Ir=a(lo,"P",{});var is=s(Ir);_t=i(is,"Converts RGB color to unique ID."),is.forEach(o),lo.forEach(o),eo=c(r),J=a(r,"DIV",{class:!0});var po=s(J);b(Ie.$$.fragment,po),bt=c(po),B=a(po,"P",{});var er=s(B);vt=i(er,"Rescales "),wr=a(er,"CODE",{});var ms=s(wr);yt=i(ms,"image"),ms.forEach(o),$t=i(er," by "),Pr=a(er,"CODE",{});var cs=s(Pr);xt=i(cs,"scale"),cs.forEach(o),It=i(er,"."),er.forEach(o),po.forEach(o),ro=c(r),H=a(r,"DIV",{class:!0});var go=s(H);b(we.$$.fragment,go),wt=c(go),j=a(go,"P",{});var ge=s(j);Pt=i(ge,"Resizes "),Er=a(ge,"CODE",{});var ds=s(Er);Et=i(ds,"image"),ds.forEach(o),Tt=i(ge," to "),Tr=a(ge,"CODE",{});var ls=s(Tr);Dt=i(ls,"(height, width)"),ls.forEach(o),kt=i(ge," specified by "),Dr=a(ge,"CODE",{});var ps=s(Dr);Mt=i(ps,"size"),ps.forEach(o),zt=i(ge," using the PIL library."),ge.forEach(o),go.forEach(o),oo=c(r),G=a(r,"DIV",{class:!0});var fo=s(G);b(Pe.$$.fragment,fo),Ct=c(fo),Ee=a(fo,"P",{});var ho=s(Ee);qt=i(ho,"Converts "),kr=a(ho,"CODE",{});var gs=s(kr);Lt=i(gs,"image"),gs.forEach(o),jt=i(ho,` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if
needed.`),ho.forEach(o),fo.forEach(o),to=c(r),Y=a(r,"H2",{class:!0});var uo=s(Y);Z=a(uo,"A",{id:!0,class:!0,href:!0});var fs=s(Z);Mr=a(fs,"SPAN",{});var hs=s(Mr);b(Te.$$.fragment,hs),hs.forEach(o),fs.forEach(o),Ot=c(uo),zr=a(uo,"SPAN",{});var us=s(zr);Nt=i(us,"ImageProcessingMixin"),us.forEach(o),uo.forEach(o),ao=c(r),u=a(r,"DIV",{class:!0});var w=s(u);b(De.$$.fragment,w),At=c(w),Cr=a(w,"P",{});var _s=s(Cr);St=i(_s,`This is an image processor mixin used to provide saving/loading functionality for sequential and image feature
extractors.`),_s.forEach(o),Ft=c(w),ee=a(w,"DIV",{class:!0});var _o=s(ee);b(ke.$$.fragment,_o),Ut=c(_o),Me=a(_o,"P",{});var bo=s(Me);Rt=i(bo,"Instantiates a type of "),He=a(bo,"A",{href:!0});var bs=s(He);Vt=i(bs,"ImageProcessingMixin"),bs.forEach(o),Wt=i(bo," from a Python dictionary of parameters."),bo.forEach(o),_o.forEach(o),Jt=c(w),re=a(w,"DIV",{class:!0});var vo=s(re);b(ze.$$.fragment,vo),Bt=c(vo),Ce=a(vo,"P",{});var yo=s(Ce);Ht=i(yo,"Instantiates a image processor of type "),Ge=a(yo,"A",{href:!0});var vs=s(Ge);Gt=i(vs,"ImageProcessingMixin"),vs.forEach(o),Yt=i(yo,` from the path to a JSON
file of parameters.`),yo.forEach(o),vo.forEach(o),Kt=c(w),N=a(w,"DIV",{class:!0});var rr=s(N);b(qe.$$.fragment,rr),Qt=c(rr),Le=a(rr,"P",{});var $o=s(Le);Xt=i($o,"Instantiate a type of "),Ye=a($o,"A",{href:!0});var ys=s(Ye);Zt=i(ys,"ImageProcessingMixin"),ys.forEach(o),ea=i($o," from an image processor."),$o.forEach(o),ra=c(rr),b(oe.$$.fragment,rr),rr.forEach(o),oa=c(w),te=a(w,"DIV",{class:!0});var xo=s(te);b(je.$$.fragment,xo),ta=c(xo),O=a(xo,"P",{});var fe=s(O);aa=i(fe,"From a "),qr=a(fe,"CODE",{});var $s=s(qr);sa=i($s,"pretrained_model_name_or_path"),$s.forEach(o),na=i(fe,`, resolve to a dictionary of parameters, to be used for instantiating a
image processor of type `),Lr=a(fe,"CODE",{});var xs=s(Lr);ia=i(xs,"~image_processor_utils.ImageProcessingMixin"),xs.forEach(o),ma=i(fe," using "),jr=a(fe,"CODE",{});var Is=s(jr);ca=i(Is,"from_dict"),Is.forEach(o),da=i(fe,"."),fe.forEach(o),xo.forEach(o),la=c(w),A=a(w,"DIV",{class:!0});var or=s(A);b(Oe.$$.fragment,or),pa=c(or),Ne=a(or,"P",{});var Io=s(Ne);ga=i(Io,`Upload the image processor file to the \u{1F917} Model Hub while synchronizing a local clone of the repo in
`),Or=a(Io,"CODE",{});var ws=s(Or);fa=i(ws,"repo_path_or_name"),ws.forEach(o),ha=i(Io,"."),Io.forEach(o),ua=c(or),b(ae.$$.fragment,or),or.forEach(o),_a=c(w),S=a(w,"DIV",{class:!0});var tr=s(S);b(Ae.$$.fragment,tr),ba=c(tr),Se=a(tr,"P",{});var wo=s(Se);va=i(wo,`Register this class with a given auto class. This should only be used for custom image processors as the ones
in the library are already mapped with `),Nr=a(wo,"CODE",{});var Ps=s(Nr);ya=i(Ps,"AutoImageProcessor "),Ps.forEach(o),$a=i(wo,"."),wo.forEach(o),xa=c(tr),b(se.$$.fragment,tr),tr.forEach(o),Ia=c(w),ne=a(w,"DIV",{class:!0});var Po=s(ne);b(Fe.$$.fragment,Po),wa=c(Po),K=a(Po,"P",{});var ar=s(K);Pa=i(ar,"Save an image processor object to the directory "),Ar=a(ar,"CODE",{});var Es=s(Ar);Ea=i(Es,"save_directory"),Es.forEach(o),Ta=i(ar,`, so that it can be re-loaded using the
`),Ke=a(ar,"A",{href:!0});var Ts=s(Ke);Da=i(Ts,"from_pretrained()"),Ts.forEach(o),ka=i(ar," class method."),ar.forEach(o),Po.forEach(o),Ma=c(w),ie=a(w,"DIV",{class:!0});var Eo=s(ie);b(Ue.$$.fragment,Eo),za=c(Eo),Sr=a(Eo,"P",{});var Ds=s(Sr);Ca=i(Ds,"Serializes this instance to a Python dictionary."),Ds.forEach(o),Eo.forEach(o),qa=c(w),me=a(w,"DIV",{class:!0});var To=s(me);b(Re.$$.fragment,To),La=c(To),Fr=a(To,"P",{});var ks=s(Fr);ja=i(ks,"Save this instance to a JSON file."),ks.forEach(o),To.forEach(o),Oa=c(w),ce=a(w,"DIV",{class:!0});var Do=s(ce);b(Ve.$$.fragment,Do),Na=c(Do),Ur=a(Do,"P",{});var Ms=s(Ur);Aa=i(Ms,"Serializes this instance to a JSON string."),Ms.forEach(o),Do.forEach(o),w.forEach(o),this.h()},h(){p(f,"name","hf:doc:metadata"),p(f,"content",JSON.stringify(Ws)),p(h,"id","utilities-for-image-processors"),p(h,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(h,"href","#utilities-for-image-processors"),p(I,"class","relative group"),p(X,"id","transformers.image_transforms.center_crop"),p(X,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(X,"href","#transformers.image_transforms.center_crop"),p(F,"class","relative group"),p(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Z,"id","transformers.ImageProcessingMixin"),p(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Z,"href","#transformers.ImageProcessingMixin"),p(Y,"class","relative group"),p(He,"href","/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin"),p(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ge,"href","/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin"),p(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ye,"href","/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin"),p(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ke,"href","/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin.from_pretrained"),p(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(r,d){e(document.head,f),g(r,T,d),g(r,I,d),e(I,h),e(h,D),v(l,D,null),e(I,E),e(I,sr),e(sr,ko),g(r,Wr,d),g(r,Je,d),e(Je,Mo),g(r,Jr,d),g(r,Be,d),e(Be,zo),g(r,Br,d),g(r,F,d),e(F,X),e(X,nr),v(he,nr,null),e(F,Co),e(F,ir),e(ir,qo),g(r,Hr,d),g(r,U,d),v(ue,U,null),e(U,Lo),e(U,k),e(k,jo),e(k,mr),e(mr,Oo),e(k,No),e(k,cr),e(cr,Ao),e(k,So),e(k,dr),e(dr,Fo),e(k,Uo),g(r,Gr,d),g(r,M,d),v(_e,M,null),e(M,Ro),e(M,lr),e(lr,Vo),e(M,Wo),e(M,pr),e(pr,Jo),g(r,Yr,d),g(r,z,d),v(be,z,null),e(z,Bo),e(z,gr),e(gr,Ho),e(z,Go),e(z,fr),e(fr,Yo),g(r,Kr,d),g(r,R,d),v(ve,R,null),e(R,Ko),e(R,hr),e(hr,Qo),g(r,Qr,d),g(r,C,d),v(ye,C,null),e(C,Xo),e(C,q),e(q,Zo),e(q,ur),e(ur,et),e(q,rt),e(q,_r),e(_r,ot),e(q,tt),e(q,br),e(br,at),e(q,st),e(C,nt),e(C,vr),e(vr,it),g(r,Xr,d),g(r,V,d),v($e,V,null),e(V,mt),e(V,L),e(L,ct),e(L,yr),e(yr,dt),e(L,lt),e(L,$r),e($r,pt),e(L,gt),e(L,xr),e(xr,ft),e(L,ht),g(r,Zr,d),g(r,W,d),v(xe,W,null),e(W,ut),e(W,Ir),e(Ir,_t),g(r,eo,d),g(r,J,d),v(Ie,J,null),e(J,bt),e(J,B),e(B,vt),e(B,wr),e(wr,yt),e(B,$t),e(B,Pr),e(Pr,xt),e(B,It),g(r,ro,d),g(r,H,d),v(we,H,null),e(H,wt),e(H,j),e(j,Pt),e(j,Er),e(Er,Et),e(j,Tt),e(j,Tr),e(Tr,Dt),e(j,kt),e(j,Dr),e(Dr,Mt),e(j,zt),g(r,oo,d),g(r,G,d),v(Pe,G,null),e(G,Ct),e(G,Ee),e(Ee,qt),e(Ee,kr),e(kr,Lt),e(Ee,jt),g(r,to,d),g(r,Y,d),e(Y,Z),e(Z,Mr),v(Te,Mr,null),e(Y,Ot),e(Y,zr),e(zr,Nt),g(r,ao,d),g(r,u,d),v(De,u,null),e(u,At),e(u,Cr),e(Cr,St),e(u,Ft),e(u,ee),v(ke,ee,null),e(ee,Ut),e(ee,Me),e(Me,Rt),e(Me,He),e(He,Vt),e(Me,Wt),e(u,Jt),e(u,re),v(ze,re,null),e(re,Bt),e(re,Ce),e(Ce,Ht),e(Ce,Ge),e(Ge,Gt),e(Ce,Yt),e(u,Kt),e(u,N),v(qe,N,null),e(N,Qt),e(N,Le),e(Le,Xt),e(Le,Ye),e(Ye,Zt),e(Le,ea),e(N,ra),v(oe,N,null),e(u,oa),e(u,te),v(je,te,null),e(te,ta),e(te,O),e(O,aa),e(O,qr),e(qr,sa),e(O,na),e(O,Lr),e(Lr,ia),e(O,ma),e(O,jr),e(jr,ca),e(O,da),e(u,la),e(u,A),v(Oe,A,null),e(A,pa),e(A,Ne),e(Ne,ga),e(Ne,Or),e(Or,fa),e(Ne,ha),e(A,ua),v(ae,A,null),e(u,_a),e(u,S),v(Ae,S,null),e(S,ba),e(S,Se),e(Se,va),e(Se,Nr),e(Nr,ya),e(Se,$a),e(S,xa),v(se,S,null),e(u,Ia),e(u,ne),v(Fe,ne,null),e(ne,wa),e(ne,K),e(K,Pa),e(K,Ar),e(Ar,Ea),e(K,Ta),e(K,Ke),e(Ke,Da),e(K,ka),e(u,Ma),e(u,ie),v(Ue,ie,null),e(ie,za),e(ie,Sr),e(Sr,Ca),e(u,qa),e(u,me),v(Re,me,null),e(me,La),e(me,Fr),e(Fr,ja),e(u,Oa),e(u,ce),v(Ve,ce,null),e(ce,Na),e(ce,Ur),e(Ur,Aa),so=!0},p(r,[d]){const We={};d&2&&(We.$$scope={dirty:d,ctx:r}),oe.$set(We);const Rr={};d&2&&(Rr.$$scope={dirty:d,ctx:r}),ae.$set(Rr);const Vr={};d&2&&(Vr.$$scope={dirty:d,ctx:r}),se.$set(Vr)},i(r){so||(y(l.$$.fragment,r),y(he.$$.fragment,r),y(ue.$$.fragment,r),y(_e.$$.fragment,r),y(be.$$.fragment,r),y(ve.$$.fragment,r),y(ye.$$.fragment,r),y($e.$$.fragment,r),y(xe.$$.fragment,r),y(Ie.$$.fragment,r),y(we.$$.fragment,r),y(Pe.$$.fragment,r),y(Te.$$.fragment,r),y(De.$$.fragment,r),y(ke.$$.fragment,r),y(ze.$$.fragment,r),y(qe.$$.fragment,r),y(oe.$$.fragment,r),y(je.$$.fragment,r),y(Oe.$$.fragment,r),y(ae.$$.fragment,r),y(Ae.$$.fragment,r),y(se.$$.fragment,r),y(Fe.$$.fragment,r),y(Ue.$$.fragment,r),y(Re.$$.fragment,r),y(Ve.$$.fragment,r),so=!0)},o(r){$(l.$$.fragment,r),$(he.$$.fragment,r),$(ue.$$.fragment,r),$(_e.$$.fragment,r),$(be.$$.fragment,r),$(ve.$$.fragment,r),$(ye.$$.fragment,r),$($e.$$.fragment,r),$(xe.$$.fragment,r),$(Ie.$$.fragment,r),$(we.$$.fragment,r),$(Pe.$$.fragment,r),$(Te.$$.fragment,r),$(De.$$.fragment,r),$(ke.$$.fragment,r),$(ze.$$.fragment,r),$(qe.$$.fragment,r),$(oe.$$.fragment,r),$(je.$$.fragment,r),$(Oe.$$.fragment,r),$(ae.$$.fragment,r),$(Ae.$$.fragment,r),$(se.$$.fragment,r),$(Fe.$$.fragment,r),$(Ue.$$.fragment,r),$(Re.$$.fragment,r),$(Ve.$$.fragment,r),so=!1},d(r){o(f),r&&o(T),r&&o(I),x(l),r&&o(Wr),r&&o(Je),r&&o(Jr),r&&o(Be),r&&o(Br),r&&o(F),x(he),r&&o(Hr),r&&o(U),x(ue),r&&o(Gr),r&&o(M),x(_e),r&&o(Yr),r&&o(z),x(be),r&&o(Kr),r&&o(R),x(ve),r&&o(Qr),r&&o(C),x(ye),r&&o(Xr),r&&o(V),x($e),r&&o(Zr),r&&o(W),x(xe),r&&o(eo),r&&o(J),x(Ie),r&&o(ro),r&&o(H),x(we),r&&o(oo),r&&o(G),x(Pe),r&&o(to),r&&o(Y),x(Te),r&&o(ao),r&&o(u),x(De),x(ke),x(ze),x(qe),x(oe),x(je),x(Oe),x(ae),x(Ae),x(se),x(Fe),x(Ue),x(Re),x(Ve)}}}const Ws={local:"utilities-for-image-processors",sections:[{local:"transformers.image_transforms.center_crop",title:"Image Transformations"},{local:"transformers.ImageProcessingMixin",title:"ImageProcessingMixin"}],title:"Utilities for Image Processors"};function Js(Q){return As(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Xs extends Ls{constructor(f){super();js(this,f,Js,Vs,Os,{})}}export{Xs as default,Ws as metadata};
