import{s as Zt,o as kt,n as Ft}from"../chunks/scheduler.25b97de1.js";import{S as zt,i as Nt,g as i,s as n,r as l,A as Wt,h as c,f as t,c as s,j as M,u as m,x as u,k as y,y as a,a as o,v as d,d as p,t as g,w as f}from"../chunks/index.d9030fc9.js";import{D as U}from"../chunks/Docstring.ffac8efa.js";import{C as ft}from"../chunks/CodeBlock.e6cd0d95.js";import{E as qt}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as Ie,E as Lt}from"../chunks/EditOnGithub.91d95064.js";function Dt(xe){let _,D="Examples:",j,I,x;return I=new ft({props:{code:"JTIzJTIwV2UlMjBjYW4ndCUyMGluc3RhbnRpYXRlJTIwZGlyZWN0bHklMjB0aGUlMjBiYXNlJTIwY2xhc3MlMjAqSW1hZ2VQcm9jZXNzaW5nTWl4aW4qJTIwc28lMjBsZXQncyUyMHNob3clMjB0aGUlMjBleGFtcGxlcyUyMG9uJTIwYSUwQSUyMyUyMGRlcml2ZWQlMjBjbGFzcyUzQSUyMCpDTElQSW1hZ2VQcm9jZXNzb3IqJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQ0xJUEltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIlMEEpJTIwJTIwJTIzJTIwRG93bmxvYWQlMjBpbWFnZV9wcm9jZXNzaW5nX2NvbmZpZyUyMGZyb20lMjBodWdnaW5nZmFjZS5jbyUyMGFuZCUyMGNhY2hlLiUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMENMSVBJbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRiUyMiUwQSklMjAlMjAlMjMlMjBFLmcuJTIwaW1hZ2UlMjBwcm9jZXNzb3IlMjAob3IlMjBtb2RlbCklMjB3YXMlMjBzYXZlZCUyMHVzaW5nJTIwKnNhdmVfcHJldHJhaW5lZCgnLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRicpKiUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMENMSVBJbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRnByZXByb2Nlc3Nvcl9jb25maWcuanNvbiUyMiklMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBDTElQSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiUyQyUyMGRvX25vcm1hbGl6ZSUzREZhbHNlJTJDJTIwZm9vJTNERmFsc2UlMEEpJTBBYXNzZXJ0JTIwaW1hZ2VfcHJvY2Vzc29yLmRvX25vcm1hbGl6ZSUyMGlzJTIwRmFsc2UlMEFpbWFnZV9wcm9jZXNzb3IlMkMlMjB1bnVzZWRfa3dhcmdzJTIwJTNEJTIwQ0xJUEltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIlMkMlMjBkb19ub3JtYWxpemUlM0RGYWxzZSUyQyUyMGZvbyUzREZhbHNlJTJDJTIwcmV0dXJuX3VudXNlZF9rd2FyZ3MlM0RUcnVlJTBBKSUwQWFzc2VydCUyMGltYWdlX3Byb2Nlc3Nvci5kb19ub3JtYWxpemUlMjBpcyUyMEZhbHNlJTBBYXNzZXJ0JTIwdW51c2VkX2t3YXJncyUyMCUzRCUzRCUyMCU3QiUyMmZvbyUyMiUzQSUyMEZhbHNlJTdE",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>}`,wrap:!1}}),{c(){_=i("p"),_.textContent=D,j=n(),l(I.$$.fragment)},l(h){_=c(h,"P",{"data-svelte-h":!0}),u(_)!=="svelte-kvfsh7"&&(_.textContent=D),j=s(h),m(I.$$.fragment,h)},m(h,w){o(h,_,w),o(h,j,w),d(I,h,w),x=!0},p:Ft,i(h){x||(p(I.$$.fragment,h),x=!0)},o(h){g(I.$$.fragment,h),x=!1},d(h){h&&(t(_),t(j)),f(I,h)}}}function Vt(xe){let _,D,j,I,x,h,w,ht="An image processor is in charge of preparing input features for vision models and post processing their outputs. This includes transformations such as resizing, normalization, and conversion to PyTorch, TensorFlow, Flax and Numpy tensors. It may also include model specific post-processing such as converting logits to segmentation masks.",we,V,ut=`Fast image processors are available for a few models and more will be added in the future. They are based on the <a href="https://pytorch.org/vision/stable/index.html" rel="nofollow">torchvision</a> library and provide a significant speed-up, especially when processing on GPU.
They have the same API as the base image processors and can be used as drop-in replacements.
To use a fast image processor, you need to install the <code>torchvision</code> library, and set the <code>use_fast</code> argument to <code>True</code> when instantiating the image processor:`,Te,E,Ue,X,_t="When using a fast image processor, you can also set the <code>device</code> argument to specify the device on which the processing should be done. By default, the processing is done on the same device as the inputs if the inputs are tensors, or on the CPU otherwise.",je,H,Ce,R,vt="Here are some speed comparisons between the base and fast image processors for the <code>DETR</code> and <code>RT-DETR</code> models, and how they impact overall inference time:",Pe,J,yt='<div><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/benchmark_results_full_pipeline_detr_fast_padded.png"/></div> <div><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/benchmark_results_full_pipeline_detr_fast_batched_compiled.png"/></div>',Je,B,bt='<div><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/benchmark_results_full_pipeline_rt_detr_fast_single.png"/></div> <div><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/benchmark_results_full_pipeline_rt_detr_fast_batched.png"/></div>',Be,Y,$t='These benchmarks were run on an <a href="https://aws.amazon.com/ec2/instance-types/g5/" rel="nofollow">AWS EC2 g5.2xlarge instance</a>, utilizing an NVIDIA A10G Tensor Core GPU.',Ze,S,ke,b,G,Qe,de,Mt=`This is an image processor mixin used to provide saving/loading functionality for sequential and image feature
extractors.`,Ae,C,Q,Ke,pe,It='Instantiate a type of <a href="/docs/transformers/pr_22105/en/internal/image_processing_utils#transformers.ImageProcessingMixin">ImageProcessingMixin</a> from an image processor.',Oe,Z,et,k,A,tt,ge,xt=`Save an image processor object to the directory <code>save_directory</code>, so that it can be re-loaded using the
<a href="/docs/transformers/pr_22105/en/internal/image_processing_utils#transformers.ImageProcessingMixin.from_pretrained">from_pretrained()</a> class method.`,Fe,K,ze,v,O,rt,fe,wt='Holds the output of the <a href="/docs/transformers/pr_22105/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor.pad">pad()</a> and feature extractor specific <code>__call__</code> methods.',nt,he,Tt="This class is derived from a python dictionary and can be used as a dictionary.",st,F,ee,at,ue,Ut="Convert the inner content to tensors.",ot,z,te,it,_e,jt=`Send all values to device by calling <code>v.to(*args, **kwargs)</code> (PyTorch only). This should support casting in
different <code>dtypes</code> and sending the <code>BatchFeature</code> to a different <code>device</code>.`,Ne,re,We,$,ne,ct,N,se,lt,ve,Ct=`Center crop an image to <code>(size[&quot;height&quot;], size[&quot;width&quot;])</code>. If the input size is smaller than <code>crop_size</code> along
any edge, the image is padded with 0’s and then center cropped.`,mt,W,ae,dt,ye,Pt="Normalize an image. image = (image - image_mean) / image_std.",pt,q,oe,gt,be,Jt="Rescale an image by a scale factor. image = image * scale.",qe,ie,Le,ce,le,De,me,Ve,Me,Ee;return x=new Ie({props:{title:"Image Processor",local:"image-processor",headingTag:"h1"}}),E=new ft({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZkZXRyLXJlc25ldC01MCUyMiUyQyUyMHVzZV9mYXN0JTNEVHJ1ZSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor

processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/detr-resnet-50&quot;</span>, use_fast=<span class="hljs-literal">True</span>)`,wrap:!1}}),H=new ft({props:{code:"ZnJvbSUyMHRvcmNodmlzaW9uLmlvJTIwaW1wb3J0JTIwcmVhZF9pbWFnZSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBEZXRySW1hZ2VQcm9jZXNzb3JGYXN0JTBBJTBBaW1hZ2VzJTIwJTNEJTIwcmVhZF9pbWFnZSglMjJpbWFnZS5qcGclMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwRGV0ckltYWdlUHJvY2Vzc29yRmFzdC5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZkZXRyLXJlc25ldC01MCUyMiklMEFpbWFnZXNfcHJvY2Vzc2VkJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMkMlMjBkZXZpY2UlM0QlMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> torchvision.io <span class="hljs-keyword">import</span> read_image
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DetrImageProcessorFast

images = read_image(<span class="hljs-string">&quot;image.jpg&quot;</span>)
processor = DetrImageProcessorFast.from_pretrained(<span class="hljs-string">&quot;facebook/detr-resnet-50&quot;</span>)
images_processed = processor(images, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, device=<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),S=new Ie({props:{title:"ImageProcessingMixin",local:"transformers.ImageProcessingMixin",headingTag:"h2"}}),G=new U({props:{name:"class transformers.ImageProcessingMixin",anchor:"transformers.ImageProcessingMixin",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_22105/src/transformers/image_processing_base.py#L69"}}),Q=new U({props:{name:"from_pretrained",anchor:"transformers.ImageProcessingMixin.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": Union"},{name:"cache_dir",val:": Union = None"},{name:"force_download",val:": bool = False"},{name:"local_files_only",val:": bool = False"},{name:"token",val:": Union = None"},{name:"revision",val:": str = 'main'"},{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.</li>
<li>a path to a <em>directory</em> containing a image processor file saved using the
<a href="/docs/transformers/pr_22105/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.
resume_download &#x2014;
Deprecated and ignored. All downloads are now resumed by default when possible.
Will be removed in v5 of Transformers.`,name:"force_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.token",description:`<strong>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:"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/vr_22105/src/transformers/image_processing_base.py#L96",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A image processor of type <a
  href="/docs/transformers/pr_22105/en/internal/image_processing_utils#transformers.ImageProcessingMixin"
>ImageProcessingMixin</a>.</p>
`}}),Z=new qt({props:{anchor:"transformers.ImageProcessingMixin.from_pretrained.example",$$slots:{default:[Dt]},$$scope:{ctx:xe}}}),A=new U({props:{name:"save_pretrained",anchor:"transformers.ImageProcessingMixin.save_pretrained",parameters:[{name:"save_directory",val:": Union"},{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).`,name:"push_to_hub"},{anchor:"transformers.ImageProcessingMixin.save_pretrained.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/pr_22105/en/main_classes/model#transformers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/vr_22105/src/transformers/image_processing_base.py#L210"}}),K=new Ie({props:{title:"BatchFeature",local:"transformers.BatchFeature",headingTag:"h2"}}),O=new U({props:{name:"class transformers.BatchFeature",anchor:"transformers.BatchFeature",parameters:[{name:"data",val:": Optional = None"},{name:"tensor_type",val:": Union = None"}],parametersDescription:[{anchor:"transformers.BatchFeature.data",description:`<strong>data</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of lists/arrays/tensors returned by the <strong>call</strong>/pad methods (&#x2018;input_values&#x2019;, &#x2018;attention_mask&#x2019;,
etc.).`,name:"data"},{anchor:"transformers.BatchFeature.tensor_type",description:`<strong>tensor_type</strong> (<code>Union[None, str, TensorType]</code>, <em>optional</em>) &#x2014;
You can give a tensor_type here to convert the lists of integers in PyTorch/TensorFlow/Numpy Tensors at
initialization.`,name:"tensor_type"}],source:"https://github.com/huggingface/transformers/blob/vr_22105/src/transformers/feature_extraction_utils.py#L62"}}),ee=new U({props:{name:"convert_to_tensors",anchor:"transformers.BatchFeature.convert_to_tensors",parameters:[{name:"tensor_type",val:": Union = None"}],parametersDescription:[{anchor:"transformers.BatchFeature.convert_to_tensors.tensor_type",description:`<strong>tensor_type</strong> (<code>str</code> or <a href="/docs/transformers/pr_22105/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
The type of tensors to use. If <code>str</code>, should be one of the values of the enum <a href="/docs/transformers/pr_22105/en/internal/file_utils#transformers.TensorType">TensorType</a>. If
<code>None</code>, no modification is done.`,name:"tensor_type"}],source:"https://github.com/huggingface/transformers/blob/vr_22105/src/transformers/feature_extraction_utils.py#L175"}}),te=new U({props:{name:"to",anchor:"transformers.BatchFeature.to",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BatchFeature.to.args",description:`<strong>args</strong> (<code>Tuple</code>) &#x2014;
Will be passed to the <code>to(...)</code> function of the tensors.`,name:"args"},{anchor:"transformers.BatchFeature.to.kwargs",description:`<strong>kwargs</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
Will be passed to the <code>to(...)</code> function of the tensors.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/vr_22105/src/transformers/feature_extraction_utils.py#L206",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The same instance after modification.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_22105/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),re=new Ie({props:{title:"BaseImageProcessor",local:"transformers.BaseImageProcessor",headingTag:"h2"}}),ne=new U({props:{name:"class transformers.BaseImageProcessor",anchor:"transformers.BaseImageProcessor",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_22105/src/transformers/image_processing_utils.py#L35"}}),se=new U({props:{name:"center_crop",anchor:"transformers.BaseImageProcessor.center_crop",parameters:[{name:"image",val:": ndarray"},{name:"size",val:": Dict"},{name:"data_format",val:": Union = None"},{name:"input_data_format",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BaseImageProcessor.center_crop.image",description:`<strong>image</strong> (<code>np.ndarray</code>) &#x2014;
Image to center crop.`,name:"image"},{anchor:"transformers.BaseImageProcessor.center_crop.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>) &#x2014;
Size of the output image.`,name:"size"},{anchor:"transformers.BaseImageProcessor.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. If unset, the channel dimension format of the input
image is used. 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.</li>
</ul>`,name:"data_format"},{anchor:"transformers.BaseImageProcessor.center_crop.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from 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.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/vr_22105/src/transformers/image_processing_utils.py#L115"}}),ae=new U({props:{name:"normalize",anchor:"transformers.BaseImageProcessor.normalize",parameters:[{name:"image",val:": ndarray"},{name:"mean",val:": Union"},{name:"std",val:": Union"},{name:"data_format",val:": Union = None"},{name:"input_data_format",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BaseImageProcessor.normalize.image",description:`<strong>image</strong> (<code>np.ndarray</code>) &#x2014;
Image to normalize.`,name:"image"},{anchor:"transformers.BaseImageProcessor.normalize.mean",description:`<strong>mean</strong> (<code>float</code> or <code>Iterable[float]</code>) &#x2014;
Image mean to use for normalization.`,name:"mean"},{anchor:"transformers.BaseImageProcessor.normalize.std",description:`<strong>std</strong> (<code>float</code> or <code>Iterable[float]</code>) &#x2014;
Image standard deviation to use for normalization.`,name:"std"},{anchor:"transformers.BaseImageProcessor.normalize.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. If unset, the channel dimension format of the input
image is used. 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.</li>
</ul>`,name:"data_format"},{anchor:"transformers.BaseImageProcessor.normalize.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from 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.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/vr_22105/src/transformers/image_processing_utils.py#L78",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The normalized image.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>np.ndarray</code></p>
`}}),oe=new U({props:{name:"rescale",anchor:"transformers.BaseImageProcessor.rescale",parameters:[{name:"image",val:": ndarray"},{name:"scale",val:": float"},{name:"data_format",val:": Union = None"},{name:"input_data_format",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BaseImageProcessor.rescale.image",description:`<strong>image</strong> (<code>np.ndarray</code>) &#x2014;
Image to rescale.`,name:"image"},{anchor:"transformers.BaseImageProcessor.rescale.scale",description:`<strong>scale</strong> (<code>float</code>) &#x2014;
The scaling factor to rescale pixel values by.`,name:"scale"},{anchor:"transformers.BaseImageProcessor.rescale.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. If unset, the channel dimension format of the input
image is used. 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.</li>
</ul>`,name:"data_format"},{anchor:"transformers.BaseImageProcessor.rescale.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from 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.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/vr_22105/src/transformers/image_processing_utils.py#L46",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The rescaled image.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>np.ndarray</code></p>
`}}),ie=new Ie({props:{title:"BaseImageProcessorFast",local:"transformers.BaseImageProcessorFast",headingTag:"h2"}}),le=new U({props:{name:"class transformers.BaseImageProcessorFast",anchor:"transformers.BaseImageProcessorFast",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_22105/src/transformers/image_processing_utils_fast.py#L50"}}),me=new Lt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/main_classes/image_processor.md"}}),{c(){_=i("meta"),D=n(),j=i("p"),I=n(),l(x.$$.fragment),h=n(),w=i("p"),w.textContent=ht,we=n(),V=i("p"),V.innerHTML=ut,Te=n(),l(E.$$.fragment),Ue=n(),X=i("p"),X.innerHTML=_t,je=n(),l(H.$$.fragment),Ce=n(),R=i("p"),R.innerHTML=vt,Pe=n(),J=i("div"),J.innerHTML=yt,Je=n(),B=i("div"),B.innerHTML=bt,Be=n(),Y=i("p"),Y.innerHTML=$t,Ze=n(),l(S.$$.fragment),ke=n(),b=i("div"),l(G.$$.fragment),Qe=n(),de=i("p"),de.textContent=Mt,Ae=n(),C=i("div"),l(Q.$$.fragment),Ke=n(),pe=i("p"),pe.innerHTML=It,Oe=n(),l(Z.$$.fragment),et=n(),k=i("div"),l(A.$$.fragment),tt=n(),ge=i("p"),ge.innerHTML=xt,Fe=n(),l(K.$$.fragment),ze=n(),v=i("div"),l(O.$$.fragment),rt=n(),fe=i("p"),fe.innerHTML=wt,nt=n(),he=i("p"),he.textContent=Tt,st=n(),F=i("div"),l(ee.$$.fragment),at=n(),ue=i("p"),ue.textContent=Ut,ot=n(),z=i("div"),l(te.$$.fragment),it=n(),_e=i("p"),_e.innerHTML=jt,Ne=n(),l(re.$$.fragment),We=n(),$=i("div"),l(ne.$$.fragment),ct=n(),N=i("div"),l(se.$$.fragment),lt=n(),ve=i("p"),ve.innerHTML=Ct,mt=n(),W=i("div"),l(ae.$$.fragment),dt=n(),ye=i("p"),ye.textContent=Pt,pt=n(),q=i("div"),l(oe.$$.fragment),gt=n(),be=i("p"),be.textContent=Jt,qe=n(),l(ie.$$.fragment),Le=n(),ce=i("div"),l(le.$$.fragment),De=n(),l(me.$$.fragment),Ve=n(),Me=i("p"),this.h()},l(e){const r=Wt("svelte-u9bgzb",document.head);_=c(r,"META",{name:!0,content:!0}),r.forEach(t),D=s(e),j=c(e,"P",{}),M(j).forEach(t),I=s(e),m(x.$$.fragment,e),h=s(e),w=c(e,"P",{"data-svelte-h":!0}),u(w)!=="svelte-l9ii3n"&&(w.textContent=ht),we=s(e),V=c(e,"P",{"data-svelte-h":!0}),u(V)!=="svelte-1j2iqts"&&(V.innerHTML=ut),Te=s(e),m(E.$$.fragment,e),Ue=s(e),X=c(e,"P",{"data-svelte-h":!0}),u(X)!=="svelte-1gp7zdk"&&(X.innerHTML=_t),je=s(e),m(H.$$.fragment,e),Ce=s(e),R=c(e,"P",{"data-svelte-h":!0}),u(R)!=="svelte-f7fjym"&&(R.innerHTML=vt),Pe=s(e),J=c(e,"DIV",{class:!0,"data-svelte-h":!0}),u(J)!=="svelte-1dpc6r1"&&(J.innerHTML=yt),Je=s(e),B=c(e,"DIV",{class:!0,"data-svelte-h":!0}),u(B)!=="svelte-1iqp459"&&(B.innerHTML=bt),Be=s(e),Y=c(e,"P",{"data-svelte-h":!0}),u(Y)!=="svelte-1tjod1j"&&(Y.innerHTML=$t),Ze=s(e),m(S.$$.fragment,e),ke=s(e),b=c(e,"DIV",{class:!0});var T=M(b);m(G.$$.fragment,T),Qe=s(T),de=c(T,"P",{"data-svelte-h":!0}),u(de)!=="svelte-16ht4m3"&&(de.textContent=Mt),Ae=s(T),C=c(T,"DIV",{class:!0});var $e=M(C);m(Q.$$.fragment,$e),Ke=s($e),pe=c($e,"P",{"data-svelte-h":!0}),u(pe)!=="svelte-1xlszvn"&&(pe.innerHTML=It),Oe=s($e),m(Z.$$.fragment,$e),$e.forEach(t),et=s(T),k=c(T,"DIV",{class:!0});var Xe=M(k);m(A.$$.fragment,Xe),tt=s(Xe),ge=c(Xe,"P",{"data-svelte-h":!0}),u(ge)!=="svelte-l7q09m"&&(ge.innerHTML=xt),Xe.forEach(t),T.forEach(t),Fe=s(e),m(K.$$.fragment,e),ze=s(e),v=c(e,"DIV",{class:!0});var P=M(v);m(O.$$.fragment,P),rt=s(P),fe=c(P,"P",{"data-svelte-h":!0}),u(fe)!=="svelte-1s09dyq"&&(fe.innerHTML=wt),nt=s(P),he=c(P,"P",{"data-svelte-h":!0}),u(he)!=="svelte-saqdtk"&&(he.textContent=Tt),st=s(P),F=c(P,"DIV",{class:!0});var He=M(F);m(ee.$$.fragment,He),at=s(He),ue=c(He,"P",{"data-svelte-h":!0}),u(ue)!=="svelte-pxfh9u"&&(ue.textContent=Ut),He.forEach(t),ot=s(P),z=c(P,"DIV",{class:!0});var Re=M(z);m(te.$$.fragment,Re),it=s(Re),_e=c(Re,"P",{"data-svelte-h":!0}),u(_e)!=="svelte-d0cfhs"&&(_e.innerHTML=jt),Re.forEach(t),P.forEach(t),Ne=s(e),m(re.$$.fragment,e),We=s(e),$=c(e,"DIV",{class:!0});var L=M($);m(ne.$$.fragment,L),ct=s(L),N=c(L,"DIV",{class:!0});var Ye=M(N);m(se.$$.fragment,Ye),lt=s(Ye),ve=c(Ye,"P",{"data-svelte-h":!0}),u(ve)!=="svelte-193kiu8"&&(ve.innerHTML=Ct),Ye.forEach(t),mt=s(L),W=c(L,"DIV",{class:!0});var Se=M(W);m(ae.$$.fragment,Se),dt=s(Se),ye=c(Se,"P",{"data-svelte-h":!0}),u(ye)!=="svelte-1e5okex"&&(ye.textContent=Pt),Se.forEach(t),pt=s(L),q=c(L,"DIV",{class:!0});var Ge=M(q);m(oe.$$.fragment,Ge),gt=s(Ge),be=c(Ge,"P",{"data-svelte-h":!0}),u(be)!=="svelte-qun0mt"&&(be.textContent=Jt),Ge.forEach(t),L.forEach(t),qe=s(e),m(ie.$$.fragment,e),Le=s(e),ce=c(e,"DIV",{class:!0});var Bt=M(ce);m(le.$$.fragment,Bt),Bt.forEach(t),De=s(e),m(me.$$.fragment,e),Ve=s(e),Me=c(e,"P",{}),M(Me).forEach(t),this.h()},h(){y(_,"name","hf:doc:metadata"),y(_,"content",Et),y(J,"class","flex"),y(B,"class","flex"),y(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,r){a(document.head,_),o(e,D,r),o(e,j,r),o(e,I,r),d(x,e,r),o(e,h,r),o(e,w,r),o(e,we,r),o(e,V,r),o(e,Te,r),d(E,e,r),o(e,Ue,r),o(e,X,r),o(e,je,r),d(H,e,r),o(e,Ce,r),o(e,R,r),o(e,Pe,r),o(e,J,r),o(e,Je,r),o(e,B,r),o(e,Be,r),o(e,Y,r),o(e,Ze,r),d(S,e,r),o(e,ke,r),o(e,b,r),d(G,b,null),a(b,Qe),a(b,de),a(b,Ae),a(b,C),d(Q,C,null),a(C,Ke),a(C,pe),a(C,Oe),d(Z,C,null),a(b,et),a(b,k),d(A,k,null),a(k,tt),a(k,ge),o(e,Fe,r),d(K,e,r),o(e,ze,r),o(e,v,r),d(O,v,null),a(v,rt),a(v,fe),a(v,nt),a(v,he),a(v,st),a(v,F),d(ee,F,null),a(F,at),a(F,ue),a(v,ot),a(v,z),d(te,z,null),a(z,it),a(z,_e),o(e,Ne,r),d(re,e,r),o(e,We,r),o(e,$,r),d(ne,$,null),a($,ct),a($,N),d(se,N,null),a(N,lt),a(N,ve),a($,mt),a($,W),d(ae,W,null),a(W,dt),a(W,ye),a($,pt),a($,q),d(oe,q,null),a(q,gt),a(q,be),o(e,qe,r),d(ie,e,r),o(e,Le,r),o(e,ce,r),d(le,ce,null),o(e,De,r),d(me,e,r),o(e,Ve,r),o(e,Me,r),Ee=!0},p(e,[r]){const T={};r&2&&(T.$$scope={dirty:r,ctx:e}),Z.$set(T)},i(e){Ee||(p(x.$$.fragment,e),p(E.$$.fragment,e),p(H.$$.fragment,e),p(S.$$.fragment,e),p(G.$$.fragment,e),p(Q.$$.fragment,e),p(Z.$$.fragment,e),p(A.$$.fragment,e),p(K.$$.fragment,e),p(O.$$.fragment,e),p(ee.$$.fragment,e),p(te.$$.fragment,e),p(re.$$.fragment,e),p(ne.$$.fragment,e),p(se.$$.fragment,e),p(ae.$$.fragment,e),p(oe.$$.fragment,e),p(ie.$$.fragment,e),p(le.$$.fragment,e),p(me.$$.fragment,e),Ee=!0)},o(e){g(x.$$.fragment,e),g(E.$$.fragment,e),g(H.$$.fragment,e),g(S.$$.fragment,e),g(G.$$.fragment,e),g(Q.$$.fragment,e),g(Z.$$.fragment,e),g(A.$$.fragment,e),g(K.$$.fragment,e),g(O.$$.fragment,e),g(ee.$$.fragment,e),g(te.$$.fragment,e),g(re.$$.fragment,e),g(ne.$$.fragment,e),g(se.$$.fragment,e),g(ae.$$.fragment,e),g(oe.$$.fragment,e),g(ie.$$.fragment,e),g(le.$$.fragment,e),g(me.$$.fragment,e),Ee=!1},d(e){e&&(t(D),t(j),t(I),t(h),t(w),t(we),t(V),t(Te),t(Ue),t(X),t(je),t(Ce),t(R),t(Pe),t(J),t(Je),t(B),t(Be),t(Y),t(Ze),t(ke),t(b),t(Fe),t(ze),t(v),t(Ne),t(We),t($),t(qe),t(Le),t(ce),t(De),t(Ve),t(Me)),t(_),f(x,e),f(E,e),f(H,e),f(S,e),f(G),f(Q),f(Z),f(A),f(K,e),f(O),f(ee),f(te),f(re,e),f(ne),f(se),f(ae),f(oe),f(ie,e),f(le),f(me,e)}}}const Et='{"title":"Image Processor","local":"image-processor","sections":[{"title":"ImageProcessingMixin","local":"transformers.ImageProcessingMixin","sections":[],"depth":2},{"title":"BatchFeature","local":"transformers.BatchFeature","sections":[],"depth":2},{"title":"BaseImageProcessor","local":"transformers.BaseImageProcessor","sections":[],"depth":2},{"title":"BaseImageProcessorFast","local":"transformers.BaseImageProcessorFast","sections":[],"depth":2}],"depth":1}';function Xt(xe){return kt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class At extends zt{constructor(_){super(),Nt(this,_,Xt,Vt,Zt,{})}}export{At as component};
