import{s as Zt,o as kt,n as Nt}from"../chunks/scheduler.25b97de1.js";import{S as Ft,i as zt,g as i,s as r,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 b,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 C}from"../chunks/Docstring.ffac8efa.js";import{C as ft}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Dt}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as Te,E as Lt}from"../chunks/EditOnGithub.91d95064.js";function qt(Ie){let _,q="Examples:",P,T,I;return T=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=q,P=r(),l(T.$$.fragment)},l(h){_=c(h,"P",{"data-svelte-h":!0}),u(_)!=="svelte-kvfsh7"&&(_.textContent=q),P=s(h),m(T.$$.fragment,h)},m(h,w){o(h,_,w),o(h,P,w),d(T,h,w),I=!0},p:Nt,i(h){I||(p(T.$$.fragment,h),I=!0)},o(h){g(T.$$.fragment,h),I=!1},d(h){h&&(t(_),t(P)),f(T,h)}}}function Vt(Ie){let _,q,P,T,I,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:`,xe,E,Ce,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.",Pe,H,Ue,R,yt="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:",je,J,bt='<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,vt='<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,v,G,Qe,de,Mt=`This is an image processor mixin used to provide saving/loading functionality for sequential and image feature
extractors.`,Ae,U,Q,Ke,pe,Tt='Instantiate a type of <a href="/docs/transformers/main/en/internal/image_processing_utils#transformers.ImageProcessingMixin">ImageProcessingMixin</a> from an image processor.',Oe,Z,et,k,A,tt,ge,It=`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/main/en/internal/image_processing_utils#transformers.ImageProcessingMixin.from_pretrained">from_pretrained()</a> class method.`,Ne,K,Fe,y,O,nt,fe,wt='Holds the output of the <a href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor.pad">pad()</a> and feature extractor specific <code>__call__</code> methods.',rt,he,xt="This class is derived from a python dictionary and can be used as a dictionary.",st,N,ee,at,ue,Ct="Convert the inner content to tensors.",ot,F,te,it,_e,Pt=`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>.`,ze,ne,We,$,re,ct,z,se,lt,ye,Ut=`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,be,jt="Normalize an image. image = (image - image_mean) / image_std.",pt,D,oe,gt,ve,Jt="Rescale an image by a scale factor. image = image * scale.",De,ie,Le,ce,le,qe,me,Ve,Me,Ee;return I=new Te({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 Te({props:{title:"ImageProcessingMixin",local:"transformers.ImageProcessingMixin",headingTag:"h2"}}),G=new C({props:{name:"class transformers.ImageProcessingMixin",anchor:"transformers.ImageProcessingMixin",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_processing_base.py#L72"}}),Q=new C({props:{name:"from_pretrained",anchor:"transformers.ImageProcessingMixin.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike]"},{name:"cache_dir",val:": typing.Union[str, os.PathLike, NoneType] = None"},{name:"force_download",val:": bool = False"},{name:"local_files_only",val:": bool = False"},{name:"token",val:": typing.Union[str, bool, NoneType] = 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/main/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> &#x2014;
Deprecated and ignored. All downloads are now resumed by default when possible.
Will be removed in v5 of Transformers.`,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.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/main/src/transformers/image_processing_base.py#L99",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A image processor of type <a
  href="/docs/transformers/main/en/internal/image_processing_utils#transformers.ImageProcessingMixin"
>ImageProcessingMixin</a>.</p>
`}}),Z=new Dt({props:{anchor:"transformers.ImageProcessingMixin.from_pretrained.example",$$slots:{default:[qt]},$$scope:{ctx:Ie}}}),A=new C({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).`,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/main/en/main_classes/model#transformers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_processing_base.py#L213"}}),K=new Te({props:{title:"BatchFeature",local:"transformers.BatchFeature",headingTag:"h2"}}),O=new C({props:{name:"class transformers.BatchFeature",anchor:"transformers.BatchFeature",parameters:[{name:"data",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"tensor_type",val:": typing.Union[NoneType, str, transformers.utils.generic.TensorType] = 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/main/src/transformers/feature_extraction_utils.py#L62"}}),ee=new C({props:{name:"convert_to_tensors",anchor:"transformers.BatchFeature.convert_to_tensors",parameters:[{name:"tensor_type",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"}],parametersDescription:[{anchor:"transformers.BatchFeature.convert_to_tensors.tensor_type",description:`<strong>tensor_type</strong> (<code>str</code> or <a href="/docs/transformers/main/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/main/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/main/src/transformers/feature_extraction_utils.py#L175"}}),te=new C({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.
To enable asynchronous data transfer, set the <code>non_blocking</code> flag in <code>kwargs</code> (defaults to <code>False</code>).`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/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/main/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),ne=new Te({props:{title:"BaseImageProcessor",local:"transformers.BaseImageProcessor",headingTag:"h2"}}),re=new C({props:{name:"class transformers.BaseImageProcessor",anchor:"transformers.BaseImageProcessor",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_processing_utils.py#L35"}}),se=new C({props:{name:"center_crop",anchor:"transformers.BaseImageProcessor.center_crop",parameters:[{name:"image",val:": ndarray"},{name:"size",val:": typing.Dict[str, int]"},{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"},{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/main/src/transformers/image_processing_utils.py#L115"}}),ae=new C({props:{name:"normalize",anchor:"transformers.BaseImageProcessor.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.Union[transformers.image_utils.ChannelDimension, str, NoneType] = None"},{name:"input_data_format",val:": typing.Union[transformers.image_utils.ChannelDimension, str, NoneType] = 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/main/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 C({props:{name:"rescale",anchor:"transformers.BaseImageProcessor.rescale",parameters:[{name:"image",val:": ndarray"},{name:"scale",val:": float"},{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"},{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/main/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 Te({props:{title:"BaseImageProcessorFast",local:"transformers.BaseImageProcessorFast",headingTag:"h2"}}),le=new C({props:{name:"class transformers.BaseImageProcessorFast",anchor:"transformers.BaseImageProcessorFast",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/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"),q=r(),P=i("p"),T=r(),l(I.$$.fragment),h=r(),w=i("p"),w.textContent=ht,we=r(),V=i("p"),V.innerHTML=ut,xe=r(),l(E.$$.fragment),Ce=r(),X=i("p"),X.innerHTML=_t,Pe=r(),l(H.$$.fragment),Ue=r(),R=i("p"),R.innerHTML=yt,je=r(),J=i("div"),J.innerHTML=bt,Je=r(),B=i("div"),B.innerHTML=vt,Be=r(),Y=i("p"),Y.innerHTML=$t,Ze=r(),l(S.$$.fragment),ke=r(),v=i("div"),l(G.$$.fragment),Qe=r(),de=i("p"),de.textContent=Mt,Ae=r(),U=i("div"),l(Q.$$.fragment),Ke=r(),pe=i("p"),pe.innerHTML=Tt,Oe=r(),l(Z.$$.fragment),et=r(),k=i("div"),l(A.$$.fragment),tt=r(),ge=i("p"),ge.innerHTML=It,Ne=r(),l(K.$$.fragment),Fe=r(),y=i("div"),l(O.$$.fragment),nt=r(),fe=i("p"),fe.innerHTML=wt,rt=r(),he=i("p"),he.textContent=xt,st=r(),N=i("div"),l(ee.$$.fragment),at=r(),ue=i("p"),ue.textContent=Ct,ot=r(),F=i("div"),l(te.$$.fragment),it=r(),_e=i("p"),_e.innerHTML=Pt,ze=r(),l(ne.$$.fragment),We=r(),$=i("div"),l(re.$$.fragment),ct=r(),z=i("div"),l(se.$$.fragment),lt=r(),ye=i("p"),ye.innerHTML=Ut,mt=r(),W=i("div"),l(ae.$$.fragment),dt=r(),be=i("p"),be.textContent=jt,pt=r(),D=i("div"),l(oe.$$.fragment),gt=r(),ve=i("p"),ve.textContent=Jt,De=r(),l(ie.$$.fragment),Le=r(),ce=i("div"),l(le.$$.fragment),qe=r(),l(me.$$.fragment),Ve=r(),Me=i("p"),this.h()},l(e){const n=Wt("svelte-u9bgzb",document.head);_=c(n,"META",{name:!0,content:!0}),n.forEach(t),q=s(e),P=c(e,"P",{}),M(P).forEach(t),T=s(e),m(I.$$.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),xe=s(e),m(E.$$.fragment,e),Ce=s(e),X=c(e,"P",{"data-svelte-h":!0}),u(X)!=="svelte-1gp7zdk"&&(X.innerHTML=_t),Pe=s(e),m(H.$$.fragment,e),Ue=s(e),R=c(e,"P",{"data-svelte-h":!0}),u(R)!=="svelte-f7fjym"&&(R.innerHTML=yt),je=s(e),J=c(e,"DIV",{class:!0,"data-svelte-h":!0}),u(J)!=="svelte-1dpc6r1"&&(J.innerHTML=bt),Je=s(e),B=c(e,"DIV",{class:!0,"data-svelte-h":!0}),u(B)!=="svelte-1iqp459"&&(B.innerHTML=vt),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),v=c(e,"DIV",{class:!0});var x=M(v);m(G.$$.fragment,x),Qe=s(x),de=c(x,"P",{"data-svelte-h":!0}),u(de)!=="svelte-16ht4m3"&&(de.textContent=Mt),Ae=s(x),U=c(x,"DIV",{class:!0});var $e=M(U);m(Q.$$.fragment,$e),Ke=s($e),pe=c($e,"P",{"data-svelte-h":!0}),u(pe)!=="svelte-5u8pkb"&&(pe.innerHTML=Tt),Oe=s($e),m(Z.$$.fragment,$e),$e.forEach(t),et=s(x),k=c(x,"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-1aln1ny"&&(ge.innerHTML=It),Xe.forEach(t),x.forEach(t),Ne=s(e),m(K.$$.fragment,e),Fe=s(e),y=c(e,"DIV",{class:!0});var j=M(y);m(O.$$.fragment,j),nt=s(j),fe=c(j,"P",{"data-svelte-h":!0}),u(fe)!=="svelte-an3ndm"&&(fe.innerHTML=wt),rt=s(j),he=c(j,"P",{"data-svelte-h":!0}),u(he)!=="svelte-saqdtk"&&(he.textContent=xt),st=s(j),N=c(j,"DIV",{class:!0});var He=M(N);m(ee.$$.fragment,He),at=s(He),ue=c(He,"P",{"data-svelte-h":!0}),u(ue)!=="svelte-pxfh9u"&&(ue.textContent=Ct),He.forEach(t),ot=s(j),F=c(j,"DIV",{class:!0});var Re=M(F);m(te.$$.fragment,Re),it=s(Re),_e=c(Re,"P",{"data-svelte-h":!0}),u(_e)!=="svelte-d0cfhs"&&(_e.innerHTML=Pt),Re.forEach(t),j.forEach(t),ze=s(e),m(ne.$$.fragment,e),We=s(e),$=c(e,"DIV",{class:!0});var L=M($);m(re.$$.fragment,L),ct=s(L),z=c(L,"DIV",{class:!0});var Ye=M(z);m(se.$$.fragment,Ye),lt=s(Ye),ye=c(Ye,"P",{"data-svelte-h":!0}),u(ye)!=="svelte-193kiu8"&&(ye.innerHTML=Ut),Ye.forEach(t),mt=s(L),W=c(L,"DIV",{class:!0});var Se=M(W);m(ae.$$.fragment,Se),dt=s(Se),be=c(Se,"P",{"data-svelte-h":!0}),u(be)!=="svelte-1e5okex"&&(be.textContent=jt),Se.forEach(t),pt=s(L),D=c(L,"DIV",{class:!0});var Ge=M(D);m(oe.$$.fragment,Ge),gt=s(Ge),ve=c(Ge,"P",{"data-svelte-h":!0}),u(ve)!=="svelte-qun0mt"&&(ve.textContent=Jt),Ge.forEach(t),L.forEach(t),De=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),qe=s(e),m(me.$$.fragment,e),Ve=s(e),Me=c(e,"P",{}),M(Me).forEach(t),this.h()},h(){b(_,"name","hf:doc:metadata"),b(_,"content",Et),b(J,"class","flex"),b(B,"class","flex"),b(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(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,n){a(document.head,_),o(e,q,n),o(e,P,n),o(e,T,n),d(I,e,n),o(e,h,n),o(e,w,n),o(e,we,n),o(e,V,n),o(e,xe,n),d(E,e,n),o(e,Ce,n),o(e,X,n),o(e,Pe,n),d(H,e,n),o(e,Ue,n),o(e,R,n),o(e,je,n),o(e,J,n),o(e,Je,n),o(e,B,n),o(e,Be,n),o(e,Y,n),o(e,Ze,n),d(S,e,n),o(e,ke,n),o(e,v,n),d(G,v,null),a(v,Qe),a(v,de),a(v,Ae),a(v,U),d(Q,U,null),a(U,Ke),a(U,pe),a(U,Oe),d(Z,U,null),a(v,et),a(v,k),d(A,k,null),a(k,tt),a(k,ge),o(e,Ne,n),d(K,e,n),o(e,Fe,n),o(e,y,n),d(O,y,null),a(y,nt),a(y,fe),a(y,rt),a(y,he),a(y,st),a(y,N),d(ee,N,null),a(N,at),a(N,ue),a(y,ot),a(y,F),d(te,F,null),a(F,it),a(F,_e),o(e,ze,n),d(ne,e,n),o(e,We,n),o(e,$,n),d(re,$,null),a($,ct),a($,z),d(se,z,null),a(z,lt),a(z,ye),a($,mt),a($,W),d(ae,W,null),a(W,dt),a(W,be),a($,pt),a($,D),d(oe,D,null),a(D,gt),a(D,ve),o(e,De,n),d(ie,e,n),o(e,Le,n),o(e,ce,n),d(le,ce,null),o(e,qe,n),d(me,e,n),o(e,Ve,n),o(e,Me,n),Ee=!0},p(e,[n]){const x={};n&2&&(x.$$scope={dirty:n,ctx:e}),Z.$set(x)},i(e){Ee||(p(I.$$.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(ne.$$.fragment,e),p(re.$$.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(I.$$.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(ne.$$.fragment,e),g(re.$$.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(q),t(P),t(T),t(h),t(w),t(we),t(V),t(xe),t(Ce),t(X),t(Pe),t(Ue),t(R),t(je),t(J),t(Je),t(B),t(Be),t(Y),t(Ze),t(ke),t(v),t(Ne),t(Fe),t(y),t(ze),t(We),t($),t(De),t(Le),t(ce),t(qe),t(Ve),t(Me)),t(_),f(I,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(ne,e),f(re),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(Ie){return kt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class At extends Ft{constructor(_){super(),zt(this,_,Xt,Vt,Zt,{})}}export{At as component};
