import{S as Oc,i as qc,s as Hc,e as o,k as d,w as S,t as s,M as Rc,c as a,d as t,m as c,a as n,x as w,h as i,b as l,N as Bc,G as e,g,y as $,q as E,o as T,B as y,v as Wc,L as Ea}from"../../chunks/vendor-hf-doc-builder.js";import{T as wa}from"../../chunks/Tip-hf-doc-builder.js";import{D as oe}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ta}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ve}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as $a}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Uc(I){let f,v,u,p,b;return p=new Ta({props:{code:`from transformers import SegformerModel, SegformerConfig

# Initializing a SegFormer nvidia/segformer-b0-finetuned-ade-512-512 style configuration
configuration = SegformerConfig()

# Initializing a model from the nvidia/segformer-b0-finetuned-ade-512-512 style configuration
model = SegformerModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SegformerModel, SegformerConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a SegFormer nvidia/segformer-b0-finetuned-ade-512-512 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = SegformerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the nvidia/segformer-b0-finetuned-ade-512-512 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SegformerModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){f=o("p"),v=s("Example:"),u=d(),S(p.$$.fragment)},l(m){f=a(m,"P",{});var _=n(f);v=i(_,"Example:"),_.forEach(t),u=c(m),w(p.$$.fragment,m)},m(m,_){g(m,f,_),e(f,v),g(m,u,_),$(p,m,_),b=!0},p:Ea,i(m){b||(E(p.$$.fragment,m),b=!0)},o(m){T(p.$$.fragment,m),b=!1},d(m){m&&t(f),m&&t(u),y(p,m)}}}function Vc(I){let f,v;return{c(){f=o("p"),v=s(`NumPy arrays and PyTorch tensors are converted to PIL images when resizing, so the most efficient is to pass
PIL images.`)},l(u){f=a(u,"P",{});var p=n(f);v=i(p,`NumPy arrays and PyTorch tensors are converted to PIL images when resizing, so the most efficient is to pass
PIL images.`),p.forEach(t)},m(u,p){g(u,f,p),e(f,v)},d(u){u&&t(f)}}}function Gc(I){let f,v,u,p,b;return{c(){f=o("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=o("code"),p=s("Module"),b=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(m){f=a(m,"P",{});var _=n(f);v=i(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a(_,"CODE",{});var N=n(u);p=i(N,"Module"),N.forEach(t),b=i(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(t)},m(m,_){g(m,f,_),e(f,v),e(f,u),e(u,p),e(f,b)},d(m){m&&t(f)}}}function Kc(I){let f,v,u,p,b;return p=new Ta({props:{code:`from transformers import SegformerFeatureExtractor, SegformerModel
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/mit-b0")
model = SegformerModel.from_pretrained("nvidia/mit-b0")

inputs = feature_extractor(image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SegformerFeatureExtractor, SegformerModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = SegformerFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;nvidia/mit-b0&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SegformerModel.from_pretrained(<span class="hljs-string">&quot;nvidia/mit-b0&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">256</span>, <span class="hljs-number">16</span>, <span class="hljs-number">16</span>]`}}),{c(){f=o("p"),v=s("Example:"),u=d(),S(p.$$.fragment)},l(m){f=a(m,"P",{});var _=n(f);v=i(_,"Example:"),_.forEach(t),u=c(m),w(p.$$.fragment,m)},m(m,_){g(m,f,_),e(f,v),g(m,u,_),$(p,m,_),b=!0},p:Ea,i(m){b||(E(p.$$.fragment,m),b=!0)},o(m){T(p.$$.fragment,m),b=!1},d(m){m&&t(f),m&&t(u),y(p,m)}}}function Jc(I){let f,v,u,p,b;return{c(){f=o("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=o("code"),p=s("Module"),b=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(m){f=a(m,"P",{});var _=n(f);v=i(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a(_,"CODE",{});var N=n(u);p=i(N,"Module"),N.forEach(t),b=i(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(t)},m(m,_){g(m,f,_),e(f,v),e(f,u),e(u,p),e(f,b)},d(m){m&&t(f)}}}function Xc(I){let f,v,u,p,b;return p=new Ta({props:{code:`from transformers import SegformerFeatureExtractor, SegformerForImageClassification
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/mit-b0")
model = SegformerForImageClassification.from_pretrained("nvidia/mit-b0")

inputs = feature_extractor(image, return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

# model predicts one of the 1000 ImageNet classes
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SegformerFeatureExtractor, SegformerForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = SegformerFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;nvidia/mit-b0&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SegformerForImageClassification.from_pretrained(<span class="hljs-string">&quot;nvidia/mit-b0&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># model predicts one of the 1000 ImageNet classes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])
tabby, tabby cat`}}),{c(){f=o("p"),v=s("Example:"),u=d(),S(p.$$.fragment)},l(m){f=a(m,"P",{});var _=n(f);v=i(_,"Example:"),_.forEach(t),u=c(m),w(p.$$.fragment,m)},m(m,_){g(m,f,_),e(f,v),g(m,u,_),$(p,m,_),b=!0},p:Ea,i(m){b||(E(p.$$.fragment,m),b=!0)},o(m){T(p.$$.fragment,m),b=!1},d(m){m&&t(f),m&&t(u),y(p,m)}}}function Yc(I){let f,v,u,p,b;return{c(){f=o("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=o("code"),p=s("Module"),b=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(m){f=a(m,"P",{});var _=n(f);v=i(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a(_,"CODE",{});var N=n(u);p=i(N,"Module"),N.forEach(t),b=i(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(t)},m(m,_){g(m,f,_),e(f,v),e(f,u),e(u,p),e(f,b)},d(m){m&&t(f)}}}function Zc(I){let f,v,u,p,b;return p=new Ta({props:{code:`from transformers import SegformerFeatureExtractor, SegformerForSemanticSegmentation
from PIL import Image
import requests

feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512")
model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512")

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits  # shape (batch_size, num_labels, height, width)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SegformerFeatureExtractor, SegformerForSemanticSegmentation
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = SegformerFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;nvidia/segformer-b0-finetuned-ade-512-512&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SegformerForSemanticSegmentation.from_pretrained(<span class="hljs-string">&quot;nvidia/segformer-b0-finetuned-ade-512-512&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits  <span class="hljs-comment"># shape (batch_size, num_labels, height, width)</span>`}}),{c(){f=o("p"),v=s("Examples:"),u=d(),S(p.$$.fragment)},l(m){f=a(m,"P",{});var _=n(f);v=i(_,"Examples:"),_.forEach(t),u=c(m),w(p.$$.fragment,m)},m(m,_){g(m,f,_),e(f,v),g(m,u,_),$(p,m,_),b=!0},p:Ea,i(m){b||(E(p.$$.fragment,m),b=!0)},o(m){T(p.$$.fragment,m),b=!1},d(m){m&&t(f),m&&t(u),y(p,m)}}}function Qc(I){let f,v,u,p,b,m,_,N,ya,Lo,ie,$e,Dr,Ge,xa,zr,Fa,No,Ee,Ia,Ke,ka,Pa,Oo,Mt,Ma,qo,Ct,jr,Ca,Ho,Te,Da,Je,za,ja,Ro,Xe,zl,Bo,ae,Aa,Ye,La,Na,Ze,Oa,qa,Wo,Dt,Ha,Uo,k,O,Ra,zt,Ba,Wa,jt,Ua,Va,At,Ga,Ka,Qe,Ja,Xa,Ya,le,Za,et,Qa,en,tt,tn,rn,on,rt,an,Ar,nn,sn,ln,de,dn,Lt,cn,mn,ot,fn,hn,gn,x,pn,Nt,un,_n,Lr,bn,vn,Nr,Sn,wn,Or,$n,En,qr,Tn,yn,Hr,xn,Fn,Ot,In,kn,Rr,Pn,Mn,Br,Cn,Dn,zn,Wr,jn,Vo,ye,Ur,P,qt,Vr,An,Ln,Gr,Kr,Nn,On,Jr,Xr,qn,Hn,Ht,Yr,Rn,Bn,Rt,Zr,Wn,Un,Bt,Qr,Vn,Gn,M,C,Wt,Kn,Jn,eo,Xn,Yn,to,Zn,Qn,Ut,es,ts,Vt,rs,os,Gt,as,ns,D,Kt,ss,is,ro,ls,ds,oo,cs,ms,Jt,fs,hs,Xt,gs,ps,Yt,us,_s,z,Zt,bs,vs,ao,Ss,ws,no,$s,Es,Qt,Ts,ys,er,xs,Fs,tr,Is,ks,j,rr,Ps,Ms,so,Cs,Ds,io,zs,js,or,As,Ls,ar,Ns,Os,nr,qs,Hs,A,sr,Rs,Bs,lo,Ws,Us,co,Vs,Gs,ir,Ks,Js,lr,Xs,Ys,dr,Zs,Qs,L,cr,ei,ti,mo,ri,oi,fo,ai,ni,mr,si,ii,fr,li,di,hr,ci,Go,ce,xe,ho,at,mi,go,fi,Ko,q,nt,hi,me,gi,gr,pi,ui,st,_i,bi,vi,fe,Si,pr,wi,$i,ur,Ei,Ti,yi,Fe,Jo,he,Ie,po,it,xi,uo,Fi,Xo,H,lt,Ii,_o,ki,Pi,dt,Mi,_r,Ci,Di,zi,ne,ct,ji,bo,Ai,Li,ke,Yo,ge,Pe,vo,mt,Ni,So,Oi,Zo,te,ft,qi,ht,Hi,gt,Ri,Bi,Wi,B,pt,Ui,pe,Vi,br,Gi,Ki,wo,Ji,Xi,Yi,Me,Zi,Ce,Qo,ue,De,$o,ut,Qi,Eo,el,ea,_e,_t,tl,vr,bt,ta,be,ze,To,vt,rl,yo,ol,ra,R,St,al,xo,nl,sl,wt,il,$t,ll,dl,cl,W,Et,ml,ve,fl,Sr,hl,gl,Fo,pl,ul,_l,je,bl,Ae,oa,Se,Le,Io,Tt,vl,ko,Sl,aa,re,yt,wl,xt,$l,Ft,El,Tl,yl,U,It,xl,we,Fl,wr,Il,kl,Po,Pl,Ml,Cl,Ne,Dl,Oe,na;return m=new Ve({}),Ge=new Ve({}),at=new Ve({}),nt=new oe({props:{name:"class transformers.SegformerConfig",anchor:"transformers.SegformerConfig",parameters:[{name:"num_channels",val:" = 3"},{name:"num_encoder_blocks",val:" = 4"},{name:"depths",val:" = [2, 2, 2, 2]"},{name:"sr_ratios",val:" = [8, 4, 2, 1]"},{name:"hidden_sizes",val:" = [32, 64, 160, 256]"},{name:"patch_sizes",val:" = [7, 3, 3, 3]"},{name:"strides",val:" = [4, 2, 2, 2]"},{name:"num_attention_heads",val:" = [1, 2, 5, 8]"},{name:"mlp_ratios",val:" = [4, 4, 4, 4]"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"classifier_dropout_prob",val:" = 0.1"},{name:"initializer_range",val:" = 0.02"},{name:"drop_path_rate",val:" = 0.1"},{name:"layer_norm_eps",val:" = 1e-06"},{name:"decoder_hidden_size",val:" = 256"},{name:"is_encoder_decoder",val:" = False"},{name:"semantic_loss_ignore_index",val:" = 255"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SegformerConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of input channels.`,name:"num_channels"},{anchor:"transformers.SegformerConfig.num_encoder_blocks",description:`<strong>num_encoder_blocks</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of encoder blocks (i.e. stages in the Mix Transformer encoder).`,name:"num_encoder_blocks"},{anchor:"transformers.SegformerConfig.depths",description:`<strong>depths</strong> (<code>List[int]</code>, <em>optional</em>, defaults to [2, 2, 2, 2]) &#x2014;
The number of layers in each encoder block.`,name:"depths"},{anchor:"transformers.SegformerConfig.sr_ratios",description:`<strong>sr_ratios</strong> (<code>List[int]</code>, <em>optional</em>, defaults to [8, 4, 2, 1]) &#x2014;
Sequence reduction ratios in each encoder block.`,name:"sr_ratios"},{anchor:"transformers.SegformerConfig.hidden_sizes",description:`<strong>hidden_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to [32, 64, 160, 256]) &#x2014;
Dimension of each of the encoder blocks.`,name:"hidden_sizes"},{anchor:"transformers.SegformerConfig.patch_sizes",description:`<strong>patch_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to [7, 3, 3, 3]) &#x2014;
Patch size before each encoder block.`,name:"patch_sizes"},{anchor:"transformers.SegformerConfig.strides",description:`<strong>strides</strong> (<code>List[int]</code>, <em>optional</em>, defaults to [4, 2, 2, 2]) &#x2014;
Stride before each encoder block.`,name:"strides"},{anchor:"transformers.SegformerConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>List[int]</code>, <em>optional</em>, defaults to [1, 2, 5, 8]) &#x2014;
Number of attention heads for each attention layer in each block of the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.SegformerConfig.mlp_ratios",description:`<strong>mlp_ratios</strong> (<code>List[int]</code>, <em>optional</em>, defaults to [4, 4, 4, 4]) &#x2014;
Ratio of the size of the hidden layer compared to the size of the input layer of the Mix FFNs in the
encoder blocks.`,name:"mlp_ratios"},{anchor:"transformers.SegformerConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.SegformerConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.SegformerConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.SegformerConfig.classifier_dropout_prob",description:`<strong>classifier_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability before the classification head.`,name:"classifier_dropout_prob"},{anchor:"transformers.SegformerConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.SegformerConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for stochastic depth, used in the blocks of the Transformer encoder.`,name:"drop_path_rate"},{anchor:"transformers.SegformerConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-6) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.SegformerConfig.decoder_hidden_size",description:`<strong>decoder_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
The dimension of the all-MLP decode head.`,name:"decoder_hidden_size"},{anchor:"transformers.SegformerConfig.semantic_loss_ignore_index",description:`<strong>semantic_loss_ignore_index</strong> (<code>int</code>, <em>optional</em>, defaults to 255) &#x2014;
The index that is ignored by the loss function of the semantic segmentation model.`,name:"semantic_loss_ignore_index"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/configuration_segformer.py#L33"}}),Fe=new $a({props:{anchor:"transformers.SegformerConfig.example",$$slots:{default:[Uc]},$$scope:{ctx:I}}}),it=new Ve({}),lt=new oe({props:{name:"class transformers.SegformerFeatureExtractor",anchor:"transformers.SegformerFeatureExtractor",parameters:[{name:"do_resize",val:" = True"},{name:"size",val:" = 512"},{name:"resample",val:" = <Resampling.BILINEAR: 2>"},{name:"do_normalize",val:" = True"},{name:"image_mean",val:" = None"},{name:"image_std",val:" = None"},{name:"reduce_labels",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SegformerFeatureExtractor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the input based on a certain <code>size</code>.`,name:"do_resize"},{anchor:"transformers.SegformerFeatureExtractor.size",description:`<strong>size</strong> (<code>int</code> or <code>Tuple(int)</code>, <em>optional</em>, defaults to 512) &#x2014;
Resize the input to the given size. If a tuple is provided, it should be (width, height). If only an
integer is provided, then the input will be resized to (size, size). Only has an effect if <code>do_resize</code> is
set to <code>True</code>.`,name:"size"},{anchor:"transformers.SegformerFeatureExtractor.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>PIL.Image.BILINEAR</code>) &#x2014;
An optional resampling filter. This can be one of <code>PIL.Image.NEAREST</code>, <code>PIL.Image.BOX</code>,
<code>PIL.Image.BILINEAR</code>, <code>PIL.Image.HAMMING</code>, <code>PIL.Image.BICUBIC</code> or <code>PIL.Image.LANCZOS</code>. Only has an effect
if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.SegformerFeatureExtractor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to normalize the input with mean and standard deviation.`,name:"do_normalize"},{anchor:"transformers.SegformerFeatureExtractor.image_mean",description:`<strong>image_mean</strong> (<code>int</code>, <em>optional</em>, defaults to <code>[0.485, 0.456, 0.406]</code>) &#x2014;
The sequence of means for each channel, to be used when normalizing images. Defaults to the ImageNet mean.`,name:"image_mean"},{anchor:"transformers.SegformerFeatureExtractor.image_std",description:`<strong>image_std</strong> (<code>int</code>, <em>optional</em>, defaults to <code>[0.229, 0.224, 0.225]</code>) &#x2014;
The sequence of standard deviations for each channel, to be used when normalizing images. Defaults to the
ImageNet std.`,name:"image_std"},{anchor:"transformers.SegformerFeatureExtractor.reduce_labels",description:`<strong>reduce_labels</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to reduce all label values of segmentation maps by 1. Usually used for datasets where 0 is
used for background, and background itself is not included in all classes of a dataset (e.g. ADE20k). The
background label will be replaced by 255.`,name:"reduce_labels"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/feature_extraction_segformer.py#L36"}}),ct=new oe({props:{name:"__call__",anchor:"transformers.SegformerFeatureExtractor.__call__",parameters:[{name:"images",val:": typing.Union[PIL.Image.Image, numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"segmentation_maps",val:": typing.Union[PIL.Image.Image, numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SegformerFeatureExtractor.__call__.images",description:`<strong>images</strong> (<code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>torch.Tensor</code>, <code>List[PIL.Image.Image]</code>, <code>List[np.ndarray]</code>, <code>List[torch.Tensor]</code>) &#x2014;
The image or batch of images to be prepared. Each image can be a PIL image, NumPy array or PyTorch
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is
the number of channels, H and W are image height and width.`,name:"images"},{anchor:"transformers.SegformerFeatureExtractor.__call__.segmentation_maps",description:`<strong>segmentation_maps</strong> (<code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>torch.Tensor</code>, <code>List[PIL.Image.Image]</code>, <code>List[np.ndarray]</code>, <code>List[torch.Tensor]</code>, <em>optional</em>) &#x2014;
Optionally, the corresponding semantic segmentation maps with the pixel-wise annotations.`,name:"segmentation_maps"},{anchor:"transformers.SegformerFeatureExtractor.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/pr_17548/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>, defaults to <code>&apos;np&apos;</code>) &#x2014;
If set, will return tensors of a particular framework. 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>
<li><code>&apos;jax&apos;</code>: Return JAX <code>jnp.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/feature_extraction_segformer.py#L89",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_17548/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a> with the following fields:</p>
<ul>
<li><strong>pixel_values</strong> \u2014 Pixel values to be fed to a model, of shape (batch_size, num_channels, height,
width).</li>
<li><strong>labels</strong> \u2014 Optional labels to be fed to a model (when <code>segmentation_maps</code> are provided)</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_17548/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),ke=new wa({props:{warning:!0,$$slots:{default:[Vc]},$$scope:{ctx:I}}}),mt=new Ve({}),ft=new oe({props:{name:"class transformers.SegformerModel",anchor:"transformers.SegformerModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.SegformerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerConfig">SegformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_17548/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/modeling_segformer.py#L506"}}),pt=new oe({props:{name:"forward",anchor:"transformers.SegformerModel.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.SegformerModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerFeatureExtractor">SegformerFeatureExtractor</a>. See <a href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerFeatureExtractor.__call__">SegformerFeatureExtractor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.SegformerModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.SegformerModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.SegformerModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_17548/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/modeling_segformer.py#L525",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_17548/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerConfig"
>SegformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_17548/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Me=new wa({props:{$$slots:{default:[Gc]},$$scope:{ctx:I}}}),Ce=new $a({props:{anchor:"transformers.SegformerModel.forward.example",$$slots:{default:[Kc]},$$scope:{ctx:I}}}),ut=new Ve({}),_t=new oe({props:{name:"class transformers.SegformerDecodeHead",anchor:"transformers.SegformerDecodeHead",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/modeling_segformer.py#L679"}}),bt=new oe({props:{name:"forward",anchor:"transformers.SegformerDecodeHead.forward",parameters:[{name:"encoder_hidden_states",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/modeling_segformer.py#L704"}}),vt=new Ve({}),St=new oe({props:{name:"class transformers.SegformerForImageClassification",anchor:"transformers.SegformerForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.SegformerForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerConfig">SegformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_17548/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/modeling_segformer.py#L572"}}),Et=new oe({props:{name:"forward",anchor:"transformers.SegformerForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.SegformerForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerFeatureExtractor">SegformerFeatureExtractor</a>. See <a href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerFeatureExtractor.__call__">SegformerFeatureExtractor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.SegformerForImageClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.SegformerForImageClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.SegformerForImageClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_17548/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.SegformerForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/modeling_segformer.py#L585",returnDescription:`
<p>A <code>transformers.models.segformer.modeling_segformer.SegFormerImageClassifierOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerConfig"
>SegformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, num_channels, height, width)</code>. Hidden-states (also
called feature maps) of the model at the output of each stage.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.segformer.modeling_segformer.SegFormerImageClassifierOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),je=new wa({props:{$$slots:{default:[Jc]},$$scope:{ctx:I}}}),Ae=new $a({props:{anchor:"transformers.SegformerForImageClassification.forward.example",$$slots:{default:[Xc]},$$scope:{ctx:I}}}),Tt=new Ve({}),yt=new oe({props:{name:"class transformers.SegformerForSemanticSegmentation",anchor:"transformers.SegformerForSemanticSegmentation",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.SegformerForSemanticSegmentation.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerConfig">SegformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_17548/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/modeling_segformer.py#L741"}}),It=new oe({props:{name:"forward",anchor:"transformers.SegformerForSemanticSegmentation.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.SegformerForSemanticSegmentation.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<a href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerFeatureExtractor">SegformerFeatureExtractor</a>. See <a href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerFeatureExtractor.__call__">SegformerFeatureExtractor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.SegformerForSemanticSegmentation.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.SegformerForSemanticSegmentation.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.SegformerForSemanticSegmentation.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_17548/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.SegformerForSemanticSegmentation.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Ground truth semantic segmentation maps for computing the loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels &gt; 1</code>, a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_17548/src/transformers/models/segformer/modeling_segformer.py#L750",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_17548/en/main_classes/output#transformers.modeling_outputs.SemanticSegmenterOutput"
>transformers.modeling_outputs.SemanticSegmenterOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerConfig"
>SegformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels, logits_height, logits_width)</code>) \u2014 Classification scores for each pixel.</p>
<Tip warning={true}>
<p>The logits returned do not necessarily have the same size as the <code>pixel_values</code> passed as inputs. This is
to avoid doing two interpolations and lose some quality when a user needs to resize the logits to the
original image size as post-processing. You should always check your logits shape and resize as needed.</p>
</Tip>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, patch_size, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_17548/en/main_classes/output#transformers.modeling_outputs.SemanticSegmenterOutput"
>transformers.modeling_outputs.SemanticSegmenterOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ne=new wa({props:{$$slots:{default:[Yc]},$$scope:{ctx:I}}}),Oe=new $a({props:{anchor:"transformers.SegformerForSemanticSegmentation.forward.example",$$slots:{default:[Zc]},$$scope:{ctx:I}}}),{c(){f=o("meta"),v=d(),u=o("h1"),p=o("a"),b=o("span"),S(m.$$.fragment),_=d(),N=o("span"),ya=s("SegFormer"),Lo=d(),ie=o("h2"),$e=o("a"),Dr=o("span"),S(Ge.$$.fragment),xa=d(),zr=o("span"),Fa=s("Overview"),No=d(),Ee=o("p"),Ia=s("The SegFormer model was proposed in "),Ke=o("a"),ka=s("SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers"),Pa=s(` by Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez, Ping
Luo. The model consists of a hierarchical Transformer encoder and a lightweight all-MLP decode head to achieve great
results on image segmentation benchmarks such as ADE20K and Cityscapes.`),Oo=d(),Mt=o("p"),Ma=s("The abstract from the paper is the following:"),qo=d(),Ct=o("p"),jr=o("em"),Ca=s(`We present SegFormer, a simple, efficient yet powerful semantic segmentation framework which unifies Transformers with
lightweight multilayer perception (MLP) decoders. SegFormer has two appealing features: 1) SegFormer comprises a novel
hierarchically structured Transformer encoder which outputs multiscale features. It does not need positional encoding,
thereby avoiding the interpolation of positional codes which leads to decreased performance when the testing resolution
differs from training. 2) SegFormer avoids complex decoders. The proposed MLP decoder aggregates information from
different layers, and thus combining both local attention and global attention to render powerful representations. We
show that this simple and lightweight design is the key to efficient segmentation on Transformers. We scale our
approach up to obtain a series of models from SegFormer-B0 to SegFormer-B5, reaching significantly better performance
and efficiency than previous counterparts. For example, SegFormer-B4 achieves 50.3% mIoU on ADE20K with 64M parameters,
being 5x smaller and 2.2% better than the previous best method. Our best model, SegFormer-B5, achieves 84.0% mIoU on
Cityscapes validation set and shows excellent zero-shot robustness on Cityscapes-C.`),Ho=d(),Te=o("p"),Da=s("The figure below illustrates the architecture of SegFormer. Taken from the "),Je=o("a"),za=s("original paper"),ja=s("."),Ro=d(),Xe=o("img"),Bo=d(),ae=o("p"),Aa=s("This model was contributed by "),Ye=o("a"),La=s("nielsr"),Na=s(". The original code can be found "),Ze=o("a"),Oa=s("here"),qa=s("."),Wo=d(),Dt=o("p"),Ha=s("Tips:"),Uo=d(),k=o("ul"),O=o("li"),Ra=s(`SegFormer consists of a hierarchical Transformer encoder, and a lightweight all-MLP decode head.
`),zt=o("a"),Ba=s("SegformerModel"),Wa=s(` is the hierarchical Transformer encoder (which in the paper is also referred to
as Mix Transformer or MiT). `),jt=o("a"),Ua=s("SegformerForSemanticSegmentation"),Va=s(` adds the all-MLP decode head on
top to perform semantic segmentation of images. In addition, there\u2019s
`),At=o("a"),Ga=s("SegformerForImageClassification"),Ka=s(` which can be used to - you guessed it - classify images. The
authors of SegFormer first pre-trained the Transformer encoder on ImageNet-1k to classify images. Next, they throw
away the classification head, and replace it by the all-MLP decode head. Next, they fine-tune the model altogether on
ADE20K, Cityscapes and COCO-stuff, which are important benchmarks for semantic segmentation. All checkpoints can be
found on the `),Qe=o("a"),Ja=s("hub"),Xa=s("."),Ya=d(),le=o("li"),Za=s("The quickest way to get started with SegFormer is by checking the "),et=o("a"),Qa=s("example notebooks"),en=s(` (which showcase both inference and
fine-tuning on custom data). One can also check out the `),tt=o("a"),tn=s("blog post"),rn=s(" introducing SegFormer and illustrating how it can be fine-tuned on custom data."),on=d(),rt=o("li"),an=s("SegFormer works on any input size, as it pads the input to be divisible by "),Ar=o("code"),nn=s("config.patch_sizes"),sn=s("."),ln=d(),de=o("li"),dn=s("One can use "),Lt=o("a"),cn=s("SegformerFeatureExtractor"),mn=s(` to prepare images and corresponding segmentation maps
for the model. Note that this feature extractor is fairly basic and does not include all data augmentations used in
the original paper. The original preprocessing pipelines (for the ADE20k dataset for instance) can be found `),ot=o("a"),fn=s("here"),hn=s(`. The most
important preprocessing step is that images and segmentation maps are randomly cropped and padded to the same size,
such as 512x512 or 640x640, after which they are normalized.`),gn=d(),x=o("li"),pn=s("One additional thing to keep in mind is that one can initialize "),Nt=o("a"),un=s("SegformerFeatureExtractor"),_n=s(` with
`),Lr=o("code"),bn=s("reduce_labels"),vn=s(" set to "),Nr=o("code"),Sn=s("True"),wn=s(" or "),Or=o("code"),$n=s("False"),En=s(`. In some datasets (like ADE20k), the 0 index is used in the annotated
segmentation maps for background. However, ADE20k doesn\u2019t include the \u201Cbackground\u201D class in its 150 labels.
Therefore, `),qr=o("code"),Tn=s("reduce_labels"),yn=s(` is used to reduce all labels by 1, and to make sure no loss is computed for the
background class (i.e. it replaces 0 in the annotated maps by 255, which is the `),Hr=o("em"),xn=s("ignore_index"),Fn=s(` of the loss function
used by `),Ot=o("a"),In=s("SegformerForSemanticSegmentation"),kn=s(`). However, other datasets use the 0 index as
background class and include this class as part of all labels. In that case, `),Rr=o("code"),Pn=s("reduce_labels"),Mn=s(` should be set to
`),Br=o("code"),Cn=s("False"),Dn=s(", as loss should also be computed for the background class."),zn=d(),Wr=o("li"),jn=s("As most models, SegFormer comes in different sizes, the details of which can be found in the table below."),Vo=d(),ye=o("table"),Ur=o("thead"),P=o("tr"),qt=o("th"),Vr=o("strong"),An=s("Model variant"),Ln=d(),Gr=o("th"),Kr=o("strong"),Nn=s("Depths"),On=d(),Jr=o("th"),Xr=o("strong"),qn=s("Hidden sizes"),Hn=d(),Ht=o("th"),Yr=o("strong"),Rn=s("Decoder hidden size"),Bn=d(),Rt=o("th"),Zr=o("strong"),Wn=s("Params (M)"),Un=d(),Bt=o("th"),Qr=o("strong"),Vn=s("ImageNet-1k Top 1"),Gn=d(),M=o("tbody"),C=o("tr"),Wt=o("td"),Kn=s("MiT-b0"),Jn=d(),eo=o("td"),Xn=s("[2, 2, 2, 2]"),Yn=d(),to=o("td"),Zn=s("[32, 64, 160, 256]"),Qn=d(),Ut=o("td"),es=s("256"),ts=d(),Vt=o("td"),rs=s("3.7"),os=d(),Gt=o("td"),as=s("70.5"),ns=d(),D=o("tr"),Kt=o("td"),ss=s("MiT-b1"),is=d(),ro=o("td"),ls=s("[2, 2, 2, 2]"),ds=d(),oo=o("td"),cs=s("[64, 128, 320, 512]"),ms=d(),Jt=o("td"),fs=s("256"),hs=d(),Xt=o("td"),gs=s("14.0"),ps=d(),Yt=o("td"),us=s("78.7"),_s=d(),z=o("tr"),Zt=o("td"),bs=s("MiT-b2"),vs=d(),ao=o("td"),Ss=s("[3, 4, 6, 3]"),ws=d(),no=o("td"),$s=s("[64, 128, 320, 512]"),Es=d(),Qt=o("td"),Ts=s("768"),ys=d(),er=o("td"),xs=s("25.4"),Fs=d(),tr=o("td"),Is=s("81.6"),ks=d(),j=o("tr"),rr=o("td"),Ps=s("MiT-b3"),Ms=d(),so=o("td"),Cs=s("[3, 4, 18, 3]"),Ds=d(),io=o("td"),zs=s("[64, 128, 320, 512]"),js=d(),or=o("td"),As=s("768"),Ls=d(),ar=o("td"),Ns=s("45.2"),Os=d(),nr=o("td"),qs=s("83.1"),Hs=d(),A=o("tr"),sr=o("td"),Rs=s("MiT-b4"),Bs=d(),lo=o("td"),Ws=s("[3, 8, 27, 3]"),Us=d(),co=o("td"),Vs=s("[64, 128, 320, 512]"),Gs=d(),ir=o("td"),Ks=s("768"),Js=d(),lr=o("td"),Xs=s("62.6"),Ys=d(),dr=o("td"),Zs=s("83.6"),Qs=d(),L=o("tr"),cr=o("td"),ei=s("MiT-b5"),ti=d(),mo=o("td"),ri=s("[3, 6, 40, 3]"),oi=d(),fo=o("td"),ai=s("[64, 128, 320, 512]"),ni=d(),mr=o("td"),si=s("768"),ii=d(),fr=o("td"),li=s("82.0"),di=d(),hr=o("td"),ci=s("83.8"),Go=d(),ce=o("h2"),xe=o("a"),ho=o("span"),S(at.$$.fragment),mi=d(),go=o("span"),fi=s("SegformerConfig"),Ko=d(),q=o("div"),S(nt.$$.fragment),hi=d(),me=o("p"),gi=s("This is the configuration class to store the configuration of a "),gr=o("a"),pi=s("SegformerModel"),ui=s(`. It is used to instantiate an
SegFormer model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the SegFormer
`),st=o("a"),_i=s("nvidia/segformer-b0-finetuned-ade-512-512"),bi=s(`
architecture.`),vi=d(),fe=o("p"),Si=s("Configuration objects inherit from "),pr=o("a"),wi=s("PretrainedConfig"),$i=s(` and can be used to control the model outputs. Read the
documentation from `),ur=o("a"),Ei=s("PretrainedConfig"),Ti=s(" for more information."),yi=d(),S(Fe.$$.fragment),Jo=d(),he=o("h2"),Ie=o("a"),po=o("span"),S(it.$$.fragment),xi=d(),uo=o("span"),Fi=s("SegformerFeatureExtractor"),Xo=d(),H=o("div"),S(lt.$$.fragment),Ii=d(),_o=o("p"),ki=s("Constructs a SegFormer feature extractor."),Pi=d(),dt=o("p"),Mi=s("This feature extractor inherits from "),_r=o("a"),Ci=s("FeatureExtractionMixin"),Di=s(` which contains most of the main methods. Users
should refer to this superclass for more information regarding those methods.`),zi=d(),ne=o("div"),S(ct.$$.fragment),ji=d(),bo=o("p"),Ai=s("Main method to prepare for the model one or several image(s) and optional corresponding segmentation maps."),Li=d(),S(ke.$$.fragment),Yo=d(),ge=o("h2"),Pe=o("a"),vo=o("span"),S(mt.$$.fragment),Ni=d(),So=o("span"),Oi=s("SegformerModel"),Zo=d(),te=o("div"),S(ft.$$.fragment),qi=d(),ht=o("p"),Hi=s(`The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),gt=o("a"),Ri=s("torch.nn.Module"),Bi=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Wi=d(),B=o("div"),S(pt.$$.fragment),Ui=d(),pe=o("p"),Vi=s("The "),br=o("a"),Gi=s("SegformerModel"),Ki=s(" forward method, overrides the "),wo=o("code"),Ji=s("__call__"),Xi=s(" special method."),Yi=d(),S(Me.$$.fragment),Zi=d(),S(Ce.$$.fragment),Qo=d(),ue=o("h2"),De=o("a"),$o=o("span"),S(ut.$$.fragment),Qi=d(),Eo=o("span"),el=s("SegformerDecodeHead"),ea=d(),_e=o("div"),S(_t.$$.fragment),tl=d(),vr=o("div"),S(bt.$$.fragment),ta=d(),be=o("h2"),ze=o("a"),To=o("span"),S(vt.$$.fragment),rl=d(),yo=o("span"),ol=s("SegformerForImageClassification"),ra=d(),R=o("div"),S(St.$$.fragment),al=d(),xo=o("p"),nl=s(`SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden
states) e.g. for ImageNet.`),sl=d(),wt=o("p"),il=s("This model is a PyTorch "),$t=o("a"),ll=s("torch.nn.Module"),dl=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),cl=d(),W=o("div"),S(Et.$$.fragment),ml=d(),ve=o("p"),fl=s("The "),Sr=o("a"),hl=s("SegformerForImageClassification"),gl=s(" forward method, overrides the "),Fo=o("code"),pl=s("__call__"),ul=s(" special method."),_l=d(),S(je.$$.fragment),bl=d(),S(Ae.$$.fragment),oa=d(),Se=o("h2"),Le=o("a"),Io=o("span"),S(Tt.$$.fragment),vl=d(),ko=o("span"),Sl=s("SegformerForSemanticSegmentation"),aa=d(),re=o("div"),S(yt.$$.fragment),wl=d(),xt=o("p"),$l=s(`SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
This model is a PyTorch `),Ft=o("a"),El=s("torch.nn.Module"),Tl=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),yl=d(),U=o("div"),S(It.$$.fragment),xl=d(),we=o("p"),Fl=s("The "),wr=o("a"),Il=s("SegformerForSemanticSegmentation"),kl=s(" forward method, overrides the "),Po=o("code"),Pl=s("__call__"),Ml=s(" special method."),Cl=d(),S(Ne.$$.fragment),Dl=d(),S(Oe.$$.fragment),this.h()},l(r){const h=Rc('[data-svelte="svelte-1phssyn"]',document.head);f=a(h,"META",{name:!0,content:!0}),h.forEach(t),v=c(r),u=a(r,"H1",{class:!0});var kt=n(u);p=a(kt,"A",{id:!0,class:!0,href:!0});var Mo=n(p);b=a(Mo,"SPAN",{});var Co=n(b);w(m.$$.fragment,Co),Co.forEach(t),Mo.forEach(t),_=c(kt),N=a(kt,"SPAN",{});var Do=n(N);ya=i(Do,"SegFormer"),Do.forEach(t),kt.forEach(t),Lo=c(r),ie=a(r,"H2",{class:!0});var Pt=n(ie);$e=a(Pt,"A",{id:!0,class:!0,href:!0});var zo=n($e);Dr=a(zo,"SPAN",{});var jo=n(Dr);w(Ge.$$.fragment,jo),jo.forEach(t),zo.forEach(t),xa=c(Pt),zr=a(Pt,"SPAN",{});var Ao=n(zr);Fa=i(Ao,"Overview"),Ao.forEach(t),Pt.forEach(t),No=c(r),Ee=a(r,"P",{});var sa=n(Ee);Ia=i(sa,"The SegFormer model was proposed in "),Ke=a(sa,"A",{href:!0,rel:!0});var jl=n(Ke);ka=i(jl,"SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers"),jl.forEach(t),Pa=i(sa,` by Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez, Ping
Luo. The model consists of a hierarchical Transformer encoder and a lightweight all-MLP decode head to achieve great
results on image segmentation benchmarks such as ADE20K and Cityscapes.`),sa.forEach(t),Oo=c(r),Mt=a(r,"P",{});var Al=n(Mt);Ma=i(Al,"The abstract from the paper is the following:"),Al.forEach(t),qo=c(r),Ct=a(r,"P",{});var Ll=n(Ct);jr=a(Ll,"EM",{});var Nl=n(jr);Ca=i(Nl,`We present SegFormer, a simple, efficient yet powerful semantic segmentation framework which unifies Transformers with
lightweight multilayer perception (MLP) decoders. SegFormer has two appealing features: 1) SegFormer comprises a novel
hierarchically structured Transformer encoder which outputs multiscale features. It does not need positional encoding,
thereby avoiding the interpolation of positional codes which leads to decreased performance when the testing resolution
differs from training. 2) SegFormer avoids complex decoders. The proposed MLP decoder aggregates information from
different layers, and thus combining both local attention and global attention to render powerful representations. We
show that this simple and lightweight design is the key to efficient segmentation on Transformers. We scale our
approach up to obtain a series of models from SegFormer-B0 to SegFormer-B5, reaching significantly better performance
and efficiency than previous counterparts. For example, SegFormer-B4 achieves 50.3% mIoU on ADE20K with 64M parameters,
being 5x smaller and 2.2% better than the previous best method. Our best model, SegFormer-B5, achieves 84.0% mIoU on
Cityscapes validation set and shows excellent zero-shot robustness on Cityscapes-C.`),Nl.forEach(t),Ll.forEach(t),Ho=c(r),Te=a(r,"P",{});var ia=n(Te);Da=i(ia,"The figure below illustrates the architecture of SegFormer. Taken from the "),Je=a(ia,"A",{href:!0,rel:!0});var Ol=n(Je);za=i(Ol,"original paper"),Ol.forEach(t),ja=i(ia,"."),ia.forEach(t),Ro=c(r),Xe=a(r,"IMG",{width:!0,src:!0}),Bo=c(r),ae=a(r,"P",{});var $r=n(ae);Aa=i($r,"This model was contributed by "),Ye=a($r,"A",{href:!0,rel:!0});var ql=n(Ye);La=i(ql,"nielsr"),ql.forEach(t),Na=i($r,". The original code can be found "),Ze=a($r,"A",{href:!0,rel:!0});var Hl=n(Ze);Oa=i(Hl,"here"),Hl.forEach(t),qa=i($r,"."),$r.forEach(t),Wo=c(r),Dt=a(r,"P",{});var Rl=n(Dt);Ha=i(Rl,"Tips:"),Rl.forEach(t),Uo=c(r),k=a(r,"UL",{});var V=n(k);O=a(V,"LI",{});var se=n(O);Ra=i(se,`SegFormer consists of a hierarchical Transformer encoder, and a lightweight all-MLP decode head.
`),zt=a(se,"A",{href:!0});var Bl=n(zt);Ba=i(Bl,"SegformerModel"),Bl.forEach(t),Wa=i(se,` is the hierarchical Transformer encoder (which in the paper is also referred to
as Mix Transformer or MiT). `),jt=a(se,"A",{href:!0});var Wl=n(jt);Ua=i(Wl,"SegformerForSemanticSegmentation"),Wl.forEach(t),Va=i(se,` adds the all-MLP decode head on
top to perform semantic segmentation of images. In addition, there\u2019s
`),At=a(se,"A",{href:!0});var Ul=n(At);Ga=i(Ul,"SegformerForImageClassification"),Ul.forEach(t),Ka=i(se,` which can be used to - you guessed it - classify images. The
authors of SegFormer first pre-trained the Transformer encoder on ImageNet-1k to classify images. Next, they throw
away the classification head, and replace it by the all-MLP decode head. Next, they fine-tune the model altogether on
ADE20K, Cityscapes and COCO-stuff, which are important benchmarks for semantic segmentation. All checkpoints can be
found on the `),Qe=a(se,"A",{href:!0,rel:!0});var Vl=n(Qe);Ja=i(Vl,"hub"),Vl.forEach(t),Xa=i(se,"."),se.forEach(t),Ya=c(V),le=a(V,"LI",{});var Er=n(le);Za=i(Er,"The quickest way to get started with SegFormer is by checking the "),et=a(Er,"A",{href:!0,rel:!0});var Gl=n(et);Qa=i(Gl,"example notebooks"),Gl.forEach(t),en=i(Er,` (which showcase both inference and
fine-tuning on custom data). One can also check out the `),tt=a(Er,"A",{href:!0,rel:!0});var Kl=n(tt);tn=i(Kl,"blog post"),Kl.forEach(t),rn=i(Er," introducing SegFormer and illustrating how it can be fine-tuned on custom data."),Er.forEach(t),on=c(V),rt=a(V,"LI",{});var la=n(rt);an=i(la,"SegFormer works on any input size, as it pads the input to be divisible by "),Ar=a(la,"CODE",{});var Jl=n(Ar);nn=i(Jl,"config.patch_sizes"),Jl.forEach(t),sn=i(la,"."),la.forEach(t),ln=c(V),de=a(V,"LI",{});var Tr=n(de);dn=i(Tr,"One can use "),Lt=a(Tr,"A",{href:!0});var Xl=n(Lt);cn=i(Xl,"SegformerFeatureExtractor"),Xl.forEach(t),mn=i(Tr,` to prepare images and corresponding segmentation maps
for the model. Note that this feature extractor is fairly basic and does not include all data augmentations used in
the original paper. The original preprocessing pipelines (for the ADE20k dataset for instance) can be found `),ot=a(Tr,"A",{href:!0,rel:!0});var Yl=n(ot);fn=i(Yl,"here"),Yl.forEach(t),hn=i(Tr,`. The most
important preprocessing step is that images and segmentation maps are randomly cropped and padded to the same size,
such as 512x512 or 640x640, after which they are normalized.`),Tr.forEach(t),gn=c(V),x=a(V,"LI",{});var F=n(x);pn=i(F,"One additional thing to keep in mind is that one can initialize "),Nt=a(F,"A",{href:!0});var Zl=n(Nt);un=i(Zl,"SegformerFeatureExtractor"),Zl.forEach(t),_n=i(F,` with
`),Lr=a(F,"CODE",{});var Ql=n(Lr);bn=i(Ql,"reduce_labels"),Ql.forEach(t),vn=i(F," set to "),Nr=a(F,"CODE",{});var ed=n(Nr);Sn=i(ed,"True"),ed.forEach(t),wn=i(F," or "),Or=a(F,"CODE",{});var td=n(Or);$n=i(td,"False"),td.forEach(t),En=i(F,`. In some datasets (like ADE20k), the 0 index is used in the annotated
segmentation maps for background. However, ADE20k doesn\u2019t include the \u201Cbackground\u201D class in its 150 labels.
Therefore, `),qr=a(F,"CODE",{});var rd=n(qr);Tn=i(rd,"reduce_labels"),rd.forEach(t),yn=i(F,` is used to reduce all labels by 1, and to make sure no loss is computed for the
background class (i.e. it replaces 0 in the annotated maps by 255, which is the `),Hr=a(F,"EM",{});var od=n(Hr);xn=i(od,"ignore_index"),od.forEach(t),Fn=i(F,` of the loss function
used by `),Ot=a(F,"A",{href:!0});var ad=n(Ot);In=i(ad,"SegformerForSemanticSegmentation"),ad.forEach(t),kn=i(F,`). However, other datasets use the 0 index as
background class and include this class as part of all labels. In that case, `),Rr=a(F,"CODE",{});var nd=n(Rr);Pn=i(nd,"reduce_labels"),nd.forEach(t),Mn=i(F,` should be set to
`),Br=a(F,"CODE",{});var sd=n(Br);Cn=i(sd,"False"),sd.forEach(t),Dn=i(F,", as loss should also be computed for the background class."),F.forEach(t),zn=c(V),Wr=a(V,"LI",{});var id=n(Wr);jn=i(id,"As most models, SegFormer comes in different sizes, the details of which can be found in the table below."),id.forEach(t),V.forEach(t),Vo=c(r),ye=a(r,"TABLE",{});var da=n(ye);Ur=a(da,"THEAD",{});var ld=n(Ur);P=a(ld,"TR",{});var G=n(P);qt=a(G,"TH",{align:!0});var dd=n(qt);Vr=a(dd,"STRONG",{});var cd=n(Vr);An=i(cd,"Model variant"),cd.forEach(t),dd.forEach(t),Ln=c(G),Gr=a(G,"TH",{});var md=n(Gr);Kr=a(md,"STRONG",{});var fd=n(Kr);Nn=i(fd,"Depths"),fd.forEach(t),md.forEach(t),On=c(G),Jr=a(G,"TH",{});var hd=n(Jr);Xr=a(hd,"STRONG",{});var gd=n(Xr);qn=i(gd,"Hidden sizes"),gd.forEach(t),hd.forEach(t),Hn=c(G),Ht=a(G,"TH",{align:!0});var pd=n(Ht);Yr=a(pd,"STRONG",{});var ud=n(Yr);Rn=i(ud,"Decoder hidden size"),ud.forEach(t),pd.forEach(t),Bn=c(G),Rt=a(G,"TH",{align:!0});var _d=n(Rt);Zr=a(_d,"STRONG",{});var bd=n(Zr);Wn=i(bd,"Params (M)"),bd.forEach(t),_d.forEach(t),Un=c(G),Bt=a(G,"TH",{align:!0});var vd=n(Bt);Qr=a(vd,"STRONG",{});var Sd=n(Qr);Vn=i(Sd,"ImageNet-1k Top 1"),Sd.forEach(t),vd.forEach(t),G.forEach(t),ld.forEach(t),Gn=c(da),M=a(da,"TBODY",{});var K=n(M);C=a(K,"TR",{});var J=n(C);Wt=a(J,"TD",{align:!0});var wd=n(Wt);Kn=i(wd,"MiT-b0"),wd.forEach(t),Jn=c(J),eo=a(J,"TD",{});var $d=n(eo);Xn=i($d,"[2, 2, 2, 2]"),$d.forEach(t),Yn=c(J),to=a(J,"TD",{});var Ed=n(to);Zn=i(Ed,"[32, 64, 160, 256]"),Ed.forEach(t),Qn=c(J),Ut=a(J,"TD",{align:!0});var Td=n(Ut);es=i(Td,"256"),Td.forEach(t),ts=c(J),Vt=a(J,"TD",{align:!0});var yd=n(Vt);rs=i(yd,"3.7"),yd.forEach(t),os=c(J),Gt=a(J,"TD",{align:!0});var xd=n(Gt);as=i(xd,"70.5"),xd.forEach(t),J.forEach(t),ns=c(K),D=a(K,"TR",{});var X=n(D);Kt=a(X,"TD",{align:!0});var Fd=n(Kt);ss=i(Fd,"MiT-b1"),Fd.forEach(t),is=c(X),ro=a(X,"TD",{});var Id=n(ro);ls=i(Id,"[2, 2, 2, 2]"),Id.forEach(t),ds=c(X),oo=a(X,"TD",{});var kd=n(oo);cs=i(kd,"[64, 128, 320, 512]"),kd.forEach(t),ms=c(X),Jt=a(X,"TD",{align:!0});var Pd=n(Jt);fs=i(Pd,"256"),Pd.forEach(t),hs=c(X),Xt=a(X,"TD",{align:!0});var Md=n(Xt);gs=i(Md,"14.0"),Md.forEach(t),ps=c(X),Yt=a(X,"TD",{align:!0});var Cd=n(Yt);us=i(Cd,"78.7"),Cd.forEach(t),X.forEach(t),_s=c(K),z=a(K,"TR",{});var Y=n(z);Zt=a(Y,"TD",{align:!0});var Dd=n(Zt);bs=i(Dd,"MiT-b2"),Dd.forEach(t),vs=c(Y),ao=a(Y,"TD",{});var zd=n(ao);Ss=i(zd,"[3, 4, 6, 3]"),zd.forEach(t),ws=c(Y),no=a(Y,"TD",{});var jd=n(no);$s=i(jd,"[64, 128, 320, 512]"),jd.forEach(t),Es=c(Y),Qt=a(Y,"TD",{align:!0});var Ad=n(Qt);Ts=i(Ad,"768"),Ad.forEach(t),ys=c(Y),er=a(Y,"TD",{align:!0});var Ld=n(er);xs=i(Ld,"25.4"),Ld.forEach(t),Fs=c(Y),tr=a(Y,"TD",{align:!0});var Nd=n(tr);Is=i(Nd,"81.6"),Nd.forEach(t),Y.forEach(t),ks=c(K),j=a(K,"TR",{});var Z=n(j);rr=a(Z,"TD",{align:!0});var Od=n(rr);Ps=i(Od,"MiT-b3"),Od.forEach(t),Ms=c(Z),so=a(Z,"TD",{});var qd=n(so);Cs=i(qd,"[3, 4, 18, 3]"),qd.forEach(t),Ds=c(Z),io=a(Z,"TD",{});var Hd=n(io);zs=i(Hd,"[64, 128, 320, 512]"),Hd.forEach(t),js=c(Z),or=a(Z,"TD",{align:!0});var Rd=n(or);As=i(Rd,"768"),Rd.forEach(t),Ls=c(Z),ar=a(Z,"TD",{align:!0});var Bd=n(ar);Ns=i(Bd,"45.2"),Bd.forEach(t),Os=c(Z),nr=a(Z,"TD",{align:!0});var Wd=n(nr);qs=i(Wd,"83.1"),Wd.forEach(t),Z.forEach(t),Hs=c(K),A=a(K,"TR",{});var Q=n(A);sr=a(Q,"TD",{align:!0});var Ud=n(sr);Rs=i(Ud,"MiT-b4"),Ud.forEach(t),Bs=c(Q),lo=a(Q,"TD",{});var Vd=n(lo);Ws=i(Vd,"[3, 8, 27, 3]"),Vd.forEach(t),Us=c(Q),co=a(Q,"TD",{});var Gd=n(co);Vs=i(Gd,"[64, 128, 320, 512]"),Gd.forEach(t),Gs=c(Q),ir=a(Q,"TD",{align:!0});var Kd=n(ir);Ks=i(Kd,"768"),Kd.forEach(t),Js=c(Q),lr=a(Q,"TD",{align:!0});var Jd=n(lr);Xs=i(Jd,"62.6"),Jd.forEach(t),Ys=c(Q),dr=a(Q,"TD",{align:!0});var Xd=n(dr);Zs=i(Xd,"83.6"),Xd.forEach(t),Q.forEach(t),Qs=c(K),L=a(K,"TR",{});var ee=n(L);cr=a(ee,"TD",{align:!0});var Yd=n(cr);ei=i(Yd,"MiT-b5"),Yd.forEach(t),ti=c(ee),mo=a(ee,"TD",{});var Zd=n(mo);ri=i(Zd,"[3, 6, 40, 3]"),Zd.forEach(t),oi=c(ee),fo=a(ee,"TD",{});var Qd=n(fo);ai=i(Qd,"[64, 128, 320, 512]"),Qd.forEach(t),ni=c(ee),mr=a(ee,"TD",{align:!0});var ec=n(mr);si=i(ec,"768"),ec.forEach(t),ii=c(ee),fr=a(ee,"TD",{align:!0});var tc=n(fr);li=i(tc,"82.0"),tc.forEach(t),di=c(ee),hr=a(ee,"TD",{align:!0});var rc=n(hr);ci=i(rc,"83.8"),rc.forEach(t),ee.forEach(t),K.forEach(t),da.forEach(t),Go=c(r),ce=a(r,"H2",{class:!0});var ca=n(ce);xe=a(ca,"A",{id:!0,class:!0,href:!0});var oc=n(xe);ho=a(oc,"SPAN",{});var ac=n(ho);w(at.$$.fragment,ac),ac.forEach(t),oc.forEach(t),mi=c(ca),go=a(ca,"SPAN",{});var nc=n(go);fi=i(nc,"SegformerConfig"),nc.forEach(t),ca.forEach(t),Ko=c(r),q=a(r,"DIV",{class:!0});var qe=n(q);w(nt.$$.fragment,qe),hi=c(qe),me=a(qe,"P",{});var yr=n(me);gi=i(yr,"This is the configuration class to store the configuration of a "),gr=a(yr,"A",{href:!0});var sc=n(gr);pi=i(sc,"SegformerModel"),sc.forEach(t),ui=i(yr,`. It is used to instantiate an
SegFormer model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the SegFormer
`),st=a(yr,"A",{href:!0,rel:!0});var ic=n(st);_i=i(ic,"nvidia/segformer-b0-finetuned-ade-512-512"),ic.forEach(t),bi=i(yr,`
architecture.`),yr.forEach(t),vi=c(qe),fe=a(qe,"P",{});var xr=n(fe);Si=i(xr,"Configuration objects inherit from "),pr=a(xr,"A",{href:!0});var lc=n(pr);wi=i(lc,"PretrainedConfig"),lc.forEach(t),$i=i(xr,` and can be used to control the model outputs. Read the
documentation from `),ur=a(xr,"A",{href:!0});var dc=n(ur);Ei=i(dc,"PretrainedConfig"),dc.forEach(t),Ti=i(xr," for more information."),xr.forEach(t),yi=c(qe),w(Fe.$$.fragment,qe),qe.forEach(t),Jo=c(r),he=a(r,"H2",{class:!0});var ma=n(he);Ie=a(ma,"A",{id:!0,class:!0,href:!0});var cc=n(Ie);po=a(cc,"SPAN",{});var mc=n(po);w(it.$$.fragment,mc),mc.forEach(t),cc.forEach(t),xi=c(ma),uo=a(ma,"SPAN",{});var fc=n(uo);Fi=i(fc,"SegformerFeatureExtractor"),fc.forEach(t),ma.forEach(t),Xo=c(r),H=a(r,"DIV",{class:!0});var He=n(H);w(lt.$$.fragment,He),Ii=c(He),_o=a(He,"P",{});var hc=n(_o);ki=i(hc,"Constructs a SegFormer feature extractor."),hc.forEach(t),Pi=c(He),dt=a(He,"P",{});var fa=n(dt);Mi=i(fa,"This feature extractor inherits from "),_r=a(fa,"A",{href:!0});var gc=n(_r);Ci=i(gc,"FeatureExtractionMixin"),gc.forEach(t),Di=i(fa,` which contains most of the main methods. Users
should refer to this superclass for more information regarding those methods.`),fa.forEach(t),zi=c(He),ne=a(He,"DIV",{class:!0});var Fr=n(ne);w(ct.$$.fragment,Fr),ji=c(Fr),bo=a(Fr,"P",{});var pc=n(bo);Ai=i(pc,"Main method to prepare for the model one or several image(s) and optional corresponding segmentation maps."),pc.forEach(t),Li=c(Fr),w(ke.$$.fragment,Fr),Fr.forEach(t),He.forEach(t),Yo=c(r),ge=a(r,"H2",{class:!0});var ha=n(ge);Pe=a(ha,"A",{id:!0,class:!0,href:!0});var uc=n(Pe);vo=a(uc,"SPAN",{});var _c=n(vo);w(mt.$$.fragment,_c),_c.forEach(t),uc.forEach(t),Ni=c(ha),So=a(ha,"SPAN",{});var bc=n(So);Oi=i(bc,"SegformerModel"),bc.forEach(t),ha.forEach(t),Zo=c(r),te=a(r,"DIV",{class:!0});var Ir=n(te);w(ft.$$.fragment,Ir),qi=c(Ir),ht=a(Ir,"P",{});var ga=n(ht);Hi=i(ga,`The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),gt=a(ga,"A",{href:!0,rel:!0});var vc=n(gt);Ri=i(vc,"torch.nn.Module"),vc.forEach(t),Bi=i(ga,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ga.forEach(t),Wi=c(Ir),B=a(Ir,"DIV",{class:!0});var Re=n(B);w(pt.$$.fragment,Re),Ui=c(Re),pe=a(Re,"P",{});var kr=n(pe);Vi=i(kr,"The "),br=a(kr,"A",{href:!0});var Sc=n(br);Gi=i(Sc,"SegformerModel"),Sc.forEach(t),Ki=i(kr," forward method, overrides the "),wo=a(kr,"CODE",{});var wc=n(wo);Ji=i(wc,"__call__"),wc.forEach(t),Xi=i(kr," special method."),kr.forEach(t),Yi=c(Re),w(Me.$$.fragment,Re),Zi=c(Re),w(Ce.$$.fragment,Re),Re.forEach(t),Ir.forEach(t),Qo=c(r),ue=a(r,"H2",{class:!0});var pa=n(ue);De=a(pa,"A",{id:!0,class:!0,href:!0});var $c=n(De);$o=a($c,"SPAN",{});var Ec=n($o);w(ut.$$.fragment,Ec),Ec.forEach(t),$c.forEach(t),Qi=c(pa),Eo=a(pa,"SPAN",{});var Tc=n(Eo);el=i(Tc,"SegformerDecodeHead"),Tc.forEach(t),pa.forEach(t),ea=c(r),_e=a(r,"DIV",{class:!0});var ua=n(_e);w(_t.$$.fragment,ua),tl=c(ua),vr=a(ua,"DIV",{class:!0});var yc=n(vr);w(bt.$$.fragment,yc),yc.forEach(t),ua.forEach(t),ta=c(r),be=a(r,"H2",{class:!0});var _a=n(be);ze=a(_a,"A",{id:!0,class:!0,href:!0});var xc=n(ze);To=a(xc,"SPAN",{});var Fc=n(To);w(vt.$$.fragment,Fc),Fc.forEach(t),xc.forEach(t),rl=c(_a),yo=a(_a,"SPAN",{});var Ic=n(yo);ol=i(Ic,"SegformerForImageClassification"),Ic.forEach(t),_a.forEach(t),ra=c(r),R=a(r,"DIV",{class:!0});var Be=n(R);w(St.$$.fragment,Be),al=c(Be),xo=a(Be,"P",{});var kc=n(xo);nl=i(kc,`SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden
states) e.g. for ImageNet.`),kc.forEach(t),sl=c(Be),wt=a(Be,"P",{});var ba=n(wt);il=i(ba,"This model is a PyTorch "),$t=a(ba,"A",{href:!0,rel:!0});var Pc=n($t);ll=i(Pc,"torch.nn.Module"),Pc.forEach(t),dl=i(ba,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ba.forEach(t),cl=c(Be),W=a(Be,"DIV",{class:!0});var We=n(W);w(Et.$$.fragment,We),ml=c(We),ve=a(We,"P",{});var Pr=n(ve);fl=i(Pr,"The "),Sr=a(Pr,"A",{href:!0});var Mc=n(Sr);hl=i(Mc,"SegformerForImageClassification"),Mc.forEach(t),gl=i(Pr," forward method, overrides the "),Fo=a(Pr,"CODE",{});var Cc=n(Fo);pl=i(Cc,"__call__"),Cc.forEach(t),ul=i(Pr," special method."),Pr.forEach(t),_l=c(We),w(je.$$.fragment,We),bl=c(We),w(Ae.$$.fragment,We),We.forEach(t),Be.forEach(t),oa=c(r),Se=a(r,"H2",{class:!0});var va=n(Se);Le=a(va,"A",{id:!0,class:!0,href:!0});var Dc=n(Le);Io=a(Dc,"SPAN",{});var zc=n(Io);w(Tt.$$.fragment,zc),zc.forEach(t),Dc.forEach(t),vl=c(va),ko=a(va,"SPAN",{});var jc=n(ko);Sl=i(jc,"SegformerForSemanticSegmentation"),jc.forEach(t),va.forEach(t),aa=c(r),re=a(r,"DIV",{class:!0});var Mr=n(re);w(yt.$$.fragment,Mr),wl=c(Mr),xt=a(Mr,"P",{});var Sa=n(xt);$l=i(Sa,`SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
This model is a PyTorch `),Ft=a(Sa,"A",{href:!0,rel:!0});var Ac=n(Ft);El=i(Ac,"torch.nn.Module"),Ac.forEach(t),Tl=i(Sa,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Sa.forEach(t),yl=c(Mr),U=a(Mr,"DIV",{class:!0});var Ue=n(U);w(It.$$.fragment,Ue),xl=c(Ue),we=a(Ue,"P",{});var Cr=n(we);Fl=i(Cr,"The "),wr=a(Cr,"A",{href:!0});var Lc=n(wr);Il=i(Lc,"SegformerForSemanticSegmentation"),Lc.forEach(t),kl=i(Cr," forward method, overrides the "),Po=a(Cr,"CODE",{});var Nc=n(Po);Pl=i(Nc,"__call__"),Nc.forEach(t),Ml=i(Cr," special method."),Cr.forEach(t),Cl=c(Ue),w(Ne.$$.fragment,Ue),Dl=c(Ue),w(Oe.$$.fragment,Ue),Ue.forEach(t),Mr.forEach(t),this.h()},h(){l(f,"name","hf:doc:metadata"),l(f,"content",JSON.stringify(em)),l(p,"id","segformer"),l(p,"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(p,"href","#segformer"),l(u,"class","relative group"),l($e,"id","overview"),l($e,"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($e,"href","#overview"),l(ie,"class","relative group"),l(Ke,"href","https://arxiv.org/abs/2105.15203"),l(Ke,"rel","nofollow"),l(Je,"href","https://arxiv.org/abs/2105.15203"),l(Je,"rel","nofollow"),l(Xe,"width","600"),Bc(Xe.src,zl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/segformer_architecture.png")||l(Xe,"src",zl),l(Ye,"href","https://huggingface.co/nielsr"),l(Ye,"rel","nofollow"),l(Ze,"href","https://github.com/NVlabs/SegFormer"),l(Ze,"rel","nofollow"),l(zt,"href","/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerModel"),l(jt,"href","/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(At,"href","/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerForImageClassification"),l(Qe,"href","https://huggingface.co/models?other=segformer"),l(Qe,"rel","nofollow"),l(et,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/SegFormer"),l(et,"rel","nofollow"),l(tt,"href","https://huggingface.co/blog/fine-tune-segformer"),l(tt,"rel","nofollow"),l(Lt,"href","/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerFeatureExtractor"),l(ot,"href","https://github.com/NVlabs/SegFormer/blob/master/local_configs/_base_/datasets/ade20k_repeat.py"),l(ot,"rel","nofollow"),l(Nt,"href","/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerFeatureExtractor"),l(Ot,"href","/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(qt,"align","center"),l(Ht,"align","center"),l(Rt,"align","center"),l(Bt,"align","center"),l(Wt,"align","center"),l(Ut,"align","center"),l(Vt,"align","center"),l(Gt,"align","center"),l(Kt,"align","center"),l(Jt,"align","center"),l(Xt,"align","center"),l(Yt,"align","center"),l(Zt,"align","center"),l(Qt,"align","center"),l(er,"align","center"),l(tr,"align","center"),l(rr,"align","center"),l(or,"align","center"),l(ar,"align","center"),l(nr,"align","center"),l(sr,"align","center"),l(ir,"align","center"),l(lr,"align","center"),l(dr,"align","center"),l(cr,"align","center"),l(mr,"align","center"),l(fr,"align","center"),l(hr,"align","center"),l(xe,"id","transformers.SegformerConfig"),l(xe,"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(xe,"href","#transformers.SegformerConfig"),l(ce,"class","relative group"),l(gr,"href","/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerModel"),l(st,"href","https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512"),l(st,"rel","nofollow"),l(pr,"href","/docs/transformers/pr_17548/en/main_classes/configuration#transformers.PretrainedConfig"),l(ur,"href","/docs/transformers/pr_17548/en/main_classes/configuration#transformers.PretrainedConfig"),l(q,"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.SegformerFeatureExtractor"),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.SegformerFeatureExtractor"),l(he,"class","relative group"),l(_r,"href","/docs/transformers/pr_17548/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin"),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(H,"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,"id","transformers.SegformerModel"),l(Pe,"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(Pe,"href","#transformers.SegformerModel"),l(ge,"class","relative group"),l(gt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(gt,"rel","nofollow"),l(br,"href","/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerModel"),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(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(De,"id","transformers.SegformerDecodeHead"),l(De,"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(De,"href","#transformers.SegformerDecodeHead"),l(ue,"class","relative group"),l(vr,"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(ze,"id","transformers.SegformerForImageClassification"),l(ze,"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(ze,"href","#transformers.SegformerForImageClassification"),l(be,"class","relative group"),l($t,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l($t,"rel","nofollow"),l(Sr,"href","/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerForImageClassification"),l(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(R,"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,"id","transformers.SegformerForSemanticSegmentation"),l(Le,"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(Le,"href","#transformers.SegformerForSemanticSegmentation"),l(Se,"class","relative group"),l(Ft,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Ft,"rel","nofollow"),l(wr,"href","/docs/transformers/pr_17548/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(U,"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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(r,h){e(document.head,f),g(r,v,h),g(r,u,h),e(u,p),e(p,b),$(m,b,null),e(u,_),e(u,N),e(N,ya),g(r,Lo,h),g(r,ie,h),e(ie,$e),e($e,Dr),$(Ge,Dr,null),e(ie,xa),e(ie,zr),e(zr,Fa),g(r,No,h),g(r,Ee,h),e(Ee,Ia),e(Ee,Ke),e(Ke,ka),e(Ee,Pa),g(r,Oo,h),g(r,Mt,h),e(Mt,Ma),g(r,qo,h),g(r,Ct,h),e(Ct,jr),e(jr,Ca),g(r,Ho,h),g(r,Te,h),e(Te,Da),e(Te,Je),e(Je,za),e(Te,ja),g(r,Ro,h),g(r,Xe,h),g(r,Bo,h),g(r,ae,h),e(ae,Aa),e(ae,Ye),e(Ye,La),e(ae,Na),e(ae,Ze),e(Ze,Oa),e(ae,qa),g(r,Wo,h),g(r,Dt,h),e(Dt,Ha),g(r,Uo,h),g(r,k,h),e(k,O),e(O,Ra),e(O,zt),e(zt,Ba),e(O,Wa),e(O,jt),e(jt,Ua),e(O,Va),e(O,At),e(At,Ga),e(O,Ka),e(O,Qe),e(Qe,Ja),e(O,Xa),e(k,Ya),e(k,le),e(le,Za),e(le,et),e(et,Qa),e(le,en),e(le,tt),e(tt,tn),e(le,rn),e(k,on),e(k,rt),e(rt,an),e(rt,Ar),e(Ar,nn),e(rt,sn),e(k,ln),e(k,de),e(de,dn),e(de,Lt),e(Lt,cn),e(de,mn),e(de,ot),e(ot,fn),e(de,hn),e(k,gn),e(k,x),e(x,pn),e(x,Nt),e(Nt,un),e(x,_n),e(x,Lr),e(Lr,bn),e(x,vn),e(x,Nr),e(Nr,Sn),e(x,wn),e(x,Or),e(Or,$n),e(x,En),e(x,qr),e(qr,Tn),e(x,yn),e(x,Hr),e(Hr,xn),e(x,Fn),e(x,Ot),e(Ot,In),e(x,kn),e(x,Rr),e(Rr,Pn),e(x,Mn),e(x,Br),e(Br,Cn),e(x,Dn),e(k,zn),e(k,Wr),e(Wr,jn),g(r,Vo,h),g(r,ye,h),e(ye,Ur),e(Ur,P),e(P,qt),e(qt,Vr),e(Vr,An),e(P,Ln),e(P,Gr),e(Gr,Kr),e(Kr,Nn),e(P,On),e(P,Jr),e(Jr,Xr),e(Xr,qn),e(P,Hn),e(P,Ht),e(Ht,Yr),e(Yr,Rn),e(P,Bn),e(P,Rt),e(Rt,Zr),e(Zr,Wn),e(P,Un),e(P,Bt),e(Bt,Qr),e(Qr,Vn),e(ye,Gn),e(ye,M),e(M,C),e(C,Wt),e(Wt,Kn),e(C,Jn),e(C,eo),e(eo,Xn),e(C,Yn),e(C,to),e(to,Zn),e(C,Qn),e(C,Ut),e(Ut,es),e(C,ts),e(C,Vt),e(Vt,rs),e(C,os),e(C,Gt),e(Gt,as),e(M,ns),e(M,D),e(D,Kt),e(Kt,ss),e(D,is),e(D,ro),e(ro,ls),e(D,ds),e(D,oo),e(oo,cs),e(D,ms),e(D,Jt),e(Jt,fs),e(D,hs),e(D,Xt),e(Xt,gs),e(D,ps),e(D,Yt),e(Yt,us),e(M,_s),e(M,z),e(z,Zt),e(Zt,bs),e(z,vs),e(z,ao),e(ao,Ss),e(z,ws),e(z,no),e(no,$s),e(z,Es),e(z,Qt),e(Qt,Ts),e(z,ys),e(z,er),e(er,xs),e(z,Fs),e(z,tr),e(tr,Is),e(M,ks),e(M,j),e(j,rr),e(rr,Ps),e(j,Ms),e(j,so),e(so,Cs),e(j,Ds),e(j,io),e(io,zs),e(j,js),e(j,or),e(or,As),e(j,Ls),e(j,ar),e(ar,Ns),e(j,Os),e(j,nr),e(nr,qs),e(M,Hs),e(M,A),e(A,sr),e(sr,Rs),e(A,Bs),e(A,lo),e(lo,Ws),e(A,Us),e(A,co),e(co,Vs),e(A,Gs),e(A,ir),e(ir,Ks),e(A,Js),e(A,lr),e(lr,Xs),e(A,Ys),e(A,dr),e(dr,Zs),e(M,Qs),e(M,L),e(L,cr),e(cr,ei),e(L,ti),e(L,mo),e(mo,ri),e(L,oi),e(L,fo),e(fo,ai),e(L,ni),e(L,mr),e(mr,si),e(L,ii),e(L,fr),e(fr,li),e(L,di),e(L,hr),e(hr,ci),g(r,Go,h),g(r,ce,h),e(ce,xe),e(xe,ho),$(at,ho,null),e(ce,mi),e(ce,go),e(go,fi),g(r,Ko,h),g(r,q,h),$(nt,q,null),e(q,hi),e(q,me),e(me,gi),e(me,gr),e(gr,pi),e(me,ui),e(me,st),e(st,_i),e(me,bi),e(q,vi),e(q,fe),e(fe,Si),e(fe,pr),e(pr,wi),e(fe,$i),e(fe,ur),e(ur,Ei),e(fe,Ti),e(q,yi),$(Fe,q,null),g(r,Jo,h),g(r,he,h),e(he,Ie),e(Ie,po),$(it,po,null),e(he,xi),e(he,uo),e(uo,Fi),g(r,Xo,h),g(r,H,h),$(lt,H,null),e(H,Ii),e(H,_o),e(_o,ki),e(H,Pi),e(H,dt),e(dt,Mi),e(dt,_r),e(_r,Ci),e(dt,Di),e(H,zi),e(H,ne),$(ct,ne,null),e(ne,ji),e(ne,bo),e(bo,Ai),e(ne,Li),$(ke,ne,null),g(r,Yo,h),g(r,ge,h),e(ge,Pe),e(Pe,vo),$(mt,vo,null),e(ge,Ni),e(ge,So),e(So,Oi),g(r,Zo,h),g(r,te,h),$(ft,te,null),e(te,qi),e(te,ht),e(ht,Hi),e(ht,gt),e(gt,Ri),e(ht,Bi),e(te,Wi),e(te,B),$(pt,B,null),e(B,Ui),e(B,pe),e(pe,Vi),e(pe,br),e(br,Gi),e(pe,Ki),e(pe,wo),e(wo,Ji),e(pe,Xi),e(B,Yi),$(Me,B,null),e(B,Zi),$(Ce,B,null),g(r,Qo,h),g(r,ue,h),e(ue,De),e(De,$o),$(ut,$o,null),e(ue,Qi),e(ue,Eo),e(Eo,el),g(r,ea,h),g(r,_e,h),$(_t,_e,null),e(_e,tl),e(_e,vr),$(bt,vr,null),g(r,ta,h),g(r,be,h),e(be,ze),e(ze,To),$(vt,To,null),e(be,rl),e(be,yo),e(yo,ol),g(r,ra,h),g(r,R,h),$(St,R,null),e(R,al),e(R,xo),e(xo,nl),e(R,sl),e(R,wt),e(wt,il),e(wt,$t),e($t,ll),e(wt,dl),e(R,cl),e(R,W),$(Et,W,null),e(W,ml),e(W,ve),e(ve,fl),e(ve,Sr),e(Sr,hl),e(ve,gl),e(ve,Fo),e(Fo,pl),e(ve,ul),e(W,_l),$(je,W,null),e(W,bl),$(Ae,W,null),g(r,oa,h),g(r,Se,h),e(Se,Le),e(Le,Io),$(Tt,Io,null),e(Se,vl),e(Se,ko),e(ko,Sl),g(r,aa,h),g(r,re,h),$(yt,re,null),e(re,wl),e(re,xt),e(xt,$l),e(xt,Ft),e(Ft,El),e(xt,Tl),e(re,yl),e(re,U),$(It,U,null),e(U,xl),e(U,we),e(we,Fl),e(we,wr),e(wr,Il),e(we,kl),e(we,Po),e(Po,Pl),e(we,Ml),e(U,Cl),$(Ne,U,null),e(U,Dl),$(Oe,U,null),na=!0},p(r,[h]){const kt={};h&2&&(kt.$$scope={dirty:h,ctx:r}),Fe.$set(kt);const Mo={};h&2&&(Mo.$$scope={dirty:h,ctx:r}),ke.$set(Mo);const Co={};h&2&&(Co.$$scope={dirty:h,ctx:r}),Me.$set(Co);const Do={};h&2&&(Do.$$scope={dirty:h,ctx:r}),Ce.$set(Do);const Pt={};h&2&&(Pt.$$scope={dirty:h,ctx:r}),je.$set(Pt);const zo={};h&2&&(zo.$$scope={dirty:h,ctx:r}),Ae.$set(zo);const jo={};h&2&&(jo.$$scope={dirty:h,ctx:r}),Ne.$set(jo);const Ao={};h&2&&(Ao.$$scope={dirty:h,ctx:r}),Oe.$set(Ao)},i(r){na||(E(m.$$.fragment,r),E(Ge.$$.fragment,r),E(at.$$.fragment,r),E(nt.$$.fragment,r),E(Fe.$$.fragment,r),E(it.$$.fragment,r),E(lt.$$.fragment,r),E(ct.$$.fragment,r),E(ke.$$.fragment,r),E(mt.$$.fragment,r),E(ft.$$.fragment,r),E(pt.$$.fragment,r),E(Me.$$.fragment,r),E(Ce.$$.fragment,r),E(ut.$$.fragment,r),E(_t.$$.fragment,r),E(bt.$$.fragment,r),E(vt.$$.fragment,r),E(St.$$.fragment,r),E(Et.$$.fragment,r),E(je.$$.fragment,r),E(Ae.$$.fragment,r),E(Tt.$$.fragment,r),E(yt.$$.fragment,r),E(It.$$.fragment,r),E(Ne.$$.fragment,r),E(Oe.$$.fragment,r),na=!0)},o(r){T(m.$$.fragment,r),T(Ge.$$.fragment,r),T(at.$$.fragment,r),T(nt.$$.fragment,r),T(Fe.$$.fragment,r),T(it.$$.fragment,r),T(lt.$$.fragment,r),T(ct.$$.fragment,r),T(ke.$$.fragment,r),T(mt.$$.fragment,r),T(ft.$$.fragment,r),T(pt.$$.fragment,r),T(Me.$$.fragment,r),T(Ce.$$.fragment,r),T(ut.$$.fragment,r),T(_t.$$.fragment,r),T(bt.$$.fragment,r),T(vt.$$.fragment,r),T(St.$$.fragment,r),T(Et.$$.fragment,r),T(je.$$.fragment,r),T(Ae.$$.fragment,r),T(Tt.$$.fragment,r),T(yt.$$.fragment,r),T(It.$$.fragment,r),T(Ne.$$.fragment,r),T(Oe.$$.fragment,r),na=!1},d(r){t(f),r&&t(v),r&&t(u),y(m),r&&t(Lo),r&&t(ie),y(Ge),r&&t(No),r&&t(Ee),r&&t(Oo),r&&t(Mt),r&&t(qo),r&&t(Ct),r&&t(Ho),r&&t(Te),r&&t(Ro),r&&t(Xe),r&&t(Bo),r&&t(ae),r&&t(Wo),r&&t(Dt),r&&t(Uo),r&&t(k),r&&t(Vo),r&&t(ye),r&&t(Go),r&&t(ce),y(at),r&&t(Ko),r&&t(q),y(nt),y(Fe),r&&t(Jo),r&&t(he),y(it),r&&t(Xo),r&&t(H),y(lt),y(ct),y(ke),r&&t(Yo),r&&t(ge),y(mt),r&&t(Zo),r&&t(te),y(ft),y(pt),y(Me),y(Ce),r&&t(Qo),r&&t(ue),y(ut),r&&t(ea),r&&t(_e),y(_t),y(bt),r&&t(ta),r&&t(be),y(vt),r&&t(ra),r&&t(R),y(St),y(Et),y(je),y(Ae),r&&t(oa),r&&t(Se),y(Tt),r&&t(aa),r&&t(re),y(yt),y(It),y(Ne),y(Oe)}}}const em={local:"segformer",sections:[{local:"overview",title:"Overview"},{local:"transformers.SegformerConfig",title:"SegformerConfig"},{local:"transformers.SegformerFeatureExtractor",title:"SegformerFeatureExtractor"},{local:"transformers.SegformerModel",title:"SegformerModel"},{local:"transformers.SegformerDecodeHead",title:"SegformerDecodeHead"},{local:"transformers.SegformerForImageClassification",title:"SegformerForImageClassification"},{local:"transformers.SegformerForSemanticSegmentation",title:"SegformerForSemanticSegmentation"}],title:"SegFormer"};function tm(I){return Wc(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class lm extends Oc{constructor(f){super();qc(this,f,tm,Qc,Hc,{})}}export{lm as default,em as metadata};
