import{S as Hn,i as Gn,s as Jn,e as a,k as c,w as h,t as s,M as Yn,c as o,d as r,m as d,a as n,x as g,h as i,b as l,G as e,g as E,y as _,q as v,o as x,B as y,v as Kn,L as Qn}from"../../chunks/vendor-hf-doc-builder.js";import{T as Xn}from"../../chunks/Tip-hf-doc-builder.js";import{D as w}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Zn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Xt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as es}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ts(Qe){let u,q,$,F,T;return F=new Zn({props:{code:`# We can't instantiate directly the base class *FeatureExtractionMixin* nor *SequenceFeatureExtractor* so let's show the examples on a
# derived class: *Wav2Vec2FeatureExtractor*
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
    "facebook/wav2vec2-base-960h"
)  # Download feature_extraction_config from huggingface.co and cache.
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
    "./test/saved_model/"
)  # E.g. feature_extractor (or model) was saved using *save_pretrained('./test/saved_model/')*
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("./test/saved_model/preprocessor_config.json")
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
    "facebook/wav2vec2-base-960h", return_attention_mask=False, foo=False
)
assert feature_extractor.return_attention_mask is False
feature_extractor, unused_kwargs = Wav2Vec2FeatureExtractor.from_pretrained(
    "facebook/wav2vec2-base-960h", return_attention_mask=False, foo=False, return_unused_kwargs=True
)
assert feature_extractor.return_attention_mask is False
assert unused_kwargs == {"foo": False}`,highlighted:`<span class="hljs-comment"># We can&#x27;t instantiate directly the base class *FeatureExtractionMixin* nor *SequenceFeatureExtractor* so let&#x27;s show the examples on a</span>
<span class="hljs-comment"># derived class: *Wav2Vec2FeatureExtractor*</span>
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
    <span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>
)  <span class="hljs-comment"># Download feature_extraction_config from huggingface.co and cache.</span>
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
    <span class="hljs-string">&quot;./test/saved_model/&quot;</span>
)  <span class="hljs-comment"># E.g. feature_extractor (or model) was saved using *save_pretrained(&#x27;./test/saved_model/&#x27;)*</span>
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(<span class="hljs-string">&quot;./test/saved_model/preprocessor_config.json&quot;</span>)
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
    <span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>, return_attention_mask=<span class="hljs-literal">False</span>, foo=<span class="hljs-literal">False</span>
)
<span class="hljs-keyword">assert</span> feature_extractor.return_attention_mask <span class="hljs-keyword">is</span> <span class="hljs-literal">False</span>
feature_extractor, unused_kwargs = Wav2Vec2FeatureExtractor.from_pretrained(
    <span class="hljs-string">&quot;facebook/wav2vec2-base-960h&quot;</span>, return_attention_mask=<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> feature_extractor.return_attention_mask <span class="hljs-keyword">is</span> <span class="hljs-literal">False</span>
<span class="hljs-keyword">assert</span> unused_kwargs == {<span class="hljs-string">&quot;foo&quot;</span>: <span class="hljs-literal">False</span>}`}}),{c(){u=a("p"),q=s("Examples:"),$=c(),h(F.$$.fragment)},l(m){u=o(m,"P",{});var P=n(u);q=i(P,"Examples:"),P.forEach(r),$=d(m),g(F.$$.fragment,m)},m(m,P){E(m,u,P),e(u,q),E(m,$,P),_(F,m,P),T=!0},p:Qn,i(m){T||(v(F.$$.fragment,m),T=!0)},o(m){x(F.$$.fragment,m),T=!1},d(m){m&&r(u),m&&r($),y(F,m)}}}function rs(Qe){let u,q,$,F,T,m,P,j;return{c(){u=a("p"),q=s("If the "),$=a("code"),F=s("processed_features"),T=s(` passed are dictionary of numpy arrays, PyTorch tensors or TensorFlow tensors, the
result will use the same type unless you provide a different tensor type with `),m=a("code"),P=s("return_tensors"),j=s(`. In the case of
PyTorch tensors, you will lose the specific device of your tensors however.`)},l(W){u=o(W,"P",{});var k=n(u);q=i(k,"If the "),$=o(k,"CODE",{});var D=n($);F=i(D,"processed_features"),D.forEach(r),T=i(k,` passed are dictionary of numpy arrays, PyTorch tensors or TensorFlow tensors, the
result will use the same type unless you provide a different tensor type with `),m=o(k,"CODE",{});var Xe=n(m);P=i(Xe,"return_tensors"),Xe.forEach(r),j=i(k,`. In the case of
PyTorch tensors, you will lose the specific device of your tensors however.`),k.forEach(r)},m(W,k){E(W,u,k),e(u,q),e(u,$),e($,F),e(u,T),e(u,m),e(m,P),e(u,j)},d(W){W&&r(u)}}}function as(Qe){let u,q,$,F,T,m,P,j,W,k,D,Xe,mt,zr,Mr,pt,Lr,qr,Zt,R,Z,ft,be,Nr,ut,Sr,er,z,Ee,Br,ht,Cr,Ar,C,$e,Or,S,Vr,Ze,jr,Wr,gt,Rr,Ur,et,Hr,Gr,Jr,ee,Yr,te,Fe,Kr,U,Qr,_t,Xr,Zr,tt,ea,ta,tr,H,re,vt,we,ra,xt,aa,rr,B,Ie,oa,yt,na,sa,N,Te,ia,bt,ca,da,G,la,Et,ma,pa,$t,fa,ua,ha,ae,ar,J,oe,Ft,Pe,ga,wt,_a,or,I,ke,va,Y,xa,rt,ya,ba,It,Ea,$a,Fa,Tt,wa,Ia,ne,De,Ta,Pt,Pa,ka,se,ze,Da,M,za,kt,Ma,La,Dt,qa,Na,zt,Sa,Ba,Mt,Ca,Aa,nr,K,ie,Lt,Me,Oa,qt,Va,sr,p,Le,ja,Nt,Wa,Ra,ce,qe,Ua,Ne,Ha,St,Ga,Ja,Ya,de,Se,Ka,Be,Qa,Bt,Xa,Za,eo,le,Ce,to,Ae,ro,Ct,ao,oo,no,me,Oe,so,Q,io,At,co,lo,Ot,mo,po,fo,pe,Ve,uo,L,ho,Vt,go,_o,jt,vo,xo,Wt,yo,bo,Rt,Eo,$o,Fo,fe,je,wo,Ut,Io,To,ue,We,Po,Re,ko,Ht,Do,zo,Mo,he,Ue,Lo,X,qo,Gt,No,So,Jt,Bo,Co,Ao,ge,He,Oo,Ge,Vo,Yt,jo,Wo,Ro,_e,Je,Uo,Ye,Ho,Kt,Go,Jo,ir;return m=new Xt({}),be=new Xt({}),Ee=new w({props:{name:"class transformers.FeatureExtractionMixin",anchor:"transformers.FeatureExtractionMixin",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/feature_extraction_utils.py#L223"}}),$e=new w({props:{name:"from_pretrained",anchor:"transformers.FeatureExtractionMixin.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FeatureExtractionMixin.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 feature_extractor hosted inside a model repo on
huggingface.co. Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or
namespaced under a user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>a path to a <em>directory</em> containing a feature extractor file saved using the
<a href="/docs/transformers/v4.27.1/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.save_pretrained">save_pretrained()</a> method, e.g.,
<code>./my_model_directory/</code>.</li>
<li>a path or url to a saved feature extractor JSON <em>file</em>, e.g.,
<code>./my_model_directory/preprocessor_config.json</code>.</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"transformers.FeatureExtractionMixin.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 feature extractor should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"transformers.FeatureExtractionMixin.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 feature extractor files and override the cached versions
if they exist.`,name:"force_download"},{anchor:"transformers.FeatureExtractionMixin.from_pretrained.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received file. Attempts to resume the download if such a file
exists.`,name:"resume_download"},{anchor:"transformers.FeatureExtractionMixin.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.FeatureExtractionMixin.from_pretrained.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <code>bool</code>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, or not specified, will use
the token generated when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"use_auth_token"},{anchor:"transformers.FeatureExtractionMixin.from_pretrained.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/feature_extraction_utils.py#L247",returnDescription:`
<p>A feature extractor of type <a
  href="/docs/transformers/v4.27.1/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin"
>FeatureExtractionMixin</a>.</p>
`}}),ee=new es({props:{anchor:"transformers.FeatureExtractionMixin.from_pretrained.example",$$slots:{default:[ts]},$$scope:{ctx:Qe}}}),Fe=new w({props:{name:"save_pretrained",anchor:"transformers.FeatureExtractionMixin.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.FeatureExtractionMixin.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory where the feature extractor JSON file will be saved (will be created if it does not exist).`,name:"save_directory"},{anchor:"transformers.FeatureExtractionMixin.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
repository you want to push to with <code>repo_id</code> (will default to the name of <code>save_directory</code> in your
namespace).
kwargs &#x2014;
Additional key word arguments passed along to the <a href="/docs/transformers/v4.27.1/en/internal/image_processing_utils#transformers.ImageProcessingMixin.push_to_hub">push_to_hub()</a> method.`,name:"push_to_hub"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/feature_extraction_utils.py#L333"}}),we=new Xt({}),Ie=new w({props:{name:"class transformers.SequenceFeatureExtractor",anchor:"transformers.SequenceFeatureExtractor",parameters:[{name:"feature_size",val:": int"},{name:"sampling_rate",val:": int"},{name:"padding_value",val:": float"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SequenceFeatureExtractor.feature_size",description:`<strong>feature_size</strong> (<code>int</code>) &#x2014;
The feature dimension of the extracted features.`,name:"feature_size"},{anchor:"transformers.SequenceFeatureExtractor.sampling_rate",description:`<strong>sampling_rate</strong> (<code>int</code>) &#x2014;
The sampling rate at which the audio files should be digitalized expressed in hertz (Hz).`,name:"sampling_rate"},{anchor:"transformers.SequenceFeatureExtractor.padding_value",description:`<strong>padding_value</strong> (<code>float</code>) &#x2014;
The value that is used to fill the padding values / vectors.`,name:"padding_value"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/feature_extraction_sequence_utils.py#L29"}}),Te=new w({props:{name:"pad",anchor:"transformers.SequenceFeatureExtractor.pad",parameters:[{name:"processed_features",val:": typing.Union[transformers.feature_extraction_utils.BatchFeature, typing.List[transformers.feature_extraction_utils.BatchFeature], typing.Dict[str, transformers.feature_extraction_utils.BatchFeature], typing.Dict[str, typing.List[transformers.feature_extraction_utils.BatchFeature]], typing.List[typing.Dict[str, transformers.feature_extraction_utils.BatchFeature]]]"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = True"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"truncation",val:": bool = False"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"}],parametersDescription:[{anchor:"transformers.SequenceFeatureExtractor.pad.processed_features",description:`<strong>processed_features</strong> (<a href="/docs/transformers/v4.27.1/en/main_classes/image_processor#transformers.BatchFeature">BatchFeature</a>, list of <a href="/docs/transformers/v4.27.1/en/main_classes/image_processor#transformers.BatchFeature">BatchFeature</a>, <code>Dict[str, List[float]]</code>, <code>Dict[str, List[List[float]]</code> or <code>List[Dict[str, List[float]]]</code>) &#x2014;
Processed inputs. Can represent one input (<a href="/docs/transformers/v4.27.1/en/main_classes/image_processor#transformers.BatchFeature">BatchFeature</a> or <code>Dict[str, List[float]]</code>) or a batch of
input values / vectors (list of <a href="/docs/transformers/v4.27.1/en/main_classes/image_processor#transformers.BatchFeature">BatchFeature</a>, <em>Dict[str, List[List[float]]]</em> or <em>List[Dict[str,
List[float]]]</em>) so you can use this method during preprocessing as well as in a PyTorch Dataloader
collate function.</p>
<p>Instead of <code>List[float]</code> you can have tensors (numpy arrays, PyTorch tensors or TensorFlow tensors),
see the note above for the return type.`,name:"processed_features"},{anchor:"transformers.SequenceFeatureExtractor.pad.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/file_utils#transformers.utils.PaddingStrategy">PaddingStrategy</a>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Select a strategy to pad the returned sequences (according to the model&#x2019;s padding side and padding
index) among:</p>
<ul>
<li><code>True</code> or <code>&apos;longest&apos;</code>: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).</li>
<li><code>&apos;max_length&apos;</code>: Pad to a maximum length specified with the argument <code>max_length</code> or to the maximum
acceptable input length for the model if that argument is not provided.</li>
<li><code>False</code> or <code>&apos;do_not_pad&apos;</code> (default): No padding (i.e., can output a batch with sequences of different
lengths).</li>
</ul>`,name:"padding"},{anchor:"transformers.SequenceFeatureExtractor.pad.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum length of the returned list and optionally padding length (see above).`,name:"max_length"},{anchor:"transformers.SequenceFeatureExtractor.pad.truncation",description:`<strong>truncation</strong> (<code>bool</code>) &#x2014;
Activates truncation to cut input sequences longer than <code>max_length</code> to <code>max_length</code>.`,name:"truncation"},{anchor:"transformers.SequenceFeatureExtractor.pad.pad_to_multiple_of",description:`<strong>pad_to_multiple_of</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If set will pad the sequence to a multiple of the provided value.</p>
<p>This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability
<code>&gt;= 7.5</code> (Volta), or on TPUs which benefit from having sequence lengths be a multiple of 128.`,name:"pad_to_multiple_of"},{anchor:"transformers.SequenceFeatureExtractor.pad.return_attention_mask",description:`<strong>return_attention_mask</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to return the attention mask. If left to the default, will return the attention mask according
to the specific feature_extractor&#x2019;s default.</p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"return_attention_mask"},{anchor:"transformers.SequenceFeatureExtractor.pad.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/v4.27.1/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/feature_extraction_sequence_utils.py#L52"}}),ae=new Xn({props:{$$slots:{default:[rs]},$$scope:{ctx:Qe}}}),Pe=new Xt({}),ke=new w({props:{name:"class transformers.BatchFeature",anchor:"transformers.BatchFeature",parameters:[{name:"data",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = 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>) &#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/v4.27.1/src/transformers/feature_extraction_utils.py#L59"}}),De=new w({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/v4.27.1/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/v4.27.1/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/v4.27.1/src/transformers/feature_extraction_utils.py#L113"}}),ze=new w({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/v4.27.1/src/transformers/feature_extraction_utils.py#L178",returnDescription:`
<p>The same instance after modification.</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/image_processor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),Me=new Xt({}),Le=new w({props:{name:"class transformers.ImageFeatureExtractionMixin",anchor:"transformers.ImageFeatureExtractionMixin",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L287"}}),qe=new w({props:{name:"center_crop",anchor:"transformers.ImageFeatureExtractionMixin.center_crop",parameters:[{name:"image",val:""},{name:"size",val:""}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.center_crop.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code> of shape (n_channels, height, width) or (height, width, n_channels)) &#x2014;
The image to resize.`,name:"image"},{anchor:"transformers.ImageFeatureExtractionMixin.center_crop.size",description:`<strong>size</strong> (<code>int</code> or <code>Tuple[int, int]</code>) &#x2014;
The size to which crop the image.`,name:"size"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L515",returnDescription:`
<p>A center cropped <code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code> of shape: (n_channels,
height, width).</p>
`,returnType:`
<p>new_image</p>
`}}),Se=new w({props:{name:"convert_rgb",anchor:"transformers.ImageFeatureExtractionMixin.convert_rgb",parameters:[{name:"image",val:""}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.convert_rgb.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code>) &#x2014;
The image to convert.`,name:"image"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L329"}}),Ce=new w({props:{name:"expand_dims",anchor:"transformers.ImageFeatureExtractionMixin.expand_dims",parameters:[{name:"image",val:""}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.expand_dims.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to expand.`,name:"image"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L382"}}),Oe=new w({props:{name:"flip_channel_order",anchor:"transformers.ImageFeatureExtractionMixin.flip_channel_order",parameters:[{name:"image",val:""}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.flip_channel_order.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image whose color channels to flip. If <code>np.ndarray</code> or <code>torch.Tensor</code>, the channel dimension should
be first.`,name:"image"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L590"}}),Ve=new w({props:{name:"normalize",anchor:"transformers.ImageFeatureExtractionMixin.normalize",parameters:[{name:"image",val:""},{name:"mean",val:""},{name:"std",val:""},{name:"rescale",val:" = False"}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.normalize.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to normalize.`,name:"image"},{anchor:"transformers.ImageFeatureExtractionMixin.normalize.mean",description:`<strong>mean</strong> (<code>List[float]</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The mean (per channel) to use for normalization.`,name:"mean"},{anchor:"transformers.ImageFeatureExtractionMixin.normalize.std",description:`<strong>std</strong> (<code>List[float]</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The standard deviation (per channel) to use for normalization.`,name:"std"},{anchor:"transformers.ImageFeatureExtractionMixin.normalize.rescale",description:`<strong>rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to rescale the image to be between 0 and 1. If a PIL image is provided, scaling will
happen automatically.`,name:"rescale"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L402"}}),je=new w({props:{name:"rescale",anchor:"transformers.ImageFeatureExtractionMixin.rescale",parameters:[{name:"image",val:": ndarray"},{name:"scale",val:": typing.Union[float, int]"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L343"}}),We=new w({props:{name:"resize",anchor:"transformers.ImageFeatureExtractionMixin.resize",parameters:[{name:"image",val:""},{name:"size",val:""},{name:"resample",val:" = None"},{name:"default_to_square",val:" = True"},{name:"max_size",val:" = None"}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.resize.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to resize.`,name:"image"},{anchor:"transformers.ImageFeatureExtractionMixin.resize.size",description:`<strong>size</strong> (<code>int</code> or <code>Tuple[int, int]</code>) &#x2014;
The size to use for resizing the image. If <code>size</code> is a sequence like (h, w), output size will be
matched to this.</p>
<p>If <code>size</code> is an int and <code>default_to_square</code> is <code>True</code>, then image will be resized to (size, size). If
<code>size</code> is an int and <code>default_to_square</code> is <code>False</code>, then smaller edge of the image will be matched to
this number. i.e, if height &gt; width, then image will be rescaled to (size * height / width, size).`,name:"size"},{anchor:"transformers.ImageFeatureExtractionMixin.resize.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
The filter to user for resampling.`,name:"resample"},{anchor:"transformers.ImageFeatureExtractionMixin.resize.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
How to convert <code>size</code> when it is a single int. If set to <code>True</code>, the <code>size</code> will be converted to a
square (<code>size</code>,<code>size</code>). If set to <code>False</code>, will replicate
<a href="https://pytorch.org/vision/stable/transforms.html#torchvision.transforms.Resize" rel="nofollow"><code>torchvision.transforms.Resize</code></a>
with support for resizing only the smallest edge and providing an optional <code>max_size</code>.`,name:"default_to_square"},{anchor:"transformers.ImageFeatureExtractionMixin.resize.max_size",description:`<strong>max_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The maximum allowed for the longer edge of the resized image: if the longer edge of the image is
greater than <code>max_size</code> after being resized according to <code>size</code>, then the image is resized again so
that the longer edge is equal to <code>max_size</code>. As a result, <code>size</code> might be overruled, i.e the smaller
edge may be shorter than <code>size</code>. Only used if <code>default_to_square</code> is <code>False</code>.`,name:"max_size"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L448",returnDescription:`
<p>A resized <code>PIL.Image.Image</code>.</p>
`,returnType:`
<p>image</p>
`}}),Ue=new w({props:{name:"rotate",anchor:"transformers.ImageFeatureExtractionMixin.rotate",parameters:[{name:"image",val:""},{name:"angle",val:""},{name:"resample",val:" = None"},{name:"expand",val:" = 0"},{name:"center",val:" = None"},{name:"translate",val:" = None"},{name:"fillcolor",val:" = None"}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.rotate.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to rotate. If <code>np.ndarray</code> or <code>torch.Tensor</code>, will be converted to <code>PIL.Image.Image</code> before
rotating.`,name:"image"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L607",returnDescription:`
<p>A rotated <code>PIL.Image.Image</code>.</p>
`,returnType:`
<p>image</p>
`}}),He=new w({props:{name:"to_numpy_array",anchor:"transformers.ImageFeatureExtractionMixin.to_numpy_array",parameters:[{name:"image",val:""},{name:"rescale",val:" = None"},{name:"channel_first",val:" = True"}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.to_numpy_array.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to convert to a NumPy array.`,name:"image"},{anchor:"transformers.ImageFeatureExtractionMixin.to_numpy_array.rescale",description:`<strong>rescale</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to apply the scaling factor (to make pixel values floats between 0. and 1.). Will
default to <code>True</code> if the image is a PIL Image or an array/tensor of integers, <code>False</code> otherwise.`,name:"rescale"},{anchor:"transformers.ImageFeatureExtractionMixin.to_numpy_array.channel_first",description:`<strong>channel_first</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to permute the dimensions of the image to put the channel dimension first.`,name:"channel_first"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L350"}}),Je=new w({props:{name:"to_pil_image",anchor:"transformers.ImageFeatureExtractionMixin.to_pil_image",parameters:[{name:"image",val:""},{name:"rescale",val:" = None"}],parametersDescription:[{anchor:"transformers.ImageFeatureExtractionMixin.to_pil_image.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>numpy.ndarray</code> or <code>torch.Tensor</code>) &#x2014;
The image to convert to the PIL Image format.`,name:"image"},{anchor:"transformers.ImageFeatureExtractionMixin.to_pil_image.rescale",description:`<strong>rescale</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to apply the scaling factor (to make pixel values integers between 0 and 255). Will
default to <code>True</code> if the image type is a floating type, <code>False</code> otherwise.`,name:"rescale"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/image_utils.py#L299"}}),{c(){u=a("meta"),q=c(),$=a("h1"),F=a("a"),T=a("span"),h(m.$$.fragment),P=c(),j=a("span"),W=s("Feature Extractor"),k=c(),D=a("p"),Xe=s(`A feature extractor is in charge of preparing input features for audio or vision models. This includes feature extraction
from sequences, `),mt=a("em"),zr=s("e.g."),Mr=s(`, pre-processing audio files to Log-Mel Spectrogram features, feature extraction from images
`),pt=a("em"),Lr=s("e.g."),qr=s(` cropping image image files, but also padding, normalization, and conversion to Numpy, PyTorch, and TensorFlow
tensors.`),Zt=c(),R=a("h2"),Z=a("a"),ft=a("span"),h(be.$$.fragment),Nr=c(),ut=a("span"),Sr=s("FeatureExtractionMixin"),er=c(),z=a("div"),h(Ee.$$.fragment),Br=c(),ht=a("p"),Cr=s(`This is a feature extraction mixin used to provide saving/loading functionality for sequential and image feature
extractors.`),Ar=c(),C=a("div"),h($e.$$.fragment),Or=c(),S=a("p"),Vr=s("Instantiate a type of "),Ze=a("a"),jr=s("FeatureExtractionMixin"),Wr=s(" from a feature extractor, "),gt=a("em"),Rr=s("e.g."),Ur=s(` a
derived class of `),et=a("a"),Hr=s("SequenceFeatureExtractor"),Gr=s("."),Jr=c(),h(ee.$$.fragment),Yr=c(),te=a("div"),h(Fe.$$.fragment),Kr=c(),U=a("p"),Qr=s("Save a feature_extractor object to the directory "),_t=a("code"),Xr=s("save_directory"),Zr=s(`, so that it can be re-loaded using the
`),tt=a("a"),ea=s("from_pretrained()"),ta=s(" class method."),tr=c(),H=a("h2"),re=a("a"),vt=a("span"),h(we.$$.fragment),ra=c(),xt=a("span"),aa=s("SequenceFeatureExtractor"),rr=c(),B=a("div"),h(Ie.$$.fragment),oa=c(),yt=a("p"),na=s("This is a general feature extraction class for speech recognition."),sa=c(),N=a("div"),h(Te.$$.fragment),ia=c(),bt=a("p"),ca=s(`Pad input values / input vectors or a batch of input values / input vectors up to predefined length or to the
max sequence length in the batch.`),da=c(),G=a("p"),la=s("Padding side (left/right) padding values are defined at the feature extractor level (with "),Et=a("code"),ma=s("self.padding_side"),pa=s(`,
`),$t=a("code"),fa=s("self.padding_value"),ua=s(")"),ha=c(),h(ae.$$.fragment),ar=c(),J=a("h2"),oe=a("a"),Ft=a("span"),h(Pe.$$.fragment),ga=c(),wt=a("span"),_a=s("BatchFeature"),or=c(),I=a("div"),h(ke.$$.fragment),va=c(),Y=a("p"),xa=s("Holds the output of the "),rt=a("a"),ya=s("pad()"),ba=s(" and feature extractor specific "),It=a("code"),Ea=s("__call__"),$a=s(" methods."),Fa=c(),Tt=a("p"),wa=s("This class is derived from a python dictionary and can be used as a dictionary."),Ia=c(),ne=a("div"),h(De.$$.fragment),Ta=c(),Pt=a("p"),Pa=s("Convert the inner content to tensors."),ka=c(),se=a("div"),h(ze.$$.fragment),Da=c(),M=a("p"),za=s("Send all values to device by calling "),kt=a("code"),Ma=s("v.to(*args, **kwargs)"),La=s(` (PyTorch only). This should support casting in
different `),Dt=a("code"),qa=s("dtypes"),Na=s(" and sending the "),zt=a("code"),Sa=s("BatchFeature"),Ba=s(" to a different "),Mt=a("code"),Ca=s("device"),Aa=s("."),nr=c(),K=a("h2"),ie=a("a"),Lt=a("span"),h(Me.$$.fragment),Oa=c(),qt=a("span"),Va=s("ImageFeatureExtractionMixin"),sr=c(),p=a("div"),h(Le.$$.fragment),ja=c(),Nt=a("p"),Wa=s("Mixin that contain utilities for preparing image features."),Ra=c(),ce=a("div"),h(qe.$$.fragment),Ua=c(),Ne=a("p"),Ha=s("Crops "),St=a("code"),Ga=s("image"),Ja=s(` to the given size using a center crop. Note that if the image is too small to be cropped to the
size given, it will be padded (so the returned result has the size asked).`),Ya=c(),de=a("div"),h(Se.$$.fragment),Ka=c(),Be=a("p"),Qa=s("Converts "),Bt=a("code"),Xa=s("PIL.Image.Image"),Za=s(" to RGB format."),eo=c(),le=a("div"),h(Ce.$$.fragment),to=c(),Ae=a("p"),ro=s("Expands 2-dimensional "),Ct=a("code"),ao=s("image"),oo=s(" to 3 dimensions."),no=c(),me=a("div"),h(Oe.$$.fragment),so=c(),Q=a("p"),io=s("Flips the channel order of "),At=a("code"),co=s("image"),lo=s(` from RGB to BGR, or vice versa. Note that this will trigger a conversion of
`),Ot=a("code"),mo=s("image"),po=s(" to a NumPy array if it\u2019s a PIL Image."),fo=c(),pe=a("div"),h(Ve.$$.fragment),uo=c(),L=a("p"),ho=s("Normalizes "),Vt=a("code"),go=s("image"),_o=s(" with "),jt=a("code"),vo=s("mean"),xo=s(" and "),Wt=a("code"),yo=s("std"),bo=s(". Note that this will trigger a conversion of "),Rt=a("code"),Eo=s("image"),$o=s(` to a NumPy array
if it\u2019s a PIL Image.`),Fo=c(),fe=a("div"),h(je.$$.fragment),wo=c(),Ut=a("p"),Io=s("Rescale a numpy image by scale amount"),To=c(),ue=a("div"),h(We.$$.fragment),Po=c(),Re=a("p"),ko=s("Resizes "),Ht=a("code"),Do=s("image"),zo=s(". Enforces conversion of input to PIL.Image."),Mo=c(),he=a("div"),h(Ue.$$.fragment),Lo=c(),X=a("p"),qo=s("Returns a rotated copy of "),Gt=a("code"),No=s("image"),So=s(". This method returns a copy of "),Jt=a("code"),Bo=s("image"),Co=s(`, rotated the given number of degrees
counter clockwise around its centre.`),Ao=c(),ge=a("div"),h(He.$$.fragment),Oo=c(),Ge=a("p"),Vo=s("Converts "),Yt=a("code"),jo=s("image"),Wo=s(` to a numpy array. Optionally rescales it and puts the channel dimension as the first
dimension.`),Ro=c(),_e=a("div"),h(Je.$$.fragment),Uo=c(),Ye=a("p"),Ho=s("Converts "),Kt=a("code"),Go=s("image"),Jo=s(` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if
needed.`),this.h()},l(t){const f=Yn('[data-svelte="svelte-1phssyn"]',document.head);u=o(f,"META",{name:!0,content:!0}),f.forEach(r),q=d(t),$=o(t,"H1",{class:!0});var Ke=n($);F=o(Ke,"A",{id:!0,class:!0,href:!0});var Qt=n(F);T=o(Qt,"SPAN",{});var Yo=n(T);g(m.$$.fragment,Yo),Yo.forEach(r),Qt.forEach(r),P=d(Ke),j=o(Ke,"SPAN",{});var Ko=n(j);W=i(Ko,"Feature Extractor"),Ko.forEach(r),Ke.forEach(r),k=d(t),D=o(t,"P",{});var at=n(D);Xe=i(at,`A feature extractor is in charge of preparing input features for audio or vision models. This includes feature extraction
from sequences, `),mt=o(at,"EM",{});var Qo=n(mt);zr=i(Qo,"e.g."),Qo.forEach(r),Mr=i(at,`, pre-processing audio files to Log-Mel Spectrogram features, feature extraction from images
`),pt=o(at,"EM",{});var Xo=n(pt);Lr=i(Xo,"e.g."),Xo.forEach(r),qr=i(at,` cropping image image files, but also padding, normalization, and conversion to Numpy, PyTorch, and TensorFlow
tensors.`),at.forEach(r),Zt=d(t),R=o(t,"H2",{class:!0});var cr=n(R);Z=o(cr,"A",{id:!0,class:!0,href:!0});var Zo=n(Z);ft=o(Zo,"SPAN",{});var en=n(ft);g(be.$$.fragment,en),en.forEach(r),Zo.forEach(r),Nr=d(cr),ut=o(cr,"SPAN",{});var tn=n(ut);Sr=i(tn,"FeatureExtractionMixin"),tn.forEach(r),cr.forEach(r),er=d(t),z=o(t,"DIV",{class:!0});var ve=n(z);g(Ee.$$.fragment,ve),Br=d(ve),ht=o(ve,"P",{});var rn=n(ht);Cr=i(rn,`This is a feature extraction mixin used to provide saving/loading functionality for sequential and image feature
extractors.`),rn.forEach(r),Ar=d(ve),C=o(ve,"DIV",{class:!0});var ot=n(C);g($e.$$.fragment,ot),Or=d(ot),S=o(ot,"P",{});var xe=n(S);Vr=i(xe,"Instantiate a type of "),Ze=o(xe,"A",{href:!0});var an=n(Ze);jr=i(an,"FeatureExtractionMixin"),an.forEach(r),Wr=i(xe," from a feature extractor, "),gt=o(xe,"EM",{});var on=n(gt);Rr=i(on,"e.g."),on.forEach(r),Ur=i(xe,` a
derived class of `),et=o(xe,"A",{href:!0});var nn=n(et);Hr=i(nn,"SequenceFeatureExtractor"),nn.forEach(r),Gr=i(xe,"."),xe.forEach(r),Jr=d(ot),g(ee.$$.fragment,ot),ot.forEach(r),Yr=d(ve),te=o(ve,"DIV",{class:!0});var dr=n(te);g(Fe.$$.fragment,dr),Kr=d(dr),U=o(dr,"P",{});var nt=n(U);Qr=i(nt,"Save a feature_extractor object to the directory "),_t=o(nt,"CODE",{});var sn=n(_t);Xr=i(sn,"save_directory"),sn.forEach(r),Zr=i(nt,`, so that it can be re-loaded using the
`),tt=o(nt,"A",{href:!0});var cn=n(tt);ea=i(cn,"from_pretrained()"),cn.forEach(r),ta=i(nt," class method."),nt.forEach(r),dr.forEach(r),ve.forEach(r),tr=d(t),H=o(t,"H2",{class:!0});var lr=n(H);re=o(lr,"A",{id:!0,class:!0,href:!0});var dn=n(re);vt=o(dn,"SPAN",{});var ln=n(vt);g(we.$$.fragment,ln),ln.forEach(r),dn.forEach(r),ra=d(lr),xt=o(lr,"SPAN",{});var mn=n(xt);aa=i(mn,"SequenceFeatureExtractor"),mn.forEach(r),lr.forEach(r),rr=d(t),B=o(t,"DIV",{class:!0});var st=n(B);g(Ie.$$.fragment,st),oa=d(st),yt=o(st,"P",{});var pn=n(yt);na=i(pn,"This is a general feature extraction class for speech recognition."),pn.forEach(r),sa=d(st),N=o(st,"DIV",{class:!0});var ye=n(N);g(Te.$$.fragment,ye),ia=d(ye),bt=o(ye,"P",{});var fn=n(bt);ca=i(fn,`Pad input values / input vectors or a batch of input values / input vectors up to predefined length or to the
max sequence length in the batch.`),fn.forEach(r),da=d(ye),G=o(ye,"P",{});var it=n(G);la=i(it,"Padding side (left/right) padding values are defined at the feature extractor level (with "),Et=o(it,"CODE",{});var un=n(Et);ma=i(un,"self.padding_side"),un.forEach(r),pa=i(it,`,
`),$t=o(it,"CODE",{});var hn=n($t);fa=i(hn,"self.padding_value"),hn.forEach(r),ua=i(it,")"),it.forEach(r),ha=d(ye),g(ae.$$.fragment,ye),ye.forEach(r),st.forEach(r),ar=d(t),J=o(t,"H2",{class:!0});var mr=n(J);oe=o(mr,"A",{id:!0,class:!0,href:!0});var gn=n(oe);Ft=o(gn,"SPAN",{});var _n=n(Ft);g(Pe.$$.fragment,_n),_n.forEach(r),gn.forEach(r),ga=d(mr),wt=o(mr,"SPAN",{});var vn=n(wt);_a=i(vn,"BatchFeature"),vn.forEach(r),mr.forEach(r),or=d(t),I=o(t,"DIV",{class:!0});var A=n(I);g(ke.$$.fragment,A),va=d(A),Y=o(A,"P",{});var ct=n(Y);xa=i(ct,"Holds the output of the "),rt=o(ct,"A",{href:!0});var xn=n(rt);ya=i(xn,"pad()"),xn.forEach(r),ba=i(ct," and feature extractor specific "),It=o(ct,"CODE",{});var yn=n(It);Ea=i(yn,"__call__"),yn.forEach(r),$a=i(ct," methods."),ct.forEach(r),Fa=d(A),Tt=o(A,"P",{});var bn=n(Tt);wa=i(bn,"This class is derived from a python dictionary and can be used as a dictionary."),bn.forEach(r),Ia=d(A),ne=o(A,"DIV",{class:!0});var pr=n(ne);g(De.$$.fragment,pr),Ta=d(pr),Pt=o(pr,"P",{});var En=n(Pt);Pa=i(En,"Convert the inner content to tensors."),En.forEach(r),pr.forEach(r),ka=d(A),se=o(A,"DIV",{class:!0});var fr=n(se);g(ze.$$.fragment,fr),Da=d(fr),M=o(fr,"P",{});var O=n(M);za=i(O,"Send all values to device by calling "),kt=o(O,"CODE",{});var $n=n(kt);Ma=i($n,"v.to(*args, **kwargs)"),$n.forEach(r),La=i(O,` (PyTorch only). This should support casting in
different `),Dt=o(O,"CODE",{});var Fn=n(Dt);qa=i(Fn,"dtypes"),Fn.forEach(r),Na=i(O," and sending the "),zt=o(O,"CODE",{});var wn=n(zt);Sa=i(wn,"BatchFeature"),wn.forEach(r),Ba=i(O," to a different "),Mt=o(O,"CODE",{});var In=n(Mt);Ca=i(In,"device"),In.forEach(r),Aa=i(O,"."),O.forEach(r),fr.forEach(r),A.forEach(r),nr=d(t),K=o(t,"H2",{class:!0});var ur=n(K);ie=o(ur,"A",{id:!0,class:!0,href:!0});var Tn=n(ie);Lt=o(Tn,"SPAN",{});var Pn=n(Lt);g(Me.$$.fragment,Pn),Pn.forEach(r),Tn.forEach(r),Oa=d(ur),qt=o(ur,"SPAN",{});var kn=n(qt);Va=i(kn,"ImageFeatureExtractionMixin"),kn.forEach(r),ur.forEach(r),sr=d(t),p=o(t,"DIV",{class:!0});var b=n(p);g(Le.$$.fragment,b),ja=d(b),Nt=o(b,"P",{});var Dn=n(Nt);Wa=i(Dn,"Mixin that contain utilities for preparing image features."),Dn.forEach(r),Ra=d(b),ce=o(b,"DIV",{class:!0});var hr=n(ce);g(qe.$$.fragment,hr),Ua=d(hr),Ne=o(hr,"P",{});var gr=n(Ne);Ha=i(gr,"Crops "),St=o(gr,"CODE",{});var zn=n(St);Ga=i(zn,"image"),zn.forEach(r),Ja=i(gr,` to the given size using a center crop. Note that if the image is too small to be cropped to the
size given, it will be padded (so the returned result has the size asked).`),gr.forEach(r),hr.forEach(r),Ya=d(b),de=o(b,"DIV",{class:!0});var _r=n(de);g(Se.$$.fragment,_r),Ka=d(_r),Be=o(_r,"P",{});var vr=n(Be);Qa=i(vr,"Converts "),Bt=o(vr,"CODE",{});var Mn=n(Bt);Xa=i(Mn,"PIL.Image.Image"),Mn.forEach(r),Za=i(vr," to RGB format."),vr.forEach(r),_r.forEach(r),eo=d(b),le=o(b,"DIV",{class:!0});var xr=n(le);g(Ce.$$.fragment,xr),to=d(xr),Ae=o(xr,"P",{});var yr=n(Ae);ro=i(yr,"Expands 2-dimensional "),Ct=o(yr,"CODE",{});var Ln=n(Ct);ao=i(Ln,"image"),Ln.forEach(r),oo=i(yr," to 3 dimensions."),yr.forEach(r),xr.forEach(r),no=d(b),me=o(b,"DIV",{class:!0});var br=n(me);g(Oe.$$.fragment,br),so=d(br),Q=o(br,"P",{});var dt=n(Q);io=i(dt,"Flips the channel order of "),At=o(dt,"CODE",{});var qn=n(At);co=i(qn,"image"),qn.forEach(r),lo=i(dt,` from RGB to BGR, or vice versa. Note that this will trigger a conversion of
`),Ot=o(dt,"CODE",{});var Nn=n(Ot);mo=i(Nn,"image"),Nn.forEach(r),po=i(dt," to a NumPy array if it\u2019s a PIL Image."),dt.forEach(r),br.forEach(r),fo=d(b),pe=o(b,"DIV",{class:!0});var Er=n(pe);g(Ve.$$.fragment,Er),uo=d(Er),L=o(Er,"P",{});var V=n(L);ho=i(V,"Normalizes "),Vt=o(V,"CODE",{});var Sn=n(Vt);go=i(Sn,"image"),Sn.forEach(r),_o=i(V," with "),jt=o(V,"CODE",{});var Bn=n(jt);vo=i(Bn,"mean"),Bn.forEach(r),xo=i(V," and "),Wt=o(V,"CODE",{});var Cn=n(Wt);yo=i(Cn,"std"),Cn.forEach(r),bo=i(V,". Note that this will trigger a conversion of "),Rt=o(V,"CODE",{});var An=n(Rt);Eo=i(An,"image"),An.forEach(r),$o=i(V,` to a NumPy array
if it\u2019s a PIL Image.`),V.forEach(r),Er.forEach(r),Fo=d(b),fe=o(b,"DIV",{class:!0});var $r=n(fe);g(je.$$.fragment,$r),wo=d($r),Ut=o($r,"P",{});var On=n(Ut);Io=i(On,"Rescale a numpy image by scale amount"),On.forEach(r),$r.forEach(r),To=d(b),ue=o(b,"DIV",{class:!0});var Fr=n(ue);g(We.$$.fragment,Fr),Po=d(Fr),Re=o(Fr,"P",{});var wr=n(Re);ko=i(wr,"Resizes "),Ht=o(wr,"CODE",{});var Vn=n(Ht);Do=i(Vn,"image"),Vn.forEach(r),zo=i(wr,". Enforces conversion of input to PIL.Image."),wr.forEach(r),Fr.forEach(r),Mo=d(b),he=o(b,"DIV",{class:!0});var Ir=n(he);g(Ue.$$.fragment,Ir),Lo=d(Ir),X=o(Ir,"P",{});var lt=n(X);qo=i(lt,"Returns a rotated copy of "),Gt=o(lt,"CODE",{});var jn=n(Gt);No=i(jn,"image"),jn.forEach(r),So=i(lt,". This method returns a copy of "),Jt=o(lt,"CODE",{});var Wn=n(Jt);Bo=i(Wn,"image"),Wn.forEach(r),Co=i(lt,`, rotated the given number of degrees
counter clockwise around its centre.`),lt.forEach(r),Ir.forEach(r),Ao=d(b),ge=o(b,"DIV",{class:!0});var Tr=n(ge);g(He.$$.fragment,Tr),Oo=d(Tr),Ge=o(Tr,"P",{});var Pr=n(Ge);Vo=i(Pr,"Converts "),Yt=o(Pr,"CODE",{});var Rn=n(Yt);jo=i(Rn,"image"),Rn.forEach(r),Wo=i(Pr,` to a numpy array. Optionally rescales it and puts the channel dimension as the first
dimension.`),Pr.forEach(r),Tr.forEach(r),Ro=d(b),_e=o(b,"DIV",{class:!0});var kr=n(_e);g(Je.$$.fragment,kr),Uo=d(kr),Ye=o(kr,"P",{});var Dr=n(Ye);Ho=i(Dr,"Converts "),Kt=o(Dr,"CODE",{});var Un=n(Kt);Go=i(Un,"image"),Un.forEach(r),Jo=i(Dr,` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if
needed.`),Dr.forEach(r),kr.forEach(r),b.forEach(r),this.h()},h(){l(u,"name","hf:doc:metadata"),l(u,"content",JSON.stringify(os)),l(F,"id","feature-extractor"),l(F,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(F,"href","#feature-extractor"),l($,"class","relative group"),l(Z,"id","transformers.FeatureExtractionMixin"),l(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Z,"href","#transformers.FeatureExtractionMixin"),l(R,"class","relative group"),l(Ze,"href","/docs/transformers/v4.27.1/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin"),l(et,"href","/docs/transformers/v4.27.1/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor"),l(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(tt,"href","/docs/transformers/v4.27.1/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin.from_pretrained"),l(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(re,"id","transformers.SequenceFeatureExtractor"),l(re,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(re,"href","#transformers.SequenceFeatureExtractor"),l(H,"class","relative group"),l(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(oe,"id","transformers.BatchFeature"),l(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(oe,"href","#transformers.BatchFeature"),l(J,"class","relative group"),l(rt,"href","/docs/transformers/v4.27.1/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor.pad"),l(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ie,"id","transformers.ImageFeatureExtractionMixin"),l(ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(ie,"href","#transformers.ImageFeatureExtractionMixin"),l(K,"class","relative group"),l(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,f){e(document.head,u),E(t,q,f),E(t,$,f),e($,F),e(F,T),_(m,T,null),e($,P),e($,j),e(j,W),E(t,k,f),E(t,D,f),e(D,Xe),e(D,mt),e(mt,zr),e(D,Mr),e(D,pt),e(pt,Lr),e(D,qr),E(t,Zt,f),E(t,R,f),e(R,Z),e(Z,ft),_(be,ft,null),e(R,Nr),e(R,ut),e(ut,Sr),E(t,er,f),E(t,z,f),_(Ee,z,null),e(z,Br),e(z,ht),e(ht,Cr),e(z,Ar),e(z,C),_($e,C,null),e(C,Or),e(C,S),e(S,Vr),e(S,Ze),e(Ze,jr),e(S,Wr),e(S,gt),e(gt,Rr),e(S,Ur),e(S,et),e(et,Hr),e(S,Gr),e(C,Jr),_(ee,C,null),e(z,Yr),e(z,te),_(Fe,te,null),e(te,Kr),e(te,U),e(U,Qr),e(U,_t),e(_t,Xr),e(U,Zr),e(U,tt),e(tt,ea),e(U,ta),E(t,tr,f),E(t,H,f),e(H,re),e(re,vt),_(we,vt,null),e(H,ra),e(H,xt),e(xt,aa),E(t,rr,f),E(t,B,f),_(Ie,B,null),e(B,oa),e(B,yt),e(yt,na),e(B,sa),e(B,N),_(Te,N,null),e(N,ia),e(N,bt),e(bt,ca),e(N,da),e(N,G),e(G,la),e(G,Et),e(Et,ma),e(G,pa),e(G,$t),e($t,fa),e(G,ua),e(N,ha),_(ae,N,null),E(t,ar,f),E(t,J,f),e(J,oe),e(oe,Ft),_(Pe,Ft,null),e(J,ga),e(J,wt),e(wt,_a),E(t,or,f),E(t,I,f),_(ke,I,null),e(I,va),e(I,Y),e(Y,xa),e(Y,rt),e(rt,ya),e(Y,ba),e(Y,It),e(It,Ea),e(Y,$a),e(I,Fa),e(I,Tt),e(Tt,wa),e(I,Ia),e(I,ne),_(De,ne,null),e(ne,Ta),e(ne,Pt),e(Pt,Pa),e(I,ka),e(I,se),_(ze,se,null),e(se,Da),e(se,M),e(M,za),e(M,kt),e(kt,Ma),e(M,La),e(M,Dt),e(Dt,qa),e(M,Na),e(M,zt),e(zt,Sa),e(M,Ba),e(M,Mt),e(Mt,Ca),e(M,Aa),E(t,nr,f),E(t,K,f),e(K,ie),e(ie,Lt),_(Me,Lt,null),e(K,Oa),e(K,qt),e(qt,Va),E(t,sr,f),E(t,p,f),_(Le,p,null),e(p,ja),e(p,Nt),e(Nt,Wa),e(p,Ra),e(p,ce),_(qe,ce,null),e(ce,Ua),e(ce,Ne),e(Ne,Ha),e(Ne,St),e(St,Ga),e(Ne,Ja),e(p,Ya),e(p,de),_(Se,de,null),e(de,Ka),e(de,Be),e(Be,Qa),e(Be,Bt),e(Bt,Xa),e(Be,Za),e(p,eo),e(p,le),_(Ce,le,null),e(le,to),e(le,Ae),e(Ae,ro),e(Ae,Ct),e(Ct,ao),e(Ae,oo),e(p,no),e(p,me),_(Oe,me,null),e(me,so),e(me,Q),e(Q,io),e(Q,At),e(At,co),e(Q,lo),e(Q,Ot),e(Ot,mo),e(Q,po),e(p,fo),e(p,pe),_(Ve,pe,null),e(pe,uo),e(pe,L),e(L,ho),e(L,Vt),e(Vt,go),e(L,_o),e(L,jt),e(jt,vo),e(L,xo),e(L,Wt),e(Wt,yo),e(L,bo),e(L,Rt),e(Rt,Eo),e(L,$o),e(p,Fo),e(p,fe),_(je,fe,null),e(fe,wo),e(fe,Ut),e(Ut,Io),e(p,To),e(p,ue),_(We,ue,null),e(ue,Po),e(ue,Re),e(Re,ko),e(Re,Ht),e(Ht,Do),e(Re,zo),e(p,Mo),e(p,he),_(Ue,he,null),e(he,Lo),e(he,X),e(X,qo),e(X,Gt),e(Gt,No),e(X,So),e(X,Jt),e(Jt,Bo),e(X,Co),e(p,Ao),e(p,ge),_(He,ge,null),e(ge,Oo),e(ge,Ge),e(Ge,Vo),e(Ge,Yt),e(Yt,jo),e(Ge,Wo),e(p,Ro),e(p,_e),_(Je,_e,null),e(_e,Uo),e(_e,Ye),e(Ye,Ho),e(Ye,Kt),e(Kt,Go),e(Ye,Jo),ir=!0},p(t,[f]){const Ke={};f&2&&(Ke.$$scope={dirty:f,ctx:t}),ee.$set(Ke);const Qt={};f&2&&(Qt.$$scope={dirty:f,ctx:t}),ae.$set(Qt)},i(t){ir||(v(m.$$.fragment,t),v(be.$$.fragment,t),v(Ee.$$.fragment,t),v($e.$$.fragment,t),v(ee.$$.fragment,t),v(Fe.$$.fragment,t),v(we.$$.fragment,t),v(Ie.$$.fragment,t),v(Te.$$.fragment,t),v(ae.$$.fragment,t),v(Pe.$$.fragment,t),v(ke.$$.fragment,t),v(De.$$.fragment,t),v(ze.$$.fragment,t),v(Me.$$.fragment,t),v(Le.$$.fragment,t),v(qe.$$.fragment,t),v(Se.$$.fragment,t),v(Ce.$$.fragment,t),v(Oe.$$.fragment,t),v(Ve.$$.fragment,t),v(je.$$.fragment,t),v(We.$$.fragment,t),v(Ue.$$.fragment,t),v(He.$$.fragment,t),v(Je.$$.fragment,t),ir=!0)},o(t){x(m.$$.fragment,t),x(be.$$.fragment,t),x(Ee.$$.fragment,t),x($e.$$.fragment,t),x(ee.$$.fragment,t),x(Fe.$$.fragment,t),x(we.$$.fragment,t),x(Ie.$$.fragment,t),x(Te.$$.fragment,t),x(ae.$$.fragment,t),x(Pe.$$.fragment,t),x(ke.$$.fragment,t),x(De.$$.fragment,t),x(ze.$$.fragment,t),x(Me.$$.fragment,t),x(Le.$$.fragment,t),x(qe.$$.fragment,t),x(Se.$$.fragment,t),x(Ce.$$.fragment,t),x(Oe.$$.fragment,t),x(Ve.$$.fragment,t),x(je.$$.fragment,t),x(We.$$.fragment,t),x(Ue.$$.fragment,t),x(He.$$.fragment,t),x(Je.$$.fragment,t),ir=!1},d(t){r(u),t&&r(q),t&&r($),y(m),t&&r(k),t&&r(D),t&&r(Zt),t&&r(R),y(be),t&&r(er),t&&r(z),y(Ee),y($e),y(ee),y(Fe),t&&r(tr),t&&r(H),y(we),t&&r(rr),t&&r(B),y(Ie),y(Te),y(ae),t&&r(ar),t&&r(J),y(Pe),t&&r(or),t&&r(I),y(ke),y(De),y(ze),t&&r(nr),t&&r(K),y(Me),t&&r(sr),t&&r(p),y(Le),y(qe),y(Se),y(Ce),y(Oe),y(Ve),y(je),y(We),y(Ue),y(He),y(Je)}}}const os={local:"feature-extractor",sections:[{local:"transformers.FeatureExtractionMixin",title:"FeatureExtractionMixin"},{local:"transformers.SequenceFeatureExtractor",title:"SequenceFeatureExtractor"},{local:"transformers.BatchFeature",title:"BatchFeature"},{local:"transformers.ImageFeatureExtractionMixin",title:"ImageFeatureExtractionMixin"}],title:"Feature Extractor"};function ns(Qe){return Kn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ps extends Hn{constructor(u){super();Gn(this,u,ns,as,Jn,{})}}export{ps as default,os as metadata};
