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