Buckets:
| import{s as st,o as it,n as ct}from"../chunks/scheduler.9991993c.js";import{S as mt,i as lt,g as s,s as r,r as p,A as dt,h as i,f as n,c as o,j as I,u as g,x as v,k as $,y as t,a as c,v as h,d as f,t as u,w as _}from"../chunks/index.7fc9a5e7.js";import{D as j}from"../chunks/Docstring.0d7e3ebb.js";import{C as pt}from"../chunks/CodeBlock.e11cba92.js";import{E as gt}from"../chunks/ExampleCodeBlock.46b9776a.js";import{H as at,E as ht}from"../chunks/EditOnGithub.84ab7f0e.js";function ft(pe){let l,W="Examples:",C,x,M;return x=new pt({props:{code:"JTIzJTIwV2UlMjBjYW4ndCUyMGluc3RhbnRpYXRlJTIwZGlyZWN0bHklMjB0aGUlMjBiYXNlJTIwY2xhc3MlMjAqSW1hZ2VQcm9jZXNzaW5nTWl4aW4qJTIwc28lMjBsZXQncyUyMHNob3clMjB0aGUlMjBleGFtcGxlcyUyMG9uJTIwYSUwQSUyMyUyMGRlcml2ZWQlMjBjbGFzcyUzQSUyMCpDTElQSW1hZ2VQcm9jZXNzb3IqJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQ0xJUEltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIlMEEpJTIwJTIwJTIzJTIwRG93bmxvYWQlMjBpbWFnZV9wcm9jZXNzaW5nX2NvbmZpZyUyMGZyb20lMjBodWdnaW5nZmFjZS5jbyUyMGFuZCUyMGNhY2hlLiUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMENMSVBJbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRiUyMiUwQSklMjAlMjAlMjMlMjBFLmcuJTIwaW1hZ2UlMjBwcm9jZXNzb3IlMjAob3IlMjBtb2RlbCklMjB3YXMlMjBzYXZlZCUyMHVzaW5nJTIwKnNhdmVfcHJldHJhaW5lZCgnLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRicpKiUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMENMSVBJbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyLiUyRnRlc3QlMkZzYXZlZF9tb2RlbCUyRnByZXByb2Nlc3Nvcl9jb25maWcuanNvbiUyMiklMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBDTElQSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMm9wZW5haSUyRmNsaXAtdml0LWJhc2UtcGF0Y2gzMiUyMiUyQyUyMGRvX25vcm1hbGl6ZSUzREZhbHNlJTJDJTIwZm9vJTNERmFsc2UlMEEpJTBBYXNzZXJ0JTIwaW1hZ2VfcHJvY2Vzc29yLmRvX25vcm1hbGl6ZSUyMGlzJTIwRmFsc2UlMEFpbWFnZV9wcm9jZXNzb3IlMkMlMjB1bnVzZWRfa3dhcmdzJTIwJTNEJTIwQ0xJUEltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJvcGVuYWklMkZjbGlwLXZpdC1iYXNlLXBhdGNoMzIlMjIlMkMlMjBkb19ub3JtYWxpemUlM0RGYWxzZSUyQyUyMGZvbyUzREZhbHNlJTJDJTIwcmV0dXJuX3VudXNlZF9rd2FyZ3MlM0RUcnVlJTBBKSUwQWFzc2VydCUyMGltYWdlX3Byb2Nlc3Nvci5kb19ub3JtYWxpemUlMjBpcyUyMEZhbHNlJTBBYXNzZXJ0JTIwdW51c2VkX2t3YXJncyUyMCUzRCUzRCUyMCU3QiUyMmZvbyUyMiUzQSUyMEZhbHNlJTdE",highlighted:`<span class="hljs-comment"># We can't instantiate directly the base class *ImageProcessingMixin* so let's show the examples on a</span> | |
| <span class="hljs-comment"># derived class: *CLIPImageProcessor*</span> | |
| image_processor = CLIPImageProcessor.from_pretrained( | |
| <span class="hljs-string">"openai/clip-vit-base-patch32"</span> | |
| ) <span class="hljs-comment"># Download image_processing_config from huggingface.co and cache.</span> | |
| image_processor = CLIPImageProcessor.from_pretrained( | |
| <span class="hljs-string">"./test/saved_model/"</span> | |
| ) <span class="hljs-comment"># E.g. image processor (or model) was saved using *save_pretrained('./test/saved_model/')*</span> | |
| image_processor = CLIPImageProcessor.from_pretrained(<span class="hljs-string">"./test/saved_model/preprocessor_config.json"</span>) | |
| image_processor = CLIPImageProcessor.from_pretrained( | |
| <span class="hljs-string">"openai/clip-vit-base-patch32"</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">"openai/clip-vit-base-patch32"</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">"foo"</span>: <span class="hljs-literal">False</span>}`,wrap:!1}}),{c(){l=s("p"),l.textContent=W,C=r(),p(x.$$.fragment)},l(m){l=i(m,"P",{"data-svelte-h":!0}),v(l)!=="svelte-kvfsh7"&&(l.textContent=W),C=o(m),g(x.$$.fragment,m)},m(m,w){c(m,l,w),c(m,C,w),h(x,m,w),M=!0},p:ct,i(m){M||(f(x.$$.fragment,m),M=!0)},o(m){u(x.$$.fragment,m),M=!1},d(m){m&&(n(l),n(C)),_(x,m)}}}function ut(pe){let l,W,C,x,M,m,w,Se="Image processor负责为视觉模型准备输入特征并后期处理处理它们的输出。这包括诸如调整大小、归一化和转换为PyTorch、TensorFlow、Flax和NumPy张量等转换。它还可能包括特定于模型的后期处理,例如将logits转换为分割掩码。",ge,q,he,b,L,Pe,ee,Ye=`This is an image processor mixin used to provide saving/loading functionality for sequential and image feature | |
| extractors.`,Ue,P,E,je,te,He='Instantiate a type of <a href="/docs/transformers/pr_31315/zh/main_classes/image_processor#transformers.ImageProcessingMixin">ImageProcessingMixin</a> from an image processor.',Be,B,ze,z,R,Ze,ne,Ge=`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_31315/zh/main_classes/image_processor#transformers.ImageProcessingMixin.from_pretrained">from_pretrained()</a> class method.`,fe,X,Ae="## BatchFeature[[transformers.BatchFeature]]",ue,d,V,Je,re,Qe='Holds the output of the <a href="/docs/transformers/pr_31315/zh/main_classes/feature_extractor#transformers.SequenceFeatureExtractor.pad">pad()</a> and feature extractor specific <code>__call__</code> methods.',ke,oe,Ke="This class is derived from a python dictionary and can be used as a dictionary.",Ne,Z,S,Fe,ae,Oe="Convert the inner content to tensors.",De,J,Y,We,se,et=`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>.`,_e,H,tt="## BaseImageProcessor[[transformers.BaseImageProcessor]]",ve,y,G,qe,k,A,Le,ie,nt=`Center crop an image to <code>(size["height"], size["width"])</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.`,Ee,N,Q,Re,ce,rt="Normalize an image. image = (image - image_mean) / image_std.",Xe,F,K,Ve,me,ot="Rescale an image by a scale factor. image = image * scale.",be,O,ye,de,xe;return M=new at({props:{title:"Image Processor",local:"image-processor",headingTag:"h1"}}),q=new at({props:{title:"ImageProcessingMixin",local:"transformers.ImageProcessingMixin",headingTag:"h2"}}),L=new j({props:{name:"class transformers.ImageProcessingMixin",anchor:"transformers.ImageProcessingMixin",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_31315/src/transformers/image_processing_base.py#L69"}}),E=new j({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>) — | |
| 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_31315/zh/main_classes/image_processor#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>) — | |
| 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>) — | |
| Whether or not to force to (re-)download the image processor files and override the cached versions if | |
| they exist. | |
| resume_download — | |
| 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>) — | |
| A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}.</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>) — | |
| 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>"main"</code>) — | |
| 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_31315/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_31315/zh/main_classes/image_processor#transformers.ImageProcessingMixin" | |
| >ImageProcessingMixin</a>.</p> | |
| `}}),B=new gt({props:{anchor:"transformers.ImageProcessingMixin.from_pretrained.example",$$slots:{default:[ft]},$$scope:{ctx:pe}}}),R=new j({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>) — | |
| 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>) — | |
| 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>) — | |
| Additional key word arguments passed along to the <a href="/docs/transformers/pr_31315/zh/main_classes/model#transformers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/vr_31315/src/transformers/image_processing_base.py#L210"}}),V=new j({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>) — | |
| Dictionary of lists/arrays/tensors returned by the <strong>call</strong>/pad methods (‘input_values’, ‘attention_mask’, | |
| etc.).`,name:"data"},{anchor:"transformers.BatchFeature.tensor_type",description:`<strong>tensor_type</strong> (<code>Union[None, str, TensorType]</code>, <em>optional</em>) — | |
| 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_31315/src/transformers/feature_extraction_utils.py#L62"}}),S=new j({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_31315/zh/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) — | |
| The type of tensors to use. If <code>str</code>, should be one of the values of the enum <a href="/docs/transformers/pr_31315/zh/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_31315/src/transformers/feature_extraction_utils.py#L165"}}),Y=new j({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>) — | |
| 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>) — | |
| Will be passed to the <code>to(...)</code> function of the tensors.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/vr_31315/src/transformers/feature_extraction_utils.py#L196",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_31315/zh/main_classes/image_processor#transformers.BatchFeature" | |
| >BatchFeature</a></p> | |
| `}}),G=new j({props:{name:"class transformers.BaseImageProcessor",anchor:"transformers.BaseImageProcessor",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_31315/src/transformers/image_processing_utils.py#L35"}}),A=new j({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>) — | |
| Image to center crop.`,name:"image"},{anchor:"transformers.BaseImageProcessor.center_crop.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>) — | |
| 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>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</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>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</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_31315/src/transformers/image_processing_utils.py#L115"}}),Q=new j({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>) — | |
| Image to normalize.`,name:"image"},{anchor:"transformers.BaseImageProcessor.normalize.mean",description:`<strong>mean</strong> (<code>float</code> or <code>Iterable[float]</code>) — | |
| 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>) — | |
| 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>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</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>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</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_31315/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> | |
| `}}),K=new j({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>) — | |
| Image to rescale.`,name:"image"},{anchor:"transformers.BaseImageProcessor.rescale.scale",description:`<strong>scale</strong> (<code>float</code>) — | |
| 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>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</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>) — | |
| 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>"channels_first"</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li> | |
| <li><code>"channels_last"</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_31315/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> | |
| `}}),O=new ht({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/zh/main_classes/image_processor.md"}}),{c(){l=s("meta"),W=r(),C=s("p"),x=r(),p(M.$$.fragment),m=r(),w=s("p"),w.textContent=Se,ge=r(),p(q.$$.fragment),he=r(),b=s("div"),p(L.$$.fragment),Pe=r(),ee=s("p"),ee.textContent=Ye,Ue=r(),P=s("div"),p(E.$$.fragment),je=r(),te=s("p"),te.innerHTML=He,Be=r(),p(B.$$.fragment),ze=r(),z=s("div"),p(R.$$.fragment),Ze=r(),ne=s("p"),ne.innerHTML=Ge,fe=r(),X=s("p"),X.textContent=Ae,ue=r(),d=s("div"),p(V.$$.fragment),Je=r(),re=s("p"),re.innerHTML=Qe,ke=r(),oe=s("p"),oe.textContent=Ke,Ne=r(),Z=s("div"),p(S.$$.fragment),Fe=r(),ae=s("p"),ae.textContent=Oe,De=r(),J=s("div"),p(Y.$$.fragment),We=r(),se=s("p"),se.innerHTML=et,_e=r(),H=s("p"),H.textContent=tt,ve=r(),y=s("div"),p(G.$$.fragment),qe=r(),k=s("div"),p(A.$$.fragment),Le=r(),ie=s("p"),ie.innerHTML=nt,Ee=r(),N=s("div"),p(Q.$$.fragment),Re=r(),ce=s("p"),ce.textContent=rt,Xe=r(),F=s("div"),p(K.$$.fragment),Ve=r(),me=s("p"),me.textContent=ot,be=r(),p(O.$$.fragment),ye=r(),de=s("p"),this.h()},l(e){const a=dt("svelte-u9bgzb",document.head);l=i(a,"META",{name:!0,content:!0}),a.forEach(n),W=o(e),C=i(e,"P",{}),I(C).forEach(n),x=o(e),g(M.$$.fragment,e),m=o(e),w=i(e,"P",{"data-svelte-h":!0}),v(w)!=="svelte-11uwufr"&&(w.textContent=Se),ge=o(e),g(q.$$.fragment,e),he=o(e),b=i(e,"DIV",{class:!0});var T=I(b);g(L.$$.fragment,T),Pe=o(T),ee=i(T,"P",{"data-svelte-h":!0}),v(ee)!=="svelte-16ht4m3"&&(ee.textContent=Ye),Ue=o(T),P=i(T,"DIV",{class:!0});var le=I(P);g(E.$$.fragment,le),je=o(le),te=i(le,"P",{"data-svelte-h":!0}),v(te)!=="svelte-g0riyf"&&(te.innerHTML=He),Be=o(le),g(B.$$.fragment,le),le.forEach(n),ze=o(T),z=i(T,"DIV",{class:!0});var Me=I(z);g(R.$$.fragment,Me),Ze=o(Me),ne=i(Me,"P",{"data-svelte-h":!0}),v(ne)!=="svelte-j23p6s"&&(ne.innerHTML=Ge),Me.forEach(n),T.forEach(n),fe=o(e),X=i(e,"P",{"data-svelte-h":!0}),v(X)!=="svelte-1kaqlr0"&&(X.textContent=Ae),ue=o(e),d=i(e,"DIV",{class:!0});var U=I(d);g(V.$$.fragment,U),Je=o(U),re=i(U,"P",{"data-svelte-h":!0}),v(re)!=="svelte-os9j18"&&(re.innerHTML=Qe),ke=o(U),oe=i(U,"P",{"data-svelte-h":!0}),v(oe)!=="svelte-saqdtk"&&(oe.textContent=Ke),Ne=o(U),Z=i(U,"DIV",{class:!0});var Ie=I(Z);g(S.$$.fragment,Ie),Fe=o(Ie),ae=i(Ie,"P",{"data-svelte-h":!0}),v(ae)!=="svelte-pxfh9u"&&(ae.textContent=Oe),Ie.forEach(n),De=o(U),J=i(U,"DIV",{class:!0});var $e=I(J);g(Y.$$.fragment,$e),We=o($e),se=i($e,"P",{"data-svelte-h":!0}),v(se)!=="svelte-d0cfhs"&&(se.innerHTML=et),$e.forEach(n),U.forEach(n),_e=o(e),H=i(e,"P",{"data-svelte-h":!0}),v(H)!=="svelte-7nklsc"&&(H.textContent=tt),ve=o(e),y=i(e,"DIV",{class:!0});var D=I(y);g(G.$$.fragment,D),qe=o(D),k=i(D,"DIV",{class:!0});var we=I(k);g(A.$$.fragment,we),Le=o(we),ie=i(we,"P",{"data-svelte-h":!0}),v(ie)!=="svelte-193kiu8"&&(ie.innerHTML=nt),we.forEach(n),Ee=o(D),N=i(D,"DIV",{class:!0});var Te=I(N);g(Q.$$.fragment,Te),Re=o(Te),ce=i(Te,"P",{"data-svelte-h":!0}),v(ce)!=="svelte-1e5okex"&&(ce.textContent=rt),Te.forEach(n),Xe=o(D),F=i(D,"DIV",{class:!0});var Ce=I(F);g(K.$$.fragment,Ce),Ve=o(Ce),me=i(Ce,"P",{"data-svelte-h":!0}),v(me)!=="svelte-qun0mt"&&(me.textContent=ot),Ce.forEach(n),D.forEach(n),be=o(e),g(O.$$.fragment,e),ye=o(e),de=i(e,"P",{}),I(de).forEach(n),this.h()},h(){$(l,"name","hf:doc:metadata"),$(l,"content",_t),$(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(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,"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,a){t(document.head,l),c(e,W,a),c(e,C,a),c(e,x,a),h(M,e,a),c(e,m,a),c(e,w,a),c(e,ge,a),h(q,e,a),c(e,he,a),c(e,b,a),h(L,b,null),t(b,Pe),t(b,ee),t(b,Ue),t(b,P),h(E,P,null),t(P,je),t(P,te),t(P,Be),h(B,P,null),t(b,ze),t(b,z),h(R,z,null),t(z,Ze),t(z,ne),c(e,fe,a),c(e,X,a),c(e,ue,a),c(e,d,a),h(V,d,null),t(d,Je),t(d,re),t(d,ke),t(d,oe),t(d,Ne),t(d,Z),h(S,Z,null),t(Z,Fe),t(Z,ae),t(d,De),t(d,J),h(Y,J,null),t(J,We),t(J,se),c(e,_e,a),c(e,H,a),c(e,ve,a),c(e,y,a),h(G,y,null),t(y,qe),t(y,k),h(A,k,null),t(k,Le),t(k,ie),t(y,Ee),t(y,N),h(Q,N,null),t(N,Re),t(N,ce),t(y,Xe),t(y,F),h(K,F,null),t(F,Ve),t(F,me),c(e,be,a),h(O,e,a),c(e,ye,a),c(e,de,a),xe=!0},p(e,[a]){const T={};a&2&&(T.$$scope={dirty:a,ctx:e}),B.$set(T)},i(e){xe||(f(M.$$.fragment,e),f(q.$$.fragment,e),f(L.$$.fragment,e),f(E.$$.fragment,e),f(B.$$.fragment,e),f(R.$$.fragment,e),f(V.$$.fragment,e),f(S.$$.fragment,e),f(Y.$$.fragment,e),f(G.$$.fragment,e),f(A.$$.fragment,e),f(Q.$$.fragment,e),f(K.$$.fragment,e),f(O.$$.fragment,e),xe=!0)},o(e){u(M.$$.fragment,e),u(q.$$.fragment,e),u(L.$$.fragment,e),u(E.$$.fragment,e),u(B.$$.fragment,e),u(R.$$.fragment,e),u(V.$$.fragment,e),u(S.$$.fragment,e),u(Y.$$.fragment,e),u(G.$$.fragment,e),u(A.$$.fragment,e),u(Q.$$.fragment,e),u(K.$$.fragment,e),u(O.$$.fragment,e),xe=!1},d(e){e&&(n(W),n(C),n(x),n(m),n(w),n(ge),n(he),n(b),n(fe),n(X),n(ue),n(d),n(_e),n(H),n(ve),n(y),n(be),n(ye),n(de)),n(l),_(M,e),_(q,e),_(L),_(E),_(B),_(R),_(V),_(S),_(Y),_(G),_(A),_(Q),_(K),_(O,e)}}}const _t='{"title":"Image Processor","local":"image-processor","sections":[{"title":"ImageProcessingMixin","local":"transformers.ImageProcessingMixin","sections":[],"depth":2}],"depth":1}';function vt(pe){return it(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class wt extends mt{constructor(l){super(),lt(this,l,vt,ut,st,{})}}export{wt as component}; | |
Xet Storage Details
- Size:
- 28.2 kB
- Xet hash:
- 731552e2798e673c0a90c9394aee153b5399202659c2704935afd162ff605c43
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.