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

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

image_processor = AutoImageProcessor.from_pretrained("nvidia/mit-b0")
model = SegformerModel.from_pretrained("nvidia/mit-b0")

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

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

image_processor = AutoImageProcessor.from_pretrained("nvidia/mit-b0")
model = SegformerForImageClassification.from_pretrained("nvidia/mit-b0")

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

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

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

image_processor = AutoImageProcessor.from_pretrained("nvidia/mit-b0")
model = TFSegformerModel.from_pretrained("nvidia/mit-b0")

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

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

image_processor = AutoImageProcessor.from_pretrained("nvidia/mit-b0")
model = TFSegformerForImageClassification.from_pretrained("nvidia/mit-b0")

inputs = image_processor(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> AutoImageProcessor, 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>image_processor = AutoImageProcessor.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 = image_processor(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"),F=n("Example:"),_=d(),v(u.$$.fragment)},l(c){f=s(c,"P",{});var p=a(f);F=i(p,"Example:"),p.forEach(t),_=m(c),S(u.$$.fragment,c)},m(c,p){h(c,f,p),e(f,F),h(c,_,p),w(u,c,p),b=!0},p:_r,i(c){b||($(u.$$.fragment,c),b=!0)},o(c){T(u.$$.fragment,c),b=!1},d(c){c&&t(f),c&&t(_),y(u,c)}}}function F_(E){let f,F,_,u,b;return{c(){f=r("p"),F=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),u=n("Module"),b=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(c){f=s(c,"P",{});var p=a(f);F=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(p,"CODE",{});var x=a(_);u=i(x,"Module"),x.forEach(t),b=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(t)},m(c,p){h(c,f,p),e(f,F),e(f,_),e(_,u),e(f,b)},d(c){c&&t(f)}}}function E_(E){let f,F,_,u,b;return u=new br({props:{code:`from transformers import AutoImageProcessor, 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 = AutoImageProcessor.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> AutoImageProcessor, 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 = AutoImageProcessor.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"),F=n("Examples:"),_=d(),v(u.$$.fragment)},l(c){f=s(c,"P",{});var p=a(f);F=i(p,"Examples:"),p.forEach(t),_=m(c),S(u.$$.fragment,c)},m(c,p){h(c,f,p),e(f,F),h(c,_,p),w(u,c,p),b=!0},p:_r,i(c){b||($(u.$$.fragment,c),b=!0)},o(c){T(u.$$.fragment,c),b=!1},d(c){c&&t(f),c&&t(_),y(u,c)}}}function x_(E){let f,F,_,u,b,c,p,x,Oi,pn,be,Ue,Rs,Nt,Li,Hs,Ri,un,Ve,Hi,Ot,Wi,Ui,_n,vr,Vi,bn,Sr,Ws,Bi,vn,Be,Gi,Lt,Ki,Yi,Sn,Rt,ih,wn,Y,Ji,Ht,Xi,Zi,Wt,Qi,el,Ut,tl,ol,$n,wr,rl,Tn,k,W,sl,$r,al,nl,Tr,il,ll,yr,dl,ml,Vt,cl,fl,gl,ve,hl,Bt,pl,ul,Gt,_l,bl,vl,Kt,Sl,Yt,wl,$l,Tl,Jt,yl,Xt,Fl,El,xl,Zt,Il,Us,Pl,kl,Cl,Se,Ml,Fr,Al,jl,Qt,zl,Dl,ql,I,Nl,Er,Ol,Ll,Vs,Rl,Hl,Bs,Wl,Ul,Gs,Vl,Bl,Ks,Gl,Kl,Ys,Yl,Jl,xr,Xl,Zl,Js,Ql,ed,Xs,td,od,rd,eo,sd,to,ad,nd,yn,Ge,Zs,A,Ir,Qs,id,ld,ea,ta,dd,md,oa,ra,cd,fd,Pr,sa,gd,hd,kr,aa,pd,ud,Cr,na,_d,bd,j,z,Mr,vd,Sd,ia,wd,$d,la,Td,yd,Ar,Fd,Ed,jr,xd,Id,zr,Pd,kd,D,Dr,Cd,Md,da,Ad,jd,ma,zd,Dd,qr,qd,Nd,Nr,Od,Ld,Or,Rd,Hd,q,Lr,Wd,Ud,ca,Vd,Bd,fa,Gd,Kd,Rr,Yd,Jd,Hr,Xd,Zd,Wr,Qd,em,N,Ur,tm,om,ga,rm,sm,ha,am,nm,Vr,im,lm,Br,dm,mm,Gr,cm,fm,O,Kr,gm,hm,pa,pm,um,ua,_m,bm,Yr,vm,Sm,Jr,wm,$m,Xr,Tm,ym,L,Zr,Fm,Em,_a,xm,Im,ba,Pm,km,Qr,Cm,Mm,es,Am,jm,ts,zm,Fn,Ke,Dm,oo,qm,Nm,En,we,Ye,va,ro,Om,Sa,Lm,xn,os,Rm,In,so,Pn,rs,he,ss,Hm,Wm,ao,Um,Vm,no,Bm,Gm,kn,as,Km,Cn,J,Je,ns,Ym,Jm,io,Xm,Zm,Qm,lo,ec,mo,tc,oc,rc,co,sc,fo,ac,nc,ic,Xe,is,lc,dc,go,mc,cc,Mn,ls,fc,An,$e,Ze,wa,ho,gc,$a,hc,jn,U,po,pc,Te,uc,ds,_c,bc,uo,vc,Sc,wc,ye,$c,ms,Tc,yc,cs,Fc,Ec,xc,Qe,zn,Fe,et,Ta,_o,Ic,ya,Pc,Dn,ce,bo,kc,pe,vo,Cc,Fa,Mc,Ac,Ee,jc,Ea,zc,Dc,xa,qc,Nc,Oc,tt,So,Lc,wo,Rc,fs,Hc,Wc,qn,xe,ot,Ia,$o,Uc,Pa,Vc,Nn,V,To,Bc,ka,Gc,Kc,rt,yo,Yc,Ca,Jc,Xc,st,Fo,Zc,Eo,Qc,gs,ef,tf,On,Ie,at,Ma,xo,of,Aa,rf,Ln,fe,Io,sf,Po,af,ko,nf,lf,df,X,Co,mf,Pe,cf,hs,ff,gf,ja,hf,pf,uf,nt,_f,it,Rn,ke,lt,za,Mo,bf,Da,vf,Hn,Ce,Ao,Sf,ps,jo,Wn,Me,dt,qa,zo,wf,Na,$f,Un,B,Do,Tf,Oa,yf,Ff,qo,Ef,No,xf,If,Pf,Z,Oo,kf,Ae,Cf,us,Mf,Af,La,jf,zf,Df,mt,qf,ct,Vn,je,ft,Ra,Lo,Nf,Ha,Of,Bn,ge,Ro,Lf,Ho,Rf,Wo,Hf,Wf,Uf,Q,Uo,Vf,ze,Bf,_s,Gf,Kf,Wa,Yf,Jf,Xf,gt,Zf,ht,Gn,De,pt,Ua,Vo,Qf,Va,eg,Kn,qe,Bo,tg,bs,Go,Yn,Ne,ut,Ba,Ko,og,Ga,rg,Jn,G,Yo,sg,Jo,ag,vs,ng,ig,lg,Xo,dg,Zo,mg,cg,fg,ee,Qo,gg,Oe,hg,Ss,pg,ug,Ka,_g,bg,vg,_t,Sg,bt,Xn,Le,vt,Ya,er,wg,Ja,$g,Zn,R,tr,Tg,Xa,yg,Fg,or,Eg,ws,xg,Ig,Pg,rr,kg,sr,Cg,Mg,Ag,te,ar,jg,Re,zg,$s,Dg,qg,Za,Ng,Og,Lg,St,Rg,wt,Qn,He,$t,Qa,nr,Hg,en,Wg,ei,K,ir,Ug,lr,Vg,Ts,Bg,Gg,Kg,dr,Yg,mr,Jg,Xg,Zg,oe,cr,Qg,We,eh,ys,th,oh,tn,rh,sh,ah,Tt,nh,yt,ti;return c=new H({}),Nt=new H({}),ro=new H({}),so=new g_({props:{pipeline:"image-classification"}}),ho=new H({}),po=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:"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/main/src/transformers/models/segformer/configuration_segformer.py#L38"}}),Qe=new ur({props:{anchor:"transformers.SegformerConfig.example",$$slots:{default:[h_]},$$scope:{ctx:E}}}),_o=new H({}),bo=new P({props:{name:"class transformers.SegformerFeatureExtractor",anchor:"transformers.SegformerFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/segformer/feature_extraction_segformer.py#L26"}}),vo=new P({props:{name:"__call__",anchor:"transformers.SegformerFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"segmentation_maps",val:" = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/segformer/image_processing_segformer.py#L311"}}),So=new P({props:{name:"post_process_semantic_segmentation",anchor:"transformers.SegformerFeatureExtractor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": typing.List[typing.Tuple] = None"}],parametersDescription:[{anchor:"transformers.SegformerFeatureExtractor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/main/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation">SegformerForSemanticSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.SegformerFeatureExtractor.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/main/src/transformers/models/segformer/image_processing_segformer.py#L445",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>
`}}),$o=new H({}),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/main/src/transformers/models/segformer/image_processing_segformer.py#L50"}}),yo=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/main/src/transformers/models/segformer/image_processing_segformer.py#L320"}}),Fo=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/main/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/main/src/transformers/models/segformer/image_processing_segformer.py#L445",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>
`}}),xo=new H({}),Io=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/main/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/main/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/main/src/transformers/models/segformer/modeling_segformer.py#L510"}}),Co=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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/segformer#transformers.SegformerFeatureExtractor.__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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/segformer/modeling_segformer.py#L529",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),nt=new Ls({props:{$$slots:{default:[p_]},$$scope:{ctx:E}}}),it=new ur({props:{anchor:"transformers.SegformerModel.forward.example",$$slots:{default:[u_]},$$scope:{ctx:E}}}),Mo=new H({}),Ao=new P({props:{name:"class transformers.SegformerDecodeHead",anchor:"transformers.SegformerDecodeHead",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/segformer/modeling_segformer.py#L681"}}),jo=new P({props:{name:"forward",anchor:"transformers.SegformerDecodeHead.forward",parameters:[{name:"encoder_hidden_states",val:": FloatTensor"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/segformer/modeling_segformer.py#L706"}}),zo=new H({}),Do=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/main/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/main/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/main/src/transformers/models/segformer/modeling_segformer.py#L575"}}),Oo=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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/segformer#transformers.SegformerFeatureExtractor.__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/main/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/main/src/transformers/models/segformer/modeling_segformer.py#L588",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/main/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>
`}}),mt=new Ls({props:{$$slots:{default:[__]},$$scope:{ctx:E}}}),ct=new ur({props:{anchor:"transformers.SegformerForImageClassification.forward.example",$$slots:{default:[b_]},$$scope:{ctx:E}}}),Lo=new H({}),Ro=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/main/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/main/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/main/src/transformers/models/segformer/modeling_segformer.py#L743"}}),Uo=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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/segformer#transformers.SegformerFeatureExtractor.__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/main/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/main/src/transformers/models/segformer/modeling_segformer.py#L752",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_outputs.SemanticSegmenterOutput"
>transformers.modeling_outputs.SemanticSegmenterOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),gt=new Ls({props:{$$slots:{default:[v_]},$$scope:{ctx:E}}}),ht=new ur({props:{anchor:"transformers.SegformerForSemanticSegmentation.forward.example",$$slots:{default:[S_]},$$scope:{ctx:E}}}),Vo=new H({}),Bo=new P({props:{name:"class transformers.TFSegformerDecodeHead",anchor:"transformers.TFSegformerDecodeHead",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/segformer/modeling_tf_segformer.py#L727"}}),Go=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/main/src/transformers/models/segformer/modeling_tf_segformer.py#L749"}}),Ko=new H({}),Yo=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/main/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/main/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/main/src/transformers/models/segformer/modeling_tf_segformer.py#L597"}}),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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/segformer#transformers.SegformerFeatureExtractor.__call__">SegformerImageProcessor.<strong>call</strong>()</a> 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/main/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/main/src/transformers/models/segformer/modeling_tf_segformer.py#L605",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput"
>transformers.modeling_tf_outputs.TFBaseModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),_t=new Ls({props:{$$slots:{default:[w_]},$$scope:{ctx:E}}}),bt=new ur({props:{anchor:"transformers.TFSegformerModel.call.example",$$slots:{default:[$_]},$$scope:{ctx:E}}}),er=new H({}),tr=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/main/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/main/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/main/src/transformers/models/segformer/modeling_tf_segformer.py#L647"}}),ar=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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/segformer#transformers.SegformerFeatureExtractor.__call__">SegformerImageProcessor.<strong>call</strong>()</a> 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/main/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/main/src/transformers/models/segformer/modeling_tf_segformer.py#L657",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),St=new Ls({props:{$$slots:{default:[T_]},$$scope:{ctx:E}}}),wt=new ur({props:{anchor:"transformers.TFSegformerForImageClassification.call.example",$$slots:{default:[y_]},$$scope:{ctx:E}}}),nr=new H({}),ir=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/main/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/main/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/main/src/transformers/models/segformer/modeling_tf_segformer.py#L787"}}),cr=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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/segformer#transformers.SegformerFeatureExtractor.__call__">SegformerImageProcessor.<strong>call</strong>()</a> 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/main/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/main/src/transformers/models/segformer/modeling_tf_segformer.py#L813",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/main/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>
`}}),Tt=new Ls({props:{$$slots:{default:[F_]},$$scope:{ctx:E}}}),yt=new ur({props:{anchor:"transformers.TFSegformerForSemanticSegmentation.call.example",$$slots:{default:[E_]},$$scope:{ctx:E}}}),{c(){f=r("meta"),F=d(),_=r("h1"),u=r("a"),b=r("span"),v(c.$$.fragment),p=d(),x=r("span"),Oi=n("SegFormer"),pn=d(),be=r("h2"),Ue=r("a"),Rs=r("span"),v(Nt.$$.fragment),Li=d(),Hs=r("span"),Ri=n("Overview"),un=d(),Ve=r("p"),Hi=n("The SegFormer model was proposed in "),Ot=r("a"),Wi=n("SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers"),Ui=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.`),_n=d(),vr=r("p"),Vi=n("The abstract from the paper is the following:"),bn=d(),Sr=r("p"),Ws=r("em"),Bi=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.`),vn=d(),Be=r("p"),Gi=n("The figure below illustrates the architecture of SegFormer. Taken from the "),Lt=r("a"),Ki=n("original paper"),Yi=n("."),Sn=d(),Rt=r("img"),wn=d(),Y=r("p"),Ji=n("This model was contributed by "),Ht=r("a"),Xi=n("nielsr"),Zi=n(`. The TensorFlow version
of the model was contributed by `),Wt=r("a"),Qi=n("sayakpaul"),el=n(". The original code can be found "),Ut=r("a"),tl=n("here"),ol=n("."),$n=d(),wr=r("p"),rl=n("Tips:"),Tn=d(),k=r("ul"),W=r("li"),sl=n(`SegFormer consists of a hierarchical Transformer encoder, and a lightweight all-MLP decoder head.
`),$r=r("a"),al=n("SegformerModel"),nl=n(` is the hierarchical Transformer encoder (which in the paper is also referred to
as Mix Transformer or MiT). `),Tr=r("a"),il=n("SegformerForSemanticSegmentation"),ll=n(` adds the all-MLP decoder head on
top to perform semantic segmentation of images. In addition, there\u2019s
`),yr=r("a"),dl=n("SegformerForImageClassification"),ml=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 `),Vt=r("a"),cl=n("hub"),fl=n("."),gl=d(),ve=r("li"),hl=n("The quickest way to get started with SegFormer is by checking the "),Bt=r("a"),pl=n("example notebooks"),ul=n(` (which showcase both inference and
fine-tuning on custom data). One can also check out the `),Gt=r("a"),_l=n("blog post"),bl=n(" introducing SegFormer and illustrating how it can be fine-tuned on custom data."),vl=d(),Kt=r("li"),Sl=n("TensorFlow users should refer to "),Yt=r("a"),wl=n("this repository"),$l=n(" that shows off-the-shelf inference and fine-tuning."),Tl=d(),Jt=r("li"),yl=n("One can also check out "),Xt=r("a"),Fl=n("this interactive demo on Hugging Face Spaces"),El=n(`
to try out a SegFormer model on custom images.`),xl=d(),Zt=r("li"),Il=n("SegFormer works on any input size, as it pads the input to be divisible by "),Us=r("code"),Pl=n("config.patch_sizes"),kl=n("."),Cl=d(),Se=r("li"),Ml=n("One can use "),Fr=r("a"),Al=n("SegformerImageProcessor"),jl=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 `),Qt=r("a"),zl=n("here"),Dl=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.`),ql=d(),I=r("li"),Nl=n("One additional thing to keep in mind is that one can initialize "),Er=r("a"),Ol=n("SegformerImageProcessor"),Ll=n(` with
`),Vs=r("code"),Rl=n("reduce_labels"),Hl=n(" set to "),Bs=r("code"),Wl=n("True"),Ul=n(" or "),Gs=r("code"),Vl=n("False"),Bl=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, `),Ks=r("code"),Gl=n("reduce_labels"),Kl=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"),Yl=n("ignore_index"),Jl=n(` of the loss function
used by `),xr=r("a"),Xl=n("SegformerForSemanticSegmentation"),Zl=n(`). However, other datasets use the 0 index as
background class and include this class as part of all labels. In that case, `),Js=r("code"),Ql=n("reduce_labels"),ed=n(` should be set to
`),Xs=r("code"),td=n("False"),od=n(", as loss should also be computed for the background class."),rd=d(),eo=r("li"),sd=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 `),to=r("a"),ad=n("original paper"),nd=n(")."),yn=d(),Ge=r("table"),Zs=r("thead"),A=r("tr"),Ir=r("th"),Qs=r("strong"),id=n("Model variant"),ld=d(),ea=r("th"),ta=r("strong"),dd=n("Depths"),md=d(),oa=r("th"),ra=r("strong"),cd=n("Hidden sizes"),fd=d(),Pr=r("th"),sa=r("strong"),gd=n("Decoder hidden size"),hd=d(),kr=r("th"),aa=r("strong"),pd=n("Params (M)"),ud=d(),Cr=r("th"),na=r("strong"),_d=n("ImageNet-1k Top 1"),bd=d(),j=r("tbody"),z=r("tr"),Mr=r("td"),vd=n("MiT-b0"),Sd=d(),ia=r("td"),wd=n("[2, 2, 2, 2]"),$d=d(),la=r("td"),Td=n("[32, 64, 160, 256]"),yd=d(),Ar=r("td"),Fd=n("256"),Ed=d(),jr=r("td"),xd=n("3.7"),Id=d(),zr=r("td"),Pd=n("70.5"),kd=d(),D=r("tr"),Dr=r("td"),Cd=n("MiT-b1"),Md=d(),da=r("td"),Ad=n("[2, 2, 2, 2]"),jd=d(),ma=r("td"),zd=n("[64, 128, 320, 512]"),Dd=d(),qr=r("td"),qd=n("256"),Nd=d(),Nr=r("td"),Od=n("14.0"),Ld=d(),Or=r("td"),Rd=n("78.7"),Hd=d(),q=r("tr"),Lr=r("td"),Wd=n("MiT-b2"),Ud=d(),ca=r("td"),Vd=n("[3, 4, 6, 3]"),Bd=d(),fa=r("td"),Gd=n("[64, 128, 320, 512]"),Kd=d(),Rr=r("td"),Yd=n("768"),Jd=d(),Hr=r("td"),Xd=n("25.4"),Zd=d(),Wr=r("td"),Qd=n("81.6"),em=d(),N=r("tr"),Ur=r("td"),tm=n("MiT-b3"),om=d(),ga=r("td"),rm=n("[3, 4, 18, 3]"),sm=d(),ha=r("td"),am=n("[64, 128, 320, 512]"),nm=d(),Vr=r("td"),im=n("768"),lm=d(),Br=r("td"),dm=n("45.2"),mm=d(),Gr=r("td"),cm=n("83.1"),fm=d(),O=r("tr"),Kr=r("td"),gm=n("MiT-b4"),hm=d(),pa=r("td"),pm=n("[3, 8, 27, 3]"),um=d(),ua=r("td"),_m=n("[64, 128, 320, 512]"),bm=d(),Yr=r("td"),vm=n("768"),Sm=d(),Jr=r("td"),wm=n("62.6"),$m=d(),Xr=r("td"),Tm=n("83.6"),ym=d(),L=r("tr"),Zr=r("td"),Fm=n("MiT-b5"),Em=d(),_a=r("td"),xm=n("[3, 6, 40, 3]"),Im=d(),ba=r("td"),Pm=n("[64, 128, 320, 512]"),km=d(),Qr=r("td"),Cm=n("768"),Mm=d(),es=r("td"),Am=n("82.0"),jm=d(),ts=r("td"),zm=n("83.8"),Fn=d(),Ke=r("p"),Dm=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 `),oo=r("a"),qm=n("paper"),Nm=n("."),En=d(),we=r("h2"),Ye=r("a"),va=r("span"),v(ro.$$.fragment),Om=d(),Sa=r("span"),Lm=n("Resources"),xn=d(),os=r("p"),Rm=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with SegFormer."),In=d(),v(so.$$.fragment),Pn=d(),rs=r("ul"),he=r("li"),ss=r("a"),Hm=n("SegformerForImageClassification"),Wm=n(" is supported by this "),ao=r("a"),Um=n("example script"),Vm=n(" and "),no=r("a"),Bm=n("notebook"),Gm=n("."),kn=d(),as=r("p"),Km=n("Semantic segmentation:"),Cn=d(),J=r("ul"),Je=r("li"),ns=r("a"),Ym=n("SegformerForSemanticSegmentation"),Jm=n(" is supported by this "),io=r("a"),Xm=n("example script"),Zm=n("."),Qm=d(),lo=r("li"),ec=n("A blog on fine-tuning SegFormer on a custom dataset can be found "),mo=r("a"),tc=n("here"),oc=n("."),rc=d(),co=r("li"),sc=n("More demo notebooks on SegFormer (both inference + fine-tuning on a custom dataset) can be found "),fo=r("a"),ac=n("here"),nc=n("."),ic=d(),Xe=r("li"),is=r("a"),lc=n("TFSegformerForSemanticSegmentation"),dc=n(" is supported by this "),go=r("a"),mc=n("example notebook"),cc=n("."),Mn=d(),ls=r("p"),fc=n("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),An=d(),$e=r("h2"),Ze=r("a"),wa=r("span"),v(ho.$$.fragment),gc=d(),$a=r("span"),hc=n("SegformerConfig"),jn=d(),U=r("div"),v(po.$$.fragment),pc=d(),Te=r("p"),uc=n("This is the configuration class to store the configuration of a "),ds=r("a"),_c=n("SegformerModel"),bc=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
`),uo=r("a"),vc=n("nvidia/segformer-b0-finetuned-ade-512-512"),Sc=n(`
architecture.`),wc=d(),ye=r("p"),$c=n("Configuration objects inherit from "),ms=r("a"),Tc=n("PretrainedConfig"),yc=n(` and can be used to control the model outputs. Read the
documentation from `),cs=r("a"),Fc=n("PretrainedConfig"),Ec=n(" for more information."),xc=d(),v(Qe.$$.fragment),zn=d(),Fe=r("h2"),et=r("a"),Ta=r("span"),v(_o.$$.fragment),Ic=d(),ya=r("span"),Pc=n("SegformerFeatureExtractor"),Dn=d(),ce=r("div"),v(bo.$$.fragment),kc=d(),pe=r("div"),v(vo.$$.fragment),Cc=d(),Fa=r("p"),Mc=n("Preprocesses a batch of images and optionally segmentation maps."),Ac=d(),Ee=r("p"),jc=n("Overrides the "),Ea=r("code"),zc=n("__call__"),Dc=n(" method of the "),xa=r("code"),qc=n("Preprocessor"),Nc=n(` class so that both images and segmentation maps can be
passed in as positional arguments.`),Oc=d(),tt=r("div"),v(So.$$.fragment),Lc=d(),wo=r("p"),Rc=n("Converts the output of "),fs=r("a"),Hc=n("SegformerForSemanticSegmentation"),Wc=n(` into semantic segmentation maps. Only supports
PyTorch.`),qn=d(),xe=r("h2"),ot=r("a"),Ia=r("span"),v($o.$$.fragment),Uc=d(),Pa=r("span"),Vc=n("SegformerImageProcessor"),Nn=d(),V=r("div"),v(To.$$.fragment),Bc=d(),ka=r("p"),Gc=n("Constructs a Segformer image processor."),Kc=d(),rt=r("div"),v(yo.$$.fragment),Yc=d(),Ca=r("p"),Jc=n("Preprocess an image or batch of images."),Xc=d(),st=r("div"),v(Fo.$$.fragment),Zc=d(),Eo=r("p"),Qc=n("Converts the output of "),gs=r("a"),ef=n("SegformerForSemanticSegmentation"),tf=n(` into semantic segmentation maps. Only supports
PyTorch.`),On=d(),Ie=r("h2"),at=r("a"),Ma=r("span"),v(xo.$$.fragment),of=d(),Aa=r("span"),rf=n("SegformerModel"),Ln=d(),fe=r("div"),v(Io.$$.fragment),sf=d(),Po=r("p"),af=n(`The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ko=r("a"),nf=n("torch.nn.Module"),lf=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.`),df=d(),X=r("div"),v(Co.$$.fragment),mf=d(),Pe=r("p"),cf=n("The "),hs=r("a"),ff=n("SegformerModel"),gf=n(" forward method, overrides the "),ja=r("code"),hf=n("__call__"),pf=n(" special method."),uf=d(),v(nt.$$.fragment),_f=d(),v(it.$$.fragment),Rn=d(),ke=r("h2"),lt=r("a"),za=r("span"),v(Mo.$$.fragment),bf=d(),Da=r("span"),vf=n("SegformerDecodeHead"),Hn=d(),Ce=r("div"),v(Ao.$$.fragment),Sf=d(),ps=r("div"),v(jo.$$.fragment),Wn=d(),Me=r("h2"),dt=r("a"),qa=r("span"),v(zo.$$.fragment),wf=d(),Na=r("span"),$f=n("SegformerForImageClassification"),Un=d(),B=r("div"),v(Do.$$.fragment),Tf=d(),Oa=r("p"),yf=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.`),Ff=d(),qo=r("p"),Ef=n("This model is a PyTorch "),No=r("a"),xf=n("torch.nn.Module"),If=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.`),Pf=d(),Z=r("div"),v(Oo.$$.fragment),kf=d(),Ae=r("p"),Cf=n("The "),us=r("a"),Mf=n("SegformerForImageClassification"),Af=n(" forward method, overrides the "),La=r("code"),jf=n("__call__"),zf=n(" special method."),Df=d(),v(mt.$$.fragment),qf=d(),v(ct.$$.fragment),Vn=d(),je=r("h2"),ft=r("a"),Ra=r("span"),v(Lo.$$.fragment),Nf=d(),Ha=r("span"),Of=n("SegformerForSemanticSegmentation"),Bn=d(),ge=r("div"),v(Ro.$$.fragment),Lf=d(),Ho=r("p"),Rf=n(`SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
This model is a PyTorch `),Wo=r("a"),Hf=n("torch.nn.Module"),Wf=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.`),Uf=d(),Q=r("div"),v(Uo.$$.fragment),Vf=d(),ze=r("p"),Bf=n("The "),_s=r("a"),Gf=n("SegformerForSemanticSegmentation"),Kf=n(" forward method, overrides the "),Wa=r("code"),Yf=n("__call__"),Jf=n(" special method."),Xf=d(),v(gt.$$.fragment),Zf=d(),v(ht.$$.fragment),Gn=d(),De=r("h2"),pt=r("a"),Ua=r("span"),v(Vo.$$.fragment),Qf=d(),Va=r("span"),eg=n("TFSegformerDecodeHead"),Kn=d(),qe=r("div"),v(Bo.$$.fragment),tg=d(),bs=r("div"),v(Go.$$.fragment),Yn=d(),Ne=r("h2"),ut=r("a"),Ba=r("span"),v(Ko.$$.fragment),og=d(),Ga=r("span"),rg=n("TFSegformerModel"),Jn=d(),G=r("div"),v(Yo.$$.fragment),sg=d(),Jo=r("p"),ag=n(`The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
This model inherits from `),vs=r("a"),ng=n("TFPreTrainedModel"),ig=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.)`),lg=d(),Xo=r("p"),dg=n("This model is also a "),Zo=r("a"),mg=n("tf.keras.Model"),cg=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.`),fg=d(),ee=r("div"),v(Qo.$$.fragment),gg=d(),Oe=r("p"),hg=n("The "),Ss=r("a"),pg=n("TFSegformerModel"),ug=n(" forward method, overrides the "),Ka=r("code"),_g=n("__call__"),bg=n(" special method."),vg=d(),v(_t.$$.fragment),Sg=d(),v(bt.$$.fragment),Xn=d(),Le=r("h2"),vt=r("a"),Ya=r("span"),v(er.$$.fragment),wg=d(),Ja=r("span"),$g=n("TFSegformerForImageClassification"),Zn=d(),R=r("div"),v(tr.$$.fragment),Tg=d(),Xa=r("p"),yg=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.`),Fg=d(),or=r("p"),Eg=n("This model inherits from "),ws=r("a"),xg=n("TFPreTrainedModel"),Ig=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.)`),Pg=d(),rr=r("p"),kg=n("This model is also a "),sr=r("a"),Cg=n("tf.keras.Model"),Mg=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.`),Ag=d(),te=r("div"),v(ar.$$.fragment),jg=d(),Re=r("p"),zg=n("The "),$s=r("a"),Dg=n("TFSegformerForImageClassification"),qg=n(" forward method, overrides the "),Za=r("code"),Ng=n("__call__"),Og=n(" special method."),Lg=d(),v(St.$$.fragment),Rg=d(),v(wt.$$.fragment),Qn=d(),He=r("h2"),$t=r("a"),Qa=r("span"),v(nr.$$.fragment),Hg=d(),en=r("span"),Wg=n("TFSegformerForSemanticSegmentation"),ei=d(),K=r("div"),v(ir.$$.fragment),Ug=d(),lr=r("p"),Vg=n(`SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
This model inherits from `),Ts=r("a"),Bg=n("TFPreTrainedModel"),Gg=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.)`),Kg=d(),dr=r("p"),Yg=n("This model is also a "),mr=r("a"),Jg=n("tf.keras.Model"),Xg=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.`),Zg=d(),oe=r("div"),v(cr.$$.fragment),Qg=d(),We=r("p"),eh=n("The "),ys=r("a"),th=n("TFSegformerForSemanticSegmentation"),oh=n(" forward method, overrides the "),tn=r("code"),rh=n("__call__"),sh=n(" special method."),ah=d(),v(Tt.$$.fragment),nh=d(),v(yt.$$.fragment),this.h()},l(o){const g=m_('[data-svelte="svelte-1phssyn"]',document.head);f=s(g,"META",{name:!0,content:!0}),g.forEach(t),F=m(o),_=s(o,"H1",{class:!0});var fr=a(_);u=s(fr,"A",{id:!0,class:!0,href:!0});var on=a(u);b=s(on,"SPAN",{});var rn=a(b);S(c.$$.fragment,rn),rn.forEach(t),on.forEach(t),p=m(fr),x=s(fr,"SPAN",{});var sn=a(x);Oi=i(sn,"SegFormer"),sn.forEach(t),fr.forEach(t),pn=m(o),be=s(o,"H2",{class:!0});var gr=a(be);Ue=s(gr,"A",{id:!0,class:!0,href:!0});var an=a(Ue);Rs=s(an,"SPAN",{});var nn=a(Rs);S(Nt.$$.fragment,nn),nn.forEach(t),an.forEach(t),Li=m(gr),Hs=s(gr,"SPAN",{});var ln=a(Hs);Ri=i(ln,"Overview"),ln.forEach(t),gr.forEach(t),un=m(o),Ve=s(o,"P",{});var hr=a(Ve);Hi=i(hr,"The SegFormer model was proposed in "),Ot=s(hr,"A",{href:!0,rel:!0});var dn=a(Ot);Wi=i(dn,"SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers"),dn.forEach(t),Ui=i(hr,` 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.`),hr.forEach(t),_n=m(o),vr=s(o,"P",{});var mn=a(vr);Vi=i(mn,"The abstract from the paper is the following:"),mn.forEach(t),bn=m(o),Sr=s(o,"P",{});var cn=a(Sr);Ws=s(cn,"EM",{});var fn=a(Ws);Bi=i(fn,`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.`),fn.forEach(t),cn.forEach(t),vn=m(o),Be=s(o,"P",{});var oi=a(Be);Gi=i(oi,"The figure below illustrates the architecture of SegFormer. Taken from the "),Lt=s(oi,"A",{href:!0,rel:!0});var lh=a(Lt);Ki=i(lh,"original paper"),lh.forEach(t),Yi=i(oi,"."),oi.forEach(t),Sn=m(o),Rt=s(o,"IMG",{width:!0,src:!0}),wn=m(o),Y=s(o,"P",{});var Ft=a(Y);Ji=i(Ft,"This model was contributed by "),Ht=s(Ft,"A",{href:!0,rel:!0});var dh=a(Ht);Xi=i(dh,"nielsr"),dh.forEach(t),Zi=i(Ft,`. The TensorFlow version
of the model was contributed by `),Wt=s(Ft,"A",{href:!0,rel:!0});var mh=a(Wt);Qi=i(mh,"sayakpaul"),mh.forEach(t),el=i(Ft,". The original code can be found "),Ut=s(Ft,"A",{href:!0,rel:!0});var ch=a(Ut);tl=i(ch,"here"),ch.forEach(t),ol=i(Ft,"."),Ft.forEach(t),$n=m(o),wr=s(o,"P",{});var fh=a(wr);rl=i(fh,"Tips:"),fh.forEach(t),Tn=m(o),k=s(o,"UL",{});var M=a(k);W=s(M,"LI",{});var ue=a(W);sl=i(ue,`SegFormer consists of a hierarchical Transformer encoder, and a lightweight all-MLP decoder head.
`),$r=s(ue,"A",{href:!0});var gh=a($r);al=i(gh,"SegformerModel"),gh.forEach(t),nl=i(ue,` is the hierarchical Transformer encoder (which in the paper is also referred to
as Mix Transformer or MiT). `),Tr=s(ue,"A",{href:!0});var hh=a(Tr);il=i(hh,"SegformerForSemanticSegmentation"),hh.forEach(t),ll=i(ue,` adds the all-MLP decoder head on
top to perform semantic segmentation of images. In addition, there\u2019s
`),yr=s(ue,"A",{href:!0});var ph=a(yr);dl=i(ph,"SegformerForImageClassification"),ph.forEach(t),ml=i(ue,` 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 `),Vt=s(ue,"A",{href:!0,rel:!0});var uh=a(Vt);cl=i(uh,"hub"),uh.forEach(t),fl=i(ue,"."),ue.forEach(t),gl=m(M),ve=s(M,"LI",{});var Fs=a(ve);hl=i(Fs,"The quickest way to get started with SegFormer is by checking the "),Bt=s(Fs,"A",{href:!0,rel:!0});var _h=a(Bt);pl=i(_h,"example notebooks"),_h.forEach(t),ul=i(Fs,` (which showcase both inference and
fine-tuning on custom data). One can also check out the `),Gt=s(Fs,"A",{href:!0,rel:!0});var bh=a(Gt);_l=i(bh,"blog post"),bh.forEach(t),bl=i(Fs," introducing SegFormer and illustrating how it can be fine-tuned on custom data."),Fs.forEach(t),vl=m(M),Kt=s(M,"LI",{});var ri=a(Kt);Sl=i(ri,"TensorFlow users should refer to "),Yt=s(ri,"A",{href:!0,rel:!0});var vh=a(Yt);wl=i(vh,"this repository"),vh.forEach(t),$l=i(ri," that shows off-the-shelf inference and fine-tuning."),ri.forEach(t),Tl=m(M),Jt=s(M,"LI",{});var si=a(Jt);yl=i(si,"One can also check out "),Xt=s(si,"A",{href:!0,rel:!0});var Sh=a(Xt);Fl=i(Sh,"this interactive demo on Hugging Face Spaces"),Sh.forEach(t),El=i(si,`
to try out a SegFormer model on custom images.`),si.forEach(t),xl=m(M),Zt=s(M,"LI",{});var ai=a(Zt);Il=i(ai,"SegFormer works on any input size, as it pads the input to be divisible by "),Us=s(ai,"CODE",{});var wh=a(Us);Pl=i(wh,"config.patch_sizes"),wh.forEach(t),kl=i(ai,"."),ai.forEach(t),Cl=m(M),Se=s(M,"LI",{});var Es=a(Se);Ml=i(Es,"One can use "),Fr=s(Es,"A",{href:!0});var $h=a(Fr);Al=i($h,"SegformerImageProcessor"),$h.forEach(t),jl=i(Es,` 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 `),Qt=s(Es,"A",{href:!0,rel:!0});var Th=a(Qt);zl=i(Th,"here"),Th.forEach(t),Dl=i(Es,`. 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.`),Es.forEach(t),ql=m(M),I=s(M,"LI",{});var C=a(I);Nl=i(C,"One additional thing to keep in mind is that one can initialize "),Er=s(C,"A",{href:!0});var yh=a(Er);Ol=i(yh,"SegformerImageProcessor"),yh.forEach(t),Ll=i(C,` with
`),Vs=s(C,"CODE",{});var Fh=a(Vs);Rl=i(Fh,"reduce_labels"),Fh.forEach(t),Hl=i(C," set to "),Bs=s(C,"CODE",{});var Eh=a(Bs);Wl=i(Eh,"True"),Eh.forEach(t),Ul=i(C," or "),Gs=s(C,"CODE",{});var xh=a(Gs);Vl=i(xh,"False"),xh.forEach(t),Bl=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, `),Ks=s(C,"CODE",{});var Ih=a(Ks);Gl=i(Ih,"reduce_labels"),Ih.forEach(t),Kl=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 Ph=a(Ys);Yl=i(Ph,"ignore_index"),Ph.forEach(t),Jl=i(C,` of the loss function
used by `),xr=s(C,"A",{href:!0});var kh=a(xr);Xl=i(kh,"SegformerForSemanticSegmentation"),kh.forEach(t),Zl=i(C,`). However, other datasets use the 0 index as
background class and include this class as part of all labels. In that case, `),Js=s(C,"CODE",{});var Ch=a(Js);Ql=i(Ch,"reduce_labels"),Ch.forEach(t),ed=i(C,` should be set to
`),Xs=s(C,"CODE",{});var Mh=a(Xs);td=i(Mh,"False"),Mh.forEach(t),od=i(C,", as loss should also be computed for the background class."),C.forEach(t),rd=m(M),eo=s(M,"LI",{});var ni=a(eo);sd=i(ni,`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 `),to=s(ni,"A",{href:!0,rel:!0});var Ah=a(to);ad=i(Ah,"original paper"),Ah.forEach(t),nd=i(ni,")."),ni.forEach(t),M.forEach(t),yn=m(o),Ge=s(o,"TABLE",{});var ii=a(Ge);Zs=s(ii,"THEAD",{});var jh=a(Zs);A=s(jh,"TR",{});var re=a(A);Ir=s(re,"TH",{align:!0});var zh=a(Ir);Qs=s(zh,"STRONG",{});var Dh=a(Qs);id=i(Dh,"Model variant"),Dh.forEach(t),zh.forEach(t),ld=m(re),ea=s(re,"TH",{});var qh=a(ea);ta=s(qh,"STRONG",{});var Nh=a(ta);dd=i(Nh,"Depths"),Nh.forEach(t),qh.forEach(t),md=m(re),oa=s(re,"TH",{});var Oh=a(oa);ra=s(Oh,"STRONG",{});var Lh=a(ra);cd=i(Lh,"Hidden sizes"),Lh.forEach(t),Oh.forEach(t),fd=m(re),Pr=s(re,"TH",{align:!0});var Rh=a(Pr);sa=s(Rh,"STRONG",{});var Hh=a(sa);gd=i(Hh,"Decoder hidden size"),Hh.forEach(t),Rh.forEach(t),hd=m(re),kr=s(re,"TH",{align:!0});var Wh=a(kr);aa=s(Wh,"STRONG",{});var Uh=a(aa);pd=i(Uh,"Params (M)"),Uh.forEach(t),Wh.forEach(t),ud=m(re),Cr=s(re,"TH",{align:!0});var Vh=a(Cr);na=s(Vh,"STRONG",{});var Bh=a(na);_d=i(Bh,"ImageNet-1k Top 1"),Bh.forEach(t),Vh.forEach(t),re.forEach(t),jh.forEach(t),bd=m(ii),j=s(ii,"TBODY",{});var se=a(j);z=s(se,"TR",{});var ae=a(z);Mr=s(ae,"TD",{align:!0});var Gh=a(Mr);vd=i(Gh,"MiT-b0"),Gh.forEach(t),Sd=m(ae),ia=s(ae,"TD",{});var Kh=a(ia);wd=i(Kh,"[2, 2, 2, 2]"),Kh.forEach(t),$d=m(ae),la=s(ae,"TD",{});var Yh=a(la);Td=i(Yh,"[32, 64, 160, 256]"),Yh.forEach(t),yd=m(ae),Ar=s(ae,"TD",{align:!0});var Jh=a(Ar);Fd=i(Jh,"256"),Jh.forEach(t),Ed=m(ae),jr=s(ae,"TD",{align:!0});var Xh=a(jr);xd=i(Xh,"3.7"),Xh.forEach(t),Id=m(ae),zr=s(ae,"TD",{align:!0});var Zh=a(zr);Pd=i(Zh,"70.5"),Zh.forEach(t),ae.forEach(t),kd=m(se),D=s(se,"TR",{});var ne=a(D);Dr=s(ne,"TD",{align:!0});var Qh=a(Dr);Cd=i(Qh,"MiT-b1"),Qh.forEach(t),Md=m(ne),da=s(ne,"TD",{});var ep=a(da);Ad=i(ep,"[2, 2, 2, 2]"),ep.forEach(t),jd=m(ne),ma=s(ne,"TD",{});var tp=a(ma);zd=i(tp,"[64, 128, 320, 512]"),tp.forEach(t),Dd=m(ne),qr=s(ne,"TD",{align:!0});var op=a(qr);qd=i(op,"256"),op.forEach(t),Nd=m(ne),Nr=s(ne,"TD",{align:!0});var rp=a(Nr);Od=i(rp,"14.0"),rp.forEach(t),Ld=m(ne),Or=s(ne,"TD",{align:!0});var sp=a(Or);Rd=i(sp,"78.7"),sp.forEach(t),ne.forEach(t),Hd=m(se),q=s(se,"TR",{});var ie=a(q);Lr=s(ie,"TD",{align:!0});var ap=a(Lr);Wd=i(ap,"MiT-b2"),ap.forEach(t),Ud=m(ie),ca=s(ie,"TD",{});var np=a(ca);Vd=i(np,"[3, 4, 6, 3]"),np.forEach(t),Bd=m(ie),fa=s(ie,"TD",{});var ip=a(fa);Gd=i(ip,"[64, 128, 320, 512]"),ip.forEach(t),Kd=m(ie),Rr=s(ie,"TD",{align:!0});var lp=a(Rr);Yd=i(lp,"768"),lp.forEach(t),Jd=m(ie),Hr=s(ie,"TD",{align:!0});var dp=a(Hr);Xd=i(dp,"25.4"),dp.forEach(t),Zd=m(ie),Wr=s(ie,"TD",{align:!0});var mp=a(Wr);Qd=i(mp,"81.6"),mp.forEach(t),ie.forEach(t),em=m(se),N=s(se,"TR",{});var le=a(N);Ur=s(le,"TD",{align:!0});var cp=a(Ur);tm=i(cp,"MiT-b3"),cp.forEach(t),om=m(le),ga=s(le,"TD",{});var fp=a(ga);rm=i(fp,"[3, 4, 18, 3]"),fp.forEach(t),sm=m(le),ha=s(le,"TD",{});var gp=a(ha);am=i(gp,"[64, 128, 320, 512]"),gp.forEach(t),nm=m(le),Vr=s(le,"TD",{align:!0});var hp=a(Vr);im=i(hp,"768"),hp.forEach(t),lm=m(le),Br=s(le,"TD",{align:!0});var pp=a(Br);dm=i(pp,"45.2"),pp.forEach(t),mm=m(le),Gr=s(le,"TD",{align:!0});var up=a(Gr);cm=i(up,"83.1"),up.forEach(t),le.forEach(t),fm=m(se),O=s(se,"TR",{});var de=a(O);Kr=s(de,"TD",{align:!0});var _p=a(Kr);gm=i(_p,"MiT-b4"),_p.forEach(t),hm=m(de),pa=s(de,"TD",{});var bp=a(pa);pm=i(bp,"[3, 8, 27, 3]"),bp.forEach(t),um=m(de),ua=s(de,"TD",{});var vp=a(ua);_m=i(vp,"[64, 128, 320, 512]"),vp.forEach(t),bm=m(de),Yr=s(de,"TD",{align:!0});var Sp=a(Yr);vm=i(Sp,"768"),Sp.forEach(t),Sm=m(de),Jr=s(de,"TD",{align:!0});var wp=a(Jr);wm=i(wp,"62.6"),wp.forEach(t),$m=m(de),Xr=s(de,"TD",{align:!0});var $p=a(Xr);Tm=i($p,"83.6"),$p.forEach(t),de.forEach(t),ym=m(se),L=s(se,"TR",{});var me=a(L);Zr=s(me,"TD",{align:!0});var Tp=a(Zr);Fm=i(Tp,"MiT-b5"),Tp.forEach(t),Em=m(me),_a=s(me,"TD",{});var yp=a(_a);xm=i(yp,"[3, 6, 40, 3]"),yp.forEach(t),Im=m(me),ba=s(me,"TD",{});var Fp=a(ba);Pm=i(Fp,"[64, 128, 320, 512]"),Fp.forEach(t),km=m(me),Qr=s(me,"TD",{align:!0});var Ep=a(Qr);Cm=i(Ep,"768"),Ep.forEach(t),Mm=m(me),es=s(me,"TD",{align:!0});var xp=a(es);Am=i(xp,"82.0"),xp.forEach(t),jm=m(me),ts=s(me,"TD",{align:!0});var Ip=a(ts);zm=i(Ip,"83.8"),Ip.forEach(t),me.forEach(t),se.forEach(t),ii.forEach(t),Fn=m(o),Ke=s(o,"P",{});var li=a(Ke);Dm=i(li,`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 `),oo=s(li,"A",{href:!0,rel:!0});var Pp=a(oo);qm=i(Pp,"paper"),Pp.forEach(t),Nm=i(li,"."),li.forEach(t),En=m(o),we=s(o,"H2",{class:!0});var di=a(we);Ye=s(di,"A",{id:!0,class:!0,href:!0});var kp=a(Ye);va=s(kp,"SPAN",{});var Cp=a(va);S(ro.$$.fragment,Cp),Cp.forEach(t),kp.forEach(t),Om=m(di),Sa=s(di,"SPAN",{});var Mp=a(Sa);Lm=i(Mp,"Resources"),Mp.forEach(t),di.forEach(t),xn=m(o),os=s(o,"P",{});var Ap=a(os);Rm=i(Ap,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with SegFormer."),Ap.forEach(t),In=m(o),S(so.$$.fragment,o),Pn=m(o),rs=s(o,"UL",{});var jp=a(rs);he=s(jp,"LI",{});var pr=a(he);ss=s(pr,"A",{href:!0});var zp=a(ss);Hm=i(zp,"SegformerForImageClassification"),zp.forEach(t),Wm=i(pr," is supported by this "),ao=s(pr,"A",{href:!0,rel:!0});var Dp=a(ao);Um=i(Dp,"example script"),Dp.forEach(t),Vm=i(pr," and "),no=s(pr,"A",{href:!0,rel:!0});var qp=a(no);Bm=i(qp,"notebook"),qp.forEach(t),Gm=i(pr,"."),pr.forEach(t),jp.forEach(t),kn=m(o),as=s(o,"P",{});var Np=a(as);Km=i(Np,"Semantic segmentation:"),Np.forEach(t),Cn=m(o),J=s(o,"UL",{});var Et=a(J);Je=s(Et,"LI",{});var gn=a(Je);ns=s(gn,"A",{href:!0});var Op=a(ns);Ym=i(Op,"SegformerForSemanticSegmentation"),Op.forEach(t),Jm=i(gn," is supported by this "),io=s(gn,"A",{href:!0,rel:!0});var Lp=a(io);Xm=i(Lp,"example script"),Lp.forEach(t),Zm=i(gn,"."),gn.forEach(t),Qm=m(Et),lo=s(Et,"LI",{});var mi=a(lo);ec=i(mi,"A blog on fine-tuning SegFormer on a custom dataset can be found "),mo=s(mi,"A",{href:!0,rel:!0});var Rp=a(mo);tc=i(Rp,"here"),Rp.forEach(t),oc=i(mi,"."),mi.forEach(t),rc=m(Et),co=s(Et,"LI",{});var ci=a(co);sc=i(ci,"More demo notebooks on SegFormer (both inference + fine-tuning on a custom dataset) can be found "),fo=s(ci,"A",{href:!0,rel:!0});var Hp=a(fo);ac=i(Hp,"here"),Hp.forEach(t),nc=i(ci,"."),ci.forEach(t),ic=m(Et),Xe=s(Et,"LI",{});var hn=a(Xe);is=s(hn,"A",{href:!0});var Wp=a(is);lc=i(Wp,"TFSegformerForSemanticSegmentation"),Wp.forEach(t),dc=i(hn," is supported by this "),go=s(hn,"A",{href:!0,rel:!0});var Up=a(go);mc=i(Up,"example notebook"),Up.forEach(t),cc=i(hn,"."),hn.forEach(t),Et.forEach(t),Mn=m(o),ls=s(o,"P",{});var Vp=a(ls);fc=i(Vp,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Vp.forEach(t),An=m(o),$e=s(o,"H2",{class:!0});var fi=a($e);Ze=s(fi,"A",{id:!0,class:!0,href:!0});var Bp=a(Ze);wa=s(Bp,"SPAN",{});var Gp=a(wa);S(ho.$$.fragment,Gp),Gp.forEach(t),Bp.forEach(t),gc=m(fi),$a=s(fi,"SPAN",{});var Kp=a($a);hc=i(Kp,"SegformerConfig"),Kp.forEach(t),fi.forEach(t),jn=m(o),U=s(o,"DIV",{class:!0});var xt=a(U);S(po.$$.fragment,xt),pc=m(xt),Te=s(xt,"P",{});var xs=a(Te);uc=i(xs,"This is the configuration class to store the configuration of a "),ds=s(xs,"A",{href:!0});var Yp=a(ds);_c=i(Yp,"SegformerModel"),Yp.forEach(t),bc=i(xs,`. 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
`),uo=s(xs,"A",{href:!0,rel:!0});var Jp=a(uo);vc=i(Jp,"nvidia/segformer-b0-finetuned-ade-512-512"),Jp.forEach(t),Sc=i(xs,`
architecture.`),xs.forEach(t),wc=m(xt),ye=s(xt,"P",{});var Is=a(ye);$c=i(Is,"Configuration objects inherit from "),ms=s(Is,"A",{href:!0});var Xp=a(ms);Tc=i(Xp,"PretrainedConfig"),Xp.forEach(t),yc=i(Is,` and can be used to control the model outputs. Read the
documentation from `),cs=s(Is,"A",{href:!0});var Zp=a(cs);Fc=i(Zp,"PretrainedConfig"),Zp.forEach(t),Ec=i(Is," for more information."),Is.forEach(t),xc=m(xt),S(Qe.$$.fragment,xt),xt.forEach(t),zn=m(o),Fe=s(o,"H2",{class:!0});var gi=a(Fe);et=s(gi,"A",{id:!0,class:!0,href:!0});var Qp=a(et);Ta=s(Qp,"SPAN",{});var eu=a(Ta);S(_o.$$.fragment,eu),eu.forEach(t),Qp.forEach(t),Ic=m(gi),ya=s(gi,"SPAN",{});var tu=a(ya);Pc=i(tu,"SegformerFeatureExtractor"),tu.forEach(t),gi.forEach(t),Dn=m(o),ce=s(o,"DIV",{class:!0});var Ps=a(ce);S(bo.$$.fragment,Ps),kc=m(Ps),pe=s(Ps,"DIV",{class:!0});var ks=a(pe);S(vo.$$.fragment,ks),Cc=m(ks),Fa=s(ks,"P",{});var ou=a(Fa);Mc=i(ou,"Preprocesses a batch of images and optionally segmentation maps."),ou.forEach(t),Ac=m(ks),Ee=s(ks,"P",{});var Cs=a(Ee);jc=i(Cs,"Overrides the "),Ea=s(Cs,"CODE",{});var ru=a(Ea);zc=i(ru,"__call__"),ru.forEach(t),Dc=i(Cs," method of the "),xa=s(Cs,"CODE",{});var su=a(xa);qc=i(su,"Preprocessor"),su.forEach(t),Nc=i(Cs,` class so that both images and segmentation maps can be
passed in as positional arguments.`),Cs.forEach(t),ks.forEach(t),Oc=m(Ps),tt=s(Ps,"DIV",{class:!0});var hi=a(tt);S(So.$$.fragment,hi),Lc=m(hi),wo=s(hi,"P",{});var pi=a(wo);Rc=i(pi,"Converts the output of "),fs=s(pi,"A",{href:!0});var au=a(fs);Hc=i(au,"SegformerForSemanticSegmentation"),au.forEach(t),Wc=i(pi,` into semantic segmentation maps. Only supports
PyTorch.`),pi.forEach(t),hi.forEach(t),Ps.forEach(t),qn=m(o),xe=s(o,"H2",{class:!0});var ui=a(xe);ot=s(ui,"A",{id:!0,class:!0,href:!0});var nu=a(ot);Ia=s(nu,"SPAN",{});var iu=a(Ia);S($o.$$.fragment,iu),iu.forEach(t),nu.forEach(t),Uc=m(ui),Pa=s(ui,"SPAN",{});var lu=a(Pa);Vc=i(lu,"SegformerImageProcessor"),lu.forEach(t),ui.forEach(t),Nn=m(o),V=s(o,"DIV",{class:!0});var It=a(V);S(To.$$.fragment,It),Bc=m(It),ka=s(It,"P",{});var du=a(ka);Gc=i(du,"Constructs a Segformer image processor."),du.forEach(t),Kc=m(It),rt=s(It,"DIV",{class:!0});var _i=a(rt);S(yo.$$.fragment,_i),Yc=m(_i),Ca=s(_i,"P",{});var mu=a(Ca);Jc=i(mu,"Preprocess an image or batch of images."),mu.forEach(t),_i.forEach(t),Xc=m(It),st=s(It,"DIV",{class:!0});var bi=a(st);S(Fo.$$.fragment,bi),Zc=m(bi),Eo=s(bi,"P",{});var vi=a(Eo);Qc=i(vi,"Converts the output of "),gs=s(vi,"A",{href:!0});var cu=a(gs);ef=i(cu,"SegformerForSemanticSegmentation"),cu.forEach(t),tf=i(vi,` into semantic segmentation maps. Only supports
PyTorch.`),vi.forEach(t),bi.forEach(t),It.forEach(t),On=m(o),Ie=s(o,"H2",{class:!0});var Si=a(Ie);at=s(Si,"A",{id:!0,class:!0,href:!0});var fu=a(at);Ma=s(fu,"SPAN",{});var gu=a(Ma);S(xo.$$.fragment,gu),gu.forEach(t),fu.forEach(t),of=m(Si),Aa=s(Si,"SPAN",{});var hu=a(Aa);rf=i(hu,"SegformerModel"),hu.forEach(t),Si.forEach(t),Ln=m(o),fe=s(o,"DIV",{class:!0});var Ms=a(fe);S(Io.$$.fragment,Ms),sf=m(Ms),Po=s(Ms,"P",{});var wi=a(Po);af=i(wi,`The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ko=s(wi,"A",{href:!0,rel:!0});var pu=a(ko);nf=i(pu,"torch.nn.Module"),pu.forEach(t),lf=i(wi,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),wi.forEach(t),df=m(Ms),X=s(Ms,"DIV",{class:!0});var Pt=a(X);S(Co.$$.fragment,Pt),mf=m(Pt),Pe=s(Pt,"P",{});var As=a(Pe);cf=i(As,"The "),hs=s(As,"A",{href:!0});var uu=a(hs);ff=i(uu,"SegformerModel"),uu.forEach(t),gf=i(As," forward method, overrides the "),ja=s(As,"CODE",{});var _u=a(ja);hf=i(_u,"__call__"),_u.forEach(t),pf=i(As," special method."),As.forEach(t),uf=m(Pt),S(nt.$$.fragment,Pt),_f=m(Pt),S(it.$$.fragment,Pt),Pt.forEach(t),Ms.forEach(t),Rn=m(o),ke=s(o,"H2",{class:!0});var $i=a(ke);lt=s($i,"A",{id:!0,class:!0,href:!0});var bu=a(lt);za=s(bu,"SPAN",{});var vu=a(za);S(Mo.$$.fragment,vu),vu.forEach(t),bu.forEach(t),bf=m($i),Da=s($i,"SPAN",{});var Su=a(Da);vf=i(Su,"SegformerDecodeHead"),Su.forEach(t),$i.forEach(t),Hn=m(o),Ce=s(o,"DIV",{class:!0});var Ti=a(Ce);S(Ao.$$.fragment,Ti),Sf=m(Ti),ps=s(Ti,"DIV",{class:!0});var wu=a(ps);S(jo.$$.fragment,wu),wu.forEach(t),Ti.forEach(t),Wn=m(o),Me=s(o,"H2",{class:!0});var yi=a(Me);dt=s(yi,"A",{id:!0,class:!0,href:!0});var $u=a(dt);qa=s($u,"SPAN",{});var Tu=a(qa);S(zo.$$.fragment,Tu),Tu.forEach(t),$u.forEach(t),wf=m(yi),Na=s(yi,"SPAN",{});var yu=a(Na);$f=i(yu,"SegformerForImageClassification"),yu.forEach(t),yi.forEach(t),Un=m(o),B=s(o,"DIV",{class:!0});var kt=a(B);S(Do.$$.fragment,kt),Tf=m(kt),Oa=s(kt,"P",{});var Fu=a(Oa);yf=i(Fu,`SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden
states) e.g. for ImageNet.`),Fu.forEach(t),Ff=m(kt),qo=s(kt,"P",{});var Fi=a(qo);Ef=i(Fi,"This model is a PyTorch "),No=s(Fi,"A",{href:!0,rel:!0});var Eu=a(No);xf=i(Eu,"torch.nn.Module"),Eu.forEach(t),If=i(Fi,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Fi.forEach(t),Pf=m(kt),Z=s(kt,"DIV",{class:!0});var Ct=a(Z);S(Oo.$$.fragment,Ct),kf=m(Ct),Ae=s(Ct,"P",{});var js=a(Ae);Cf=i(js,"The "),us=s(js,"A",{href:!0});var xu=a(us);Mf=i(xu,"SegformerForImageClassification"),xu.forEach(t),Af=i(js," forward method, overrides the "),La=s(js,"CODE",{});var Iu=a(La);jf=i(Iu,"__call__"),Iu.forEach(t),zf=i(js," special method."),js.forEach(t),Df=m(Ct),S(mt.$$.fragment,Ct),qf=m(Ct),S(ct.$$.fragment,Ct),Ct.forEach(t),kt.forEach(t),Vn=m(o),je=s(o,"H2",{class:!0});var Ei=a(je);ft=s(Ei,"A",{id:!0,class:!0,href:!0});var Pu=a(ft);Ra=s(Pu,"SPAN",{});var ku=a(Ra);S(Lo.$$.fragment,ku),ku.forEach(t),Pu.forEach(t),Nf=m(Ei),Ha=s(Ei,"SPAN",{});var Cu=a(Ha);Of=i(Cu,"SegformerForSemanticSegmentation"),Cu.forEach(t),Ei.forEach(t),Bn=m(o),ge=s(o,"DIV",{class:!0});var zs=a(ge);S(Ro.$$.fragment,zs),Lf=m(zs),Ho=s(zs,"P",{});var xi=a(Ho);Rf=i(xi,`SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
This model is a PyTorch `),Wo=s(xi,"A",{href:!0,rel:!0});var Mu=a(Wo);Hf=i(Mu,"torch.nn.Module"),Mu.forEach(t),Wf=i(xi,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),xi.forEach(t),Uf=m(zs),Q=s(zs,"DIV",{class:!0});var Mt=a(Q);S(Uo.$$.fragment,Mt),Vf=m(Mt),ze=s(Mt,"P",{});var Ds=a(ze);Bf=i(Ds,"The "),_s=s(Ds,"A",{href:!0});var Au=a(_s);Gf=i(Au,"SegformerForSemanticSegmentation"),Au.forEach(t),Kf=i(Ds," forward method, overrides the "),Wa=s(Ds,"CODE",{});var ju=a(Wa);Yf=i(ju,"__call__"),ju.forEach(t),Jf=i(Ds," special method."),Ds.forEach(t),Xf=m(Mt),S(gt.$$.fragment,Mt),Zf=m(Mt),S(ht.$$.fragment,Mt),Mt.forEach(t),zs.forEach(t),Gn=m(o),De=s(o,"H2",{class:!0});var Ii=a(De);pt=s(Ii,"A",{id:!0,class:!0,href:!0});var zu=a(pt);Ua=s(zu,"SPAN",{});var Du=a(Ua);S(Vo.$$.fragment,Du),Du.forEach(t),zu.forEach(t),Qf=m(Ii),Va=s(Ii,"SPAN",{});var qu=a(Va);eg=i(qu,"TFSegformerDecodeHead"),qu.forEach(t),Ii.forEach(t),Kn=m(o),qe=s(o,"DIV",{class:!0});var Pi=a(qe);S(Bo.$$.fragment,Pi),tg=m(Pi),bs=s(Pi,"DIV",{class:!0});var Nu=a(bs);S(Go.$$.fragment,Nu),Nu.forEach(t),Pi.forEach(t),Yn=m(o),Ne=s(o,"H2",{class:!0});var ki=a(Ne);ut=s(ki,"A",{id:!0,class:!0,href:!0});var Ou=a(ut);Ba=s(Ou,"SPAN",{});var Lu=a(Ba);S(Ko.$$.fragment,Lu),Lu.forEach(t),Ou.forEach(t),og=m(ki),Ga=s(ki,"SPAN",{});var Ru=a(Ga);rg=i(Ru,"TFSegformerModel"),Ru.forEach(t),ki.forEach(t),Jn=m(o),G=s(o,"DIV",{class:!0});var At=a(G);S(Yo.$$.fragment,At),sg=m(At),Jo=s(At,"P",{});var Ci=a(Jo);ag=i(Ci,`The bare SegFormer encoder (Mix-Transformer) outputting raw hidden-states without any specific head on top.
This model inherits from `),vs=s(Ci,"A",{href:!0});var Hu=a(vs);ng=i(Hu,"TFPreTrainedModel"),Hu.forEach(t),ig=i(Ci,`. 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.)`),Ci.forEach(t),lg=m(At),Xo=s(At,"P",{});var Mi=a(Xo);dg=i(Mi,"This model is also a "),Zo=s(Mi,"A",{href:!0,rel:!0});var Wu=a(Zo);mg=i(Wu,"tf.keras.Model"),Wu.forEach(t),cg=i(Mi,` 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.`),Mi.forEach(t),fg=m(At),ee=s(At,"DIV",{class:!0});var jt=a(ee);S(Qo.$$.fragment,jt),gg=m(jt),Oe=s(jt,"P",{});var qs=a(Oe);hg=i(qs,"The "),Ss=s(qs,"A",{href:!0});var Uu=a(Ss);pg=i(Uu,"TFSegformerModel"),Uu.forEach(t),ug=i(qs," forward method, overrides the "),Ka=s(qs,"CODE",{});var Vu=a(Ka);_g=i(Vu,"__call__"),Vu.forEach(t),bg=i(qs," special method."),qs.forEach(t),vg=m(jt),S(_t.$$.fragment,jt),Sg=m(jt),S(bt.$$.fragment,jt),jt.forEach(t),At.forEach(t),Xn=m(o),Le=s(o,"H2",{class:!0});var Ai=a(Le);vt=s(Ai,"A",{id:!0,class:!0,href:!0});var Bu=a(vt);Ya=s(Bu,"SPAN",{});var Gu=a(Ya);S(er.$$.fragment,Gu),Gu.forEach(t),Bu.forEach(t),wg=m(Ai),Ja=s(Ai,"SPAN",{});var Ku=a(Ja);$g=i(Ku,"TFSegformerForImageClassification"),Ku.forEach(t),Ai.forEach(t),Zn=m(o),R=s(o,"DIV",{class:!0});var _e=a(R);S(tr.$$.fragment,_e),Tg=m(_e),Xa=s(_e,"P",{});var Yu=a(Xa);yg=i(Yu,`SegFormer Model transformer with an image classification head on top (a linear layer on top of the final hidden
states) e.g. for ImageNet.`),Yu.forEach(t),Fg=m(_e),or=s(_e,"P",{});var ji=a(or);Eg=i(ji,"This model inherits from "),ws=s(ji,"A",{href:!0});var Ju=a(ws);xg=i(Ju,"TFPreTrainedModel"),Ju.forEach(t),Ig=i(ji,`. 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.)`),ji.forEach(t),Pg=m(_e),rr=s(_e,"P",{});var zi=a(rr);kg=i(zi,"This model is also a "),sr=s(zi,"A",{href:!0,rel:!0});var Xu=a(sr);Cg=i(Xu,"tf.keras.Model"),Xu.forEach(t),Mg=i(zi,` 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.`),zi.forEach(t),Ag=m(_e),te=s(_e,"DIV",{class:!0});var zt=a(te);S(ar.$$.fragment,zt),jg=m(zt),Re=s(zt,"P",{});var Ns=a(Re);zg=i(Ns,"The "),$s=s(Ns,"A",{href:!0});var Zu=a($s);Dg=i(Zu,"TFSegformerForImageClassification"),Zu.forEach(t),qg=i(Ns," forward method, overrides the "),Za=s(Ns,"CODE",{});var Qu=a(Za);Ng=i(Qu,"__call__"),Qu.forEach(t),Og=i(Ns," special method."),Ns.forEach(t),Lg=m(zt),S(St.$$.fragment,zt),Rg=m(zt),S(wt.$$.fragment,zt),zt.forEach(t),_e.forEach(t),Qn=m(o),He=s(o,"H2",{class:!0});var Di=a(He);$t=s(Di,"A",{id:!0,class:!0,href:!0});var e_=a($t);Qa=s(e_,"SPAN",{});var t_=a(Qa);S(nr.$$.fragment,t_),t_.forEach(t),e_.forEach(t),Hg=m(Di),en=s(Di,"SPAN",{});var o_=a(en);Wg=i(o_,"TFSegformerForSemanticSegmentation"),o_.forEach(t),Di.forEach(t),ei=m(o),K=s(o,"DIV",{class:!0});var Dt=a(K);S(ir.$$.fragment,Dt),Ug=m(Dt),lr=s(Dt,"P",{});var qi=a(lr);Vg=i(qi,`SegFormer Model transformer with an all-MLP decode head on top e.g. for ADE20k, CityScapes.
This model inherits from `),Ts=s(qi,"A",{href:!0});var r_=a(Ts);Bg=i(r_,"TFPreTrainedModel"),r_.forEach(t),Gg=i(qi,`. 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.)`),qi.forEach(t),Kg=m(Dt),dr=s(Dt,"P",{});var Ni=a(dr);Yg=i(Ni,"This model is also a "),mr=s(Ni,"A",{href:!0,rel:!0});var s_=a(mr);Jg=i(s_,"tf.keras.Model"),s_.forEach(t),Xg=i(Ni,` 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.`),Ni.forEach(t),Zg=m(Dt),oe=s(Dt,"DIV",{class:!0});var qt=a(oe);S(cr.$$.fragment,qt),Qg=m(qt),We=s(qt,"P",{});var Os=a(We);eh=i(Os,"The "),ys=s(Os,"A",{href:!0});var a_=a(ys);th=i(a_,"TFSegformerForSemanticSegmentation"),a_.forEach(t),oh=i(Os," forward method, overrides the "),tn=s(Os,"CODE",{});var n_=a(tn);rh=i(n_,"__call__"),n_.forEach(t),sh=i(Os," special method."),Os.forEach(t),ah=m(qt),S(Tt.$$.fragment,qt),nh=m(qt),S(yt.$$.fragment,qt),qt.forEach(t),Dt.forEach(t),this.h()},h(){l(f,"name","hf:doc:metadata"),l(f,"content",JSON.stringify(I_)),l(u,"id","segformer"),l(u,"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(u,"href","#segformer"),l(_,"class","relative group"),l(Ue,"id","overview"),l(Ue,"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(Ue,"href","#overview"),l(be,"class","relative group"),l(Ot,"href","https://arxiv.org/abs/2105.15203"),l(Ot,"rel","nofollow"),l(Lt,"href","https://arxiv.org/abs/2105.15203"),l(Lt,"rel","nofollow"),l(Rt,"width","600"),c_(Rt.src,ih="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/segformer_architecture.png")||l(Rt,"src",ih),l(Ht,"href","https://huggingface.co/nielsr"),l(Ht,"rel","nofollow"),l(Wt,"href","https://huggingface.co/sayakpaul"),l(Wt,"rel","nofollow"),l(Ut,"href","https://github.com/NVlabs/SegFormer"),l(Ut,"rel","nofollow"),l($r,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerModel"),l(Tr,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(yr,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerForImageClassification"),l(Vt,"href","https://huggingface.co/models?other=segformer"),l(Vt,"rel","nofollow"),l(Bt,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/SegFormer"),l(Bt,"rel","nofollow"),l(Gt,"href","https://huggingface.co/blog/fine-tune-segformer"),l(Gt,"rel","nofollow"),l(Yt,"href","https://github.com/deep-diver/segformer-tf-transformers"),l(Yt,"rel","nofollow"),l(Xt,"href","https://huggingface.co/spaces/chansung/segformer-tf-transformers"),l(Xt,"rel","nofollow"),l(Fr,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerImageProcessor"),l(Qt,"href","https://github.com/NVlabs/SegFormer/blob/master/local_configs/_base_/datasets/ade20k_repeat.py"),l(Qt,"rel","nofollow"),l(Er,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerImageProcessor"),l(xr,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(to,"href","https://arxiv.org/abs/2105.15203"),l(to,"rel","nofollow"),l(Ir,"align","center"),l(Pr,"align","center"),l(kr,"align","center"),l(Cr,"align","center"),l(Mr,"align","center"),l(Ar,"align","center"),l(jr,"align","center"),l(zr,"align","center"),l(Dr,"align","center"),l(qr,"align","center"),l(Nr,"align","center"),l(Or,"align","center"),l(Lr,"align","center"),l(Rr,"align","center"),l(Hr,"align","center"),l(Wr,"align","center"),l(Ur,"align","center"),l(Vr,"align","center"),l(Br,"align","center"),l(Gr,"align","center"),l(Kr,"align","center"),l(Yr,"align","center"),l(Jr,"align","center"),l(Xr,"align","center"),l(Zr,"align","center"),l(Qr,"align","center"),l(es,"align","center"),l(ts,"align","center"),l(oo,"href","https://arxiv.org/abs/2105.15203"),l(oo,"rel","nofollow"),l(Ye,"id","resources"),l(Ye,"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(Ye,"href","#resources"),l(we,"class","relative group"),l(ss,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerForImageClassification"),l(ao,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),l(ao,"rel","nofollow"),l(no,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),l(no,"rel","nofollow"),l(ns,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(io,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/semantic-segmentation"),l(io,"rel","nofollow"),l(mo,"href","https://huggingface.co/blog/fine-tune-segformer"),l(mo,"rel","nofollow"),l(fo,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/SegFormer"),l(fo,"rel","nofollow"),l(is,"href","/docs/transformers/main/en/model_doc/segformer#transformers.TFSegformerForSemanticSegmentation"),l(go,"href","https://github.com/huggingface/notebooks/blob/main/examples/semantic_segmentation-tf.ipynb"),l(go,"rel","nofollow"),l(Ze,"id","transformers.SegformerConfig"),l(Ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ze,"href","#transformers.SegformerConfig"),l($e,"class","relative group"),l(ds,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerModel"),l(uo,"href","https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512"),l(uo,"rel","nofollow"),l(ms,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(cs,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),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(et,"id","transformers.SegformerFeatureExtractor"),l(et,"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(et,"href","#transformers.SegformerFeatureExtractor"),l(Fe,"class","relative group"),l(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(fs,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ot,"id","transformers.SegformerImageProcessor"),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.SegformerImageProcessor"),l(xe,"class","relative group"),l(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(gs,"href","/docs/transformers/main/en/model_doc/segformer#transformers.SegformerForSemanticSegmentation"),l(st,"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(at,"id","transformers.SegformerModel"),l(at,"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(at,"href","#transformers.SegformerModel"),l(Ie,"class","relative group"),l(ko,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(ko,"rel","nofollow"),l(hs,"href","/docs/transformers/main/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(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(lt,"id","transformers.SegformerDecodeHead"),l(lt,"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(lt,"href","#transformers.SegformerDecodeHead"),l(ke,"class","relative group"),l(ps,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(dt,"id","transformers.SegformerForImageClassification"),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.SegformerForImageClassification"),l(Me,"class","relative group"),l(No,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(No,"rel","nofollow"),l(us,"href","/docs/transformers/main/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(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(ft,"id","transformers.SegformerForSemanticSegmentation"),l(ft,"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(ft,"href","#transformers.SegformerForSemanticSegmentation"),l(je,"class","relative group"),l(Wo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Wo,"rel","nofollow"),l(_s,"href","/docs/transformers/main/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(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(pt,"id","transformers.TFSegformerDecodeHead"),l(pt,"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(pt,"href","#transformers.TFSegformerDecodeHead"),l(De,"class","relative group"),l(bs,"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,"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.TFSegformerModel"),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.TFSegformerModel"),l(Ne,"class","relative group"),l(vs,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),l(Zo,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),l(Zo,"rel","nofollow"),l(Ss,"href","/docs/transformers/main/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(vt,"id","transformers.TFSegformerForImageClassification"),l(vt,"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(vt,"href","#transformers.TFSegformerForImageClassification"),l(Le,"class","relative group"),l(ws,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),l(sr,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),l(sr,"rel","nofollow"),l($s,"href","/docs/transformers/main/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($t,"id","transformers.TFSegformerForSemanticSegmentation"),l($t,"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($t,"href","#transformers.TFSegformerForSemanticSegmentation"),l(He,"class","relative group"),l(Ts,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),l(mr,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),l(mr,"rel","nofollow"),l(ys,"href","/docs/transformers/main/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),h(o,F,g),h(o,_,g),e(_,u),e(u,b),w(c,b,null),e(_,p),e(_,x),e(x,Oi),h(o,pn,g),h(o,be,g),e(be,Ue),e(Ue,Rs),w(Nt,Rs,null),e(be,Li),e(be,Hs),e(Hs,Ri),h(o,un,g),h(o,Ve,g),e(Ve,Hi),e(Ve,Ot),e(Ot,Wi),e(Ve,Ui),h(o,_n,g),h(o,vr,g),e(vr,Vi),h(o,bn,g),h(o,Sr,g),e(Sr,Ws),e(Ws,Bi),h(o,vn,g),h(o,Be,g),e(Be,Gi),e(Be,Lt),e(Lt,Ki),e(Be,Yi),h(o,Sn,g),h(o,Rt,g),h(o,wn,g),h(o,Y,g),e(Y,Ji),e(Y,Ht),e(Ht,Xi),e(Y,Zi),e(Y,Wt),e(Wt,Qi),e(Y,el),e(Y,Ut),e(Ut,tl),e(Y,ol),h(o,$n,g),h(o,wr,g),e(wr,rl),h(o,Tn,g),h(o,k,g),e(k,W),e(W,sl),e(W,$r),e($r,al),e(W,nl),e(W,Tr),e(Tr,il),e(W,ll),e(W,yr),e(yr,dl),e(W,ml),e(W,Vt),e(Vt,cl),e(W,fl),e(k,gl),e(k,ve),e(ve,hl),e(ve,Bt),e(Bt,pl),e(ve,ul),e(ve,Gt),e(Gt,_l),e(ve,bl),e(k,vl),e(k,Kt),e(Kt,Sl),e(Kt,Yt),e(Yt,wl),e(Kt,$l),e(k,Tl),e(k,Jt),e(Jt,yl),e(Jt,Xt),e(Xt,Fl),e(Jt,El),e(k,xl),e(k,Zt),e(Zt,Il),e(Zt,Us),e(Us,Pl),e(Zt,kl),e(k,Cl),e(k,Se),e(Se,Ml),e(Se,Fr),e(Fr,Al),e(Se,jl),e(Se,Qt),e(Qt,zl),e(Se,Dl),e(k,ql),e(k,I),e(I,Nl),e(I,Er),e(Er,Ol),e(I,Ll),e(I,Vs),e(Vs,Rl),e(I,Hl),e(I,Bs),e(Bs,Wl),e(I,Ul),e(I,Gs),e(Gs,Vl),e(I,Bl),e(I,Ks),e(Ks,Gl),e(I,Kl),e(I,Ys),e(Ys,Yl),e(I,Jl),e(I,xr),e(xr,Xl),e(I,Zl),e(I,Js),e(Js,Ql),e(I,ed),e(I,Xs),e(Xs,td),e(I,od),e(k,rd),e(k,eo),e(eo,sd),e(eo,to),e(to,ad),e(eo,nd),h(o,yn,g),h(o,Ge,g),e(Ge,Zs),e(Zs,A),e(A,Ir),e(Ir,Qs),e(Qs,id),e(A,ld),e(A,ea),e(ea,ta),e(ta,dd),e(A,md),e(A,oa),e(oa,ra),e(ra,cd),e(A,fd),e(A,Pr),e(Pr,sa),e(sa,gd),e(A,hd),e(A,kr),e(kr,aa),e(aa,pd),e(A,ud),e(A,Cr),e(Cr,na),e(na,_d),e(Ge,bd),e(Ge,j),e(j,z),e(z,Mr),e(Mr,vd),e(z,Sd),e(z,ia),e(ia,wd),e(z,$d),e(z,la),e(la,Td),e(z,yd),e(z,Ar),e(Ar,Fd),e(z,Ed),e(z,jr),e(jr,xd),e(z,Id),e(z,zr),e(zr,Pd),e(j,kd),e(j,D),e(D,Dr),e(Dr,Cd),e(D,Md),e(D,da),e(da,Ad),e(D,jd),e(D,ma),e(ma,zd),e(D,Dd),e(D,qr),e(qr,qd),e(D,Nd),e(D,Nr),e(Nr,Od),e(D,Ld),e(D,Or),e(Or,Rd),e(j,Hd),e(j,q),e(q,Lr),e(Lr,Wd),e(q,Ud),e(q,ca),e(ca,Vd),e(q,Bd),e(q,fa),e(fa,Gd),e(q,Kd),e(q,Rr),e(Rr,Yd),e(q,Jd),e(q,Hr),e(Hr,Xd),e(q,Zd),e(q,Wr),e(Wr,Qd),e(j,em),e(j,N),e(N,Ur),e(Ur,tm),e(N,om),e(N,ga),e(ga,rm),e(N,sm),e(N,ha),e(ha,am),e(N,nm),e(N,Vr),e(Vr,im),e(N,lm),e(N,Br),e(Br,dm),e(N,mm),e(N,Gr),e(Gr,cm),e(j,fm),e(j,O),e(O,Kr),e(Kr,gm),e(O,hm),e(O,pa),e(pa,pm),e(O,um),e(O,ua),e(ua,_m),e(O,bm),e(O,Yr),e(Yr,vm),e(O,Sm),e(O,Jr),e(Jr,wm),e(O,$m),e(O,Xr),e(Xr,Tm),e(j,ym),e(j,L),e(L,Zr),e(Zr,Fm),e(L,Em),e(L,_a),e(_a,xm),e(L,Im),e(L,ba),e(ba,Pm),e(L,km),e(L,Qr),e(Qr,Cm),e(L,Mm),e(L,es),e(es,Am),e(L,jm),e(L,ts),e(ts,zm),h(o,Fn,g),h(o,Ke,g),e(Ke,Dm),e(Ke,oo),e(oo,qm),e(Ke,Nm),h(o,En,g),h(o,we,g),e(we,Ye),e(Ye,va),w(ro,va,null),e(we,Om),e(we,Sa),e(Sa,Lm),h(o,xn,g),h(o,os,g),e(os,Rm),h(o,In,g),w(so,o,g),h(o,Pn,g),h(o,rs,g),e(rs,he),e(he,ss),e(ss,Hm),e(he,Wm),e(he,ao),e(ao,Um),e(he,Vm),e(he,no),e(no,Bm),e(he,Gm),h(o,kn,g),h(o,as,g),e(as,Km),h(o,Cn,g),h(o,J,g),e(J,Je),e(Je,ns),e(ns,Ym),e(Je,Jm),e(Je,io),e(io,Xm),e(Je,Zm),e(J,Qm),e(J,lo),e(lo,ec),e(lo,mo),e(mo,tc),e(lo,oc),e(J,rc),e(J,co),e(co,sc),e(co,fo),e(fo,ac),e(co,nc),e(J,ic),e(J,Xe),e(Xe,is),e(is,lc),e(Xe,dc),e(Xe,go),e(go,mc),e(Xe,cc),h(o,Mn,g),h(o,ls,g),e(ls,fc),h(o,An,g),h(o,$e,g),e($e,Ze),e(Ze,wa),w(ho,wa,null),e($e,gc),e($e,$a),e($a,hc),h(o,jn,g),h(o,U,g),w(po,U,null),e(U,pc),e(U,Te),e(Te,uc),e(Te,ds),e(ds,_c),e(Te,bc),e(Te,uo),e(uo,vc),e(Te,Sc),e(U,wc),e(U,ye),e(ye,$c),e(ye,ms),e(ms,Tc),e(ye,yc),e(ye,cs),e(cs,Fc),e(ye,Ec),e(U,xc),w(Qe,U,null),h(o,zn,g),h(o,Fe,g),e(Fe,et),e(et,Ta),w(_o,Ta,null),e(Fe,Ic),e(Fe,ya),e(ya,Pc),h(o,Dn,g),h(o,ce,g),w(bo,ce,null),e(ce,kc),e(ce,pe),w(vo,pe,null),e(pe,Cc),e(pe,Fa),e(Fa,Mc),e(pe,Ac),e(pe,Ee),e(Ee,jc),e(Ee,Ea),e(Ea,zc),e(Ee,Dc),e(Ee,xa),e(xa,qc),e(Ee,Nc),e(ce,Oc),e(ce,tt),w(So,tt,null),e(tt,Lc),e(tt,wo),e(wo,Rc),e(wo,fs),e(fs,Hc),e(wo,Wc),h(o,qn,g),h(o,xe,g),e(xe,ot),e(ot,Ia),w($o,Ia,null),e(xe,Uc),e(xe,Pa),e(Pa,Vc),h(o,Nn,g),h(o,V,g),w(To,V,null),e(V,Bc),e(V,ka),e(ka,Gc),e(V,Kc),e(V,rt),w(yo,rt,null),e(rt,Yc),e(rt,Ca),e(Ca,Jc),e(V,Xc),e(V,st),w(Fo,st,null),e(st,Zc),e(st,Eo),e(Eo,Qc),e(Eo,gs),e(gs,ef),e(Eo,tf),h(o,On,g),h(o,Ie,g),e(Ie,at),e(at,Ma),w(xo,Ma,null),e(Ie,of),e(Ie,Aa),e(Aa,rf),h(o,Ln,g),h(o,fe,g),w(Io,fe,null),e(fe,sf),e(fe,Po),e(Po,af),e(Po,ko),e(ko,nf),e(Po,lf),e(fe,df),e(fe,X),w(Co,X,null),e(X,mf),e(X,Pe),e(Pe,cf),e(Pe,hs),e(hs,ff),e(Pe,gf),e(Pe,ja),e(ja,hf),e(Pe,pf),e(X,uf),w(nt,X,null),e(X,_f),w(it,X,null),h(o,Rn,g),h(o,ke,g),e(ke,lt),e(lt,za),w(Mo,za,null),e(ke,bf),e(ke,Da),e(Da,vf),h(o,Hn,g),h(o,Ce,g),w(Ao,Ce,null),e(Ce,Sf),e(Ce,ps),w(jo,ps,null),h(o,Wn,g),h(o,Me,g),e(Me,dt),e(dt,qa),w(zo,qa,null),e(Me,wf),e(Me,Na),e(Na,$f),h(o,Un,g),h(o,B,g),w(Do,B,null),e(B,Tf),e(B,Oa),e(Oa,yf),e(B,Ff),e(B,qo),e(qo,Ef),e(qo,No),e(No,xf),e(qo,If),e(B,Pf),e(B,Z),w(Oo,Z,null),e(Z,kf),e(Z,Ae),e(Ae,Cf),e(Ae,us),e(us,Mf),e(Ae,Af),e(Ae,La),e(La,jf),e(Ae,zf),e(Z,Df),w(mt,Z,null),e(Z,qf),w(ct,Z,null),h(o,Vn,g),h(o,je,g),e(je,ft),e(ft,Ra),w(Lo,Ra,null),e(je,Nf),e(je,Ha),e(Ha,Of),h(o,Bn,g),h(o,ge,g),w(Ro,ge,null),e(ge,Lf),e(ge,Ho),e(Ho,Rf),e(Ho,Wo),e(Wo,Hf),e(Ho,Wf),e(ge,Uf),e(ge,Q),w(Uo,Q,null),e(Q,Vf),e(Q,ze),e(ze,Bf),e(ze,_s),e(_s,Gf),e(ze,Kf),e(ze,Wa),e(Wa,Yf),e(ze,Jf),e(Q,Xf),w(gt,Q,null),e(Q,Zf),w(ht,Q,null),h(o,Gn,g),h(o,De,g),e(De,pt),e(pt,Ua),w(Vo,Ua,null),e(De,Qf),e(De,Va),e(Va,eg),h(o,Kn,g),h(o,qe,g),w(Bo,qe,null),e(qe,tg),e(qe,bs),w(Go,bs,null),h(o,Yn,g),h(o,Ne,g),e(Ne,ut),e(ut,Ba),w(Ko,Ba,null),e(Ne,og),e(Ne,Ga),e(Ga,rg),h(o,Jn,g),h(o,G,g),w(Yo,G,null),e(G,sg),e(G,Jo),e(Jo,ag),e(Jo,vs),e(vs,ng),e(Jo,ig),e(G,lg),e(G,Xo),e(Xo,dg),e(Xo,Zo),e(Zo,mg),e(Xo,cg),e(G,fg),e(G,ee),w(Qo,ee,null),e(ee,gg),e(ee,Oe),e(Oe,hg),e(Oe,Ss),e(Ss,pg),e(Oe,ug),e(Oe,Ka),e(Ka,_g),e(Oe,bg),e(ee,vg),w(_t,ee,null),e(ee,Sg),w(bt,ee,null),h(o,Xn,g),h(o,Le,g),e(Le,vt),e(vt,Ya),w(er,Ya,null),e(Le,wg),e(Le,Ja),e(Ja,$g),h(o,Zn,g),h(o,R,g),w(tr,R,null),e(R,Tg),e(R,Xa),e(Xa,yg),e(R,Fg),e(R,or),e(or,Eg),e(or,ws),e(ws,xg),e(or,Ig),e(R,Pg),e(R,rr),e(rr,kg),e(rr,sr),e(sr,Cg),e(rr,Mg),e(R,Ag),e(R,te),w(ar,te,null),e(te,jg),e(te,Re),e(Re,zg),e(Re,$s),e($s,Dg),e(Re,qg),e(Re,Za),e(Za,Ng),e(Re,Og),e(te,Lg),w(St,te,null),e(te,Rg),w(wt,te,null),h(o,Qn,g),h(o,He,g),e(He,$t),e($t,Qa),w(nr,Qa,null),e(He,Hg),e(He,en),e(en,Wg),h(o,ei,g),h(o,K,g),w(ir,K,null),e(K,Ug),e(K,lr),e(lr,Vg),e(lr,Ts),e(Ts,Bg),e(lr,Gg),e(K,Kg),e(K,dr),e(dr,Yg),e(dr,mr),e(mr,Jg),e(dr,Xg),e(K,Zg),e(K,oe),w(cr,oe,null),e(oe,Qg),e(oe,We),e(We,eh),e(We,ys),e(ys,th),e(We,oh),e(We,tn),e(tn,rh),e(We,sh),e(oe,ah),w(Tt,oe,null),e(oe,nh),w(yt,oe,null),ti=!0},p(o,[g]){const fr={};g&2&&(fr.$$scope={dirty:g,ctx:o}),Qe.$set(fr);const on={};g&2&&(on.$$scope={dirty:g,ctx:o}),nt.$set(on);const rn={};g&2&&(rn.$$scope={dirty:g,ctx:o}),it.$set(rn);const sn={};g&2&&(sn.$$scope={dirty:g,ctx:o}),mt.$set(sn);const gr={};g&2&&(gr.$$scope={dirty:g,ctx:o}),ct.$set(gr);const an={};g&2&&(an.$$scope={dirty:g,ctx:o}),gt.$set(an);const nn={};g&2&&(nn.$$scope={dirty:g,ctx:o}),ht.$set(nn);const ln={};g&2&&(ln.$$scope={dirty:g,ctx:o}),_t.$set(ln);const hr={};g&2&&(hr.$$scope={dirty:g,ctx:o}),bt.$set(hr);const dn={};g&2&&(dn.$$scope={dirty:g,ctx:o}),St.$set(dn);const mn={};g&2&&(mn.$$scope={dirty:g,ctx:o}),wt.$set(mn);const cn={};g&2&&(cn.$$scope={dirty:g,ctx:o}),Tt.$set(cn);const fn={};g&2&&(fn.$$scope={dirty:g,ctx:o}),yt.$set(fn)},i(o){ti||($(c.$$.fragment,o),$(Nt.$$.fragment,o),$(ro.$$.fragment,o),$(so.$$.fragment,o),$(ho.$$.fragment,o),$(po.$$.fragment,o),$(Qe.$$.fragment,o),$(_o.$$.fragment,o),$(bo.$$.fragment,o),$(vo.$$.fragment,o),$(So.$$.fragment,o),$($o.$$.fragment,o),$(To.$$.fragment,o),$(yo.$$.fragment,o),$(Fo.$$.fragment,o),$(xo.$$.fragment,o),$(Io.$$.fragment,o),$(Co.$$.fragment,o),$(nt.$$.fragment,o),$(it.$$.fragment,o),$(Mo.$$.fragment,o),$(Ao.$$.fragment,o),$(jo.$$.fragment,o),$(zo.$$.fragment,o),$(Do.$$.fragment,o),$(Oo.$$.fragment,o),$(mt.$$.fragment,o),$(ct.$$.fragment,o),$(Lo.$$.fragment,o),$(Ro.$$.fragment,o),$(Uo.$$.fragment,o),$(gt.$$.fragment,o),$(ht.$$.fragment,o),$(Vo.$$.fragment,o),$(Bo.$$.fragment,o),$(Go.$$.fragment,o),$(Ko.$$.fragment,o),$(Yo.$$.fragment,o),$(Qo.$$.fragment,o),$(_t.$$.fragment,o),$(bt.$$.fragment,o),$(er.$$.fragment,o),$(tr.$$.fragment,o),$(ar.$$.fragment,o),$(St.$$.fragment,o),$(wt.$$.fragment,o),$(nr.$$.fragment,o),$(ir.$$.fragment,o),$(cr.$$.fragment,o),$(Tt.$$.fragment,o),$(yt.$$.fragment,o),ti=!0)},o(o){T(c.$$.fragment,o),T(Nt.$$.fragment,o),T(ro.$$.fragment,o),T(so.$$.fragment,o),T(ho.$$.fragment,o),T(po.$$.fragment,o),T(Qe.$$.fragment,o),T(_o.$$.fragment,o),T(bo.$$.fragment,o),T(vo.$$.fragment,o),T(So.$$.fragment,o),T($o.$$.fragment,o),T(To.$$.fragment,o),T(yo.$$.fragment,o),T(Fo.$$.fragment,o),T(xo.$$.fragment,o),T(Io.$$.fragment,o),T(Co.$$.fragment,o),T(nt.$$.fragment,o),T(it.$$.fragment,o),T(Mo.$$.fragment,o),T(Ao.$$.fragment,o),T(jo.$$.fragment,o),T(zo.$$.fragment,o),T(Do.$$.fragment,o),T(Oo.$$.fragment,o),T(mt.$$.fragment,o),T(ct.$$.fragment,o),T(Lo.$$.fragment,o),T(Ro.$$.fragment,o),T(Uo.$$.fragment,o),T(gt.$$.fragment,o),T(ht.$$.fragment,o),T(Vo.$$.fragment,o),T(Bo.$$.fragment,o),T(Go.$$.fragment,o),T(Ko.$$.fragment,o),T(Yo.$$.fragment,o),T(Qo.$$.fragment,o),T(_t.$$.fragment,o),T(bt.$$.fragment,o),T(er.$$.fragment,o),T(tr.$$.fragment,o),T(ar.$$.fragment,o),T(St.$$.fragment,o),T(wt.$$.fragment,o),T(nr.$$.fragment,o),T(ir.$$.fragment,o),T(cr.$$.fragment,o),T(Tt.$$.fragment,o),T(yt.$$.fragment,o),ti=!1},d(o){t(f),o&&t(F),o&&t(_),y(c),o&&t(pn),o&&t(be),y(Nt),o&&t(un),o&&t(Ve),o&&t(_n),o&&t(vr),o&&t(bn),o&&t(Sr),o&&t(vn),o&&t(Be),o&&t(Sn),o&&t(Rt),o&&t(wn),o&&t(Y),o&&t($n),o&&t(wr),o&&t(Tn),o&&t(k),o&&t(yn),o&&t(Ge),o&&t(Fn),o&&t(Ke),o&&t(En),o&&t(we),y(ro),o&&t(xn),o&&t(os),o&&t(In),y(so,o),o&&t(Pn),o&&t(rs),o&&t(kn),o&&t(as),o&&t(Cn),o&&t(J),o&&t(Mn),o&&t(ls),o&&t(An),o&&t($e),y(ho),o&&t(jn),o&&t(U),y(po),y(Qe),o&&t(zn),o&&t(Fe),y(_o),o&&t(Dn),o&&t(ce),y(bo),y(vo),y(So),o&&t(qn),o&&t(xe),y($o),o&&t(Nn),o&&t(V),y(To),y(yo),y(Fo),o&&t(On),o&&t(Ie),y(xo),o&&t(Ln),o&&t(fe),y(Io),y(Co),y(nt),y(it),o&&t(Rn),o&&t(ke),y(Mo),o&&t(Hn),o&&t(Ce),y(Ao),y(jo),o&&t(Wn),o&&t(Me),y(zo),o&&t(Un),o&&t(B),y(Do),y(Oo),y(mt),y(ct),o&&t(Vn),o&&t(je),y(Lo),o&&t(Bn),o&&t(ge),y(Ro),y(Uo),y(gt),y(ht),o&&t(Gn),o&&t(De),y(Vo),o&&t(Kn),o&&t(qe),y(Bo),y(Go),o&&t(Yn),o&&t(Ne),y(Ko),o&&t(Jn),o&&t(G),y(Yo),y(Qo),y(_t),y(bt),o&&t(Xn),o&&t(Le),y(er),o&&t(Zn),o&&t(R),y(tr),y(ar),y(St),y(wt),o&&t(Qn),o&&t(He),y(nr),o&&t(ei),o&&t(K),y(ir),y(cr),y(Tt),y(yt)}}}const I_={local:"segformer",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.SegformerConfig",title:"SegformerConfig"},{local:"transformers.SegformerFeatureExtractor",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 P_(E){return f_(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class q_ extends i_{constructor(f){super();l_(this,f,P_,x_,d_,{})}}export{q_ as default,I_ as metadata};
