import{S as Ap,i as qp,s as Np,e as r,k as c,w as S,t as n,M as Op,c as s,d as t,m,a,x as w,h as i,b as l,N as Lp,G as e,g as u,y as T,q as $,o as y,B as F,v as Rp,L as er}from"../../chunks/vendor-hf-doc-builder.js";import{T as ps}from"../../chunks/Tip-hf-doc-builder.js";import{D as P}from"../../chunks/Docstring-hf-doc-builder.js";import{C as tr}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Y}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Qo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Hp(E){let f,b,_,p,v;return p=new tr({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=r("p"),b=n("Example:"),_=c(),S(p.$$.fragment)},l(d){f=s(d,"P",{});var h=a(f);b=i(h,"Example:"),h.forEach(t),_=m(d),w(p.$$.fragment,d)},m(d,h){u(d,f,h),e(f,b),u(d,_,h),T(p,d,h),v=!0},p:er,i(d){v||($(p.$$.fragment,d),v=!0)},o(d){y(p.$$.fragment,d),v=!1},d(d){d&&t(f),d&&t(_),F(p,d)}}}function Wp(E){let f,b,_,p,v;return{c(){f=r("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),p=n("Module"),v=n(`
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(d){f=s(d,"P",{});var h=a(f);b=i(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(h,"CODE",{});var I=a(_);p=i(I,"Module"),I.forEach(t),v=i(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(d,h){u(d,f,h),e(f,b),e(f,_),e(_,p),e(f,v)},d(d){d&&t(f)}}}function Up(E){let f,b,_,p,v;return p=new tr({props:{code:`from transformers import SegformerImageProcessor, SegformerModel
import torch
from datasets import load_dataset

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

feature_extractor = SegformerImageProcessor.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> SegformerImageProcessor, 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 = SegformerImageProcessor.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=r("p"),b=n("Example:"),_=c(),S(p.$$.fragment)},l(d){f=s(d,"P",{});var h=a(f);b=i(h,"Example:"),h.forEach(t),_=m(d),w(p.$$.fragment,d)},m(d,h){u(d,f,h),e(f,b),u(d,_,h),T(p,d,h),v=!0},p:er,i(d){v||($(p.$$.fragment,d),v=!0)},o(d){y(p.$$.fragment,d),v=!1},d(d){d&&t(f),d&&t(_),F(p,d)}}}function Bp(E){let f,b,_,p,v;return{c(){f=r("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),p=n("Module"),v=n(`
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(d){f=s(d,"P",{});var h=a(f);b=i(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(h,"CODE",{});var I=a(_);p=i(I,"Module"),I.forEach(t),v=i(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(d,h){u(d,f,h),e(f,b),e(f,_),e(_,p),e(f,v)},d(d){d&&t(f)}}}function Vp(E){let f,b,_,p,v;return p=new tr({props:{code:`from transformers import SegformerImageProcessor, SegformerForImageClassification
import torch
from datasets import load_dataset

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

feature_extractor = SegformerImageProcessor.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> SegformerImageProcessor, 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 = SegformerImageProcessor.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=r("p"),b=n("Example:"),_=c(),S(p.$$.fragment)},l(d){f=s(d,"P",{});var h=a(f);b=i(h,"Example:"),h.forEach(t),_=m(d),w(p.$$.fragment,d)},m(d,h){u(d,f,h),e(f,b),u(d,_,h),T(p,d,h),v=!0},p:er,i(d){v||($(p.$$.fragment,d),v=!0)},o(d){y(p.$$.fragment,d),v=!1},d(d){d&&t(f),d&&t(_),F(p,d)}}}function Gp(E){let f,b,_,p,v;return{c(){f=r("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),p=n("Module"),v=n(`
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(d){f=s(d,"P",{});var h=a(f);b=i(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(h,"CODE",{});var I=a(_);p=i(I,"Module"),I.forEach(t),v=i(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(d,h){u(d,f,h),e(f,b),e(f,_),e(_,p),e(f,v)},d(d){d&&t(f)}}}function Kp(E){let f,b,_,p,v;return p=new tr({props:{code:`from transformers import SegformerImageProcessor, SegformerForSemanticSegmentation
from PIL import Image
import requests

image_processor = SegformerImageProcessor.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 = image_processor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits  # shape (batch_size, num_labels, height/4, width/4)
list(logits.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SegformerImageProcessor, 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>image_processor = SegformerImageProcessor.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 = image_processor(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/4, width/4)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(logits.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">150</span>, <span class="hljs-number">128</span>, <span class="hljs-number">128</span>]`}}),{c(){f=r("p"),b=n("Examples:"),_=c(),S(p.$$.fragment)},l(d){f=s(d,"P",{});var h=a(f);b=i(h,"Examples:"),h.forEach(t),_=m(d),w(p.$$.fragment,d)},m(d,h){u(d,f,h),e(f,b),u(d,_,h),T(p,d,h),v=!0},p:er,i(d){v||($(p.$$.fragment,d),v=!0)},o(d){y(p.$$.fragment,d),v=!1},d(d){d&&t(f),d&&t(_),F(p,d)}}}function Yp(E){let f,b,_,p,v;return{c(){f=r("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),p=n("Module"),v=n(`
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(d){f=s(d,"P",{});var h=a(f);b=i(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(h,"CODE",{});var I=a(_);p=i(I,"Module"),I.forEach(t),v=i(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(d,h){u(d,f,h),e(f,b),e(f,_),e(_,p),e(f,v)},d(d){d&&t(f)}}}function Jp(E){let f,b,_,p,v;return p=new tr({props:{code:`from transformers import SegformerImageProcessor, TFSegformerModel
from datasets import load_dataset

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

feature_extractor = SegformerImageProcessor.from_pretrained("nvidia/mit-b0")
model = TFSegformerModel.from_pretrained("nvidia/mit-b0")

inputs = feature_extractor(image, return_tensors="tf")
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> SegformerImageProcessor, TFSegformerModel
<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 = SegformerImageProcessor.from_pretrained(<span class="hljs-string">&quot;nvidia/mit-b0&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFSegformerModel.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;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </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=r("p"),b=n("Example:"),_=c(),S(p.$$.fragment)},l(d){f=s(d,"P",{});var h=a(f);b=i(h,"Example:"),h.forEach(t),_=m(d),w(p.$$.fragment,d)},m(d,h){u(d,f,h),e(f,b),u(d,_,h),T(p,d,h),v=!0},p:er,i(d){v||($(p.$$.fragment,d),v=!0)},o(d){y(p.$$.fragment,d),v=!1},d(d){d&&t(f),d&&t(_),F(p,d)}}}function Xp(E){let f,b,_,p,v;return{c(){f=r("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),p=n("Module"),v=n(`
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(d){f=s(d,"P",{});var h=a(f);b=i(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(h,"CODE",{});var I=a(_);p=i(I,"Module"),I.forEach(t),v=i(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(d,h){u(d,f,h),e(f,b),e(f,_),e(_,p),e(f,v)},d(d){d&&t(f)}}}function Zp(E){let f,b,_,p,v;return p=new tr({props:{code:`from transformers import SegformerImageProcessor, TFSegformerForImageClassification
import tensorflow as tf
from datasets import load_dataset

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

feature_extractor = SegformerImageProcessor.from_pretrained("nvidia/mit-b0")
model = TFSegformerForImageClassification.from_pretrained("nvidia/mit-b0")

inputs = feature_extractor(image, return_tensors="tf")
logits = model(**inputs).logits

# model predicts one of the 1000 ImageNet classes
predicted_label = int(tf.math.argmax(logits, axis=-1))
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> SegformerImageProcessor, TFSegformerForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<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 = SegformerImageProcessor.from_pretrained(<span class="hljs-string">&quot;nvidia/mit-b0&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFSegformerForImageClassification.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;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </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 = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>))
<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=r("p"),b=n("Example:"),_=c(),S(p.$$.fragment)},l(d){f=s(d,"P",{});var h=a(f);b=i(h,"Example:"),h.forEach(t),_=m(d),w(p.$$.fragment,d)},m(d,h){u(d,f,h),e(f,b),u(d,_,h),T(p,d,h),v=!0},p:er,i(d){v||($(p.$$.fragment,d),v=!0)},o(d){y(p.$$.fragment,d),v=!1},d(d){d&&t(f),d&&t(_),F(p,d)}}}function Qp(E){let f,b,_,p,v;return{c(){f=r("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),p=n("Module"),v=n(`
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(d){f=s(d,"P",{});var h=a(f);b=i(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(h,"CODE",{});var I=a(_);p=i(I,"Module"),I.forEach(t),v=i(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(d,h){u(d,f,h),e(f,b),e(f,_),e(_,p),e(f,v)},d(d){d&&t(f)}}}function eu(E){let f,b,_,p,v;return p=new tr({props:{code:`from transformers import SegformerImageProcessor, TFSegformerForSemanticSegmentation
from PIL import Image
import requests

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

image_processor = SegformerImageProcessor.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512")
model = TFSegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512")

inputs = image_processor(images=image, return_tensors="tf")
outputs = model(**inputs, training=False)
# logits are of shape (batch_size, num_labels, height/4, width/4)
logits = outputs.logits
list(logits.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SegformerImageProcessor, TFSegformerForSemanticSegmentation
<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>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>image_processor = SegformerImageProcessor.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 = TFSegformerForSemanticSegmentation.from_pretrained(<span class="hljs-string">&quot;nvidia/segformer-b0-finetuned-ade-512-512&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, training=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># logits are of shape (batch_size, num_labels, height/4, width/4)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(logits.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">150</span>, <span class="hljs-number">128</span>, <span class="hljs-number">128</span>]`}}),{c(){f=r("p"),b=n("Examples:"),_=c(),S(p.$$.fragment)},l(d){f=s(d,"P",{});var h=a(f);b=i(h,"Examples:"),h.forEach(t),_=m(d),w(p.$$.fragment,d)},m(d,h){u(d,f,h),e(f,b),u(d,_,h),T(p,d,h),v=!0},p:er,i(d){v||($(p.$$.fragment,d),v=!0)},o(d){y(p.$$.fragment,d),v=!1},d(d){d&&t(f),d&&t(_),F(p,d)}}}function tu(E){let f,b,_,p,v,d,h,I,ti,La,ue,Re,us,Mt,oi,_s,ri,Ra,He,si,zt,ai,ni,Ha,or,ii,Wa,rr,vs,li,Ua,We,di,jt,ci,mi,Ba,Dt,Xf,Va,J,fi,At,gi,hi,qt,pi,ui,Nt,_i,vi,Ga,sr,bi,Ka,k,H,Si,ar,wi,Ti,nr,$i,yi,ir,Fi,Ei,Ot,Ii,xi,Pi,_e,ki,Lt,Ci,Mi,Rt,zi,ji,Di,Ht,Ai,Wt,qi,Ni,Oi,Ut,Li,Bt,Ri,Hi,Wi,Vt,Ui,bs,Bi,Vi,Gi,ve,Ki,lr,Yi,Ji,Gt,Xi,Zi,Qi,x,el,dr,tl,ol,Ss,rl,sl,ws,al,nl,Ts,il,ll,$s,dl,cl,ys,ml,fl,cr,gl,hl,Fs,pl,ul,Es,_l,vl,bl,Kt,Sl,Yt,wl,Tl,Ya,Ue,Is,z,mr,xs,$l,yl,Ps,ks,Fl,El,Cs,Ms,Il,xl,fr,zs,Pl,kl,gr,js,Cl,Ml,hr,Ds,zl,jl,j,D,pr,Dl,Al,As,ql,Nl,qs,Ol,Ll,ur,Rl,Hl,_r,Wl,Ul,vr,Bl,Vl,A,br,Gl,Kl,Ns,Yl,Jl,Os,Xl,Zl,Sr,Ql,ed,wr,td,od,Tr,rd,sd,q,$r,ad,nd,Ls,id,ld,Rs,dd,cd,yr,md,fd,Fr,gd,hd,Er,pd,ud,N,Ir,_d,vd,Hs,bd,Sd,Ws,wd,Td,xr,$d,yd,Pr,Fd,Ed,kr,Id,xd,O,Cr,Pd,kd,Us,Cd,Md,Bs,zd,jd,Mr,Dd,Ad,zr,qd,Nd,jr,Od,Ld,L,Dr,Rd,Hd,Vs,Wd,Ud,Gs,Bd,Vd,Ar,Gd,Kd,qr,Yd,Jd,Nr,Xd,Ja,Be,Zd,Jt,Qd,ec,Xa,be,Ve,Ks,Xt,tc,Ys,oc,Za,W,Zt,rc,Se,sc,Or,ac,nc,Qt,ic,lc,dc,we,cc,Lr,mc,fc,Rr,gc,hc,pc,Ge,Qa,Te,Ke,Js,eo,uc,Xs,_c,en,U,to,vc,Zs,bc,Sc,ge,oo,wc,Qs,Tc,$c,$e,yc,ea,Fc,Ec,ta,Ic,xc,Pc,Ye,ro,kc,so,Cc,Hr,Mc,zc,tn,ye,Je,oa,ao,jc,ra,Dc,on,B,no,Ac,sa,qc,Nc,Xe,io,Oc,aa,Lc,Rc,Ze,lo,Hc,co,Wc,Wr,Uc,Bc,rn,Fe,Qe,na,mo,Vc,ia,Gc,sn,me,fo,Kc,go,Yc,ho,Jc,Xc,Zc,X,po,Qc,Ee,em,Ur,tm,om,la,rm,sm,am,et,nm,tt,an,Ie,ot,da,uo,im,ca,lm,nn,xe,_o,dm,Br,vo,ln,Pe,rt,ma,bo,cm,fa,mm,dn,V,So,fm,ga,gm,hm,wo,pm,To,um,_m,vm,Z,$o,bm,ke,Sm,Vr,wm,Tm,ha,$m,ym,Fm,st,Em,at,cn,Ce,nt,pa,yo,Im,ua,xm,mn,fe,Fo,Pm,Eo,km,Io,Cm,Mm,zm,Q,xo,jm,Me,Dm,Gr,Am,qm,_a,Nm,Om,Lm,it,Rm,lt,fn,ze,dt,va,Po,Hm,ba,Wm,gn,je,ko,Um,Kr,Co,hn,De,ct,Sa,Mo,Bm,wa,Vm,pn,G,zo,Gm,jo,Km,Yr,Ym,Jm,Xm,Do,Zm,Ao,Qm,ef,tf,ee,qo,of,Ae,rf,Jr,sf,af,Ta,nf,lf,df,mt,cf,ft,un,qe,gt,$a,No,mf,ya,ff,_n,R,Oo,gf,Fa,hf,pf,Lo,uf,Xr,_f,vf,bf,Ro,Sf,Ho,wf,Tf,$f,te,Wo,yf,Ne,Ff,Zr,Ef,If,Ea,xf,Pf,kf,ht,Cf,pt,vn,Oe,ut,Ia,Uo,Mf,xa,zf,bn,K,Bo,jf,Vo,Df,Qr,Af,qf,Nf,Go,Of,Ko,Lf,Rf,Hf,oe,Yo,Wf,Le,Uf,es,Bf,Vf,Pa,Gf,Kf,Yf,_t,Jf,vt,Sn;return d=new Y({}),Mt=new Y({}),Xt=new Y({}),Zt=new P({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/v4.25.1/src/transformers/models/segformer/configuration_segformer.py#L38"}}),Ge=new Qo({props:{anchor:"transformers.SegformerConfig.example",$$slots:{default:[Hp]},$$scope:{ctx:E}}}),eo=new Y({}),to=new P({props:{name:"class transformers.SegformerImageProcessor",anchor:"transformers.SegformerImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_reduce_labels",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SegformerImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>(size[&quot;height&quot;], size[&quot;width&quot;])</code>. Can be overridden by the <code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.SegformerImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 512, &quot;width&quot;: 512}</code>):
Size of the output image after resizing. Can be overridden by the <code>size</code> parameter in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.SegformerImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by the <code>resample</code> parameter in the
<code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.SegformerImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the <code>do_rescale</code>
parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.SegformerImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"rescale_factor"},{anchor:"transformers.SegformerImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"do_normalize"},{anchor:"transformers.SegformerImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_MEAN</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.SegformerImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_STD</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.SegformerImageProcessor.do_reduce_labels",description:`<strong>do_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. Can be overridden by the <code>do_reduce_labels</code> parameter in the
<code>preprocess</code> method.`,name:"do_reduce_labels"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/image_processing_segformer.py#L50"}}),oo=new P({props:{name:"__call__",anchor:"transformers.SegformerImageProcessor.__call__",parameters:[{name:"images",val:""},{name:"segmentation_maps",val:" = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/image_processing_segformer.py#L314"}}),ro=new P({props:{name:"post_process_semantic_segmentation",anchor:"transformers.SegformerImageProcessor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": typing.List[typing.Tuple] = None"}],parametersDescription:[{anchor:"transformers.SegformerImageProcessor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation">SegformerForSemanticSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.SegformerImageProcessor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code> of length <code>batch_size</code>, <em>optional</em>) &#x2014;
List of tuples corresponding to the requested final size (height, width) of each prediction. If left to
None, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/image_processing_segformer.py#L448",returnDescription:`
<p><code>List[torch.Tensor]</code> of length <code>batch_size</code>, where each item is a semantic
segmentation map of shape (height, width) corresponding to the target_sizes entry (if <code>target_sizes</code> is
specified). Each entry of each <code>torch.Tensor</code> correspond to a semantic class id.</p>
`,returnType:`
<p>semantic_segmentation</p>
`}}),ao=new Y({}),no=new P({props:{name:"class transformers.SegformerImageProcessor",anchor:"transformers.SegformerImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_reduce_labels",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SegformerImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>(size[&quot;height&quot;], size[&quot;width&quot;])</code>. Can be overridden by the <code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.SegformerImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 512, &quot;width&quot;: 512}</code>):
Size of the output image after resizing. Can be overridden by the <code>size</code> parameter in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.SegformerImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by the <code>resample</code> parameter in the
<code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.SegformerImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the <code>do_rescale</code>
parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.SegformerImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"rescale_factor"},{anchor:"transformers.SegformerImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"do_normalize"},{anchor:"transformers.SegformerImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_MEAN</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.SegformerImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_STD</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.SegformerImageProcessor.do_reduce_labels",description:`<strong>do_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. Can be overridden by the <code>do_reduce_labels</code> parameter in the
<code>preprocess</code> method.`,name:"do_reduce_labels"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/image_processing_segformer.py#L50"}}),io=new P({props:{name:"preprocess",anchor:"transformers.SegformerImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"segmentation_maps",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')], NoneType] = None"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"resample",val:": Resampling = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_reduce_labels",val:": typing.Optional[bool] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SegformerImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.SegformerImageProcessor.preprocess.segmentation_maps",description:`<strong>segmentation_maps</strong> (<code>ImageInput</code>, <em>optional</em>) &#x2014;
Segmentation map to preprocess.`,name:"segmentation_maps"},{anchor:"transformers.SegformerImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.SegformerImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after <code>resize</code> is applied.`,name:"size"},{anchor:"transformers.SegformerImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>, Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.SegformerImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image values between [0 - 1].`,name:"do_rescale"},{anchor:"transformers.SegformerImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.SegformerImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.SegformerImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean.`,name:"image_mean"},{anchor:"transformers.SegformerImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation.`,name:"image_std"},{anchor:"transformers.SegformerImageProcessor.preprocess.do_reduce_labels",description:`<strong>do_reduce_labels</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_reduce_labels</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:"do_reduce_labels"},{anchor:"transformers.SegformerImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.SegformerImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/image_processing_segformer.py#L323"}}),lo=new P({props:{name:"post_process_semantic_segmentation",anchor:"transformers.SegformerImageProcessor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": typing.List[typing.Tuple] = None"}],parametersDescription:[{anchor:"transformers.SegformerImageProcessor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation">SegformerForSemanticSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.SegformerImageProcessor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code> of length <code>batch_size</code>, <em>optional</em>) &#x2014;
List of tuples corresponding to the requested final size (height, width) of each prediction. If left to
None, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/image_processing_segformer.py#L448",returnDescription:`
<p><code>List[torch.Tensor]</code> of length <code>batch_size</code>, where each item is a semantic
segmentation map of shape (height, width) corresponding to the target_sizes entry (if <code>target_sizes</code> is
specified). Each entry of each <code>torch.Tensor</code> correspond to a semantic class id.</p>
`,returnType:`
<p>semantic_segmentation</p>
`}}),mo=new Y({}),fo=new P({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/v4.25.1/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/v4.25.1/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/v4.25.1/src/transformers/models/segformer/modeling_segformer.py#L511"}}),po=new P({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/v4.25.1/en/model_doc/segformer#transformers.SegformerImageProcessor">SegformerImageProcessor</a>. See <a href="/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerImageProcessor.__call__">SegformerImageProcessor.<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/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_segformer.py#L530",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/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/v4.25.1/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/v4.25.1/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),et=new ps({props:{$$slots:{default:[Wp]},$$scope:{ctx:E}}}),tt=new Qo({props:{anchor:"transformers.SegformerModel.forward.example",$$slots:{default:[Up]},$$scope:{ctx:E}}}),uo=new Y({}),_o=new P({props:{name:"class transformers.SegformerDecodeHead",anchor:"transformers.SegformerDecodeHead",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_segformer.py#L684"}}),vo=new P({props:{name:"forward",anchor:"transformers.SegformerDecodeHead.forward",parameters:[{name:"encoder_hidden_states",val:": FloatTensor"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_segformer.py#L709"}}),bo=new Y({}),So=new P({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/v4.25.1/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/v4.25.1/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/v4.25.1/src/transformers/models/segformer/modeling_segformer.py#L577"}}),$o=new P({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/v4.25.1/en/model_doc/segformer#transformers.SegformerImageProcessor">SegformerImageProcessor</a>. See <a href="/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerImageProcessor.__call__">SegformerImageProcessor.<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/v4.25.1/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/v4.25.1/src/transformers/models/segformer/modeling_segformer.py#L590",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/v4.25.1/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>
`}}),st=new ps({props:{$$slots:{default:[Bp]},$$scope:{ctx:E}}}),at=new Qo({props:{anchor:"transformers.SegformerForImageClassification.forward.example",$$slots:{default:[Vp]},$$scope:{ctx:E}}}),yo=new Y({}),Fo=new P({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/v4.25.1/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/v4.25.1/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/v4.25.1/src/transformers/models/segformer/modeling_segformer.py#L746"}}),xo=new P({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/v4.25.1/en/model_doc/segformer#transformers.SegformerImageProcessor">SegformerImageProcessor</a>. See <a href="/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerImageProcessor.__call__">SegformerImageProcessor.<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/v4.25.1/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/v4.25.1/src/transformers/models/segformer/modeling_segformer.py#L755",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/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/v4.25.1/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/v4.25.1/en/main_classes/output#transformers.modeling_outputs.SemanticSegmenterOutput"
>transformers.modeling_outputs.SemanticSegmenterOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),it=new ps({props:{$$slots:{default:[Gp]},$$scope:{ctx:E}}}),lt=new Qo({props:{anchor:"transformers.SegformerForSemanticSegmentation.forward.example",$$slots:{default:[Kp]},$$scope:{ctx:E}}}),Po=new Y({}),ko=new P({props:{name:"class transformers.TFSegformerDecodeHead",anchor:"transformers.TFSegformerDecodeHead",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_tf_segformer.py#L730"}}),Co=new P({props:{name:"call",anchor:"transformers.TFSegformerDecodeHead.call",parameters:[{name:"encoder_hidden_states",val:""},{name:"training",val:": bool = False"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_tf_segformer.py#L752"}}),Mo=new Y({}),zo=new P({props:{name:"class transformers.TFSegformerModel",anchor:"transformers.TFSegformerModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFSegformerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/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/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_tf_segformer.py#L598"}}),qo=new P({props:{name:"call",anchor:"transformers.TFSegformerModel.call",parameters:[{name:"pixel_values",val:": Tensor"},{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"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFSegformerModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>AutoImageProcessor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.TFSegformerModel.call.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. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFSegformerModel.call.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFSegformerModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFSegformerModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_tf_segformer.py#L606",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput"
>transformers.modeling_tf_outputs.TFBaseModelOutput</a> or a tuple of <code>tf.Tensor</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/v4.25.1/en/model_doc/segformer#transformers.SegformerConfig"
>SegformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</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(tf.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>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</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>tf.Tensor</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/v4.25.1/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput"
>transformers.modeling_tf_outputs.TFBaseModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),mt=new ps({props:{$$slots:{default:[Yp]},$$scope:{ctx:E}}}),ft=new Qo({props:{anchor:"transformers.TFSegformerModel.call.example",$$slots:{default:[Jp]},$$scope:{ctx:E}}}),No=new Y({}),Oo=new P({props:{name:"class transformers.TFSegformerForImageClassification",anchor:"transformers.TFSegformerForImageClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFSegformerForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/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/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_tf_segformer.py#L649"}}),Wo=new P({props:{name:"call",anchor:"transformers.TFSegformerForImageClassification.call",parameters:[{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"labels",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = 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.TFSegformerForImageClassification.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>AutoImageProcessor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.TFSegformerForImageClassification.call.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. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFSegformerForImageClassification.call.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFSegformerForImageClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFSegformerForImageClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_tf_segformer.py#L659",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or a tuple of <code>tf.Tensor</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/v4.25.1/en/model_doc/segformer#transformers.SegformerConfig"
>SegformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</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>tf.Tensor</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/v4.25.1/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),ht=new ps({props:{$$slots:{default:[Xp]},$$scope:{ctx:E}}}),pt=new Qo({props:{anchor:"transformers.TFSegformerForImageClassification.call.example",$$slots:{default:[Zp]},$$scope:{ctx:E}}}),Uo=new Y({}),Bo=new P({props:{name:"class transformers.TFSegformerForSemanticSegmentation",anchor:"transformers.TFSegformerForSemanticSegmentation",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFSegformerForSemanticSegmentation.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.25.1/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/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_tf_segformer.py#L790"}}),Yo=new P({props:{name:"call",anchor:"transformers.TFSegformerForSemanticSegmentation.call",parameters:[{name:"pixel_values",val:": Tensor"},{name:"labels",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = 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.TFSegformerForSemanticSegmentation.call.pixel_values",description:`<strong>pixel_values</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.25.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>AutoImageProcessor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.TFSegformerForSemanticSegmentation.call.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. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFSegformerForSemanticSegmentation.call.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFSegformerForSemanticSegmentation.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFSegformerForSemanticSegmentation.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFSegformerForSemanticSegmentation.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</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 (per-pixel) classification loss is computed
(Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/segformer/modeling_tf_segformer.py#L816",returnDescription:`
<p>A <code>transformers.modeling_tf_outputs.TFSemanticSegmenterOutput</code> or a tuple of <code>tf.Tensor</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/v4.25.1/en/model_doc/segformer#transformers.SegformerConfig"
>SegformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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.modeling_tf_outputs.TFSemanticSegmenterOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),_t=new ps({props:{$$slots:{default:[Qp]},$$scope:{ctx:E}}}),vt=new Qo({props:{anchor:"transformers.TFSegformerForSemanticSegmentation.call.example",$$slots:{default:[eu]},$$scope:{ctx:E}}}),{c(){f=r("meta"),b=c(),_=r("h1"),p=r("a"),v=r("span"),S(d.$$.fragment),h=c(),I=r("span"),ti=n("SegFormer"),La=c(),ue=r("h2"),Re=r("a"),us=r("span"),S(Mt.$$.fragment),oi=c(),_s=r("span"),ri=n("Overview"),Ra=c(),He=r("p"),si=n("The SegFormer model was proposed in "),zt=r("a"),ai=n("SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers"),ni=n(` 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.`),Ha=c(),or=r("p"),ii=n("The abstract from the paper is the following:"),Wa=c(),rr=r("p"),vs=r("em"),li=n(`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.`),Ua=c(),We=r("p"),di=n("The figure below illustrates the architecture of SegFormer. Taken from the "),jt=r("a"),ci=n("original paper"),mi=n("."),Ba=c(),Dt=r("img"),Va=c(),J=r("p"),fi=n("This model was contributed by "),At=r("a"),gi=n("nielsr"),hi=n(`. The TensorFlow version
of the model was contributed by `),qt=r("a"),pi=n("sayakpaul"),ui=n(". The original code can be found "),Nt=r("a"),_i=n("here"),vi=n("."),Ga=c(),sr=r("p"),bi=n("Tips:"),Ka=c(),k=r("ul"),H=r("li"),Si=n(`SegFormer consists of a hierarchical Transformer encoder, and a lightweight all-MLP decoder head.
`),ar=r("a"),wi=n("SegformerModel"),Ti=n(` is the hierarchical Transformer encoder (which in the paper is also referred to
as Mix Transformer or MiT). `),nr=r("a"),$i=n("SegformerForSemanticSegmentation"),yi=n(` adds the all-MLP decoder head on
top to perform semantic segmentation of images. In addition, there\u2019s
`),ir=r("a"),Fi=n("SegformerForImageClassification"),Ei=n(` 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 `),Ot=r("a"),Ii=n("hub"),xi=n("."),Pi=c(),_e=r("li"),ki=n("The quickest way to get started with SegFormer is by checking the "),Lt=r("a"),Ci=n("example notebooks"),Mi=n(` (which showcase both inference and
fine-tuning on custom data). One can also check out the `),Rt=r("a"),zi=n("blog post"),ji=n(" introducing SegFormer and illustrating how it can be fine-tuned on custom data."),Di=c(),Ht=r("li"),Ai=n("TensorFlow users should refer to "),Wt=r("a"),qi=n("this repository"),Ni=n(" that shows off-the-shelf inference and fine-tuning."),Oi=c(),Ut=r("li"),Li=n("One can also check out "),Bt=r("a"),Ri=n("this interactive demo on Hugging Face Spaces"),Hi=n(`
to try out a SegFormer model on custom images.`),Wi=c(),Vt=r("li"),Ui=n("SegFormer works on any input size, as it pads the input to be divisible by "),bs=r("code"),Bi=n("config.patch_sizes"),Vi=n("."),Gi=c(),ve=r("li"),Ki=n("One can use "),lr=r("a"),Yi=n("SegformerImageProcessor"),Ji=n(` to prepare images and corresponding segmentation maps
for the model. Note that this image processor 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 `),Gt=r("a"),Xi=n("here"),Zi=n(`. 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.`),Qi=c(),x=r("li"),el=n("One additional thing to keep in mind is that one can initialize "),dr=r("a"),tl=n("SegformerImageProcessor"),ol=n(` with
`),Ss=r("code"),rl=n("reduce_labels"),sl=n(" set to "),ws=r("code"),al=n("True"),nl=n(" or "),Ts=r("code"),il=n("False"),ll=n(`. 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, `),$s=r("code"),dl=n("reduce_labels"),cl=n(` 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 `),ys=r("em"),ml=n("ignore_index"),fl=n(` of the loss function
used by `),cr=r("a"),gl=n("SegformerForSemanticSegmentation"),hl=n(`). However, other datasets use the 0 index as
background class and include this class as part of all labels. In that case, `),Fs=r("code"),pl=n("reduce_labels"),ul=n(` should be set to
`),Es=r("code"),_l=n("False"),vl=n(", as loss should also be computed for the background class."),bl=c(),Kt=r("li"),Sl=n(`As most models, SegFormer comes in different sizes, the details of which can be found in the table below
(taken from Table 7 of the `),Yt=r("a"),wl=n("original paper"),Tl=n(")."),Ya=c(),Ue=r("table"),Is=r("thead"),z=r("tr"),mr=r("th"),xs=r("strong"),$l=n("Model variant"),yl=c(),Ps=r("th"),ks=r("strong"),Fl=n("Depths"),El=c(),Cs=r("th"),Ms=r("strong"),Il=n("Hidden sizes"),xl=c(),fr=r("th"),zs=r("strong"),Pl=n("Decoder hidden size"),kl=c(),gr=r("th"),js=r("strong"),Cl=n("Params (M)"),Ml=c(),hr=r("th"),Ds=r("strong"),zl=n("ImageNet-1k Top 1"),jl=c(),j=r("tbody"),D=r("tr"),pr=r("td"),Dl=n("MiT-b0"),Al=c(),As=r("td"),ql=n("[2, 2, 2, 2]"),Nl=c(),qs=r("td"),Ol=n("[32, 64, 160, 256]"),Ll=c(),ur=r("td"),Rl=n("256"),Hl=c(),_r=r("td"),Wl=n("3.7"),Ul=c(),vr=r("td"),Bl=n("70.5"),Vl=c(),A=r("tr"),br=r("td"),Gl=n("MiT-b1"),Kl=c(),Ns=r("td"),Yl=n("[2, 2, 2, 2]"),Jl=c(),Os=r("td"),Xl=n("[64, 128, 320, 512]"),Zl=c(),Sr=r("td"),Ql=n("256"),ed=c(),wr=r("td"),td=n("14.0"),od=c(),Tr=r("td"),rd=n("78.7"),sd=c(),q=r("tr"),$r=r("td"),ad=n("MiT-b2"),nd=c(),Ls=r("td"),id=n("[3, 4, 6, 3]"),ld=c(),Rs=r("td"),dd=n("[64, 128, 320, 512]"),cd=c(),yr=r("td"),md=n("768"),fd=c(),Fr=r("td"),gd=n("25.4"),hd=c(),Er=r("td"),pd=n("81.6"),ud=c(),N=r("tr"),Ir=r("td"),_d=n("MiT-b3"),vd=c(),Hs=r("td"),bd=n("[3, 4, 18, 3]"),Sd=c(),Ws=r("td"),wd=n("[64, 128, 320, 512]"),Td=c(),xr=r("td"),$d=n("768"),yd=c(),Pr=r("td"),Fd=n("45.2"),Ed=c(),kr=r("td"),Id=n("83.1"),xd=c(),O=r("tr"),Cr=r("td"),Pd=n("MiT-b4"),kd=c(),Us=r("td"),Cd=n("[3, 8, 27, 3]"),Md=c(),Bs=r("td"),zd=n("[64, 128, 320, 512]"),jd=c(),Mr=r("td"),Dd=n("768"),Ad=c(),zr=r("td"),qd=n("62.6"),Nd=c(),jr=r("td"),Od=n("83.6"),Ld=c(),L=r("tr"),Dr=r("td"),Rd=n("MiT-b5"),Hd=c(),Vs=r("td"),Wd=n("[3, 6, 40, 3]"),Ud=c(),Gs=r("td"),Bd=n("[64, 128, 320, 512]"),Vd=c(),Ar=r("td"),Gd=n("768"),Kd=c(),qr=r("td"),Yd=n("82.0"),Jd=c(),Nr=r("td"),Xd=n("83.8"),Ja=c(),Be=r("p"),Zd=n(`Note that MiT in the above table refers to the Mix Transformer encoder backbone introduced in SegFormer. For
SegFormer\u2019s results on the segmentation datasets like ADE20k, refer to the `),Jt=r("a"),Qd=n("paper"),ec=n("."),Xa=c(),be=r("h2"),Ve=r("a"),Ks=r("span"),S(Xt.$$.fragment),tc=c(),Ys=r("span"),oc=n("SegformerConfig"),Za=c(),W=r("div"),S(Zt.$$.fragment),rc=c(),Se=r("p"),sc=n("This is the configuration class to store the configuration of a "),Or=r("a"),ac=n("SegformerModel"),nc=n(`. 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
`),Qt=r("a"),ic=n("nvidia/segformer-b0-finetuned-ade-512-512"),lc=n(`
architecture.`),dc=c(),we=r("p"),cc=n("Configuration objects inherit from "),Lr=r("a"),mc=n("PretrainedConfig"),fc=n(` and can be used to control the model outputs. Read the
documentation from `),Rr=r("a"),gc=n("PretrainedConfig"),hc=n(" for more information."),pc=c(),S(Ge.$$.fragment),Qa=c(),Te=r("h2"),Ke=r("a"),Js=r("span"),S(eo.$$.fragment),uc=c(),Xs=r("span"),_c=n("SegformerFeatureExtractor"),en=c(),U=r("div"),S(to.$$.fragment),vc=c(),Zs=r("p"),bc=n("Constructs a Segformer image processor."),Sc=c(),ge=r("div"),S(oo.$$.fragment),wc=c(),Qs=r("p"),Tc=n("Preprocesses a batch of images and optionally segmentation maps."),$c=c(),$e=r("p"),yc=n("Overrides the "),ea=r("code"),Fc=n("__call__"),Ec=n(" method of the "),ta=r("code"),Ic=n("Preprocessor"),xc=n(` class so that both images and segmentation maps can be
passed in as positional arguments.`),Pc=c(),Ye=r("div"),S(ro.$$.fragment),kc=c(),so=r("p"),Cc=n("Converts the output of "),Hr=r("a"),Mc=n("SegformerForSemanticSegmentation"),zc=n(` into semantic segmentation maps. Only supports
PyTorch.`),tn=c(),ye=r("h2"),Je=r("a"),oa=r("span"),S(ao.$$.fragment),jc=c(),ra=r("span"),Dc=n("SegformerImageProcessor"),on=c(),B=r("div"),S(no.$$.fragment),Ac=c(),sa=r("p"),qc=n("Constructs a Segformer image processor."),Nc=c(),Xe=r("div"),S(io.$$.fragment),Oc=c(),aa=r("p"),Lc=n("Preprocess an image or batch of images."),Rc=c(),Ze=r("div"),S(lo.$$.fragment),Hc=c(),co=r("p"),Wc=n("Converts the output of "),Wr=r("a"),Uc=n("SegformerForSemanticSegmentation"),Bc=n(` into semantic segmentation maps. Only supports
PyTorch.`),rn=c(),Fe=r("h2"),Qe=r("a"),na=r("span"),S(mo.$$.fragment),Vc=c(),ia=r("span"),Gc=n("SegformerModel"),sn=c(),me=r("div"),S(fo.$$.fragment),Kc=c(),go=r("p"),Yc=n(`The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ho=r("a"),Jc=n("torch.nn.Module"),Xc=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Zc=c(),X=r("div"),S(po.$$.fragment),Qc=c(),Ee=r("p"),em=n("The "),Ur=r("a"),tm=n("SegformerModel"),om=n(" forward method, overrides the "),la=r("code"),rm=n("__call__"),sm=n(" special method."),am=c(),S(et.$$.fragment),nm=c(),S(tt.$$.fragment),an=c(),Ie=r("h2"),ot=r("a"),da=r("span"),S(uo.$$.fragment),im=c(),ca=r("span"),lm=n("SegformerDecodeHead"),nn=c(),xe=r("div"),S(_o.$$.fragment),dm=c(),Br=r("div"),S(vo.$$.fragment),ln=c(),Pe=r("h2"),rt=r("a"),ma=r("span"),S(bo.$$.fragment),cm=c(),fa=r("span"),mm=n("SegformerForImageClassification"),dn=c(),V=r("div"),S(So.$$.fragment),fm=c(),ga=r("p"),gm=n(`SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden
states) e.g. for ImageNet.`),hm=c(),wo=r("p"),pm=n("This model is a PyTorch "),To=r("a"),um=n("torch.nn.Module"),_m=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),vm=c(),Z=r("div"),S($o.$$.fragment),bm=c(),ke=r("p"),Sm=n("The "),Vr=r("a"),wm=n("SegformerForImageClassification"),Tm=n(" forward method, overrides the "),ha=r("code"),$m=n("__call__"),ym=n(" special method."),Fm=c(),S(st.$$.fragment),Em=c(),S(at.$$.fragment),cn=c(),Ce=r("h2"),nt=r("a"),pa=r("span"),S(yo.$$.fragment),Im=c(),ua=r("span"),xm=n("SegformerForSemanticSegmentation"),mn=c(),fe=r("div"),S(Fo.$$.fragment),Pm=c(),Eo=r("p"),km=n(`SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
This model is a PyTorch `),Io=r("a"),Cm=n("torch.nn.Module"),Mm=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),zm=c(),Q=r("div"),S(xo.$$.fragment),jm=c(),Me=r("p"),Dm=n("The "),Gr=r("a"),Am=n("SegformerForSemanticSegmentation"),qm=n(" forward method, overrides the "),_a=r("code"),Nm=n("__call__"),Om=n(" special method."),Lm=c(),S(it.$$.fragment),Rm=c(),S(lt.$$.fragment),fn=c(),ze=r("h2"),dt=r("a"),va=r("span"),S(Po.$$.fragment),Hm=c(),ba=r("span"),Wm=n("TFSegformerDecodeHead"),gn=c(),je=r("div"),S(ko.$$.fragment),Um=c(),Kr=r("div"),S(Co.$$.fragment),hn=c(),De=r("h2"),ct=r("a"),Sa=r("span"),S(Mo.$$.fragment),Bm=c(),wa=r("span"),Vm=n("TFSegformerModel"),pn=c(),G=r("div"),S(zo.$$.fragment),Gm=c(),jo=r("p"),Km=n(`The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
This model inherits from `),Yr=r("a"),Ym=n("TFPreTrainedModel"),Jm=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Xm=c(),Do=r("p"),Zm=n("This model is also a "),Ao=r("a"),Qm=n("tf.keras.Model"),ef=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),tf=c(),ee=r("div"),S(qo.$$.fragment),of=c(),Ae=r("p"),rf=n("The "),Jr=r("a"),sf=n("TFSegformerModel"),af=n(" forward method, overrides the "),Ta=r("code"),nf=n("__call__"),lf=n(" special method."),df=c(),S(mt.$$.fragment),cf=c(),S(ft.$$.fragment),un=c(),qe=r("h2"),gt=r("a"),$a=r("span"),S(No.$$.fragment),mf=c(),ya=r("span"),ff=n("TFSegformerForImageClassification"),_n=c(),R=r("div"),S(Oo.$$.fragment),gf=c(),Fa=r("p"),hf=n(`SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden
states) e.g. for ImageNet.`),pf=c(),Lo=r("p"),uf=n("This model inherits from "),Xr=r("a"),_f=n("TFPreTrainedModel"),vf=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),bf=c(),Ro=r("p"),Sf=n("This model is also a "),Ho=r("a"),wf=n("tf.keras.Model"),Tf=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),$f=c(),te=r("div"),S(Wo.$$.fragment),yf=c(),Ne=r("p"),Ff=n("The "),Zr=r("a"),Ef=n("TFSegformerForImageClassification"),If=n(" forward method, overrides the "),Ea=r("code"),xf=n("__call__"),Pf=n(" special method."),kf=c(),S(ht.$$.fragment),Cf=c(),S(pt.$$.fragment),vn=c(),Oe=r("h2"),ut=r("a"),Ia=r("span"),S(Uo.$$.fragment),Mf=c(),xa=r("span"),zf=n("TFSegformerForSemanticSegmentation"),bn=c(),K=r("div"),S(Bo.$$.fragment),jf=c(),Vo=r("p"),Df=n(`SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
This model inherits from `),Qr=r("a"),Af=n("TFPreTrainedModel"),qf=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Nf=c(),Go=r("p"),Of=n("This model is also a "),Ko=r("a"),Lf=n("tf.keras.Model"),Rf=n(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Hf=c(),oe=r("div"),S(Yo.$$.fragment),Wf=c(),Le=r("p"),Uf=n("The "),es=r("a"),Bf=n("TFSegformerForSemanticSegmentation"),Vf=n(" forward method, overrides the "),Pa=r("code"),Gf=n("__call__"),Kf=n(" special method."),Yf=c(),S(_t.$$.fragment),Jf=c(),S(vt.$$.fragment),this.h()},l(o){const g=Op('[data-svelte="svelte-1phssyn"]',document.head);f=s(g,"META",{name:!0,content:!0}),g.forEach(t),b=m(o),_=s(o,"H1",{class:!0});var Jo=a(_);p=s(Jo,"A",{id:!0,class:!0,href:!0});var ka=a(p);v=s(ka,"SPAN",{});var Ca=a(v);w(d.$$.fragment,Ca),Ca.forEach(t),ka.forEach(t),h=m(Jo),I=s(Jo,"SPAN",{});var Ma=a(I);ti=i(Ma,"SegFormer"),Ma.forEach(t),Jo.forEach(t),La=m(o),ue=s(o,"H2",{class:!0});var Xo=a(ue);Re=s(Xo,"A",{id:!0,class:!0,href:!0});var za=a(Re);us=s(za,"SPAN",{});var ja=a(us);w(Mt.$$.fragment,ja),ja.forEach(t),za.forEach(t),oi=m(Xo),_s=s(Xo,"SPAN",{});var Da=a(_s);ri=i(Da,"Overview"),Da.forEach(t),Xo.forEach(t),Ra=m(o),He=s(o,"P",{});var Zo=a(He);si=i(Zo,"The SegFormer model was proposed in "),zt=s(Zo,"A",{href:!0,rel:!0});var Aa=a(zt);ai=i(Aa,"SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers"),Aa.forEach(t),ni=i(Zo,` 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.`),Zo.forEach(t),Ha=m(o),or=s(o,"P",{});var qa=a(or);ii=i(qa,"The abstract from the paper is the following:"),qa.forEach(t),Wa=m(o),rr=s(o,"P",{});var Na=a(rr);vs=s(Na,"EM",{});var Oa=a(vs);li=i(Oa,`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.`),Oa.forEach(t),Na.forEach(t),Ua=m(o),We=s(o,"P",{});var wn=a(We);di=i(wn,"The figure below illustrates the architecture of SegFormer. Taken from the "),jt=s(wn,"A",{href:!0,rel:!0});var Zf=a(jt);ci=i(Zf,"original paper"),Zf.forEach(t),mi=i(wn,"."),wn.forEach(t),Ba=m(o),Dt=s(o,"IMG",{width:!0,src:!0}),Va=m(o),J=s(o,"P",{});var bt=a(J);fi=i(bt,"This model was contributed by "),At=s(bt,"A",{href:!0,rel:!0});var Qf=a(At);gi=i(Qf,"nielsr"),Qf.forEach(t),hi=i(bt,`. The TensorFlow version
of the model was contributed by `),qt=s(bt,"A",{href:!0,rel:!0});var eg=a(qt);pi=i(eg,"sayakpaul"),eg.forEach(t),ui=i(bt,". The original code can be found "),Nt=s(bt,"A",{href:!0,rel:!0});var tg=a(Nt);_i=i(tg,"here"),tg.forEach(t),vi=i(bt,"."),bt.forEach(t),Ga=m(o),sr=s(o,"P",{});var og=a(sr);bi=i(og,"Tips:"),og.forEach(t),Ka=m(o),k=s(o,"UL",{});var M=a(k);H=s(M,"LI",{});var he=a(H);Si=i(he,`SegFormer consists of a hierarchical Transformer encoder, and a lightweight all-MLP decoder head.
`),ar=s(he,"A",{href:!0});var rg=a(ar);wi=i(rg,"SegformerModel"),rg.forEach(t),Ti=i(he,` is the hierarchical Transformer encoder (which in the paper is also referred to
as Mix Transformer or MiT). `),nr=s(he,"A",{href:!0});var sg=a(nr);$i=i(sg,"SegformerForSemanticSegmentation"),sg.forEach(t),yi=i(he,` adds the all-MLP decoder head on
top to perform semantic segmentation of images. In addition, there\u2019s
`),ir=s(he,"A",{href:!0});var ag=a(ir);Fi=i(ag,"SegformerForImageClassification"),ag.forEach(t),Ei=i(he,` 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 `),Ot=s(he,"A",{href:!0,rel:!0});var ng=a(Ot);Ii=i(ng,"hub"),ng.forEach(t),xi=i(he,"."),he.forEach(t),Pi=m(M),_e=s(M,"LI",{});var ts=a(_e);ki=i(ts,"The quickest way to get started with SegFormer is by checking the "),Lt=s(ts,"A",{href:!0,rel:!0});var ig=a(Lt);Ci=i(ig,"example notebooks"),ig.forEach(t),Mi=i(ts,` (which showcase both inference and
fine-tuning on custom data). One can also check out the `),Rt=s(ts,"A",{href:!0,rel:!0});var lg=a(Rt);zi=i(lg,"blog post"),lg.forEach(t),ji=i(ts," introducing SegFormer and illustrating how it can be fine-tuned on custom data."),ts.forEach(t),Di=m(M),Ht=s(M,"LI",{});var Tn=a(Ht);Ai=i(Tn,"TensorFlow users should refer to "),Wt=s(Tn,"A",{href:!0,rel:!0});var dg=a(Wt);qi=i(dg,"this repository"),dg.forEach(t),Ni=i(Tn," that shows off-the-shelf inference and fine-tuning."),Tn.forEach(t),Oi=m(M),Ut=s(M,"LI",{});var $n=a(Ut);Li=i($n,"One can also check out "),Bt=s($n,"A",{href:!0,rel:!0});var cg=a(Bt);Ri=i(cg,"this interactive demo on Hugging Face Spaces"),cg.forEach(t),Hi=i($n,`
to try out a SegFormer model on custom images.`),$n.forEach(t),Wi=m(M),Vt=s(M,"LI",{});var yn=a(Vt);Ui=i(yn,"SegFormer works on any input size, as it pads the input to be divisible by "),bs=s(yn,"CODE",{});var mg=a(bs);Bi=i(mg,"config.patch_sizes"),mg.forEach(t),Vi=i(yn,"."),yn.forEach(t),Gi=m(M),ve=s(M,"LI",{});var os=a(ve);Ki=i(os,"One can use "),lr=s(os,"A",{href:!0});var fg=a(lr);Yi=i(fg,"SegformerImageProcessor"),fg.forEach(t),Ji=i(os,` to prepare images and corresponding segmentation maps
for the model. Note that this image processor 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 `),Gt=s(os,"A",{href:!0,rel:!0});var gg=a(Gt);Xi=i(gg,"here"),gg.forEach(t),Zi=i(os,`. 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.`),os.forEach(t),Qi=m(M),x=s(M,"LI",{});var C=a(x);el=i(C,"One additional thing to keep in mind is that one can initialize "),dr=s(C,"A",{href:!0});var hg=a(dr);tl=i(hg,"SegformerImageProcessor"),hg.forEach(t),ol=i(C,` with
`),Ss=s(C,"CODE",{});var pg=a(Ss);rl=i(pg,"reduce_labels"),pg.forEach(t),sl=i(C," set to "),ws=s(C,"CODE",{});var ug=a(ws);al=i(ug,"True"),ug.forEach(t),nl=i(C," or "),Ts=s(C,"CODE",{});var _g=a(Ts);il=i(_g,"False"),_g.forEach(t),ll=i(C,`. 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, `),$s=s(C,"CODE",{});var vg=a($s);dl=i(vg,"reduce_labels"),vg.forEach(t),cl=i(C,` 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 `),ys=s(C,"EM",{});var bg=a(ys);ml=i(bg,"ignore_index"),bg.forEach(t),fl=i(C,` of the loss function
used by `),cr=s(C,"A",{href:!0});var Sg=a(cr);gl=i(Sg,"SegformerForSemanticSegmentation"),Sg.forEach(t),hl=i(C,`). However, other datasets use the 0 index as
background class and include this class as part of all labels. In that case, `),Fs=s(C,"CODE",{});var wg=a(Fs);pl=i(wg,"reduce_labels"),wg.forEach(t),ul=i(C,` should be set to
`),Es=s(C,"CODE",{});var Tg=a(Es);_l=i(Tg,"False"),Tg.forEach(t),vl=i(C,", as loss should also be computed for the background class."),C.forEach(t),bl=m(M),Kt=s(M,"LI",{});var Fn=a(Kt);Sl=i(Fn,`As most models, SegFormer comes in different sizes, the details of which can be found in the table below
(taken from Table 7 of the `),Yt=s(Fn,"A",{href:!0,rel:!0});var $g=a(Yt);wl=i($g,"original paper"),$g.forEach(t),Tl=i(Fn,")."),Fn.forEach(t),M.forEach(t),Ya=m(o),Ue=s(o,"TABLE",{});var En=a(Ue);Is=s(En,"THEAD",{});var yg=a(Is);z=s(yg,"TR",{});var re=a(z);mr=s(re,"TH",{align:!0});var Fg=a(mr);xs=s(Fg,"STRONG",{});var Eg=a(xs);$l=i(Eg,"Model variant"),Eg.forEach(t),Fg.forEach(t),yl=m(re),Ps=s(re,"TH",{});var Ig=a(Ps);ks=s(Ig,"STRONG",{});var xg=a(ks);Fl=i(xg,"Depths"),xg.forEach(t),Ig.forEach(t),El=m(re),Cs=s(re,"TH",{});var Pg=a(Cs);Ms=s(Pg,"STRONG",{});var kg=a(Ms);Il=i(kg,"Hidden sizes"),kg.forEach(t),Pg.forEach(t),xl=m(re),fr=s(re,"TH",{align:!0});var Cg=a(fr);zs=s(Cg,"STRONG",{});var Mg=a(zs);Pl=i(Mg,"Decoder hidden size"),Mg.forEach(t),Cg.forEach(t),kl=m(re),gr=s(re,"TH",{align:!0});var zg=a(gr);js=s(zg,"STRONG",{});var jg=a(js);Cl=i(jg,"Params (M)"),jg.forEach(t),zg.forEach(t),Ml=m(re),hr=s(re,"TH",{align:!0});var Dg=a(hr);Ds=s(Dg,"STRONG",{});var Ag=a(Ds);zl=i(Ag,"ImageNet-1k Top 1"),Ag.forEach(t),Dg.forEach(t),re.forEach(t),yg.forEach(t),jl=m(En),j=s(En,"TBODY",{});var se=a(j);D=s(se,"TR",{});var ae=a(D);pr=s(ae,"TD",{align:!0});var qg=a(pr);Dl=i(qg,"MiT-b0"),qg.forEach(t),Al=m(ae),As=s(ae,"TD",{});var Ng=a(As);ql=i(Ng,"[2, 2, 2, 2]"),Ng.forEach(t),Nl=m(ae),qs=s(ae,"TD",{});var Og=a(qs);Ol=i(Og,"[32, 64, 160, 256]"),Og.forEach(t),Ll=m(ae),ur=s(ae,"TD",{align:!0});var Lg=a(ur);Rl=i(Lg,"256"),Lg.forEach(t),Hl=m(ae),_r=s(ae,"TD",{align:!0});var Rg=a(_r);Wl=i(Rg,"3.7"),Rg.forEach(t),Ul=m(ae),vr=s(ae,"TD",{align:!0});var Hg=a(vr);Bl=i(Hg,"70.5"),Hg.forEach(t),ae.forEach(t),Vl=m(se),A=s(se,"TR",{});var ne=a(A);br=s(ne,"TD",{align:!0});var Wg=a(br);Gl=i(Wg,"MiT-b1"),Wg.forEach(t),Kl=m(ne),Ns=s(ne,"TD",{});var Ug=a(Ns);Yl=i(Ug,"[2, 2, 2, 2]"),Ug.forEach(t),Jl=m(ne),Os=s(ne,"TD",{});var Bg=a(Os);Xl=i(Bg,"[64, 128, 320, 512]"),Bg.forEach(t),Zl=m(ne),Sr=s(ne,"TD",{align:!0});var Vg=a(Sr);Ql=i(Vg,"256"),Vg.forEach(t),ed=m(ne),wr=s(ne,"TD",{align:!0});var Gg=a(wr);td=i(Gg,"14.0"),Gg.forEach(t),od=m(ne),Tr=s(ne,"TD",{align:!0});var Kg=a(Tr);rd=i(Kg,"78.7"),Kg.forEach(t),ne.forEach(t),sd=m(se),q=s(se,"TR",{});var ie=a(q);$r=s(ie,"TD",{align:!0});var Yg=a($r);ad=i(Yg,"MiT-b2"),Yg.forEach(t),nd=m(ie),Ls=s(ie,"TD",{});var Jg=a(Ls);id=i(Jg,"[3, 4, 6, 3]"),Jg.forEach(t),ld=m(ie),Rs=s(ie,"TD",{});var Xg=a(Rs);dd=i(Xg,"[64, 128, 320, 512]"),Xg.forEach(t),cd=m(ie),yr=s(ie,"TD",{align:!0});var Zg=a(yr);md=i(Zg,"768"),Zg.forEach(t),fd=m(ie),Fr=s(ie,"TD",{align:!0});var Qg=a(Fr);gd=i(Qg,"25.4"),Qg.forEach(t),hd=m(ie),Er=s(ie,"TD",{align:!0});var eh=a(Er);pd=i(eh,"81.6"),eh.forEach(t),ie.forEach(t),ud=m(se),N=s(se,"TR",{});var le=a(N);Ir=s(le,"TD",{align:!0});var th=a(Ir);_d=i(th,"MiT-b3"),th.forEach(t),vd=m(le),Hs=s(le,"TD",{});var oh=a(Hs);bd=i(oh,"[3, 4, 18, 3]"),oh.forEach(t),Sd=m(le),Ws=s(le,"TD",{});var rh=a(Ws);wd=i(rh,"[64, 128, 320, 512]"),rh.forEach(t),Td=m(le),xr=s(le,"TD",{align:!0});var sh=a(xr);$d=i(sh,"768"),sh.forEach(t),yd=m(le),Pr=s(le,"TD",{align:!0});var ah=a(Pr);Fd=i(ah,"45.2"),ah.forEach(t),Ed=m(le),kr=s(le,"TD",{align:!0});var nh=a(kr);Id=i(nh,"83.1"),nh.forEach(t),le.forEach(t),xd=m(se),O=s(se,"TR",{});var de=a(O);Cr=s(de,"TD",{align:!0});var ih=a(Cr);Pd=i(ih,"MiT-b4"),ih.forEach(t),kd=m(de),Us=s(de,"TD",{});var lh=a(Us);Cd=i(lh,"[3, 8, 27, 3]"),lh.forEach(t),Md=m(de),Bs=s(de,"TD",{});var dh=a(Bs);zd=i(dh,"[64, 128, 320, 512]"),dh.forEach(t),jd=m(de),Mr=s(de,"TD",{align:!0});var ch=a(Mr);Dd=i(ch,"768"),ch.forEach(t),Ad=m(de),zr=s(de,"TD",{align:!0});var mh=a(zr);qd=i(mh,"62.6"),mh.forEach(t),Nd=m(de),jr=s(de,"TD",{align:!0});var fh=a(jr);Od=i(fh,"83.6"),fh.forEach(t),de.forEach(t),Ld=m(se),L=s(se,"TR",{});var ce=a(L);Dr=s(ce,"TD",{align:!0});var gh=a(Dr);Rd=i(gh,"MiT-b5"),gh.forEach(t),Hd=m(ce),Vs=s(ce,"TD",{});var hh=a(Vs);Wd=i(hh,"[3, 6, 40, 3]"),hh.forEach(t),Ud=m(ce),Gs=s(ce,"TD",{});var ph=a(Gs);Bd=i(ph,"[64, 128, 320, 512]"),ph.forEach(t),Vd=m(ce),Ar=s(ce,"TD",{align:!0});var uh=a(Ar);Gd=i(uh,"768"),uh.forEach(t),Kd=m(ce),qr=s(ce,"TD",{align:!0});var _h=a(qr);Yd=i(_h,"82.0"),_h.forEach(t),Jd=m(ce),Nr=s(ce,"TD",{align:!0});var vh=a(Nr);Xd=i(vh,"83.8"),vh.forEach(t),ce.forEach(t),se.forEach(t),En.forEach(t),Ja=m(o),Be=s(o,"P",{});var In=a(Be);Zd=i(In,`Note that MiT in the above table refers to the Mix Transformer encoder backbone introduced in SegFormer. For
SegFormer\u2019s results on the segmentation datasets like ADE20k, refer to the `),Jt=s(In,"A",{href:!0,rel:!0});var bh=a(Jt);Qd=i(bh,"paper"),bh.forEach(t),ec=i(In,"."),In.forEach(t),Xa=m(o),be=s(o,"H2",{class:!0});var xn=a(be);Ve=s(xn,"A",{id:!0,class:!0,href:!0});var Sh=a(Ve);Ks=s(Sh,"SPAN",{});var wh=a(Ks);w(Xt.$$.fragment,wh),wh.forEach(t),Sh.forEach(t),tc=m(xn),Ys=s(xn,"SPAN",{});var Th=a(Ys);oc=i(Th,"SegformerConfig"),Th.forEach(t),xn.forEach(t),Za=m(o),W=s(o,"DIV",{class:!0});var St=a(W);w(Zt.$$.fragment,St),rc=m(St),Se=s(St,"P",{});var rs=a(Se);sc=i(rs,"This is the configuration class to store the configuration of a "),Or=s(rs,"A",{href:!0});var $h=a(Or);ac=i($h,"SegformerModel"),$h.forEach(t),nc=i(rs,`. 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
`),Qt=s(rs,"A",{href:!0,rel:!0});var yh=a(Qt);ic=i(yh,"nvidia/segformer-b0-finetuned-ade-512-512"),yh.forEach(t),lc=i(rs,`
architecture.`),rs.forEach(t),dc=m(St),we=s(St,"P",{});var ss=a(we);cc=i(ss,"Configuration objects inherit from "),Lr=s(ss,"A",{href:!0});var Fh=a(Lr);mc=i(Fh,"PretrainedConfig"),Fh.forEach(t),fc=i(ss,` and can be used to control the model outputs. Read the
documentation from `),Rr=s(ss,"A",{href:!0});var Eh=a(Rr);gc=i(Eh,"PretrainedConfig"),Eh.forEach(t),hc=i(ss," for more information."),ss.forEach(t),pc=m(St),w(Ge.$$.fragment,St),St.forEach(t),Qa=m(o),Te=s(o,"H2",{class:!0});var Pn=a(Te);Ke=s(Pn,"A",{id:!0,class:!0,href:!0});var Ih=a(Ke);Js=s(Ih,"SPAN",{});var xh=a(Js);w(eo.$$.fragment,xh),xh.forEach(t),Ih.forEach(t),uc=m(Pn),Xs=s(Pn,"SPAN",{});var Ph=a(Xs);_c=i(Ph,"SegformerFeatureExtractor"),Ph.forEach(t),Pn.forEach(t),en=m(o),U=s(o,"DIV",{class:!0});var wt=a(U);w(to.$$.fragment,wt),vc=m(wt),Zs=s(wt,"P",{});var kh=a(Zs);bc=i(kh,"Constructs a Segformer image processor."),kh.forEach(t),Sc=m(wt),ge=s(wt,"DIV",{class:!0});var as=a(ge);w(oo.$$.fragment,as),wc=m(as),Qs=s(as,"P",{});var Ch=a(Qs);Tc=i(Ch,"Preprocesses a batch of images and optionally segmentation maps."),Ch.forEach(t),$c=m(as),$e=s(as,"P",{});var ns=a($e);yc=i(ns,"Overrides the "),ea=s(ns,"CODE",{});var Mh=a(ea);Fc=i(Mh,"__call__"),Mh.forEach(t),Ec=i(ns," method of the "),ta=s(ns,"CODE",{});var zh=a(ta);Ic=i(zh,"Preprocessor"),zh.forEach(t),xc=i(ns,` class so that both images and segmentation maps can be
passed in as positional arguments.`),ns.forEach(t),as.forEach(t),Pc=m(wt),Ye=s(wt,"DIV",{class:!0});var kn=a(Ye);w(ro.$$.fragment,kn),kc=m(kn),so=s(kn,"P",{});var Cn=a(so);Cc=i(Cn,"Converts the output of "),Hr=s(Cn,"A",{href:!0});var jh=a(Hr);Mc=i(jh,"SegformerForSemanticSegmentation"),jh.forEach(t),zc=i(Cn,` into semantic segmentation maps. Only supports
PyTorch.`),Cn.forEach(t),kn.forEach(t),wt.forEach(t),tn=m(o),ye=s(o,"H2",{class:!0});var Mn=a(ye);Je=s(Mn,"A",{id:!0,class:!0,href:!0});var Dh=a(Je);oa=s(Dh,"SPAN",{});var Ah=a(oa);w(ao.$$.fragment,Ah),Ah.forEach(t),Dh.forEach(t),jc=m(Mn),ra=s(Mn,"SPAN",{});var qh=a(ra);Dc=i(qh,"SegformerImageProcessor"),qh.forEach(t),Mn.forEach(t),on=m(o),B=s(o,"DIV",{class:!0});var Tt=a(B);w(no.$$.fragment,Tt),Ac=m(Tt),sa=s(Tt,"P",{});var Nh=a(sa);qc=i(Nh,"Constructs a Segformer image processor."),Nh.forEach(t),Nc=m(Tt),Xe=s(Tt,"DIV",{class:!0});var zn=a(Xe);w(io.$$.fragment,zn),Oc=m(zn),aa=s(zn,"P",{});var Oh=a(aa);Lc=i(Oh,"Preprocess an image or batch of images."),Oh.forEach(t),zn.forEach(t),Rc=m(Tt),Ze=s(Tt,"DIV",{class:!0});var jn=a(Ze);w(lo.$$.fragment,jn),Hc=m(jn),co=s(jn,"P",{});var Dn=a(co);Wc=i(Dn,"Converts the output of "),Wr=s(Dn,"A",{href:!0});var Lh=a(Wr);Uc=i(Lh,"SegformerForSemanticSegmentation"),Lh.forEach(t),Bc=i(Dn,` into semantic segmentation maps. Only supports
PyTorch.`),Dn.forEach(t),jn.forEach(t),Tt.forEach(t),rn=m(o),Fe=s(o,"H2",{class:!0});var An=a(Fe);Qe=s(An,"A",{id:!0,class:!0,href:!0});var Rh=a(Qe);na=s(Rh,"SPAN",{});var Hh=a(na);w(mo.$$.fragment,Hh),Hh.forEach(t),Rh.forEach(t),Vc=m(An),ia=s(An,"SPAN",{});var Wh=a(ia);Gc=i(Wh,"SegformerModel"),Wh.forEach(t),An.forEach(t),sn=m(o),me=s(o,"DIV",{class:!0});var is=a(me);w(fo.$$.fragment,is),Kc=m(is),go=s(is,"P",{});var qn=a(go);Yc=i(qn,`The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ho=s(qn,"A",{href:!0,rel:!0});var Uh=a(ho);Jc=i(Uh,"torch.nn.Module"),Uh.forEach(t),Xc=i(qn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),qn.forEach(t),Zc=m(is),X=s(is,"DIV",{class:!0});var $t=a(X);w(po.$$.fragment,$t),Qc=m($t),Ee=s($t,"P",{});var ls=a(Ee);em=i(ls,"The "),Ur=s(ls,"A",{href:!0});var Bh=a(Ur);tm=i(Bh,"SegformerModel"),Bh.forEach(t),om=i(ls," forward method, overrides the "),la=s(ls,"CODE",{});var Vh=a(la);rm=i(Vh,"__call__"),Vh.forEach(t),sm=i(ls," special method."),ls.forEach(t),am=m($t),w(et.$$.fragment,$t),nm=m($t),w(tt.$$.fragment,$t),$t.forEach(t),is.forEach(t),an=m(o),Ie=s(o,"H2",{class:!0});var Nn=a(Ie);ot=s(Nn,"A",{id:!0,class:!0,href:!0});var Gh=a(ot);da=s(Gh,"SPAN",{});var Kh=a(da);w(uo.$$.fragment,Kh),Kh.forEach(t),Gh.forEach(t),im=m(Nn),ca=s(Nn,"SPAN",{});var Yh=a(ca);lm=i(Yh,"SegformerDecodeHead"),Yh.forEach(t),Nn.forEach(t),nn=m(o),xe=s(o,"DIV",{class:!0});var On=a(xe);w(_o.$$.fragment,On),dm=m(On),Br=s(On,"DIV",{class:!0});var Jh=a(Br);w(vo.$$.fragment,Jh),Jh.forEach(t),On.forEach(t),ln=m(o),Pe=s(o,"H2",{class:!0});var Ln=a(Pe);rt=s(Ln,"A",{id:!0,class:!0,href:!0});var Xh=a(rt);ma=s(Xh,"SPAN",{});var Zh=a(ma);w(bo.$$.fragment,Zh),Zh.forEach(t),Xh.forEach(t),cm=m(Ln),fa=s(Ln,"SPAN",{});var Qh=a(fa);mm=i(Qh,"SegformerForImageClassification"),Qh.forEach(t),Ln.forEach(t),dn=m(o),V=s(o,"DIV",{class:!0});var yt=a(V);w(So.$$.fragment,yt),fm=m(yt),ga=s(yt,"P",{});var ep=a(ga);gm=i(ep,`SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden
states) e.g. for ImageNet.`),ep.forEach(t),hm=m(yt),wo=s(yt,"P",{});var Rn=a(wo);pm=i(Rn,"This model is a PyTorch "),To=s(Rn,"A",{href:!0,rel:!0});var tp=a(To);um=i(tp,"torch.nn.Module"),tp.forEach(t),_m=i(Rn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Rn.forEach(t),vm=m(yt),Z=s(yt,"DIV",{class:!0});var Ft=a(Z);w($o.$$.fragment,Ft),bm=m(Ft),ke=s(Ft,"P",{});var ds=a(ke);Sm=i(ds,"The "),Vr=s(ds,"A",{href:!0});var op=a(Vr);wm=i(op,"SegformerForImageClassification"),op.forEach(t),Tm=i(ds," forward method, overrides the "),ha=s(ds,"CODE",{});var rp=a(ha);$m=i(rp,"__call__"),rp.forEach(t),ym=i(ds," special method."),ds.forEach(t),Fm=m(Ft),w(st.$$.fragment,Ft),Em=m(Ft),w(at.$$.fragment,Ft),Ft.forEach(t),yt.forEach(t),cn=m(o),Ce=s(o,"H2",{class:!0});var Hn=a(Ce);nt=s(Hn,"A",{id:!0,class:!0,href:!0});var sp=a(nt);pa=s(sp,"SPAN",{});var ap=a(pa);w(yo.$$.fragment,ap),ap.forEach(t),sp.forEach(t),Im=m(Hn),ua=s(Hn,"SPAN",{});var np=a(ua);xm=i(np,"SegformerForSemanticSegmentation"),np.forEach(t),Hn.forEach(t),mn=m(o),fe=s(o,"DIV",{class:!0});var cs=a(fe);w(Fo.$$.fragment,cs),Pm=m(cs),Eo=s(cs,"P",{});var Wn=a(Eo);km=i(Wn,`SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
This model is a PyTorch `),Io=s(Wn,"A",{href:!0,rel:!0});var ip=a(Io);Cm=i(ip,"torch.nn.Module"),ip.forEach(t),Mm=i(Wn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Wn.forEach(t),zm=m(cs),Q=s(cs,"DIV",{class:!0});var Et=a(Q);w(xo.$$.fragment,Et),jm=m(Et),Me=s(Et,"P",{});var ms=a(Me);Dm=i(ms,"The "),Gr=s(ms,"A",{href:!0});var lp=a(Gr);Am=i(lp,"SegformerForSemanticSegmentation"),lp.forEach(t),qm=i(ms," forward method, overrides the "),_a=s(ms,"CODE",{});var dp=a(_a);Nm=i(dp,"__call__"),dp.forEach(t),Om=i(ms," special method."),ms.forEach(t),Lm=m(Et),w(it.$$.fragment,Et),Rm=m(Et),w(lt.$$.fragment,Et),Et.forEach(t),cs.forEach(t),fn=m(o),ze=s(o,"H2",{class:!0});var Un=a(ze);dt=s(Un,"A",{id:!0,class:!0,href:!0});var cp=a(dt);va=s(cp,"SPAN",{});var mp=a(va);w(Po.$$.fragment,mp),mp.forEach(t),cp.forEach(t),Hm=m(Un),ba=s(Un,"SPAN",{});var fp=a(ba);Wm=i(fp,"TFSegformerDecodeHead"),fp.forEach(t),Un.forEach(t),gn=m(o),je=s(o,"DIV",{class:!0});var Bn=a(je);w(ko.$$.fragment,Bn),Um=m(Bn),Kr=s(Bn,"DIV",{class:!0});var gp=a(Kr);w(Co.$$.fragment,gp),gp.forEach(t),Bn.forEach(t),hn=m(o),De=s(o,"H2",{class:!0});var Vn=a(De);ct=s(Vn,"A",{id:!0,class:!0,href:!0});var hp=a(ct);Sa=s(hp,"SPAN",{});var pp=a(Sa);w(Mo.$$.fragment,pp),pp.forEach(t),hp.forEach(t),Bm=m(Vn),wa=s(Vn,"SPAN",{});var up=a(wa);Vm=i(up,"TFSegformerModel"),up.forEach(t),Vn.forEach(t),pn=m(o),G=s(o,"DIV",{class:!0});var It=a(G);w(zo.$$.fragment,It),Gm=m(It),jo=s(It,"P",{});var Gn=a(jo);Km=i(Gn,`The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
This model inherits from `),Yr=s(Gn,"A",{href:!0});var _p=a(Yr);Ym=i(_p,"TFPreTrainedModel"),_p.forEach(t),Jm=i(Gn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Gn.forEach(t),Xm=m(It),Do=s(It,"P",{});var Kn=a(Do);Zm=i(Kn,"This model is also a "),Ao=s(Kn,"A",{href:!0,rel:!0});var vp=a(Ao);Qm=i(vp,"tf.keras.Model"),vp.forEach(t),ef=i(Kn,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Kn.forEach(t),tf=m(It),ee=s(It,"DIV",{class:!0});var xt=a(ee);w(qo.$$.fragment,xt),of=m(xt),Ae=s(xt,"P",{});var fs=a(Ae);rf=i(fs,"The "),Jr=s(fs,"A",{href:!0});var bp=a(Jr);sf=i(bp,"TFSegformerModel"),bp.forEach(t),af=i(fs," forward method, overrides the "),Ta=s(fs,"CODE",{});var Sp=a(Ta);nf=i(Sp,"__call__"),Sp.forEach(t),lf=i(fs," special method."),fs.forEach(t),df=m(xt),w(mt.$$.fragment,xt),cf=m(xt),w(ft.$$.fragment,xt),xt.forEach(t),It.forEach(t),un=m(o),qe=s(o,"H2",{class:!0});var Yn=a(qe);gt=s(Yn,"A",{id:!0,class:!0,href:!0});var wp=a(gt);$a=s(wp,"SPAN",{});var Tp=a($a);w(No.$$.fragment,Tp),Tp.forEach(t),wp.forEach(t),mf=m(Yn),ya=s(Yn,"SPAN",{});var $p=a(ya);ff=i($p,"TFSegformerForImageClassification"),$p.forEach(t),Yn.forEach(t),_n=m(o),R=s(o,"DIV",{class:!0});var pe=a(R);w(Oo.$$.fragment,pe),gf=m(pe),Fa=s(pe,"P",{});var yp=a(Fa);hf=i(yp,`SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden
states) e.g. for ImageNet.`),yp.forEach(t),pf=m(pe),Lo=s(pe,"P",{});var Jn=a(Lo);uf=i(Jn,"This model inherits from "),Xr=s(Jn,"A",{href:!0});var Fp=a(Xr);_f=i(Fp,"TFPreTrainedModel"),Fp.forEach(t),vf=i(Jn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Jn.forEach(t),bf=m(pe),Ro=s(pe,"P",{});var Xn=a(Ro);Sf=i(Xn,"This model is also a "),Ho=s(Xn,"A",{href:!0,rel:!0});var Ep=a(Ho);wf=i(Ep,"tf.keras.Model"),Ep.forEach(t),Tf=i(Xn,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),Xn.forEach(t),$f=m(pe),te=s(pe,"DIV",{class:!0});var Pt=a(te);w(Wo.$$.fragment,Pt),yf=m(Pt),Ne=s(Pt,"P",{});var gs=a(Ne);Ff=i(gs,"The "),Zr=s(gs,"A",{href:!0});var Ip=a(Zr);Ef=i(Ip,"TFSegformerForImageClassification"),Ip.forEach(t),If=i(gs," forward method, overrides the "),Ea=s(gs,"CODE",{});var xp=a(Ea);xf=i(xp,"__call__"),xp.forEach(t),Pf=i(gs," special method."),gs.forEach(t),kf=m(Pt),w(ht.$$.fragment,Pt),Cf=m(Pt),w(pt.$$.fragment,Pt),Pt.forEach(t),pe.forEach(t),vn=m(o),Oe=s(o,"H2",{class:!0});var Zn=a(Oe);ut=s(Zn,"A",{id:!0,class:!0,href:!0});var Pp=a(ut);Ia=s(Pp,"SPAN",{});var kp=a(Ia);w(Uo.$$.fragment,kp),kp.forEach(t),Pp.forEach(t),Mf=m(Zn),xa=s(Zn,"SPAN",{});var Cp=a(xa);zf=i(Cp,"TFSegformerForSemanticSegmentation"),Cp.forEach(t),Zn.forEach(t),bn=m(o),K=s(o,"DIV",{class:!0});var kt=a(K);w(Bo.$$.fragment,kt),jf=m(kt),Vo=s(kt,"P",{});var Qn=a(Vo);Df=i(Qn,`SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
This model inherits from `),Qr=s(Qn,"A",{href:!0});var Mp=a(Qr);Af=i(Mp,"TFPreTrainedModel"),Mp.forEach(t),qf=i(Qn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Qn.forEach(t),Nf=m(kt),Go=s(kt,"P",{});var ei=a(Go);Of=i(ei,"This model is also a "),Ko=s(ei,"A",{href:!0,rel:!0});var zp=a(Ko);Lf=i(zp,"tf.keras.Model"),zp.forEach(t),Rf=i(ei,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),ei.forEach(t),Hf=m(kt),oe=s(kt,"DIV",{class:!0});var Ct=a(oe);w(Yo.$$.fragment,Ct),Wf=m(Ct),Le=s(Ct,"P",{});var hs=a(Le);Uf=i(hs,"The "),es=s(hs,"A",{href:!0});var jp=a(es);Bf=i(jp,"TFSegformerForSemanticSegmentation"),jp.forEach(t),Vf=i(hs," forward method, overrides the "),Pa=s(hs,"CODE",{});var Dp=a(Pa);Gf=i(Dp,"__call__"),Dp.forEach(t),Kf=i(hs," special method."),hs.forEach(t),Yf=m(Ct),w(_t.$$.fragment,Ct),Jf=m(Ct),w(vt.$$.fragment,Ct),Ct.forEach(t),kt.forEach(t),this.h()},h(){l(f,"name","hf:doc:metadata"),l(f,"content",JSON.stringify(ou)),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(_,"class","relative group"),l(Re,"id","overview"),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","#overview"),l(ue,"class","relative group"),l(zt,"href","https://arxiv.org/abs/2105.15203"),l(zt,"rel","nofollow"),l(jt,"href","https://arxiv.org/abs/2105.15203"),l(jt,"rel","nofollow"),l(Dt,"width","600"),Lp(Dt.src,Xf="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/segformer_architecture.png")||l(Dt,"src",Xf),l(At,"href","https://huggingface.co/nielsr"),l(At,"rel","nofollow"),l(qt,"href","https://huggingface.co/sayakpaul"),l(qt,"rel","nofollow"),l(Nt,"href","https://github.com/NVlabs/SegFormer"),l(Nt,"rel","nofollow"),l(ar,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerModel"),l(nr,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(ir,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerForImageClassification"),l(Ot,"href","https://huggingface.co/models?other=segformer"),l(Ot,"rel","nofollow"),l(Lt,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/SegFormer"),l(Lt,"rel","nofollow"),l(Rt,"href","https://huggingface.co/blog/fine-tune-segformer"),l(Rt,"rel","nofollow"),l(Wt,"href","https://github.com/deep-diver/segformer-tf-transformers"),l(Wt,"rel","nofollow"),l(Bt,"href","https://huggingface.co/spaces/chansung/segformer-tf-transformers"),l(Bt,"rel","nofollow"),l(lr,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerImageProcessor"),l(Gt,"href","https://github.com/NVlabs/SegFormer/blob/master/local_configs/_base_/datasets/ade20k_repeat.py"),l(Gt,"rel","nofollow"),l(dr,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerImageProcessor"),l(cr,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(Yt,"href","https://arxiv.org/abs/2105.15203"),l(Yt,"rel","nofollow"),l(mr,"align","center"),l(fr,"align","center"),l(gr,"align","center"),l(hr,"align","center"),l(pr,"align","center"),l(ur,"align","center"),l(_r,"align","center"),l(vr,"align","center"),l(br,"align","center"),l(Sr,"align","center"),l(wr,"align","center"),l(Tr,"align","center"),l($r,"align","center"),l(yr,"align","center"),l(Fr,"align","center"),l(Er,"align","center"),l(Ir,"align","center"),l(xr,"align","center"),l(Pr,"align","center"),l(kr,"align","center"),l(Cr,"align","center"),l(Mr,"align","center"),l(zr,"align","center"),l(jr,"align","center"),l(Dr,"align","center"),l(Ar,"align","center"),l(qr,"align","center"),l(Nr,"align","center"),l(Jt,"href","https://arxiv.org/abs/2105.15203"),l(Jt,"rel","nofollow"),l(Ve,"id","transformers.SegformerConfig"),l(Ve,"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(Ve,"href","#transformers.SegformerConfig"),l(be,"class","relative group"),l(Or,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerModel"),l(Qt,"href","https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512"),l(Qt,"rel","nofollow"),l(Lr,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),l(Rr,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),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(Ke,"id","transformers.SegformerImageProcessor"),l(Ke,"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(Ke,"href","#transformers.SegformerImageProcessor"),l(Te,"class","relative group"),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(Hr,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(Je,"id","transformers.SegformerImageProcessor"),l(Je,"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(Je,"href","#transformers.SegformerImageProcessor"),l(ye,"class","relative group"),l(Xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Wr,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(Ze,"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(Qe,"id","transformers.SegformerModel"),l(Qe,"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(Qe,"href","#transformers.SegformerModel"),l(Fe,"class","relative group"),l(ho,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(ho,"rel","nofollow"),l(Ur,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerModel"),l(X,"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(ot,"id","transformers.SegformerDecodeHead"),l(ot,"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(ot,"href","#transformers.SegformerDecodeHead"),l(Ie,"class","relative group"),l(Br,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(rt,"id","transformers.SegformerForImageClassification"),l(rt,"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(rt,"href","#transformers.SegformerForImageClassification"),l(Pe,"class","relative group"),l(To,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(To,"rel","nofollow"),l(Vr,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerForImageClassification"),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(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(nt,"id","transformers.SegformerForSemanticSegmentation"),l(nt,"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(nt,"href","#transformers.SegformerForSemanticSegmentation"),l(Ce,"class","relative group"),l(Io,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Io,"rel","nofollow"),l(Gr,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),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(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(dt,"id","transformers.TFSegformerDecodeHead"),l(dt,"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(dt,"href","#transformers.TFSegformerDecodeHead"),l(ze,"class","relative group"),l(Kr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ct,"id","transformers.TFSegformerModel"),l(ct,"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(ct,"href","#transformers.TFSegformerModel"),l(De,"class","relative group"),l(Yr,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel"),l(Ao,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),l(Ao,"rel","nofollow"),l(Jr,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.TFSegformerModel"),l(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(gt,"id","transformers.TFSegformerForImageClassification"),l(gt,"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(gt,"href","#transformers.TFSegformerForImageClassification"),l(qe,"class","relative group"),l(Xr,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel"),l(Ho,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),l(Ho,"rel","nofollow"),l(Zr,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.TFSegformerForImageClassification"),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(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(ut,"id","transformers.TFSegformerForSemanticSegmentation"),l(ut,"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(ut,"href","#transformers.TFSegformerForSemanticSegmentation"),l(Oe,"class","relative group"),l(Qr,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.TFPreTrainedModel"),l(Ko,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),l(Ko,"rel","nofollow"),l(es,"href","/docs/transformers/v4.25.1/en/model_doc/segformer#transformers.TFSegformerForSemanticSegmentation"),l(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,g){e(document.head,f),u(o,b,g),u(o,_,g),e(_,p),e(p,v),T(d,v,null),e(_,h),e(_,I),e(I,ti),u(o,La,g),u(o,ue,g),e(ue,Re),e(Re,us),T(Mt,us,null),e(ue,oi),e(ue,_s),e(_s,ri),u(o,Ra,g),u(o,He,g),e(He,si),e(He,zt),e(zt,ai),e(He,ni),u(o,Ha,g),u(o,or,g),e(or,ii),u(o,Wa,g),u(o,rr,g),e(rr,vs),e(vs,li),u(o,Ua,g),u(o,We,g),e(We,di),e(We,jt),e(jt,ci),e(We,mi),u(o,Ba,g),u(o,Dt,g),u(o,Va,g),u(o,J,g),e(J,fi),e(J,At),e(At,gi),e(J,hi),e(J,qt),e(qt,pi),e(J,ui),e(J,Nt),e(Nt,_i),e(J,vi),u(o,Ga,g),u(o,sr,g),e(sr,bi),u(o,Ka,g),u(o,k,g),e(k,H),e(H,Si),e(H,ar),e(ar,wi),e(H,Ti),e(H,nr),e(nr,$i),e(H,yi),e(H,ir),e(ir,Fi),e(H,Ei),e(H,Ot),e(Ot,Ii),e(H,xi),e(k,Pi),e(k,_e),e(_e,ki),e(_e,Lt),e(Lt,Ci),e(_e,Mi),e(_e,Rt),e(Rt,zi),e(_e,ji),e(k,Di),e(k,Ht),e(Ht,Ai),e(Ht,Wt),e(Wt,qi),e(Ht,Ni),e(k,Oi),e(k,Ut),e(Ut,Li),e(Ut,Bt),e(Bt,Ri),e(Ut,Hi),e(k,Wi),e(k,Vt),e(Vt,Ui),e(Vt,bs),e(bs,Bi),e(Vt,Vi),e(k,Gi),e(k,ve),e(ve,Ki),e(ve,lr),e(lr,Yi),e(ve,Ji),e(ve,Gt),e(Gt,Xi),e(ve,Zi),e(k,Qi),e(k,x),e(x,el),e(x,dr),e(dr,tl),e(x,ol),e(x,Ss),e(Ss,rl),e(x,sl),e(x,ws),e(ws,al),e(x,nl),e(x,Ts),e(Ts,il),e(x,ll),e(x,$s),e($s,dl),e(x,cl),e(x,ys),e(ys,ml),e(x,fl),e(x,cr),e(cr,gl),e(x,hl),e(x,Fs),e(Fs,pl),e(x,ul),e(x,Es),e(Es,_l),e(x,vl),e(k,bl),e(k,Kt),e(Kt,Sl),e(Kt,Yt),e(Yt,wl),e(Kt,Tl),u(o,Ya,g),u(o,Ue,g),e(Ue,Is),e(Is,z),e(z,mr),e(mr,xs),e(xs,$l),e(z,yl),e(z,Ps),e(Ps,ks),e(ks,Fl),e(z,El),e(z,Cs),e(Cs,Ms),e(Ms,Il),e(z,xl),e(z,fr),e(fr,zs),e(zs,Pl),e(z,kl),e(z,gr),e(gr,js),e(js,Cl),e(z,Ml),e(z,hr),e(hr,Ds),e(Ds,zl),e(Ue,jl),e(Ue,j),e(j,D),e(D,pr),e(pr,Dl),e(D,Al),e(D,As),e(As,ql),e(D,Nl),e(D,qs),e(qs,Ol),e(D,Ll),e(D,ur),e(ur,Rl),e(D,Hl),e(D,_r),e(_r,Wl),e(D,Ul),e(D,vr),e(vr,Bl),e(j,Vl),e(j,A),e(A,br),e(br,Gl),e(A,Kl),e(A,Ns),e(Ns,Yl),e(A,Jl),e(A,Os),e(Os,Xl),e(A,Zl),e(A,Sr),e(Sr,Ql),e(A,ed),e(A,wr),e(wr,td),e(A,od),e(A,Tr),e(Tr,rd),e(j,sd),e(j,q),e(q,$r),e($r,ad),e(q,nd),e(q,Ls),e(Ls,id),e(q,ld),e(q,Rs),e(Rs,dd),e(q,cd),e(q,yr),e(yr,md),e(q,fd),e(q,Fr),e(Fr,gd),e(q,hd),e(q,Er),e(Er,pd),e(j,ud),e(j,N),e(N,Ir),e(Ir,_d),e(N,vd),e(N,Hs),e(Hs,bd),e(N,Sd),e(N,Ws),e(Ws,wd),e(N,Td),e(N,xr),e(xr,$d),e(N,yd),e(N,Pr),e(Pr,Fd),e(N,Ed),e(N,kr),e(kr,Id),e(j,xd),e(j,O),e(O,Cr),e(Cr,Pd),e(O,kd),e(O,Us),e(Us,Cd),e(O,Md),e(O,Bs),e(Bs,zd),e(O,jd),e(O,Mr),e(Mr,Dd),e(O,Ad),e(O,zr),e(zr,qd),e(O,Nd),e(O,jr),e(jr,Od),e(j,Ld),e(j,L),e(L,Dr),e(Dr,Rd),e(L,Hd),e(L,Vs),e(Vs,Wd),e(L,Ud),e(L,Gs),e(Gs,Bd),e(L,Vd),e(L,Ar),e(Ar,Gd),e(L,Kd),e(L,qr),e(qr,Yd),e(L,Jd),e(L,Nr),e(Nr,Xd),u(o,Ja,g),u(o,Be,g),e(Be,Zd),e(Be,Jt),e(Jt,Qd),e(Be,ec),u(o,Xa,g),u(o,be,g),e(be,Ve),e(Ve,Ks),T(Xt,Ks,null),e(be,tc),e(be,Ys),e(Ys,oc),u(o,Za,g),u(o,W,g),T(Zt,W,null),e(W,rc),e(W,Se),e(Se,sc),e(Se,Or),e(Or,ac),e(Se,nc),e(Se,Qt),e(Qt,ic),e(Se,lc),e(W,dc),e(W,we),e(we,cc),e(we,Lr),e(Lr,mc),e(we,fc),e(we,Rr),e(Rr,gc),e(we,hc),e(W,pc),T(Ge,W,null),u(o,Qa,g),u(o,Te,g),e(Te,Ke),e(Ke,Js),T(eo,Js,null),e(Te,uc),e(Te,Xs),e(Xs,_c),u(o,en,g),u(o,U,g),T(to,U,null),e(U,vc),e(U,Zs),e(Zs,bc),e(U,Sc),e(U,ge),T(oo,ge,null),e(ge,wc),e(ge,Qs),e(Qs,Tc),e(ge,$c),e(ge,$e),e($e,yc),e($e,ea),e(ea,Fc),e($e,Ec),e($e,ta),e(ta,Ic),e($e,xc),e(U,Pc),e(U,Ye),T(ro,Ye,null),e(Ye,kc),e(Ye,so),e(so,Cc),e(so,Hr),e(Hr,Mc),e(so,zc),u(o,tn,g),u(o,ye,g),e(ye,Je),e(Je,oa),T(ao,oa,null),e(ye,jc),e(ye,ra),e(ra,Dc),u(o,on,g),u(o,B,g),T(no,B,null),e(B,Ac),e(B,sa),e(sa,qc),e(B,Nc),e(B,Xe),T(io,Xe,null),e(Xe,Oc),e(Xe,aa),e(aa,Lc),e(B,Rc),e(B,Ze),T(lo,Ze,null),e(Ze,Hc),e(Ze,co),e(co,Wc),e(co,Wr),e(Wr,Uc),e(co,Bc),u(o,rn,g),u(o,Fe,g),e(Fe,Qe),e(Qe,na),T(mo,na,null),e(Fe,Vc),e(Fe,ia),e(ia,Gc),u(o,sn,g),u(o,me,g),T(fo,me,null),e(me,Kc),e(me,go),e(go,Yc),e(go,ho),e(ho,Jc),e(go,Xc),e(me,Zc),e(me,X),T(po,X,null),e(X,Qc),e(X,Ee),e(Ee,em),e(Ee,Ur),e(Ur,tm),e(Ee,om),e(Ee,la),e(la,rm),e(Ee,sm),e(X,am),T(et,X,null),e(X,nm),T(tt,X,null),u(o,an,g),u(o,Ie,g),e(Ie,ot),e(ot,da),T(uo,da,null),e(Ie,im),e(Ie,ca),e(ca,lm),u(o,nn,g),u(o,xe,g),T(_o,xe,null),e(xe,dm),e(xe,Br),T(vo,Br,null),u(o,ln,g),u(o,Pe,g),e(Pe,rt),e(rt,ma),T(bo,ma,null),e(Pe,cm),e(Pe,fa),e(fa,mm),u(o,dn,g),u(o,V,g),T(So,V,null),e(V,fm),e(V,ga),e(ga,gm),e(V,hm),e(V,wo),e(wo,pm),e(wo,To),e(To,um),e(wo,_m),e(V,vm),e(V,Z),T($o,Z,null),e(Z,bm),e(Z,ke),e(ke,Sm),e(ke,Vr),e(Vr,wm),e(ke,Tm),e(ke,ha),e(ha,$m),e(ke,ym),e(Z,Fm),T(st,Z,null),e(Z,Em),T(at,Z,null),u(o,cn,g),u(o,Ce,g),e(Ce,nt),e(nt,pa),T(yo,pa,null),e(Ce,Im),e(Ce,ua),e(ua,xm),u(o,mn,g),u(o,fe,g),T(Fo,fe,null),e(fe,Pm),e(fe,Eo),e(Eo,km),e(Eo,Io),e(Io,Cm),e(Eo,Mm),e(fe,zm),e(fe,Q),T(xo,Q,null),e(Q,jm),e(Q,Me),e(Me,Dm),e(Me,Gr),e(Gr,Am),e(Me,qm),e(Me,_a),e(_a,Nm),e(Me,Om),e(Q,Lm),T(it,Q,null),e(Q,Rm),T(lt,Q,null),u(o,fn,g),u(o,ze,g),e(ze,dt),e(dt,va),T(Po,va,null),e(ze,Hm),e(ze,ba),e(ba,Wm),u(o,gn,g),u(o,je,g),T(ko,je,null),e(je,Um),e(je,Kr),T(Co,Kr,null),u(o,hn,g),u(o,De,g),e(De,ct),e(ct,Sa),T(Mo,Sa,null),e(De,Bm),e(De,wa),e(wa,Vm),u(o,pn,g),u(o,G,g),T(zo,G,null),e(G,Gm),e(G,jo),e(jo,Km),e(jo,Yr),e(Yr,Ym),e(jo,Jm),e(G,Xm),e(G,Do),e(Do,Zm),e(Do,Ao),e(Ao,Qm),e(Do,ef),e(G,tf),e(G,ee),T(qo,ee,null),e(ee,of),e(ee,Ae),e(Ae,rf),e(Ae,Jr),e(Jr,sf),e(Ae,af),e(Ae,Ta),e(Ta,nf),e(Ae,lf),e(ee,df),T(mt,ee,null),e(ee,cf),T(ft,ee,null),u(o,un,g),u(o,qe,g),e(qe,gt),e(gt,$a),T(No,$a,null),e(qe,mf),e(qe,ya),e(ya,ff),u(o,_n,g),u(o,R,g),T(Oo,R,null),e(R,gf),e(R,Fa),e(Fa,hf),e(R,pf),e(R,Lo),e(Lo,uf),e(Lo,Xr),e(Xr,_f),e(Lo,vf),e(R,bf),e(R,Ro),e(Ro,Sf),e(Ro,Ho),e(Ho,wf),e(Ro,Tf),e(R,$f),e(R,te),T(Wo,te,null),e(te,yf),e(te,Ne),e(Ne,Ff),e(Ne,Zr),e(Zr,Ef),e(Ne,If),e(Ne,Ea),e(Ea,xf),e(Ne,Pf),e(te,kf),T(ht,te,null),e(te,Cf),T(pt,te,null),u(o,vn,g),u(o,Oe,g),e(Oe,ut),e(ut,Ia),T(Uo,Ia,null),e(Oe,Mf),e(Oe,xa),e(xa,zf),u(o,bn,g),u(o,K,g),T(Bo,K,null),e(K,jf),e(K,Vo),e(Vo,Df),e(Vo,Qr),e(Qr,Af),e(Vo,qf),e(K,Nf),e(K,Go),e(Go,Of),e(Go,Ko),e(Ko,Lf),e(Go,Rf),e(K,Hf),e(K,oe),T(Yo,oe,null),e(oe,Wf),e(oe,Le),e(Le,Uf),e(Le,es),e(es,Bf),e(Le,Vf),e(Le,Pa),e(Pa,Gf),e(Le,Kf),e(oe,Yf),T(_t,oe,null),e(oe,Jf),T(vt,oe,null),Sn=!0},p(o,[g]){const Jo={};g&2&&(Jo.$$scope={dirty:g,ctx:o}),Ge.$set(Jo);const ka={};g&2&&(ka.$$scope={dirty:g,ctx:o}),et.$set(ka);const Ca={};g&2&&(Ca.$$scope={dirty:g,ctx:o}),tt.$set(Ca);const Ma={};g&2&&(Ma.$$scope={dirty:g,ctx:o}),st.$set(Ma);const Xo={};g&2&&(Xo.$$scope={dirty:g,ctx:o}),at.$set(Xo);const za={};g&2&&(za.$$scope={dirty:g,ctx:o}),it.$set(za);const ja={};g&2&&(ja.$$scope={dirty:g,ctx:o}),lt.$set(ja);const Da={};g&2&&(Da.$$scope={dirty:g,ctx:o}),mt.$set(Da);const Zo={};g&2&&(Zo.$$scope={dirty:g,ctx:o}),ft.$set(Zo);const Aa={};g&2&&(Aa.$$scope={dirty:g,ctx:o}),ht.$set(Aa);const qa={};g&2&&(qa.$$scope={dirty:g,ctx:o}),pt.$set(qa);const Na={};g&2&&(Na.$$scope={dirty:g,ctx:o}),_t.$set(Na);const Oa={};g&2&&(Oa.$$scope={dirty:g,ctx:o}),vt.$set(Oa)},i(o){Sn||($(d.$$.fragment,o),$(Mt.$$.fragment,o),$(Xt.$$.fragment,o),$(Zt.$$.fragment,o),$(Ge.$$.fragment,o),$(eo.$$.fragment,o),$(to.$$.fragment,o),$(oo.$$.fragment,o),$(ro.$$.fragment,o),$(ao.$$.fragment,o),$(no.$$.fragment,o),$(io.$$.fragment,o),$(lo.$$.fragment,o),$(mo.$$.fragment,o),$(fo.$$.fragment,o),$(po.$$.fragment,o),$(et.$$.fragment,o),$(tt.$$.fragment,o),$(uo.$$.fragment,o),$(_o.$$.fragment,o),$(vo.$$.fragment,o),$(bo.$$.fragment,o),$(So.$$.fragment,o),$($o.$$.fragment,o),$(st.$$.fragment,o),$(at.$$.fragment,o),$(yo.$$.fragment,o),$(Fo.$$.fragment,o),$(xo.$$.fragment,o),$(it.$$.fragment,o),$(lt.$$.fragment,o),$(Po.$$.fragment,o),$(ko.$$.fragment,o),$(Co.$$.fragment,o),$(Mo.$$.fragment,o),$(zo.$$.fragment,o),$(qo.$$.fragment,o),$(mt.$$.fragment,o),$(ft.$$.fragment,o),$(No.$$.fragment,o),$(Oo.$$.fragment,o),$(Wo.$$.fragment,o),$(ht.$$.fragment,o),$(pt.$$.fragment,o),$(Uo.$$.fragment,o),$(Bo.$$.fragment,o),$(Yo.$$.fragment,o),$(_t.$$.fragment,o),$(vt.$$.fragment,o),Sn=!0)},o(o){y(d.$$.fragment,o),y(Mt.$$.fragment,o),y(Xt.$$.fragment,o),y(Zt.$$.fragment,o),y(Ge.$$.fragment,o),y(eo.$$.fragment,o),y(to.$$.fragment,o),y(oo.$$.fragment,o),y(ro.$$.fragment,o),y(ao.$$.fragment,o),y(no.$$.fragment,o),y(io.$$.fragment,o),y(lo.$$.fragment,o),y(mo.$$.fragment,o),y(fo.$$.fragment,o),y(po.$$.fragment,o),y(et.$$.fragment,o),y(tt.$$.fragment,o),y(uo.$$.fragment,o),y(_o.$$.fragment,o),y(vo.$$.fragment,o),y(bo.$$.fragment,o),y(So.$$.fragment,o),y($o.$$.fragment,o),y(st.$$.fragment,o),y(at.$$.fragment,o),y(yo.$$.fragment,o),y(Fo.$$.fragment,o),y(xo.$$.fragment,o),y(it.$$.fragment,o),y(lt.$$.fragment,o),y(Po.$$.fragment,o),y(ko.$$.fragment,o),y(Co.$$.fragment,o),y(Mo.$$.fragment,o),y(zo.$$.fragment,o),y(qo.$$.fragment,o),y(mt.$$.fragment,o),y(ft.$$.fragment,o),y(No.$$.fragment,o),y(Oo.$$.fragment,o),y(Wo.$$.fragment,o),y(ht.$$.fragment,o),y(pt.$$.fragment,o),y(Uo.$$.fragment,o),y(Bo.$$.fragment,o),y(Yo.$$.fragment,o),y(_t.$$.fragment,o),y(vt.$$.fragment,o),Sn=!1},d(o){t(f),o&&t(b),o&&t(_),F(d),o&&t(La),o&&t(ue),F(Mt),o&&t(Ra),o&&t(He),o&&t(Ha),o&&t(or),o&&t(Wa),o&&t(rr),o&&t(Ua),o&&t(We),o&&t(Ba),o&&t(Dt),o&&t(Va),o&&t(J),o&&t(Ga),o&&t(sr),o&&t(Ka),o&&t(k),o&&t(Ya),o&&t(Ue),o&&t(Ja),o&&t(Be),o&&t(Xa),o&&t(be),F(Xt),o&&t(Za),o&&t(W),F(Zt),F(Ge),o&&t(Qa),o&&t(Te),F(eo),o&&t(en),o&&t(U),F(to),F(oo),F(ro),o&&t(tn),o&&t(ye),F(ao),o&&t(on),o&&t(B),F(no),F(io),F(lo),o&&t(rn),o&&t(Fe),F(mo),o&&t(sn),o&&t(me),F(fo),F(po),F(et),F(tt),o&&t(an),o&&t(Ie),F(uo),o&&t(nn),o&&t(xe),F(_o),F(vo),o&&t(ln),o&&t(Pe),F(bo),o&&t(dn),o&&t(V),F(So),F($o),F(st),F(at),o&&t(cn),o&&t(Ce),F(yo),o&&t(mn),o&&t(fe),F(Fo),F(xo),F(it),F(lt),o&&t(fn),o&&t(ze),F(Po),o&&t(gn),o&&t(je),F(ko),F(Co),o&&t(hn),o&&t(De),F(Mo),o&&t(pn),o&&t(G),F(zo),F(qo),F(mt),F(ft),o&&t(un),o&&t(qe),F(No),o&&t(_n),o&&t(R),F(Oo),F(Wo),F(ht),F(pt),o&&t(vn),o&&t(Oe),F(Uo),o&&t(bn),o&&t(K),F(Bo),F(Yo),F(_t),F(vt)}}}const ou={local:"segformer",sections:[{local:"overview",title:"Overview"},{local:"transformers.SegformerConfig",title:"SegformerConfig"},{local:"transformers.SegformerImageProcessor",title:"SegformerFeatureExtractor"},{local:"transformers.SegformerImageProcessor",title:"SegformerImageProcessor"},{local:"transformers.SegformerModel",title:"SegformerModel"},{local:"transformers.SegformerDecodeHead",title:"SegformerDecodeHead"},{local:"transformers.SegformerForImageClassification",title:"SegformerForImageClassification"},{local:"transformers.SegformerForSemanticSegmentation",title:"SegformerForSemanticSegmentation"},{local:"transformers.TFSegformerDecodeHead",title:"TFSegformerDecodeHead"},{local:"transformers.TFSegformerModel",title:"TFSegformerModel"},{local:"transformers.TFSegformerForImageClassification",title:"TFSegformerForImageClassification"},{local:"transformers.TFSegformerForSemanticSegmentation",title:"TFSegformerForSemanticSegmentation"}],title:"SegFormer"};function ru(E){return Rp(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class cu extends Ap{constructor(f){super();qp(this,f,ru,tu,Np,{})}}export{cu as default,ou as metadata};
