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