import{S as Hc,i as Qc,s as Kc,e as a,k as d,w as b,t as s,M as ed,c as n,d as o,m,a as i,x as k,h as r,b as l,N as td,G as e,g as f,y,q as v,o as M,B as F,v as od,L as Ur}from"../../chunks/vendor-hf-doc-builder.js";import{T as vl}from"../../chunks/Tip-hf-doc-builder.js";import{D as $}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Pr}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as he}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Nr}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as sd}from"../../chunks/PipelineTag-hf-doc-builder.js";function rd(j){let h,T,_,g,w;return{c(){h=a("p"),T=s(`This is a recently introduced model so the API hasn\u2019t been tested extensively. There may be some bugs or slight
breaking changes to fix it in the future. If you see something strange, file a `),_=a("a"),g=s("Github Issue"),w=s("."),this.h()},l(c){h=n(c,"P",{});var u=i(h);T=r(u,`This is a recently introduced model so the API hasn\u2019t been tested extensively. There may be some bugs or slight
breaking changes to fix it in the future. If you see something strange, file a `),_=n(u,"A",{href:!0,rel:!0});var U=i(_);g=r(U,"Github Issue"),U.forEach(o),w=r(u,"."),u.forEach(o),this.h()},h(){l(_,"href","https://github.com/huggingface/transformers/issues/new?assignees=&labels=&template=bug-report.md&title"),l(_,"rel","nofollow")},m(c,u){f(c,h,u),e(h,T),e(h,_),e(_,g),e(h,w)},d(c){c&&o(h)}}}function ad(j){let h,T,_,g,w;return g=new Pr({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1hc2tGb3JtZXJDb25maWclMkMlMjBNYXNrRm9ybWVyTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwTWFza0Zvcm1lciUyMGZhY2Vib29rJTJGbWFza2Zvcm1lci1zd2luLWJhc2UtYWRlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBNYXNrRm9ybWVyQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMGZhY2Vib29rJTJGbWFza2Zvcm1lci1zd2luLWJhc2UtYWRlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBNYXNrRm9ybWVyTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> MaskFormerConfig, MaskFormerModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a MaskFormer facebook/maskformer-swin-base-ade configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = MaskFormerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the facebook/maskformer-swin-base-ade style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MaskFormerModel(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(){h=a("p"),T=s("Examples:"),_=d(),b(g.$$.fragment)},l(c){h=n(c,"P",{});var u=i(h);T=r(u,"Examples:"),u.forEach(o),_=m(c),k(g.$$.fragment,c)},m(c,u){f(c,h,u),e(h,T),f(c,_,u),y(g,c,u),w=!0},p:Ur,i(c){w||(v(g.$$.fragment,c),w=!0)},o(c){M(g.$$.fragment,c),w=!1},d(c){c&&o(h),c&&o(_),F(g,c)}}}function nd(j){let h,T,_,g,w;return{c(){h=a("p"),T=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),g=s("Module"),w=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){h=n(c,"P",{});var u=i(h);T=r(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(u,"CODE",{});var U=i(_);g=r(U,"Module"),U.forEach(o),w=r(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(c,u){f(c,h,u),e(h,T),e(h,_),e(_,g),e(h,w)},d(c){c&&o(h)}}}function id(j){let h,T,_,g,w;return g=new Pr({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1hc2tGb3JtZXJNb2RlbCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBJTIzJTIwbG9hZCUyME1hc2tGb3JtZXIlMjBmaW5lLXR1bmVkJTIwb24lMjBBREUyMGslMjBzZW1hbnRpYyUyMHNlZ21lbnRhdGlvbiUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZtYXNrZm9ybWVyLXN3aW4tYmFzZS1hZGUlMjIpJTBBbW9kZWwlMjAlM0QlMjBNYXNrRm9ybWVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGbWFza2Zvcm1lci1zd2luLWJhc2UtYWRlJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMyUyMGZvcndhcmQlMjBwYXNzJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQSUyMyUyMHRoZSUyMGRlY29kZXIlMjBvZiUyME1hc2tGb3JtZXIlMjBvdXRwdXRzJTIwaGlkZGVuJTIwc3RhdGVzJTIwb2YlMjBzaGFwZSUyMChiYXRjaF9zaXplJTJDJTIwbnVtX3F1ZXJpZXMlMkMlMjBoaWRkZW5fc2l6ZSklMEF0cmFuc2Zvcm1lcl9kZWNvZGVyX2xhc3RfaGlkZGVuX3N0YXRlJTIwJTNEJTIwb3V0cHV0cy50cmFuc2Zvcm1lcl9kZWNvZGVyX2xhc3RfaGlkZGVuX3N0YXRlJTBBbGlzdCh0cmFuc2Zvcm1lcl9kZWNvZGVyX2xhc3RfaGlkZGVuX3N0YXRlLnNoYXBlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, MaskFormerModel
<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><span class="hljs-comment"># load MaskFormer fine-tuned on ADE20k semantic segmentation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/maskformer-swin-base-ade&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MaskFormerModel.from_pretrained(<span class="hljs-string">&quot;facebook/maskformer-swin-base-ade&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(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># the decoder of MaskFormer outputs hidden states of shape (batch_size, num_queries, hidden_size)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>transformer_decoder_last_hidden_state = outputs.transformer_decoder_last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(transformer_decoder_last_hidden_state.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">100</span>, <span class="hljs-number">256</span>]`}}),{c(){h=a("p"),T=s("Examples:"),_=d(),b(g.$$.fragment)},l(c){h=n(c,"P",{});var u=i(h);T=r(u,"Examples:"),u.forEach(o),_=m(c),k(g.$$.fragment,c)},m(c,u){f(c,h,u),e(h,T),f(c,_,u),y(g,c,u),w=!0},p:Ur,i(c){w||(v(g.$$.fragment,c),w=!0)},o(c){M(g.$$.fragment,c),w=!1},d(c){c&&o(h),c&&o(_),F(g,c)}}}function ld(j){let h,T,_,g,w;return{c(){h=a("p"),T=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),g=s("Module"),w=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){h=n(c,"P",{});var u=i(h);T=r(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(u,"CODE",{});var U=i(_);g=r(U,"Module"),U.forEach(o),w=r(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(c,u){f(c,h,u),e(h,T),e(h,_),e(_,g),e(h,w)},d(c){c&&o(h)}}}function cd(j){let h,T,_,g,w;return g=new Pr({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1hc2tGb3JtZXJGb3JJbnN0YW5jZVNlZ21lbnRhdGlvbiUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBJTIzJTIwbG9hZCUyME1hc2tGb3JtZXIlMjBmaW5lLXR1bmVkJTIwb24lMjBBREUyMGslMjBzZW1hbnRpYyUyMHNlZ21lbnRhdGlvbiUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZtYXNrZm9ybWVyLXN3aW4tYmFzZS1hZGUlMjIpJTBBbW9kZWwlMjAlM0QlMjBNYXNrRm9ybWVyRm9ySW5zdGFuY2VTZWdtZW50YXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGbWFza2Zvcm1lci1zd2luLWJhc2UtYWRlJTIyKSUwQSUwQXVybCUyMCUzRCUyMCglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZml4dHVyZXNfYWRlMjBrJTJGcmVzb2x2ZSUyRm1haW4lMkZBREVfdmFsXzAwMDAwMDAxLmpwZyUyMiUwQSklMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMjMlMjBtb2RlbCUyMHByZWRpY3RzJTIwY2xhc3NfcXVlcmllc19sb2dpdHMlMjBvZiUyMHNoYXBlJTIwJTYwKGJhdGNoX3NpemUlMkMlMjBudW1fcXVlcmllcyklNjAlMEElMjMlMjBhbmQlMjBtYXNrc19xdWVyaWVzX2xvZ2l0cyUyMG9mJTIwc2hhcGUlMjAlNjAoYmF0Y2hfc2l6ZSUyQyUyMG51bV9xdWVyaWVzJTJDJTIwaGVpZ2h0JTJDJTIwd2lkdGgpJTYwJTBBY2xhc3NfcXVlcmllc19sb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmNsYXNzX3F1ZXJpZXNfbG9naXRzJTBBbWFza3NfcXVlcmllc19sb2dpdHMlMjAlM0QlMjBvdXRwdXRzLm1hc2tzX3F1ZXJpZXNfbG9naXRzJTBBJTBBJTIzJTIweW91JTIwY2FuJTIwcGFzcyUyMHRoZW0lMjB0byUyMGltYWdlX3Byb2Nlc3NvciUyMGZvciUyMHBvc3Rwcm9jZXNzaW5nJTBBcHJlZGljdGVkX3NlbWFudGljX21hcCUyMCUzRCUyMGltYWdlX3Byb2Nlc3Nvci5wb3N0X3Byb2Nlc3Nfc2VtYW50aWNfc2VnbWVudGF0aW9uKCUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMkMlMjB0YXJnZXRfc2l6ZXMlM0QlNUJpbWFnZS5zaXplJTVCJTNBJTNBLTElNUQlNUQlMEEpJTVCMCU1RCUwQSUwQSUyMyUyMHdlJTIwcmVmZXIlMjB0byUyMHRoZSUyMGRlbW8lMjBub3RlYm9va3MlMjBmb3IlMjB2aXN1YWxpemF0aW9uJTIwKHNlZSUyMCUyMlJlc291cmNlcyUyMiUyMHNlY3Rpb24lMjBpbiUyMHRoZSUyME1hc2tGb3JtZXIlMjBkb2NzKSUwQWxpc3QocHJlZGljdGVkX3NlbWFudGljX21hcC5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, MaskFormerForInstanceSegmentation
<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><span class="hljs-comment"># load MaskFormer fine-tuned on ADE20k semantic segmentation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/maskformer-swin-base-ade&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MaskFormerForInstanceSegmentation.from_pretrained(<span class="hljs-string">&quot;facebook/maskformer-swin-base-ade&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = (
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/fixtures_ade20k/resolve/main/ADE_val_00000001.jpg&quot;</span>
<span class="hljs-meta">... </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><span class="hljs-comment"># model predicts class_queries_logits of shape \`(batch_size, num_queries)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># and masks_queries_logits of shape \`(batch_size, num_queries, height, width)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>class_queries_logits = outputs.class_queries_logits
<span class="hljs-meta">&gt;&gt;&gt; </span>masks_queries_logits = outputs.masks_queries_logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># you can pass them to image_processor for postprocessing</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_semantic_map = image_processor.post_process_semantic_segmentation(
<span class="hljs-meta">... </span>    outputs, target_sizes=[image.size[::-<span class="hljs-number">1</span>]]
<span class="hljs-meta">... </span>)[<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># we refer to the demo notebooks for visualization (see &quot;Resources&quot; section in the MaskFormer docs)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(predicted_semantic_map.shape)
[<span class="hljs-number">512</span>, <span class="hljs-number">683</span>]`}}),{c(){h=a("p"),T=s("Semantic segmentation example:"),_=d(),b(g.$$.fragment)},l(c){h=n(c,"P",{});var u=i(h);T=r(u,"Semantic segmentation example:"),u.forEach(o),_=m(c),k(g.$$.fragment,c)},m(c,u){f(c,h,u),e(h,T),f(c,_,u),y(g,c,u),w=!0},p:Ur,i(c){w||(v(g.$$.fragment,c),w=!0)},o(c){M(g.$$.fragment,c),w=!1},d(c){c&&o(h),c&&o(_),F(g,c)}}}function dd(j){let h,T,_,g,w;return g=new Pr({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1hc2tGb3JtZXJGb3JJbnN0YW5jZVNlZ21lbnRhdGlvbiUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBJTIzJTIwbG9hZCUyME1hc2tGb3JtZXIlMjBmaW5lLXR1bmVkJTIwb24lMjBDT0NPJTIwcGFub3B0aWMlMjBzZWdtZW50YXRpb24lMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGbWFza2Zvcm1lci1zd2luLWJhc2UtY29jbyUyMiklMEFtb2RlbCUyMCUzRCUyME1hc2tGb3JtZXJGb3JJbnN0YW5jZVNlZ21lbnRhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZtYXNrZm9ybWVyLXN3aW4tYmFzZS1jb2NvJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMjMlMjBtb2RlbCUyMHByZWRpY3RzJTIwY2xhc3NfcXVlcmllc19sb2dpdHMlMjBvZiUyMHNoYXBlJTIwJTYwKGJhdGNoX3NpemUlMkMlMjBudW1fcXVlcmllcyklNjAlMEElMjMlMjBhbmQlMjBtYXNrc19xdWVyaWVzX2xvZ2l0cyUyMG9mJTIwc2hhcGUlMjAlNjAoYmF0Y2hfc2l6ZSUyQyUyMG51bV9xdWVyaWVzJTJDJTIwaGVpZ2h0JTJDJTIwd2lkdGgpJTYwJTBBY2xhc3NfcXVlcmllc19sb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmNsYXNzX3F1ZXJpZXNfbG9naXRzJTBBbWFza3NfcXVlcmllc19sb2dpdHMlMjAlM0QlMjBvdXRwdXRzLm1hc2tzX3F1ZXJpZXNfbG9naXRzJTBBJTBBJTIzJTIweW91JTIwY2FuJTIwcGFzcyUyMHRoZW0lMjB0byUyMGltYWdlX3Byb2Nlc3NvciUyMGZvciUyMHBvc3Rwcm9jZXNzaW5nJTBBcmVzdWx0JTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yLnBvc3RfcHJvY2Vzc19wYW5vcHRpY19zZWdtZW50YXRpb24ob3V0cHV0cyUyQyUyMHRhcmdldF9zaXplcyUzRCU1QmltYWdlLnNpemUlNUIlM0ElM0EtMSU1RCU1RCklNUIwJTVEJTBBJTBBJTIzJTIwd2UlMjByZWZlciUyMHRvJTIwdGhlJTIwZGVtbyUyMG5vdGVib29rcyUyMGZvciUyMHZpc3VhbGl6YXRpb24lMjAoc2VlJTIwJTIyUmVzb3VyY2VzJTIyJTIwc2VjdGlvbiUyMGluJTIwdGhlJTIwTWFza0Zvcm1lciUyMGRvY3MpJTBBcHJlZGljdGVkX3Bhbm9wdGljX21hcCUyMCUzRCUyMHJlc3VsdCU1QiUyMnNlZ21lbnRhdGlvbiUyMiU1RCUwQWxpc3QocHJlZGljdGVkX3Bhbm9wdGljX21hcC5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, MaskFormerForInstanceSegmentation
<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><span class="hljs-comment"># load MaskFormer fine-tuned on COCO panoptic segmentation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/maskformer-swin-base-coco&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MaskFormerForInstanceSegmentation.from_pretrained(<span class="hljs-string">&quot;facebook/maskformer-swin-base-coco&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><span class="hljs-comment"># model predicts class_queries_logits of shape \`(batch_size, num_queries)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># and masks_queries_logits of shape \`(batch_size, num_queries, height, width)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>class_queries_logits = outputs.class_queries_logits
<span class="hljs-meta">&gt;&gt;&gt; </span>masks_queries_logits = outputs.masks_queries_logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># you can pass them to image_processor for postprocessing</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>result = image_processor.post_process_panoptic_segmentation(outputs, target_sizes=[image.size[::-<span class="hljs-number">1</span>]])[<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># we refer to the demo notebooks for visualization (see &quot;Resources&quot; section in the MaskFormer docs)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_panoptic_map = result[<span class="hljs-string">&quot;segmentation&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(predicted_panoptic_map.shape)
[<span class="hljs-number">480</span>, <span class="hljs-number">640</span>]`}}),{c(){h=a("p"),T=s("Panoptic segmentation example:"),_=d(),b(g.$$.fragment)},l(c){h=n(c,"P",{});var u=i(h);T=r(u,"Panoptic segmentation example:"),u.forEach(o),_=m(c),k(g.$$.fragment,c)},m(c,u){f(c,h,u),e(h,T),f(c,_,u),y(g,c,u),w=!0},p:Ur,i(c){w||(v(g.$$.fragment,c),w=!0)},o(c){M(g.$$.fragment,c),w=!1},d(c){c&&o(h),c&&o(_),F(g,c)}}}function md(j){let h,T,_,g,w,c,u,U,Zr,Fs,fe,ws,ee,ge,No,Ve,Jr,Uo,Cr,Ts,ue,Rr,Xe,Wr,Sr,xs,Yt,Br,$s,Ht,Po,Lr,Is,Qt,Ar,Es,R,Z,Or,Kt,Vr,Xr,Zo,Gr,Dr,eo,qr,Yr,Jo,Hr,Qr,Kr,J,ea,Co,ta,oa,Ro,sa,ra,Wo,aa,na,Ge,ia,la,ca,De,da,to,ma,pa,ha,C,fa,oo,ga,ua,so,_a,ba,ro,ka,ya,So,va,Ma,js,_e,Fa,qe,wa,Ta,zs,Ye,Ml,Ns,D,xa,He,$a,Ia,Qe,Ea,ja,Us,te,be,Bo,Ke,za,Lo,Na,Ps,et,Zs,ao,tt,Ua,ot,Pa,Za,Js,oe,ke,Ao,st,Ja,Oo,Ca,Cs,se,rt,Ra,at,Wa,no,Sa,Ba,Rs,L,nt,La,it,Aa,io,Oa,Va,Xa,A,Ga,lo,Da,qa,co,Ya,Ha,mo,Qa,Ka,Ws,re,ye,Vo,lt,en,Xo,tn,Ss,I,ct,on,O,sn,po,rn,an,dt,nn,ln,mt,cn,dn,mn,ae,pn,ho,hn,fn,fo,gn,un,_n,pt,bn,go,kn,yn,vn,ve,Mn,Me,ht,Fn,ft,wn,uo,Tn,xn,$n,Fe,gt,In,ut,En,_o,jn,zn,Bs,ne,we,Go,_t,Nn,Do,Un,Ls,x,bt,Pn,qo,Zn,Jn,kt,Cn,Yo,Rn,Wn,Sn,bo,yt,Bn,q,vt,Ln,Mt,An,Ho,On,Vn,Xn,V,Gn,Qo,Dn,qn,Ko,Yn,Hn,es,Qn,Kn,ei,Te,Ft,ti,wt,oi,ko,si,ri,ai,xe,Tt,ni,xt,ii,ts,li,ci,di,$e,$t,mi,It,pi,os,hi,fi,As,ie,Ie,ss,Et,gi,rs,ui,Os,E,jt,_i,yo,zt,bi,Y,Nt,ki,Ut,yi,as,vi,Mi,Fi,X,wi,ns,Ti,xi,is,$i,Ii,ls,Ei,ji,zi,Ee,Pt,Ni,Zt,Ui,vo,Pi,Zi,Ji,je,Jt,Ci,Ct,Ri,cs,Wi,Si,Bi,ze,Rt,Li,Wt,Ai,ds,Oi,Vi,Vs,le,Ne,ms,St,Xi,ps,Gi,Xs,G,Bt,Di,Lt,qi,At,Yi,Hi,Qi,W,Ot,Ki,ce,el,Mo,tl,ol,hs,sl,rl,al,Ue,nl,Pe,Gs,de,Ze,fs,Vt,il,gs,ll,Ds,me,Xt,cl,z,Gt,dl,pe,ml,Fo,pl,hl,us,fl,gl,ul,Je,_l,_s,bl,kl,Ce,yl,Re,qs;return c=new he({}),fe=new vl({props:{$$slots:{default:[rd]},$$scope:{ctx:j}}}),Ve=new he({}),Ke=new he({}),et=new sd({props:{pipeline:"image-segmentation"}}),st=new he({}),rt=new $({props:{name:"class transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput",anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput",parameters:[{name:"encoder_last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pixel_decoder_last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"transformer_decoder_last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"pixel_decoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"transformer_decoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput.encoder_last_hidden_state",description:`<strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Last hidden states (final feature map) of the last stage of the encoder model (backbone).`,name:"encoder_last_hidden_state"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput.pixel_decoder_last_hidden_state",description:`<strong>pixel_decoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Last hidden states (final feature map) of the last stage of the pixel decoder model (FPN).`,name:"pixel_decoder_last_hidden_state"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput.transformer_decoder_last_hidden_state",description:`<strong>transformer_decoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) &#x2014;
Last hidden states (final feature map) of the last stage of the transformer decoder model.`,name:"transformer_decoder_last_hidden_state"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput.encoder_hidden_states",description:`<strong>encoder_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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + 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 encoder
model at the output of each stage.`,name:"encoder_hidden_states"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput.pixel_decoder_hidden_states",description:`<strong>pixel_decoder_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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + 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 pixel
decoder model at the output of each stage.`,name:"pixel_decoder_hidden_states"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput.transformer_decoder_hidden_states",description:`<strong>transformer_decoder_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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each stage) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states (also called feature maps) of the
transformer decoder at the output of each stage.`,name:"transformer_decoder_hidden_states"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput.hidden_states",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> containing <code>encoder_hidden_states</code>, <code>pixel_decoder_hidden_states</code> and
<code>decoder_hidden_states</code>`,name:"hidden_states"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput.attentions",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights from Detr&#x2019;s decoder after the attention softmax, used to compute the
weighted average in the self-attention heads.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/modeling_maskformer.py#L145"}}),nt=new $({props:{name:"class transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput",anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"class_queries_logits",val:": FloatTensor = None"},{name:"masks_queries_logits",val:": FloatTensor = None"},{name:"auxiliary_logits",val:": FloatTensor = None"},{name:"encoder_last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pixel_decoder_last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"transformer_decoder_last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"pixel_decoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"transformer_decoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.loss",description:`<strong>loss</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
The computed loss, returned when labels are present.`,name:"loss"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.class_queries_logits",description:`<strong>class_queries_logits</strong> (<code>torch.FloatTensor</code>) &#x2014;
A tensor of shape <code>(batch_size, num_queries, num_labels + 1)</code> representing the proposed classes for each
query. Note the <code>+ 1</code> is needed because we incorporate the null class.`,name:"class_queries_logits"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.masks_queries_logits",description:`<strong>masks_queries_logits</strong> (<code>torch.FloatTensor</code>) &#x2014;
A tensor of shape <code>(batch_size, num_queries, height, width)</code> representing the proposed masks for each
query.`,name:"masks_queries_logits"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.encoder_last_hidden_state",description:`<strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Last hidden states (final feature map) of the last stage of the encoder model (backbone).`,name:"encoder_last_hidden_state"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.pixel_decoder_last_hidden_state",description:`<strong>pixel_decoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Last hidden states (final feature map) of the last stage of the pixel decoder model (FPN).`,name:"pixel_decoder_last_hidden_state"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.transformer_decoder_last_hidden_state",description:`<strong>transformer_decoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) &#x2014;
Last hidden states (final feature map) of the last stage of the transformer decoder model.`,name:"transformer_decoder_last_hidden_state"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.encoder_hidden_states",description:`<strong>encoder_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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + 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 encoder
model at the output of each stage.`,name:"encoder_hidden_states"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.pixel_decoder_hidden_states",description:`<strong>pixel_decoder_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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + 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 pixel
decoder model at the output of each stage.`,name:"pixel_decoder_hidden_states"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.transformer_decoder_hidden_states",description:`<strong>transformer_decoder_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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each stage) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the transformer decoder at the output
of each stage.`,name:"transformer_decoder_hidden_states"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.hidden_states",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> containing <code>encoder_hidden_states</code>, <code>pixel_decoder_hidden_states</code> and
<code>decoder_hidden_states</code>.`,name:"hidden_states"},{anchor:"transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput.attentions",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights from Detr&#x2019;s decoder after the attention softmax, used to compute the
weighted average in the self-attention heads.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/modeling_maskformer.py#L188"}}),lt=new he({}),ct=new $({props:{name:"class transformers.MaskFormerConfig",anchor:"transformers.MaskFormerConfig",parameters:[{name:"fpn_feature_size",val:": int = 256"},{name:"mask_feature_size",val:": int = 256"},{name:"no_object_weight",val:": float = 0.1"},{name:"use_auxiliary_loss",val:": bool = False"},{name:"backbone_config",val:": typing.Optional[typing.Dict] = None"},{name:"decoder_config",val:": typing.Optional[typing.Dict] = None"},{name:"init_std",val:": float = 0.02"},{name:"init_xavier_std",val:": float = 1.0"},{name:"dice_weight",val:": float = 1.0"},{name:"cross_entropy_weight",val:": float = 1.0"},{name:"mask_weight",val:": float = 20.0"},{name:"output_auxiliary_logits",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MaskFormerConfig.mask_feature_size",description:`<strong>mask_feature_size</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
The masks&#x2019; features size, this value will also be used to specify the Feature Pyramid Network features&#x2019;
size.`,name:"mask_feature_size"},{anchor:"transformers.MaskFormerConfig.no_object_weight",description:`<strong>no_object_weight</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Weight to apply to the null (no object) class.`,name:"no_object_weight"},{anchor:"transformers.MaskFormerConfig.use_auxiliary_loss(bool,",description:`<strong>use_auxiliary_loss(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
If <code>True</code> <code>MaskFormerForInstanceSegmentationOutput</code> will contain the auxiliary losses computed using the
logits from each decoder&#x2019;s stage.`,name:"use_auxiliary_loss(bool,"},{anchor:"transformers.MaskFormerConfig.backbone_config",description:`<strong>backbone_config</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
The configuration passed to the backbone, if unset, the configuration corresponding to
<code>swin-base-patch4-window12-384</code> will be used.`,name:"backbone_config"},{anchor:"transformers.MaskFormerConfig.decoder_config",description:`<strong>decoder_config</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
The configuration passed to the transformer decoder model, if unset the base config for <code>detr-resnet-50</code>
will be used.`,name:"decoder_config"},{anchor:"transformers.MaskFormerConfig.init_std",description:`<strong>init_std</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:"init_std"},{anchor:"transformers.MaskFormerConfig.init_xavier_std",description:`<strong>init_xavier_std</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
The scaling factor used for the Xavier initialization gain in the HM Attention map module.`,name:"init_xavier_std"},{anchor:"transformers.MaskFormerConfig.dice_weight",description:`<strong>dice_weight</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
The weight for the dice loss.`,name:"dice_weight"},{anchor:"transformers.MaskFormerConfig.cross_entropy_weight",description:`<strong>cross_entropy_weight</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
The weight for the cross entropy loss.`,name:"cross_entropy_weight"},{anchor:"transformers.MaskFormerConfig.mask_weight",description:`<strong>mask_weight</strong> (<code>float</code>, <em>optional</em>, defaults to 20.0) &#x2014;
The weight for the mask loss.`,name:"mask_weight"},{anchor:"transformers.MaskFormerConfig.output_auxiliary_logits",description:`<strong>output_auxiliary_logits</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Should the model output its <code>auxiliary_logits</code> or not.`,name:"output_auxiliary_logits"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/configuration_maskformer.py#L36",raiseDescription:`
<ul>
<li><code>ValueError</code> \u2014
Raised if the backbone model type selected is not in <code>["swin"]</code> or the decoder model type selected is not
in <code>["detr"]</code></li>
</ul>
`,raiseType:`
<p><code>ValueError</code></p>
`}}),ve=new Nr({props:{anchor:"transformers.MaskFormerConfig.example",$$slots:{default:[ad]},$$scope:{ctx:j}}}),ht=new $({props:{name:"from_backbone_and_decoder_configs",anchor:"transformers.MaskFormerConfig.from_backbone_and_decoder_configs",parameters:[{name:"backbone_config",val:": PretrainedConfig"},{name:"decoder_config",val:": PretrainedConfig"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MaskFormerConfig.from_backbone_and_decoder_configs.backbone_config",description:`<strong>backbone_config</strong> (<a href="/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The backbone configuration.`,name:"backbone_config"},{anchor:"transformers.MaskFormerConfig.from_backbone_and_decoder_configs.decoder_config",description:`<strong>decoder_config</strong> (<a href="/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The transformer decoder configuration to use.`,name:"decoder_config"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/configuration_maskformer.py#L182",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerConfig"
>MaskFormerConfig</a></p>
`}}),gt=new $({props:{name:"to_dict",anchor:"transformers.MaskFormerConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/configuration_maskformer.py#L204",returnDescription:`
<p>Dictionary of all the attributes that make up this configuration instance,</p>
`,returnType:`
<p><code>Dict[str, any]</code></p>
`}}),_t=new he({}),bt=new $({props:{name:"class transformers.MaskFormerImageProcessor",anchor:"transformers.MaskFormerImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"size_divisor",val:": int = 32"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": float = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float]] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float]] = None"},{name:"ignore_index",val:": typing.Optional[int] = None"},{name:"do_reduce_labels",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MaskFormerImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the input to a certain <code>size</code>.`,name:"do_resize"},{anchor:"transformers.MaskFormerImageProcessor.size",description:`<strong>size</strong> (<code>int</code>, <em>optional</em>, defaults to 800) &#x2014;
Resize the input to the given size. Only has an effect if <code>do_resize</code> is set to <code>True</code>. If size is a
sequence like <code>(width, height)</code>, output size will be matched to this. If size is an int, smaller edge of
the image will be matched to this number. i.e, if <code>height &gt; width</code>, then image will be rescaled to <code>(size * height / width, size)</code>.`,name:"size"},{anchor:"transformers.MaskFormerImageProcessor.max_size",description:`<strong>max_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1333) &#x2014;
The largest size an image dimension can have (otherwise it&#x2019;s capped). Only has an effect if <code>do_resize</code> is
set to <code>True</code>.`,name:"max_size"},{anchor:"transformers.MaskFormerImageProcessor.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>PIL.Image.Resampling.BILINEAR</code>) &#x2014;
An optional resampling filter. This can be one of <code>PIL.Image.Resampling.NEAREST</code>,
<code>PIL.Image.Resampling.BOX</code>, <code>PIL.Image.Resampling.BILINEAR</code>, <code>PIL.Image.Resampling.HAMMING</code>,
<code>PIL.Image.Resampling.BICUBIC</code> or <code>PIL.Image.Resampling.LANCZOS</code>. Only has an effect if <code>do_resize</code> is set
to <code>True</code>.`,name:"resample"},{anchor:"transformers.MaskFormerImageProcessor.size_divisor",description:`<strong>size_divisor</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Some backbones need images divisible by a certain number. If not passed, it defaults to the value used in
Swin Transformer.`,name:"size_divisor"},{anchor:"transformers.MaskFormerImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the input to a certain <code>scale</code>.`,name:"do_rescale"},{anchor:"transformers.MaskFormerImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1/ 255) &#x2014;
Rescale the input by the given factor. Only has an effect if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.MaskFormerImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to normalize the input with mean and standard deviation.`,name:"do_normalize"},{anchor:"transformers.MaskFormerImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>int</code>, <em>optional</em>, defaults to <code>[0.485, 0.456, 0.406]</code>) &#x2014;
The sequence of means for each channel, to be used when normalizing images. Defaults to the ImageNet mean.`,name:"image_mean"},{anchor:"transformers.MaskFormerImageProcessor.image_std",description:`<strong>image_std</strong> (<code>int</code>, <em>optional</em>, defaults to <code>[0.229, 0.224, 0.225]</code>) &#x2014;
The sequence of standard deviations for each channel, to be used when normalizing images. Defaults to the
ImageNet std.`,name:"image_std"},{anchor:"transformers.MaskFormerImageProcessor.ignore_index",description:`<strong>ignore_index</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Label to be assigned to background pixels in segmentation maps. If provided, segmentation map pixels
denoted with 0 (background) will be replaced with <code>ignore_index</code>.`,name:"ignore_index"},{anchor:"transformers.MaskFormerImageProcessor.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 decrement 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 <code>ignore_index</code>.`,name:"do_reduce_labels"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/image_processing_maskformer.py#L335"}}),yt=new $({props:{name:"preprocess",anchor:"transformers.MaskFormerImageProcessor.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:"instance_id_to_semantic_id",val:": typing.Union[typing.Dict[int, int], NoneType] = None"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"size_divisor",val:": typing.Optional[int] = 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:"ignore_index",val:": typing.Optional[int] = 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:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/image_processing_maskformer.py#L623"}}),vt=new $({props:{name:"encode_inputs",anchor:"transformers.MaskFormerImageProcessor.encode_inputs",parameters:[{name:"pixel_values_list",val:": typing.List[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')]] = None"},{name:"instance_id_to_semantic_id",val:": typing.Union[typing.List[typing.Dict[int, int]], typing.Dict[int, int], NoneType] = None"},{name:"ignore_index",val:": typing.Optional[int] = None"},{name:"reduce_labels",val:": bool = False"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"}],parametersDescription:[{anchor:"transformers.MaskFormerImageProcessor.encode_inputs.pixel_values_list",description:`<strong>pixel_values_list</strong> (<code>List[ImageInput]</code>) &#x2014;
List of images (pixel values) to be padded. Each image should be a tensor of shape <code>(channels, height, width)</code>.`,name:"pixel_values_list"},{anchor:"transformers.MaskFormerImageProcessor.encode_inputs.segmentation_maps",description:`<strong>segmentation_maps</strong> (<code>ImageInput</code>, <em>optional</em>) &#x2014;
The corresponding semantic segmentation maps with the pixel-wise annotations.</p>
<p>(<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
Whether or not to pad images up to the largest image in a batch and create a pixel mask.</p>
<p>If left to the default, will return a pixel mask that is:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).</li>
</ul>`,name:"segmentation_maps"},{anchor:"transformers.MaskFormerImageProcessor.encode_inputs.instance_id_to_semantic_id",description:`<strong>instance_id_to_semantic_id</strong> (<code>List[Dict[int, int]]</code> or <code>Dict[int, int]</code>, <em>optional</em>) &#x2014;
A mapping between object instance ids and class ids. If passed, <code>segmentation_maps</code> is treated as an
instance segmentation map where each pixel represents an instance id. Can be provided as a single
dictionary with a global/dataset-level mapping or as a list of dictionaries (one per image), to map
instance ids in each image separately.`,name:"instance_id_to_semantic_id"},{anchor:"transformers.MaskFormerImageProcessor.encode_inputs.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/v4.31.0/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of NumPy arrays. If set to <code>&apos;pt&apos;</code>, return PyTorch <code>torch.Tensor</code>
objects.`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/image_processing_maskformer.py#L788",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a> with the following fields:</p>
<ul>
<li><strong>pixel_values</strong> \u2014 Pixel values to be fed to a model.</li>
<li><strong>pixel_mask</strong> \u2014 Pixel mask to be fed to a model (when <code>=True</code> or if <code>pixel_mask</code> is in
<code>self.model_input_names</code>).</li>
<li><strong>mask_labels</strong> \u2014 Optional list of mask labels of shape <code>(labels, height, width)</code> to be fed to a model
(when <code>annotations</code> are provided).</li>
<li><strong>class_labels</strong> \u2014 Optional list of class labels of shape <code>(labels)</code> to be fed to a model (when
<code>annotations</code> are provided). They identify the labels of <code>mask_labels</code>, e.g. the label of
<code>mask_labels[i][j]</code> if <code>class_labels[i][j]</code>.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),Ft=new $({props:{name:"post_process_semantic_segmentation",anchor:"transformers.MaskFormerImageProcessor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": typing.Union[typing.List[typing.Tuple[int, int]], NoneType] = None"}],parametersDescription:[{anchor:"transformers.MaskFormerImageProcessor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation">MaskFormerForInstanceSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.MaskFormerImageProcessor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple[int, int]]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds 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/maskformer/image_processing_maskformer.py#L929",returnDescription:`
<p>A list 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><code>List[torch.Tensor]</code></p>
`}}),Tt=new $({props:{name:"post_process_instance_segmentation",anchor:"transformers.MaskFormerImageProcessor.post_process_instance_segmentation",parameters:[{name:"outputs",val:""},{name:"threshold",val:": float = 0.5"},{name:"mask_threshold",val:": float = 0.5"},{name:"overlap_mask_area_threshold",val:": float = 0.8"},{name:"target_sizes",val:": typing.Union[typing.List[typing.Tuple[int, int]], NoneType] = None"},{name:"return_coco_annotation",val:": typing.Optional[bool] = False"},{name:"return_binary_maps",val:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.MaskFormerImageProcessor.post_process_instance_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation">MaskFormerForInstanceSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.MaskFormerImageProcessor.post_process_instance_segmentation.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The probability score threshold to keep predicted instance masks.`,name:"threshold"},{anchor:"transformers.MaskFormerImageProcessor.post_process_instance_segmentation.mask_threshold",description:`<strong>mask_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Threshold to use when turning the predicted masks into binary values.`,name:"mask_threshold"},{anchor:"transformers.MaskFormerImageProcessor.post_process_instance_segmentation.overlap_mask_area_threshold",description:`<strong>overlap_mask_area_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
The overlap mask area threshold to merge or discard small disconnected parts within each binary
instance mask.`,name:"overlap_mask_area_threshold"},{anchor:"transformers.MaskFormerImageProcessor.post_process_instance_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds to the requested
final size (height, width) of each prediction. If left to None, predictions will not be resized.`,name:"target_sizes"},{anchor:"transformers.MaskFormerImageProcessor.post_process_instance_segmentation.return_coco_annotation",description:`<strong>return_coco_annotation</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If set to <code>True</code>, segmentation maps are returned in COCO run-length encoding (RLE) format.`,name:"return_coco_annotation"},{anchor:"transformers.MaskFormerImageProcessor.post_process_instance_segmentation.return_binary_maps",description:`<strong>return_binary_maps</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If set to <code>True</code>, segmentation maps are returned as a concatenated tensor of binary segmentation maps
(one per detected instance).`,name:"return_binary_maps"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/image_processing_maskformer.py#L979",returnDescription:`
<p>A list of dictionaries, one per image, each dictionary containing two keys:</p>
<ul>
<li><strong>segmentation</strong> \u2014 A tensor of shape <code>(height, width)</code> where each pixel represents a <code>segment_id</code> or
<code>List[List]</code> run-length encoding (RLE) of the segmentation map if return_coco_annotation is set to
<code>True</code>. Set to <code>None</code> if no mask if found above <code>threshold</code>.</li>
<li><strong>segments_info</strong> \u2014 A dictionary that contains additional information on each segment.<ul>
<li><strong>id</strong> \u2014 An integer representing the <code>segment_id</code>.</li>
<li><strong>label_id</strong> \u2014 An integer representing the label / semantic class id corresponding to <code>segment_id</code>.</li>
<li><strong>score</strong> \u2014 Prediction score of segment with <code>segment_id</code>.</li>
</ul></li>
</ul>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),$t=new $({props:{name:"post_process_panoptic_segmentation",anchor:"transformers.MaskFormerImageProcessor.post_process_panoptic_segmentation",parameters:[{name:"outputs",val:""},{name:"threshold",val:": float = 0.5"},{name:"mask_threshold",val:": float = 0.5"},{name:"overlap_mask_area_threshold",val:": float = 0.8"},{name:"label_ids_to_fuse",val:": typing.Optional[typing.Set[int]] = None"},{name:"target_sizes",val:": typing.Union[typing.List[typing.Tuple[int, int]], NoneType] = None"}],parametersDescription:[{anchor:"transformers.MaskFormerImageProcessor.post_process_panoptic_segmentation.outputs",description:`<strong>outputs</strong> (<code>MaskFormerForInstanceSegmentationOutput</code>) &#x2014;
The outputs from <a href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation">MaskFormerForInstanceSegmentation</a>.`,name:"outputs"},{anchor:"transformers.MaskFormerImageProcessor.post_process_panoptic_segmentation.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The probability score threshold to keep predicted instance masks.`,name:"threshold"},{anchor:"transformers.MaskFormerImageProcessor.post_process_panoptic_segmentation.mask_threshold",description:`<strong>mask_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Threshold to use when turning the predicted masks into binary values.`,name:"mask_threshold"},{anchor:"transformers.MaskFormerImageProcessor.post_process_panoptic_segmentation.overlap_mask_area_threshold",description:`<strong>overlap_mask_area_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
The overlap mask area threshold to merge or discard small disconnected parts within each binary
instance mask.`,name:"overlap_mask_area_threshold"},{anchor:"transformers.MaskFormerImageProcessor.post_process_panoptic_segmentation.label_ids_to_fuse",description:`<strong>label_ids_to_fuse</strong> (<code>Set[int]</code>, <em>optional</em>) &#x2014;
The labels in this state will have all their instances be fused together. For instance we could say
there can only be one sky in an image, but several persons, so the label ID for sky would be in that
set, but not the one for person.`,name:"label_ids_to_fuse"},{anchor:"transformers.MaskFormerImageProcessor.post_process_panoptic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds to the requested
final size (height, width) of each prediction in batch. 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/maskformer/image_processing_maskformer.py#L1092",returnDescription:`
<p>A list of dictionaries, one per image, each dictionary containing two keys:</p>
<ul>
<li><strong>segmentation</strong> \u2014 a tensor of shape <code>(height, width)</code> where each pixel represents a <code>segment_id</code>, set
to <code>None</code> if no mask if found above <code>threshold</code>. If <code>target_sizes</code> is specified, segmentation is resized
to the corresponding <code>target_sizes</code> entry.</li>
<li><strong>segments_info</strong> \u2014 A dictionary that contains additional information on each segment.<ul>
<li><strong>id</strong> \u2014 an integer representing the <code>segment_id</code>.</li>
<li><strong>label_id</strong> \u2014 An integer representing the label / semantic class id corresponding to <code>segment_id</code>.</li>
<li><strong>was_fused</strong> \u2014 a boolean, <code>True</code> if <code>label_id</code> was in <code>label_ids_to_fuse</code>, <code>False</code> otherwise.
Multiple instances of the same class / label were fused and assigned a single <code>segment_id</code>.</li>
<li><strong>score</strong> \u2014 Prediction score of segment with <code>segment_id</code>.</li>
</ul></li>
</ul>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),Et=new he({}),jt=new $({props:{name:"class transformers.MaskFormerFeatureExtractor",anchor:"transformers.MaskFormerFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/feature_extraction_maskformer.py#L26"}}),zt=new $({props:{name:"__call__",anchor:"transformers.MaskFormerFeatureExtractor.__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/maskformer/image_processing_maskformer.py#L535"}}),Nt=new $({props:{name:"encode_inputs",anchor:"transformers.MaskFormerFeatureExtractor.encode_inputs",parameters:[{name:"pixel_values_list",val:": typing.List[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')]] = None"},{name:"instance_id_to_semantic_id",val:": typing.Union[typing.List[typing.Dict[int, int]], typing.Dict[int, int], NoneType] = None"},{name:"ignore_index",val:": typing.Optional[int] = None"},{name:"reduce_labels",val:": bool = False"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"}],parametersDescription:[{anchor:"transformers.MaskFormerFeatureExtractor.encode_inputs.pixel_values_list",description:`<strong>pixel_values_list</strong> (<code>List[ImageInput]</code>) &#x2014;
List of images (pixel values) to be padded. Each image should be a tensor of shape <code>(channels, height, width)</code>.`,name:"pixel_values_list"},{anchor:"transformers.MaskFormerFeatureExtractor.encode_inputs.segmentation_maps",description:`<strong>segmentation_maps</strong> (<code>ImageInput</code>, <em>optional</em>) &#x2014;
The corresponding semantic segmentation maps with the pixel-wise annotations.</p>
<p>(<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
Whether or not to pad images up to the largest image in a batch and create a pixel mask.</p>
<p>If left to the default, will return a pixel mask that is:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).</li>
</ul>`,name:"segmentation_maps"},{anchor:"transformers.MaskFormerFeatureExtractor.encode_inputs.instance_id_to_semantic_id",description:`<strong>instance_id_to_semantic_id</strong> (<code>List[Dict[int, int]]</code> or <code>Dict[int, int]</code>, <em>optional</em>) &#x2014;
A mapping between object instance ids and class ids. If passed, <code>segmentation_maps</code> is treated as an
instance segmentation map where each pixel represents an instance id. Can be provided as a single
dictionary with a global/dataset-level mapping or as a list of dictionaries (one per image), to map
instance ids in each image separately.`,name:"instance_id_to_semantic_id"},{anchor:"transformers.MaskFormerFeatureExtractor.encode_inputs.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/v4.31.0/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of NumPy arrays. If set to <code>&apos;pt&apos;</code>, return PyTorch <code>torch.Tensor</code>
objects.`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/image_processing_maskformer.py#L788",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a> with the following fields:</p>
<ul>
<li><strong>pixel_values</strong> \u2014 Pixel values to be fed to a model.</li>
<li><strong>pixel_mask</strong> \u2014 Pixel mask to be fed to a model (when <code>=True</code> or if <code>pixel_mask</code> is in
<code>self.model_input_names</code>).</li>
<li><strong>mask_labels</strong> \u2014 Optional list of mask labels of shape <code>(labels, height, width)</code> to be fed to a model
(when <code>annotations</code> are provided).</li>
<li><strong>class_labels</strong> \u2014 Optional list of class labels of shape <code>(labels)</code> to be fed to a model (when
<code>annotations</code> are provided). They identify the labels of <code>mask_labels</code>, e.g. the label of
<code>mask_labels[i][j]</code> if <code>class_labels[i][j]</code>.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),Pt=new $({props:{name:"post_process_semantic_segmentation",anchor:"transformers.MaskFormerFeatureExtractor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": typing.Union[typing.List[typing.Tuple[int, int]], NoneType] = None"}],parametersDescription:[{anchor:"transformers.MaskFormerFeatureExtractor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation">MaskFormerForInstanceSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple[int, int]]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds 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/maskformer/image_processing_maskformer.py#L929",returnDescription:`
<p>A list 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><code>List[torch.Tensor]</code></p>
`}}),Jt=new $({props:{name:"post_process_instance_segmentation",anchor:"transformers.MaskFormerFeatureExtractor.post_process_instance_segmentation",parameters:[{name:"outputs",val:""},{name:"threshold",val:": float = 0.5"},{name:"mask_threshold",val:": float = 0.5"},{name:"overlap_mask_area_threshold",val:": float = 0.8"},{name:"target_sizes",val:": typing.Union[typing.List[typing.Tuple[int, int]], NoneType] = None"},{name:"return_coco_annotation",val:": typing.Optional[bool] = False"},{name:"return_binary_maps",val:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.MaskFormerFeatureExtractor.post_process_instance_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation">MaskFormerForInstanceSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_instance_segmentation.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The probability score threshold to keep predicted instance masks.`,name:"threshold"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_instance_segmentation.mask_threshold",description:`<strong>mask_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Threshold to use when turning the predicted masks into binary values.`,name:"mask_threshold"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_instance_segmentation.overlap_mask_area_threshold",description:`<strong>overlap_mask_area_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
The overlap mask area threshold to merge or discard small disconnected parts within each binary
instance mask.`,name:"overlap_mask_area_threshold"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_instance_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds to the requested
final size (height, width) of each prediction. If left to None, predictions will not be resized.`,name:"target_sizes"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_instance_segmentation.return_coco_annotation",description:`<strong>return_coco_annotation</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If set to <code>True</code>, segmentation maps are returned in COCO run-length encoding (RLE) format.`,name:"return_coco_annotation"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_instance_segmentation.return_binary_maps",description:`<strong>return_binary_maps</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If set to <code>True</code>, segmentation maps are returned as a concatenated tensor of binary segmentation maps
(one per detected instance).`,name:"return_binary_maps"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/image_processing_maskformer.py#L979",returnDescription:`
<p>A list of dictionaries, one per image, each dictionary containing two keys:</p>
<ul>
<li><strong>segmentation</strong> \u2014 A tensor of shape <code>(height, width)</code> where each pixel represents a <code>segment_id</code> or
<code>List[List]</code> run-length encoding (RLE) of the segmentation map if return_coco_annotation is set to
<code>True</code>. Set to <code>None</code> if no mask if found above <code>threshold</code>.</li>
<li><strong>segments_info</strong> \u2014 A dictionary that contains additional information on each segment.<ul>
<li><strong>id</strong> \u2014 An integer representing the <code>segment_id</code>.</li>
<li><strong>label_id</strong> \u2014 An integer representing the label / semantic class id corresponding to <code>segment_id</code>.</li>
<li><strong>score</strong> \u2014 Prediction score of segment with <code>segment_id</code>.</li>
</ul></li>
</ul>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),Rt=new $({props:{name:"post_process_panoptic_segmentation",anchor:"transformers.MaskFormerFeatureExtractor.post_process_panoptic_segmentation",parameters:[{name:"outputs",val:""},{name:"threshold",val:": float = 0.5"},{name:"mask_threshold",val:": float = 0.5"},{name:"overlap_mask_area_threshold",val:": float = 0.8"},{name:"label_ids_to_fuse",val:": typing.Optional[typing.Set[int]] = None"},{name:"target_sizes",val:": typing.Union[typing.List[typing.Tuple[int, int]], NoneType] = None"}],parametersDescription:[{anchor:"transformers.MaskFormerFeatureExtractor.post_process_panoptic_segmentation.outputs",description:`<strong>outputs</strong> (<code>MaskFormerForInstanceSegmentationOutput</code>) &#x2014;
The outputs from <a href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation">MaskFormerForInstanceSegmentation</a>.`,name:"outputs"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_panoptic_segmentation.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The probability score threshold to keep predicted instance masks.`,name:"threshold"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_panoptic_segmentation.mask_threshold",description:`<strong>mask_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Threshold to use when turning the predicted masks into binary values.`,name:"mask_threshold"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_panoptic_segmentation.overlap_mask_area_threshold",description:`<strong>overlap_mask_area_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
The overlap mask area threshold to merge or discard small disconnected parts within each binary
instance mask.`,name:"overlap_mask_area_threshold"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_panoptic_segmentation.label_ids_to_fuse",description:`<strong>label_ids_to_fuse</strong> (<code>Set[int]</code>, <em>optional</em>) &#x2014;
The labels in this state will have all their instances be fused together. For instance we could say
there can only be one sky in an image, but several persons, so the label ID for sky would be in that
set, but not the one for person.`,name:"label_ids_to_fuse"},{anchor:"transformers.MaskFormerFeatureExtractor.post_process_panoptic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds to the requested
final size (height, width) of each prediction in batch. 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/maskformer/image_processing_maskformer.py#L1092",returnDescription:`
<p>A list of dictionaries, one per image, each dictionary containing two keys:</p>
<ul>
<li><strong>segmentation</strong> \u2014 a tensor of shape <code>(height, width)</code> where each pixel represents a <code>segment_id</code>, set
to <code>None</code> if no mask if found above <code>threshold</code>. If <code>target_sizes</code> is specified, segmentation is resized
to the corresponding <code>target_sizes</code> entry.</li>
<li><strong>segments_info</strong> \u2014 A dictionary that contains additional information on each segment.<ul>
<li><strong>id</strong> \u2014 an integer representing the <code>segment_id</code>.</li>
<li><strong>label_id</strong> \u2014 An integer representing the label / semantic class id corresponding to <code>segment_id</code>.</li>
<li><strong>was_fused</strong> \u2014 a boolean, <code>True</code> if <code>label_id</code> was in <code>label_ids_to_fuse</code>, <code>False</code> otherwise.
Multiple instances of the same class / label were fused and assigned a single <code>segment_id</code>.</li>
<li><strong>score</strong> \u2014 Prediction score of segment with <code>segment_id</code>.</li>
</ul></li>
</ul>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),St=new he({}),Bt=new $({props:{name:"class transformers.MaskFormerModel",anchor:"transformers.MaskFormerModel",parameters:[{name:"config",val:": MaskFormerConfig"}],parametersDescription:[{anchor:"transformers.MaskFormerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerConfig">MaskFormerConfig</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/maskformer/modeling_maskformer.py#L1534"}}),Ot=new $({props:{name:"forward",anchor:"transformers.MaskFormerModel.forward",parameters:[{name:"pixel_values",val:": Tensor"},{name:"pixel_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MaskFormerModel.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. 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/maskformer#transformers.MaskFormerFeatureExtractor.__call__">MaskFormerImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.MaskFormerModel.forward.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"pixel_mask"},{anchor:"transformers.MaskFormerModel.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.MaskFormerModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of Detr&#x2019;s decoder attention layers.`,name:"output_attentions"},{anchor:"transformers.MaskFormerModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <code>~MaskFormerModelOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/modeling_maskformer.py#L1544",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput"
>transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput</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/maskformer#transformers.MaskFormerConfig"
>MaskFormerConfig</a>) and inputs.</p>
<ul>
<li><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Last hidden states (final feature map) of the last stage of the encoder model (backbone).</li>
<li><strong>pixel_decoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Last hidden states (final feature map) of the last stage of the pixel decoder model (FPN).</li>
<li><strong>transformer_decoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Last hidden states (final feature map) of the last stage of the transformer decoder model.</li>
<li><strong>encoder_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 + 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 encoder
model at the output of each stage.</li>
<li><strong>pixel_decoder_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 + 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 pixel
decoder model at the output of each stage.</li>
<li><strong>transformer_decoder_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 + one for the output of each stage) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states (also called feature maps) of the
transformer decoder at the output of each stage.</li>
<li><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> containing <code>encoder_hidden_states</code>, <code>pixel_decoder_hidden_states</code> and
<code>decoder_hidden_states</code></li>
<li><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>. Attentions weights from Detr\u2019s decoder after the attention softmax, used to compute the
weighted average in the self-attention heads.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput"
>transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ue=new vl({props:{$$slots:{default:[nd]},$$scope:{ctx:j}}}),Pe=new Nr({props:{anchor:"transformers.MaskFormerModel.forward.example",$$slots:{default:[id]},$$scope:{ctx:j}}}),Vt=new he({}),Xt=new $({props:{name:"class transformers.MaskFormerForInstanceSegmentation",anchor:"transformers.MaskFormerForInstanceSegmentation",parameters:[{name:"config",val:": MaskFormerConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/modeling_maskformer.py#L1631"}}),Gt=new $({props:{name:"forward",anchor:"transformers.MaskFormerForInstanceSegmentation.forward",parameters:[{name:"pixel_values",val:": Tensor"},{name:"mask_labels",val:": typing.Optional[typing.List[torch.Tensor]] = None"},{name:"class_labels",val:": typing.Optional[typing.List[torch.Tensor]] = None"},{name:"pixel_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_auxiliary_logits",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MaskFormerForInstanceSegmentation.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. 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/maskformer#transformers.MaskFormerFeatureExtractor.__call__">MaskFormerImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.MaskFormerForInstanceSegmentation.forward.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"pixel_mask"},{anchor:"transformers.MaskFormerForInstanceSegmentation.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.MaskFormerForInstanceSegmentation.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of Detr&#x2019;s decoder attention layers.`,name:"output_attentions"},{anchor:"transformers.MaskFormerForInstanceSegmentation.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <code>~MaskFormerModelOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.MaskFormerForInstanceSegmentation.forward.mask_labels",description:`<strong>mask_labels</strong> (<code>List[torch.Tensor]</code>, <em>optional</em>) &#x2014;
List of mask labels of shape <code>(num_labels, height, width)</code> to be fed to a model`,name:"mask_labels"},{anchor:"transformers.MaskFormerForInstanceSegmentation.forward.class_labels",description:`<strong>class_labels</strong> (<code>List[torch.LongTensor]</code>, <em>optional</em>) &#x2014;
list of target class labels of shape <code>(num_labels, height, width)</code> to be fed to a model. They identify the
labels of <code>mask_labels</code>, e.g. the label of <code>mask_labels[i][j]</code> if <code>class_labels[i][j]</code>.`,name:"class_labels"}],source:"https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/models/maskformer/modeling_maskformer.py#L1712",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput"
>transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput</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/maskformer#transformers.MaskFormerConfig"
>MaskFormerConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.Tensor</code>, <em>optional</em>) \u2014 The computed loss, returned when labels are present.</li>
<li><strong>class_queries_logits</strong> (<code>torch.FloatTensor</code>) \u2014 A tensor of shape <code>(batch_size, num_queries, num_labels + 1)</code> representing the proposed classes for each
query. Note the <code>+ 1</code> is needed because we incorporate the null class.</li>
<li><strong>masks_queries_logits</strong> (<code>torch.FloatTensor</code>) \u2014 A tensor of shape <code>(batch_size, num_queries, height, width)</code> representing the proposed masks for each
query.</li>
<li><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Last hidden states (final feature map) of the last stage of the encoder model (backbone).</li>
<li><strong>pixel_decoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Last hidden states (final feature map) of the last stage of the pixel decoder model (FPN).</li>
<li><strong>transformer_decoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Last hidden states (final feature map) of the last stage of the transformer decoder model.</li>
<li><strong>encoder_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 + 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 encoder
model at the output of each stage.</li>
<li><strong>pixel_decoder_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 + 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 pixel
decoder model at the output of each stage.</li>
<li><strong>transformer_decoder_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 + one for the output of each stage) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the transformer decoder at the output
of each stage.</li>
<li><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> containing <code>encoder_hidden_states</code>, <code>pixel_decoder_hidden_states</code> and
<code>decoder_hidden_states</code>.</li>
<li><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>. Attentions weights from Detr\u2019s decoder after the attention softmax, used to compute the
weighted average in the self-attention heads.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput"
>transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Je=new vl({props:{$$slots:{default:[ld]},$$scope:{ctx:j}}}),Ce=new Nr({props:{anchor:"transformers.MaskFormerForInstanceSegmentation.forward.example",$$slots:{default:[cd]},$$scope:{ctx:j}}}),Re=new Nr({props:{anchor:"transformers.MaskFormerForInstanceSegmentation.forward.example-2",$$slots:{default:[dd]},$$scope:{ctx:j}}}),{c(){h=a("meta"),T=d(),_=a("h1"),g=a("a"),w=a("span"),b(c.$$.fragment),u=d(),U=a("span"),Zr=s("MaskFormer"),Fs=d(),b(fe.$$.fragment),ws=d(),ee=a("h2"),ge=a("a"),No=a("span"),b(Ve.$$.fragment),Jr=d(),Uo=a("span"),Cr=s("Overview"),Ts=d(),ue=a("p"),Rr=s("The MaskFormer model was proposed in "),Xe=a("a"),Wr=s("Per-Pixel Classification is Not All You Need for Semantic Segmentation"),Sr=s(" by Bowen Cheng, Alexander G. Schwing, Alexander Kirillov. MaskFormer addresses semantic segmentation with a mask classification paradigm instead of performing classic pixel-level classification."),xs=d(),Yt=a("p"),Br=s("The abstract from the paper is the following:"),$s=d(),Ht=a("p"),Po=a("em"),Lr=s("Modern approaches typically formulate semantic segmentation as a per-pixel classification task, while instance-level segmentation is handled with an alternative mask classification. Our key insight: mask classification is sufficiently general to solve both semantic- and instance-level segmentation tasks in a unified manner using the exact same model, loss, and training procedure. Following this observation, we propose MaskFormer, a simple mask classification model which predicts a set of binary masks, each associated with a single global class label prediction. Overall, the proposed mask classification-based method simplifies the landscape of effective approaches to semantic and panoptic segmentation tasks and shows excellent empirical results. In particular, we observe that MaskFormer outperforms per-pixel classification baselines when the number of classes is large. Our mask classification-based method outperforms both current state-of-the-art semantic (55.6 mIoU on ADE20K) and panoptic segmentation (52.7 PQ on COCO) models."),Is=d(),Qt=a("p"),Ar=s("Tips:"),Es=d(),R=a("ul"),Z=a("li"),Or=s("MaskFormer\u2019s Transformer decoder is identical to the decoder of "),Kt=a("a"),Vr=s("DETR"),Xr=s(". During training, the authors of DETR did find it helpful to use auxiliary losses in the decoder, especially to help the model output the correct number of objects of each class. If you set the parameter "),Zo=a("code"),Gr=s("use_auxilary_loss"),Dr=s(" of "),eo=a("a"),qr=s("MaskFormerConfig"),Yr=s(" to "),Jo=a("code"),Hr=s("True"),Qr=s(", then prediction feedforward neural networks and Hungarian losses are added after each decoder layer (with the FFNs sharing parameters)."),Kr=d(),J=a("li"),ea=s(`If you want to train the model in a distributed environment across multiple nodes, then one should update the
`),Co=a("code"),ta=s("get_num_masks"),oa=s(" function inside in the "),Ro=a("code"),sa=s("MaskFormerLoss"),ra=s(" class of "),Wo=a("code"),aa=s("modeling_maskformer.py"),na=s(`. When training on multiple nodes, this should be
set to the average number of target masks across all nodes, as can be seen in the original implementation `),Ge=a("a"),ia=s("here"),la=s("."),ca=d(),De=a("li"),da=s("One can use "),to=a("a"),ma=s("MaskFormerImageProcessor"),pa=s(" to prepare images for the model and optional targets for the model."),ha=d(),C=a("li"),fa=s("To get the final segmentation, depending on the task, you can call "),oo=a("a"),ga=s("post_process_semantic_segmentation()"),ua=s(" or "),so=a("a"),_a=s("post_process_panoptic_segmentation()"),ba=s(". Both tasks can be solved using "),ro=a("a"),ka=s("MaskFormerForInstanceSegmentation"),ya=s(" output, panoptic segmentation accepts an optional "),So=a("code"),va=s("label_ids_to_fuse"),Ma=s(" argument to fuse instances of the target object/s (e.g. sky) together."),js=d(),_e=a("p"),Fa=s("The figure below illustrates the architecture of MaskFormer. Taken from the "),qe=a("a"),wa=s("original paper"),Ta=s("."),zs=d(),Ye=a("img"),Ns=d(),D=a("p"),xa=s("This model was contributed by "),He=a("a"),$a=s("francesco"),Ia=s(". The original code can be found "),Qe=a("a"),Ea=s("here"),ja=s("."),Us=d(),te=a("h2"),be=a("a"),Bo=a("span"),b(Ke.$$.fragment),za=d(),Lo=a("span"),Na=s("Resources"),Ps=d(),b(et.$$.fragment),Zs=d(),ao=a("ul"),tt=a("li"),Ua=s("All notebooks that illustrate inference as well as fine-tuning on custom data with MaskFormer can be found "),ot=a("a"),Pa=s("here"),Za=s("."),Js=d(),oe=a("h2"),ke=a("a"),Ao=a("span"),b(st.$$.fragment),Ja=d(),Oo=a("span"),Ca=s("MaskFormer specific outputs"),Cs=d(),se=a("div"),b(rt.$$.fragment),Ra=d(),at=a("p"),Wa=s("Class for outputs of "),no=a("a"),Sa=s("MaskFormerModel"),Ba=s(". This class returns all the needed hidden states to compute the logits."),Rs=d(),L=a("div"),b(nt.$$.fragment),La=d(),it=a("p"),Aa=s("Class for outputs of "),io=a("a"),Oa=s("MaskFormerForInstanceSegmentation"),Va=s("."),Xa=d(),A=a("p"),Ga=s("This output can be directly passed to "),lo=a("a"),Da=s("post_process_semantic_segmentation()"),qa=s(` or or
`),co=a("a"),Ya=s("post_process_instance_segmentation()"),Ha=s(` or
`),mo=a("a"),Qa=s("post_process_panoptic_segmentation()"),Ka=s(" depending on the task. Please, see\n[`~MaskFormerImageProcessor] for details regarding usage."),Ws=d(),re=a("h2"),ye=a("a"),Vo=a("span"),b(lt.$$.fragment),en=d(),Xo=a("span"),tn=s("MaskFormerConfig"),Ss=d(),I=a("div"),b(ct.$$.fragment),on=d(),O=a("p"),sn=s("This is the configuration class to store the configuration of a "),po=a("a"),rn=s("MaskFormerModel"),an=s(`. It is used to instantiate a
MaskFormer 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 MaskFormer
`),dt=a("a"),nn=s("facebook/maskformer-swin-base-ade"),ln=s(` architecture trained
on `),mt=a("a"),cn=s("ADE20k-150"),dn=s("."),mn=d(),ae=a("p"),pn=s("Configuration objects inherit from "),ho=a("a"),hn=s("PretrainedConfig"),fn=s(` and can be used to control the model outputs. Read the
documentation from `),fo=a("a"),gn=s("PretrainedConfig"),un=s(" for more information."),_n=d(),pt=a("p"),bn=s("Currently, MaskFormer only supports the "),go=a("a"),kn=s("Swin Transformer"),yn=s(" as backbone."),vn=d(),b(ve.$$.fragment),Mn=d(),Me=a("div"),b(ht.$$.fragment),Fn=d(),ft=a("p"),wn=s("Instantiate a "),uo=a("a"),Tn=s("MaskFormerConfig"),xn=s(` (or a derived class) from a pre-trained backbone model configuration and DETR model
configuration.`),$n=d(),Fe=a("div"),b(gt.$$.fragment),In=d(),ut=a("p"),En=s("Serializes this instance to a Python dictionary. Override the default "),_o=a("a"),jn=s("to_dict()"),zn=s("."),Bs=d(),ne=a("h2"),we=a("a"),Go=a("span"),b(_t.$$.fragment),Nn=d(),Do=a("span"),Un=s("MaskFormerImageProcessor"),Ls=d(),x=a("div"),b(bt.$$.fragment),Pn=d(),qo=a("p"),Zn=s(`Constructs a MaskFormer image processor. The image processor can be used to prepare image(s) and optional targets
for the model.`),Jn=d(),kt=a("p"),Cn=s("This image processor inherits from "),Yo=a("code"),Rn=s("BaseImageProcessor"),Wn=s(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Sn=d(),bo=a("div"),b(yt.$$.fragment),Bn=d(),q=a("div"),b(vt.$$.fragment),Ln=d(),Mt=a("p"),An=s("Pad images up to the largest image in a batch and create a corresponding "),Ho=a("code"),On=s("pixel_mask"),Vn=s("."),Xn=d(),V=a("p"),Gn=s(`MaskFormer addresses semantic segmentation with a mask classification paradigm, thus input segmentation maps
will be converted to lists of binary masks and their respective labels. Let\u2019s see an example, assuming
`),Qo=a("code"),Dn=s("segmentation_maps = [[2,6,7,9]]"),qn=s(", the output will contain "),Ko=a("code"),Yn=s("mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),Hn=s(" (four binary masks) and "),es=a("code"),Qn=s("class_labels = [2,6,7,9]"),Kn=s(`, the labels for
each mask.`),ei=d(),Te=a("div"),b(Ft.$$.fragment),ti=d(),wt=a("p"),oi=s("Converts the output of "),ko=a("a"),si=s("MaskFormerForInstanceSegmentation"),ri=s(` into semantic segmentation maps. Only supports
PyTorch.`),ai=d(),xe=a("div"),b(Tt.$$.fragment),ni=d(),xt=a("p"),ii=s("Converts the output of "),ts=a("code"),li=s("MaskFormerForInstanceSegmentationOutput"),ci=s(` into instance segmentation predictions. Only
supports PyTorch.`),di=d(),$e=a("div"),b($t.$$.fragment),mi=d(),It=a("p"),pi=s("Converts the output of "),os=a("code"),hi=s("MaskFormerForInstanceSegmentationOutput"),fi=s(` into image panoptic segmentation
predictions. Only supports PyTorch.`),As=d(),ie=a("h2"),Ie=a("a"),ss=a("span"),b(Et.$$.fragment),gi=d(),rs=a("span"),ui=s("MaskFormerFeatureExtractor"),Os=d(),E=a("div"),b(jt.$$.fragment),_i=d(),yo=a("div"),b(zt.$$.fragment),bi=d(),Y=a("div"),b(Nt.$$.fragment),ki=d(),Ut=a("p"),yi=s("Pad images up to the largest image in a batch and create a corresponding "),as=a("code"),vi=s("pixel_mask"),Mi=s("."),Fi=d(),X=a("p"),wi=s(`MaskFormer addresses semantic segmentation with a mask classification paradigm, thus input segmentation maps
will be converted to lists of binary masks and their respective labels. Let\u2019s see an example, assuming
`),ns=a("code"),Ti=s("segmentation_maps = [[2,6,7,9]]"),xi=s(", the output will contain "),is=a("code"),$i=s("mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),Ii=s(" (four binary masks) and "),ls=a("code"),Ei=s("class_labels = [2,6,7,9]"),ji=s(`, the labels for
each mask.`),zi=d(),Ee=a("div"),b(Pt.$$.fragment),Ni=d(),Zt=a("p"),Ui=s("Converts the output of "),vo=a("a"),Pi=s("MaskFormerForInstanceSegmentation"),Zi=s(` into semantic segmentation maps. Only supports
PyTorch.`),Ji=d(),je=a("div"),b(Jt.$$.fragment),Ci=d(),Ct=a("p"),Ri=s("Converts the output of "),cs=a("code"),Wi=s("MaskFormerForInstanceSegmentationOutput"),Si=s(` into instance segmentation predictions. Only
supports PyTorch.`),Bi=d(),ze=a("div"),b(Rt.$$.fragment),Li=d(),Wt=a("p"),Ai=s("Converts the output of "),ds=a("code"),Oi=s("MaskFormerForInstanceSegmentationOutput"),Vi=s(` into image panoptic segmentation
predictions. Only supports PyTorch.`),Vs=d(),le=a("h2"),Ne=a("a"),ms=a("span"),b(St.$$.fragment),Xi=d(),ps=a("span"),Gi=s("MaskFormerModel"),Xs=d(),G=a("div"),b(Bt.$$.fragment),Di=d(),Lt=a("p"),qi=s(`The bare MaskFormer Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),At=a("a"),Yi=s("torch.nn.Module"),Hi=s(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Qi=d(),W=a("div"),b(Ot.$$.fragment),Ki=d(),ce=a("p"),el=s("The "),Mo=a("a"),tl=s("MaskFormerModel"),ol=s(" forward method, overrides the "),hs=a("code"),sl=s("__call__"),rl=s(" special method."),al=d(),b(Ue.$$.fragment),nl=d(),b(Pe.$$.fragment),Gs=d(),de=a("h2"),Ze=a("a"),fs=a("span"),b(Vt.$$.fragment),il=d(),gs=a("span"),ll=s("MaskFormerForInstanceSegmentation"),Ds=d(),me=a("div"),b(Xt.$$.fragment),cl=d(),z=a("div"),b(Gt.$$.fragment),dl=d(),pe=a("p"),ml=s("The "),Fo=a("a"),pl=s("MaskFormerForInstanceSegmentation"),hl=s(" forward method, overrides the "),us=a("code"),fl=s("__call__"),gl=s(" special method."),ul=d(),b(Je.$$.fragment),_l=d(),_s=a("p"),bl=s("Examples:"),kl=d(),b(Ce.$$.fragment),yl=d(),b(Re.$$.fragment),this.h()},l(t){const p=ed('[data-svelte="svelte-1phssyn"]',document.head);h=n(p,"META",{name:!0,content:!0}),p.forEach(o),T=m(t),_=n(t,"H1",{class:!0});var Dt=i(_);g=n(Dt,"A",{id:!0,class:!0,href:!0});var bs=i(g);w=n(bs,"SPAN",{});var ks=i(w);k(c.$$.fragment,ks),ks.forEach(o),bs.forEach(o),u=m(Dt),U=n(Dt,"SPAN",{});var ys=i(U);Zr=r(ys,"MaskFormer"),ys.forEach(o),Dt.forEach(o),Fs=m(t),k(fe.$$.fragment,t),ws=m(t),ee=n(t,"H2",{class:!0});var qt=i(ee);ge=n(qt,"A",{id:!0,class:!0,href:!0});var vs=i(ge);No=n(vs,"SPAN",{});var Ms=i(No);k(Ve.$$.fragment,Ms),Ms.forEach(o),vs.forEach(o),Jr=m(qt),Uo=n(qt,"SPAN",{});var Fl=i(Uo);Cr=r(Fl,"Overview"),Fl.forEach(o),qt.forEach(o),Ts=m(t),ue=n(t,"P",{});var Ys=i(ue);Rr=r(Ys,"The MaskFormer model was proposed in "),Xe=n(Ys,"A",{href:!0,rel:!0});var wl=i(Xe);Wr=r(wl,"Per-Pixel Classification is Not All You Need for Semantic Segmentation"),wl.forEach(o),Sr=r(Ys," by Bowen Cheng, Alexander G. Schwing, Alexander Kirillov. MaskFormer addresses semantic segmentation with a mask classification paradigm instead of performing classic pixel-level classification."),Ys.forEach(o),xs=m(t),Yt=n(t,"P",{});var Tl=i(Yt);Br=r(Tl,"The abstract from the paper is the following:"),Tl.forEach(o),$s=m(t),Ht=n(t,"P",{});var xl=i(Ht);Po=n(xl,"EM",{});var $l=i(Po);Lr=r($l,"Modern approaches typically formulate semantic segmentation as a per-pixel classification task, while instance-level segmentation is handled with an alternative mask classification. Our key insight: mask classification is sufficiently general to solve both semantic- and instance-level segmentation tasks in a unified manner using the exact same model, loss, and training procedure. Following this observation, we propose MaskFormer, a simple mask classification model which predicts a set of binary masks, each associated with a single global class label prediction. Overall, the proposed mask classification-based method simplifies the landscape of effective approaches to semantic and panoptic segmentation tasks and shows excellent empirical results. In particular, we observe that MaskFormer outperforms per-pixel classification baselines when the number of classes is large. Our mask classification-based method outperforms both current state-of-the-art semantic (55.6 mIoU on ADE20K) and panoptic segmentation (52.7 PQ on COCO) models."),$l.forEach(o),xl.forEach(o),Is=m(t),Qt=n(t,"P",{});var Il=i(Qt);Ar=r(Il,"Tips:"),Il.forEach(o),Es=m(t),R=n(t,"UL",{});var We=i(R);Z=n(We,"LI",{});var H=i(Z);Or=r(H,"MaskFormer\u2019s Transformer decoder is identical to the decoder of "),Kt=n(H,"A",{href:!0});var El=i(Kt);Vr=r(El,"DETR"),El.forEach(o),Xr=r(H,". During training, the authors of DETR did find it helpful to use auxiliary losses in the decoder, especially to help the model output the correct number of objects of each class. If you set the parameter "),Zo=n(H,"CODE",{});var jl=i(Zo);Gr=r(jl,"use_auxilary_loss"),jl.forEach(o),Dr=r(H," of "),eo=n(H,"A",{href:!0});var zl=i(eo);qr=r(zl,"MaskFormerConfig"),zl.forEach(o),Yr=r(H," to "),Jo=n(H,"CODE",{});var Nl=i(Jo);Hr=r(Nl,"True"),Nl.forEach(o),Qr=r(H,", then prediction feedforward neural networks and Hungarian losses are added after each decoder layer (with the FFNs sharing parameters)."),H.forEach(o),Kr=m(We),J=n(We,"LI",{});var Q=i(J);ea=r(Q,`If you want to train the model in a distributed environment across multiple nodes, then one should update the
`),Co=n(Q,"CODE",{});var Ul=i(Co);ta=r(Ul,"get_num_masks"),Ul.forEach(o),oa=r(Q," function inside in the "),Ro=n(Q,"CODE",{});var Pl=i(Ro);sa=r(Pl,"MaskFormerLoss"),Pl.forEach(o),ra=r(Q," class of "),Wo=n(Q,"CODE",{});var Zl=i(Wo);aa=r(Zl,"modeling_maskformer.py"),Zl.forEach(o),na=r(Q,`. When training on multiple nodes, this should be
set to the average number of target masks across all nodes, as can be seen in the original implementation `),Ge=n(Q,"A",{href:!0,rel:!0});var Jl=i(Ge);ia=r(Jl,"here"),Jl.forEach(o),la=r(Q,"."),Q.forEach(o),ca=m(We),De=n(We,"LI",{});var Hs=i(De);da=r(Hs,"One can use "),to=n(Hs,"A",{href:!0});var Cl=i(to);ma=r(Cl,"MaskFormerImageProcessor"),Cl.forEach(o),pa=r(Hs," to prepare images for the model and optional targets for the model."),Hs.forEach(o),ha=m(We),C=n(We,"LI",{});var K=i(C);fa=r(K,"To get the final segmentation, depending on the task, you can call "),oo=n(K,"A",{href:!0});var Rl=i(oo);ga=r(Rl,"post_process_semantic_segmentation()"),Rl.forEach(o),ua=r(K," or "),so=n(K,"A",{href:!0});var Wl=i(so);_a=r(Wl,"post_process_panoptic_segmentation()"),Wl.forEach(o),ba=r(K,". Both tasks can be solved using "),ro=n(K,"A",{href:!0});var Sl=i(ro);ka=r(Sl,"MaskFormerForInstanceSegmentation"),Sl.forEach(o),ya=r(K," output, panoptic segmentation accepts an optional "),So=n(K,"CODE",{});var Bl=i(So);va=r(Bl,"label_ids_to_fuse"),Bl.forEach(o),Ma=r(K," argument to fuse instances of the target object/s (e.g. sky) together."),K.forEach(o),We.forEach(o),js=m(t),_e=n(t,"P",{});var Qs=i(_e);Fa=r(Qs,"The figure below illustrates the architecture of MaskFormer. Taken from the "),qe=n(Qs,"A",{href:!0,rel:!0});var Ll=i(qe);wa=r(Ll,"original paper"),Ll.forEach(o),Ta=r(Qs,"."),Qs.forEach(o),zs=m(t),Ye=n(t,"IMG",{width:!0,src:!0}),Ns=m(t),D=n(t,"P",{});var wo=i(D);xa=r(wo,"This model was contributed by "),He=n(wo,"A",{href:!0,rel:!0});var Al=i(He);$a=r(Al,"francesco"),Al.forEach(o),Ia=r(wo,". The original code can be found "),Qe=n(wo,"A",{href:!0,rel:!0});var Ol=i(Qe);Ea=r(Ol,"here"),Ol.forEach(o),ja=r(wo,"."),wo.forEach(o),Us=m(t),te=n(t,"H2",{class:!0});var Ks=i(te);be=n(Ks,"A",{id:!0,class:!0,href:!0});var Vl=i(be);Bo=n(Vl,"SPAN",{});var Xl=i(Bo);k(Ke.$$.fragment,Xl),Xl.forEach(o),Vl.forEach(o),za=m(Ks),Lo=n(Ks,"SPAN",{});var Gl=i(Lo);Na=r(Gl,"Resources"),Gl.forEach(o),Ks.forEach(o),Ps=m(t),k(et.$$.fragment,t),Zs=m(t),ao=n(t,"UL",{});var Dl=i(ao);tt=n(Dl,"LI",{});var er=i(tt);Ua=r(er,"All notebooks that illustrate inference as well as fine-tuning on custom data with MaskFormer can be found "),ot=n(er,"A",{href:!0,rel:!0});var ql=i(ot);Pa=r(ql,"here"),ql.forEach(o),Za=r(er,"."),er.forEach(o),Dl.forEach(o),Js=m(t),oe=n(t,"H2",{class:!0});var tr=i(oe);ke=n(tr,"A",{id:!0,class:!0,href:!0});var Yl=i(ke);Ao=n(Yl,"SPAN",{});var Hl=i(Ao);k(st.$$.fragment,Hl),Hl.forEach(o),Yl.forEach(o),Ja=m(tr),Oo=n(tr,"SPAN",{});var Ql=i(Oo);Ca=r(Ql,"MaskFormer specific outputs"),Ql.forEach(o),tr.forEach(o),Cs=m(t),se=n(t,"DIV",{class:!0});var or=i(se);k(rt.$$.fragment,or),Ra=m(or),at=n(or,"P",{});var sr=i(at);Wa=r(sr,"Class for outputs of "),no=n(sr,"A",{href:!0});var Kl=i(no);Sa=r(Kl,"MaskFormerModel"),Kl.forEach(o),Ba=r(sr,". This class returns all the needed hidden states to compute the logits."),sr.forEach(o),or.forEach(o),Rs=m(t),L=n(t,"DIV",{class:!0});var To=i(L);k(nt.$$.fragment,To),La=m(To),it=n(To,"P",{});var rr=i(it);Aa=r(rr,"Class for outputs of "),io=n(rr,"A",{href:!0});var ec=i(io);Oa=r(ec,"MaskFormerForInstanceSegmentation"),ec.forEach(o),Va=r(rr,"."),rr.forEach(o),Xa=m(To),A=n(To,"P",{});var Se=i(A);Ga=r(Se,"This output can be directly passed to "),lo=n(Se,"A",{href:!0});var tc=i(lo);Da=r(tc,"post_process_semantic_segmentation()"),tc.forEach(o),qa=r(Se,` or or
`),co=n(Se,"A",{href:!0});var oc=i(co);Ya=r(oc,"post_process_instance_segmentation()"),oc.forEach(o),Ha=r(Se,` or
`),mo=n(Se,"A",{href:!0});var sc=i(mo);Qa=r(sc,"post_process_panoptic_segmentation()"),sc.forEach(o),Ka=r(Se," depending on the task. Please, see\n[`~MaskFormerImageProcessor] for details regarding usage."),Se.forEach(o),To.forEach(o),Ws=m(t),re=n(t,"H2",{class:!0});var ar=i(re);ye=n(ar,"A",{id:!0,class:!0,href:!0});var rc=i(ye);Vo=n(rc,"SPAN",{});var ac=i(Vo);k(lt.$$.fragment,ac),ac.forEach(o),rc.forEach(o),en=m(ar),Xo=n(ar,"SPAN",{});var nc=i(Xo);tn=r(nc,"MaskFormerConfig"),nc.forEach(o),ar.forEach(o),Ss=m(t),I=n(t,"DIV",{class:!0});var P=i(I);k(ct.$$.fragment,P),on=m(P),O=n(P,"P",{});var Be=i(O);sn=r(Be,"This is the configuration class to store the configuration of a "),po=n(Be,"A",{href:!0});var ic=i(po);rn=r(ic,"MaskFormerModel"),ic.forEach(o),an=r(Be,`. It is used to instantiate a
MaskFormer 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 MaskFormer
`),dt=n(Be,"A",{href:!0,rel:!0});var lc=i(dt);nn=r(lc,"facebook/maskformer-swin-base-ade"),lc.forEach(o),ln=r(Be,` architecture trained
on `),mt=n(Be,"A",{href:!0,rel:!0});var cc=i(mt);cn=r(cc,"ADE20k-150"),cc.forEach(o),dn=r(Be,"."),Be.forEach(o),mn=m(P),ae=n(P,"P",{});var xo=i(ae);pn=r(xo,"Configuration objects inherit from "),ho=n(xo,"A",{href:!0});var dc=i(ho);hn=r(dc,"PretrainedConfig"),dc.forEach(o),fn=r(xo,` and can be used to control the model outputs. Read the
documentation from `),fo=n(xo,"A",{href:!0});var mc=i(fo);gn=r(mc,"PretrainedConfig"),mc.forEach(o),un=r(xo," for more information."),xo.forEach(o),_n=m(P),pt=n(P,"P",{});var nr=i(pt);bn=r(nr,"Currently, MaskFormer only supports the "),go=n(nr,"A",{href:!0});var pc=i(go);kn=r(pc,"Swin Transformer"),pc.forEach(o),yn=r(nr," as backbone."),nr.forEach(o),vn=m(P),k(ve.$$.fragment,P),Mn=m(P),Me=n(P,"DIV",{class:!0});var ir=i(Me);k(ht.$$.fragment,ir),Fn=m(ir),ft=n(ir,"P",{});var lr=i(ft);wn=r(lr,"Instantiate a "),uo=n(lr,"A",{href:!0});var hc=i(uo);Tn=r(hc,"MaskFormerConfig"),hc.forEach(o),xn=r(lr,` (or a derived class) from a pre-trained backbone model configuration and DETR model
configuration.`),lr.forEach(o),ir.forEach(o),$n=m(P),Fe=n(P,"DIV",{class:!0});var cr=i(Fe);k(gt.$$.fragment,cr),In=m(cr),ut=n(cr,"P",{});var dr=i(ut);En=r(dr,"Serializes this instance to a Python dictionary. Override the default "),_o=n(dr,"A",{href:!0});var fc=i(_o);jn=r(fc,"to_dict()"),fc.forEach(o),zn=r(dr,"."),dr.forEach(o),cr.forEach(o),P.forEach(o),Bs=m(t),ne=n(t,"H2",{class:!0});var mr=i(ne);we=n(mr,"A",{id:!0,class:!0,href:!0});var gc=i(we);Go=n(gc,"SPAN",{});var uc=i(Go);k(_t.$$.fragment,uc),uc.forEach(o),gc.forEach(o),Nn=m(mr),Do=n(mr,"SPAN",{});var _c=i(Do);Un=r(_c,"MaskFormerImageProcessor"),_c.forEach(o),mr.forEach(o),Ls=m(t),x=n(t,"DIV",{class:!0});var N=i(x);k(bt.$$.fragment,N),Pn=m(N),qo=n(N,"P",{});var bc=i(qo);Zn=r(bc,`Constructs a MaskFormer image processor. The image processor can be used to prepare image(s) and optional targets
for the model.`),bc.forEach(o),Jn=m(N),kt=n(N,"P",{});var pr=i(kt);Cn=r(pr,"This image processor inherits from "),Yo=n(pr,"CODE",{});var kc=i(Yo);Rn=r(kc,"BaseImageProcessor"),kc.forEach(o),Wn=r(pr,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),pr.forEach(o),Sn=m(N),bo=n(N,"DIV",{class:!0});var yc=i(bo);k(yt.$$.fragment,yc),yc.forEach(o),Bn=m(N),q=n(N,"DIV",{class:!0});var $o=i(q);k(vt.$$.fragment,$o),Ln=m($o),Mt=n($o,"P",{});var hr=i(Mt);An=r(hr,"Pad images up to the largest image in a batch and create a corresponding "),Ho=n(hr,"CODE",{});var vc=i(Ho);On=r(vc,"pixel_mask"),vc.forEach(o),Vn=r(hr,"."),hr.forEach(o),Xn=m($o),V=n($o,"P",{});var Le=i(V);Gn=r(Le,`MaskFormer addresses semantic segmentation with a mask classification paradigm, thus input segmentation maps
will be converted to lists of binary masks and their respective labels. Let\u2019s see an example, assuming
`),Qo=n(Le,"CODE",{});var Mc=i(Qo);Dn=r(Mc,"segmentation_maps = [[2,6,7,9]]"),Mc.forEach(o),qn=r(Le,", the output will contain "),Ko=n(Le,"CODE",{});var Fc=i(Ko);Yn=r(Fc,"mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),Fc.forEach(o),Hn=r(Le," (four binary masks) and "),es=n(Le,"CODE",{});var wc=i(es);Qn=r(wc,"class_labels = [2,6,7,9]"),wc.forEach(o),Kn=r(Le,`, the labels for
each mask.`),Le.forEach(o),$o.forEach(o),ei=m(N),Te=n(N,"DIV",{class:!0});var fr=i(Te);k(Ft.$$.fragment,fr),ti=m(fr),wt=n(fr,"P",{});var gr=i(wt);oi=r(gr,"Converts the output of "),ko=n(gr,"A",{href:!0});var Tc=i(ko);si=r(Tc,"MaskFormerForInstanceSegmentation"),Tc.forEach(o),ri=r(gr,` into semantic segmentation maps. Only supports
PyTorch.`),gr.forEach(o),fr.forEach(o),ai=m(N),xe=n(N,"DIV",{class:!0});var ur=i(xe);k(Tt.$$.fragment,ur),ni=m(ur),xt=n(ur,"P",{});var _r=i(xt);ii=r(_r,"Converts the output of "),ts=n(_r,"CODE",{});var xc=i(ts);li=r(xc,"MaskFormerForInstanceSegmentationOutput"),xc.forEach(o),ci=r(_r,` into instance segmentation predictions. Only
supports PyTorch.`),_r.forEach(o),ur.forEach(o),di=m(N),$e=n(N,"DIV",{class:!0});var br=i($e);k($t.$$.fragment,br),mi=m(br),It=n(br,"P",{});var kr=i(It);pi=r(kr,"Converts the output of "),os=n(kr,"CODE",{});var $c=i(os);hi=r($c,"MaskFormerForInstanceSegmentationOutput"),$c.forEach(o),fi=r(kr,` into image panoptic segmentation
predictions. Only supports PyTorch.`),kr.forEach(o),br.forEach(o),N.forEach(o),As=m(t),ie=n(t,"H2",{class:!0});var yr=i(ie);Ie=n(yr,"A",{id:!0,class:!0,href:!0});var Ic=i(Ie);ss=n(Ic,"SPAN",{});var Ec=i(ss);k(Et.$$.fragment,Ec),Ec.forEach(o),Ic.forEach(o),gi=m(yr),rs=n(yr,"SPAN",{});var jc=i(rs);ui=r(jc,"MaskFormerFeatureExtractor"),jc.forEach(o),yr.forEach(o),Os=m(t),E=n(t,"DIV",{class:!0});var S=i(E);k(jt.$$.fragment,S),_i=m(S),yo=n(S,"DIV",{class:!0});var zc=i(yo);k(zt.$$.fragment,zc),zc.forEach(o),bi=m(S),Y=n(S,"DIV",{class:!0});var Io=i(Y);k(Nt.$$.fragment,Io),ki=m(Io),Ut=n(Io,"P",{});var vr=i(Ut);yi=r(vr,"Pad images up to the largest image in a batch and create a corresponding "),as=n(vr,"CODE",{});var Nc=i(as);vi=r(Nc,"pixel_mask"),Nc.forEach(o),Mi=r(vr,"."),vr.forEach(o),Fi=m(Io),X=n(Io,"P",{});var Ae=i(X);wi=r(Ae,`MaskFormer addresses semantic segmentation with a mask classification paradigm, thus input segmentation maps
will be converted to lists of binary masks and their respective labels. Let\u2019s see an example, assuming
`),ns=n(Ae,"CODE",{});var Uc=i(ns);Ti=r(Uc,"segmentation_maps = [[2,6,7,9]]"),Uc.forEach(o),xi=r(Ae,", the output will contain "),is=n(Ae,"CODE",{});var Pc=i(is);$i=r(Pc,"mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),Pc.forEach(o),Ii=r(Ae," (four binary masks) and "),ls=n(Ae,"CODE",{});var Zc=i(ls);Ei=r(Zc,"class_labels = [2,6,7,9]"),Zc.forEach(o),ji=r(Ae,`, the labels for
each mask.`),Ae.forEach(o),Io.forEach(o),zi=m(S),Ee=n(S,"DIV",{class:!0});var Mr=i(Ee);k(Pt.$$.fragment,Mr),Ni=m(Mr),Zt=n(Mr,"P",{});var Fr=i(Zt);Ui=r(Fr,"Converts the output of "),vo=n(Fr,"A",{href:!0});var Jc=i(vo);Pi=r(Jc,"MaskFormerForInstanceSegmentation"),Jc.forEach(o),Zi=r(Fr,` into semantic segmentation maps. Only supports
PyTorch.`),Fr.forEach(o),Mr.forEach(o),Ji=m(S),je=n(S,"DIV",{class:!0});var wr=i(je);k(Jt.$$.fragment,wr),Ci=m(wr),Ct=n(wr,"P",{});var Tr=i(Ct);Ri=r(Tr,"Converts the output of "),cs=n(Tr,"CODE",{});var Cc=i(cs);Wi=r(Cc,"MaskFormerForInstanceSegmentationOutput"),Cc.forEach(o),Si=r(Tr,` into instance segmentation predictions. Only
supports PyTorch.`),Tr.forEach(o),wr.forEach(o),Bi=m(S),ze=n(S,"DIV",{class:!0});var xr=i(ze);k(Rt.$$.fragment,xr),Li=m(xr),Wt=n(xr,"P",{});var $r=i(Wt);Ai=r($r,"Converts the output of "),ds=n($r,"CODE",{});var Rc=i(ds);Oi=r(Rc,"MaskFormerForInstanceSegmentationOutput"),Rc.forEach(o),Vi=r($r,` into image panoptic segmentation
predictions. Only supports PyTorch.`),$r.forEach(o),xr.forEach(o),S.forEach(o),Vs=m(t),le=n(t,"H2",{class:!0});var Ir=i(le);Ne=n(Ir,"A",{id:!0,class:!0,href:!0});var Wc=i(Ne);ms=n(Wc,"SPAN",{});var Sc=i(ms);k(St.$$.fragment,Sc),Sc.forEach(o),Wc.forEach(o),Xi=m(Ir),ps=n(Ir,"SPAN",{});var Bc=i(ps);Gi=r(Bc,"MaskFormerModel"),Bc.forEach(o),Ir.forEach(o),Xs=m(t),G=n(t,"DIV",{class:!0});var Eo=i(G);k(Bt.$$.fragment,Eo),Di=m(Eo),Lt=n(Eo,"P",{});var Er=i(Lt);qi=r(Er,`The bare MaskFormer Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),At=n(Er,"A",{href:!0,rel:!0});var Lc=i(At);Yi=r(Lc,"torch.nn.Module"),Lc.forEach(o),Hi=r(Er,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Er.forEach(o),Qi=m(Eo),W=n(Eo,"DIV",{class:!0});var Oe=i(W);k(Ot.$$.fragment,Oe),Ki=m(Oe),ce=n(Oe,"P",{});var jo=i(ce);el=r(jo,"The "),Mo=n(jo,"A",{href:!0});var Ac=i(Mo);tl=r(Ac,"MaskFormerModel"),Ac.forEach(o),ol=r(jo," forward method, overrides the "),hs=n(jo,"CODE",{});var Oc=i(hs);sl=r(Oc,"__call__"),Oc.forEach(o),rl=r(jo," special method."),jo.forEach(o),al=m(Oe),k(Ue.$$.fragment,Oe),nl=m(Oe),k(Pe.$$.fragment,Oe),Oe.forEach(o),Eo.forEach(o),Gs=m(t),de=n(t,"H2",{class:!0});var jr=i(de);Ze=n(jr,"A",{id:!0,class:!0,href:!0});var Vc=i(Ze);fs=n(Vc,"SPAN",{});var Xc=i(fs);k(Vt.$$.fragment,Xc),Xc.forEach(o),Vc.forEach(o),il=m(jr),gs=n(jr,"SPAN",{});var Gc=i(gs);ll=r(Gc,"MaskFormerForInstanceSegmentation"),Gc.forEach(o),jr.forEach(o),Ds=m(t),me=n(t,"DIV",{class:!0});var zr=i(me);k(Xt.$$.fragment,zr),cl=m(zr),z=n(zr,"DIV",{class:!0});var B=i(z);k(Gt.$$.fragment,B),dl=m(B),pe=n(B,"P",{});var zo=i(pe);ml=r(zo,"The "),Fo=n(zo,"A",{href:!0});var Dc=i(Fo);pl=r(Dc,"MaskFormerForInstanceSegmentation"),Dc.forEach(o),hl=r(zo," forward method, overrides the "),us=n(zo,"CODE",{});var qc=i(us);fl=r(qc,"__call__"),qc.forEach(o),gl=r(zo," special method."),zo.forEach(o),ul=m(B),k(Je.$$.fragment,B),_l=m(B),_s=n(B,"P",{});var Yc=i(_s);bl=r(Yc,"Examples:"),Yc.forEach(o),kl=m(B),k(Ce.$$.fragment,B),yl=m(B),k(Re.$$.fragment,B),B.forEach(o),zr.forEach(o),this.h()},h(){l(h,"name","hf:doc:metadata"),l(h,"content",JSON.stringify(pd)),l(g,"id","maskformer"),l(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(g,"href","#maskformer"),l(_,"class","relative group"),l(ge,"id","overview"),l(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"),l(ge,"href","#overview"),l(ee,"class","relative group"),l(Xe,"href","https://arxiv.org/abs/2107.06278"),l(Xe,"rel","nofollow"),l(Kt,"href","detr"),l(eo,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerConfig"),l(Ge,"href","https://github.com/facebookresearch/MaskFormer/blob/da3e60d85fdeedcb31476b5edd7d328826ce56cc/mask_former/modeling/criterion.py#L169"),l(Ge,"rel","nofollow"),l(to,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerImageProcessor"),l(oo,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerFeatureExtractor.post_process_semantic_segmentation"),l(so,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerFeatureExtractor.post_process_panoptic_segmentation"),l(ro,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation"),l(qe,"href","https://arxiv.org/abs/2107.06278"),l(qe,"rel","nofollow"),l(Ye,"width","600"),td(Ye.src,Ml="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/maskformer_architecture.png")||l(Ye,"src",Ml),l(He,"href","https://huggingface.co/francesco"),l(He,"rel","nofollow"),l(Qe,"href","https://github.com/facebookresearch/MaskFormer"),l(Qe,"rel","nofollow"),l(be,"id","resources"),l(be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(be,"href","#resources"),l(te,"class","relative group"),l(ot,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/MaskFormer"),l(ot,"rel","nofollow"),l(ke,"id","transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput"),l(ke,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(ke,"href","#transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput"),l(oe,"class","relative group"),l(no,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerModel"),l(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(io,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation"),l(lo,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerFeatureExtractor.post_process_semantic_segmentation"),l(co,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerFeatureExtractor.post_process_instance_segmentation"),l(mo,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerFeatureExtractor.post_process_panoptic_segmentation"),l(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ye,"id","transformers.MaskFormerConfig"),l(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(ye,"href","#transformers.MaskFormerConfig"),l(re,"class","relative group"),l(po,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerModel"),l(dt,"href","https://huggingface.co/facebook/maskformer-swin-base-ade"),l(dt,"rel","nofollow"),l(mt,"href","https://huggingface.co/datasets/scene_parse_150"),l(mt,"rel","nofollow"),l(ho,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(fo,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(go,"href","swin"),l(uo,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerConfig"),l(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(_o,"href","/docs/transformers/v4.31.0/en/main_classes/configuration#transformers.PretrainedConfig.to_dict"),l(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(we,"id","transformers.MaskFormerImageProcessor"),l(we,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(we,"href","#transformers.MaskFormerImageProcessor"),l(ne,"class","relative group"),l(bo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ko,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation"),l(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ie,"id","transformers.MaskFormerFeatureExtractor"),l(Ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ie,"href","#transformers.MaskFormerFeatureExtractor"),l(ie,"class","relative group"),l(yo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(vo,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation"),l(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ne,"id","transformers.MaskFormerModel"),l(Ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ne,"href","#transformers.MaskFormerModel"),l(le,"class","relative group"),l(At,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(At,"rel","nofollow"),l(Mo,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerModel"),l(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ze,"id","transformers.MaskFormerForInstanceSegmentation"),l(Ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ze,"href","#transformers.MaskFormerForInstanceSegmentation"),l(de,"class","relative group"),l(Fo,"href","/docs/transformers/v4.31.0/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation"),l(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,h),f(t,T,p),f(t,_,p),e(_,g),e(g,w),y(c,w,null),e(_,u),e(_,U),e(U,Zr),f(t,Fs,p),y(fe,t,p),f(t,ws,p),f(t,ee,p),e(ee,ge),e(ge,No),y(Ve,No,null),e(ee,Jr),e(ee,Uo),e(Uo,Cr),f(t,Ts,p),f(t,ue,p),e(ue,Rr),e(ue,Xe),e(Xe,Wr),e(ue,Sr),f(t,xs,p),f(t,Yt,p),e(Yt,Br),f(t,$s,p),f(t,Ht,p),e(Ht,Po),e(Po,Lr),f(t,Is,p),f(t,Qt,p),e(Qt,Ar),f(t,Es,p),f(t,R,p),e(R,Z),e(Z,Or),e(Z,Kt),e(Kt,Vr),e(Z,Xr),e(Z,Zo),e(Zo,Gr),e(Z,Dr),e(Z,eo),e(eo,qr),e(Z,Yr),e(Z,Jo),e(Jo,Hr),e(Z,Qr),e(R,Kr),e(R,J),e(J,ea),e(J,Co),e(Co,ta),e(J,oa),e(J,Ro),e(Ro,sa),e(J,ra),e(J,Wo),e(Wo,aa),e(J,na),e(J,Ge),e(Ge,ia),e(J,la),e(R,ca),e(R,De),e(De,da),e(De,to),e(to,ma),e(De,pa),e(R,ha),e(R,C),e(C,fa),e(C,oo),e(oo,ga),e(C,ua),e(C,so),e(so,_a),e(C,ba),e(C,ro),e(ro,ka),e(C,ya),e(C,So),e(So,va),e(C,Ma),f(t,js,p),f(t,_e,p),e(_e,Fa),e(_e,qe),e(qe,wa),e(_e,Ta),f(t,zs,p),f(t,Ye,p),f(t,Ns,p),f(t,D,p),e(D,xa),e(D,He),e(He,$a),e(D,Ia),e(D,Qe),e(Qe,Ea),e(D,ja),f(t,Us,p),f(t,te,p),e(te,be),e(be,Bo),y(Ke,Bo,null),e(te,za),e(te,Lo),e(Lo,Na),f(t,Ps,p),y(et,t,p),f(t,Zs,p),f(t,ao,p),e(ao,tt),e(tt,Ua),e(tt,ot),e(ot,Pa),e(tt,Za),f(t,Js,p),f(t,oe,p),e(oe,ke),e(ke,Ao),y(st,Ao,null),e(oe,Ja),e(oe,Oo),e(Oo,Ca),f(t,Cs,p),f(t,se,p),y(rt,se,null),e(se,Ra),e(se,at),e(at,Wa),e(at,no),e(no,Sa),e(at,Ba),f(t,Rs,p),f(t,L,p),y(nt,L,null),e(L,La),e(L,it),e(it,Aa),e(it,io),e(io,Oa),e(it,Va),e(L,Xa),e(L,A),e(A,Ga),e(A,lo),e(lo,Da),e(A,qa),e(A,co),e(co,Ya),e(A,Ha),e(A,mo),e(mo,Qa),e(A,Ka),f(t,Ws,p),f(t,re,p),e(re,ye),e(ye,Vo),y(lt,Vo,null),e(re,en),e(re,Xo),e(Xo,tn),f(t,Ss,p),f(t,I,p),y(ct,I,null),e(I,on),e(I,O),e(O,sn),e(O,po),e(po,rn),e(O,an),e(O,dt),e(dt,nn),e(O,ln),e(O,mt),e(mt,cn),e(O,dn),e(I,mn),e(I,ae),e(ae,pn),e(ae,ho),e(ho,hn),e(ae,fn),e(ae,fo),e(fo,gn),e(ae,un),e(I,_n),e(I,pt),e(pt,bn),e(pt,go),e(go,kn),e(pt,yn),e(I,vn),y(ve,I,null),e(I,Mn),e(I,Me),y(ht,Me,null),e(Me,Fn),e(Me,ft),e(ft,wn),e(ft,uo),e(uo,Tn),e(ft,xn),e(I,$n),e(I,Fe),y(gt,Fe,null),e(Fe,In),e(Fe,ut),e(ut,En),e(ut,_o),e(_o,jn),e(ut,zn),f(t,Bs,p),f(t,ne,p),e(ne,we),e(we,Go),y(_t,Go,null),e(ne,Nn),e(ne,Do),e(Do,Un),f(t,Ls,p),f(t,x,p),y(bt,x,null),e(x,Pn),e(x,qo),e(qo,Zn),e(x,Jn),e(x,kt),e(kt,Cn),e(kt,Yo),e(Yo,Rn),e(kt,Wn),e(x,Sn),e(x,bo),y(yt,bo,null),e(x,Bn),e(x,q),y(vt,q,null),e(q,Ln),e(q,Mt),e(Mt,An),e(Mt,Ho),e(Ho,On),e(Mt,Vn),e(q,Xn),e(q,V),e(V,Gn),e(V,Qo),e(Qo,Dn),e(V,qn),e(V,Ko),e(Ko,Yn),e(V,Hn),e(V,es),e(es,Qn),e(V,Kn),e(x,ei),e(x,Te),y(Ft,Te,null),e(Te,ti),e(Te,wt),e(wt,oi),e(wt,ko),e(ko,si),e(wt,ri),e(x,ai),e(x,xe),y(Tt,xe,null),e(xe,ni),e(xe,xt),e(xt,ii),e(xt,ts),e(ts,li),e(xt,ci),e(x,di),e(x,$e),y($t,$e,null),e($e,mi),e($e,It),e(It,pi),e(It,os),e(os,hi),e(It,fi),f(t,As,p),f(t,ie,p),e(ie,Ie),e(Ie,ss),y(Et,ss,null),e(ie,gi),e(ie,rs),e(rs,ui),f(t,Os,p),f(t,E,p),y(jt,E,null),e(E,_i),e(E,yo),y(zt,yo,null),e(E,bi),e(E,Y),y(Nt,Y,null),e(Y,ki),e(Y,Ut),e(Ut,yi),e(Ut,as),e(as,vi),e(Ut,Mi),e(Y,Fi),e(Y,X),e(X,wi),e(X,ns),e(ns,Ti),e(X,xi),e(X,is),e(is,$i),e(X,Ii),e(X,ls),e(ls,Ei),e(X,ji),e(E,zi),e(E,Ee),y(Pt,Ee,null),e(Ee,Ni),e(Ee,Zt),e(Zt,Ui),e(Zt,vo),e(vo,Pi),e(Zt,Zi),e(E,Ji),e(E,je),y(Jt,je,null),e(je,Ci),e(je,Ct),e(Ct,Ri),e(Ct,cs),e(cs,Wi),e(Ct,Si),e(E,Bi),e(E,ze),y(Rt,ze,null),e(ze,Li),e(ze,Wt),e(Wt,Ai),e(Wt,ds),e(ds,Oi),e(Wt,Vi),f(t,Vs,p),f(t,le,p),e(le,Ne),e(Ne,ms),y(St,ms,null),e(le,Xi),e(le,ps),e(ps,Gi),f(t,Xs,p),f(t,G,p),y(Bt,G,null),e(G,Di),e(G,Lt),e(Lt,qi),e(Lt,At),e(At,Yi),e(Lt,Hi),e(G,Qi),e(G,W),y(Ot,W,null),e(W,Ki),e(W,ce),e(ce,el),e(ce,Mo),e(Mo,tl),e(ce,ol),e(ce,hs),e(hs,sl),e(ce,rl),e(W,al),y(Ue,W,null),e(W,nl),y(Pe,W,null),f(t,Gs,p),f(t,de,p),e(de,Ze),e(Ze,fs),y(Vt,fs,null),e(de,il),e(de,gs),e(gs,ll),f(t,Ds,p),f(t,me,p),y(Xt,me,null),e(me,cl),e(me,z),y(Gt,z,null),e(z,dl),e(z,pe),e(pe,ml),e(pe,Fo),e(Fo,pl),e(pe,hl),e(pe,us),e(us,fl),e(pe,gl),e(z,ul),y(Je,z,null),e(z,_l),e(z,_s),e(_s,bl),e(z,kl),y(Ce,z,null),e(z,yl),y(Re,z,null),qs=!0},p(t,[p]){const Dt={};p&2&&(Dt.$$scope={dirty:p,ctx:t}),fe.$set(Dt);const bs={};p&2&&(bs.$$scope={dirty:p,ctx:t}),ve.$set(bs);const ks={};p&2&&(ks.$$scope={dirty:p,ctx:t}),Ue.$set(ks);const ys={};p&2&&(ys.$$scope={dirty:p,ctx:t}),Pe.$set(ys);const qt={};p&2&&(qt.$$scope={dirty:p,ctx:t}),Je.$set(qt);const vs={};p&2&&(vs.$$scope={dirty:p,ctx:t}),Ce.$set(vs);const Ms={};p&2&&(Ms.$$scope={dirty:p,ctx:t}),Re.$set(Ms)},i(t){qs||(v(c.$$.fragment,t),v(fe.$$.fragment,t),v(Ve.$$.fragment,t),v(Ke.$$.fragment,t),v(et.$$.fragment,t),v(st.$$.fragment,t),v(rt.$$.fragment,t),v(nt.$$.fragment,t),v(lt.$$.fragment,t),v(ct.$$.fragment,t),v(ve.$$.fragment,t),v(ht.$$.fragment,t),v(gt.$$.fragment,t),v(_t.$$.fragment,t),v(bt.$$.fragment,t),v(yt.$$.fragment,t),v(vt.$$.fragment,t),v(Ft.$$.fragment,t),v(Tt.$$.fragment,t),v($t.$$.fragment,t),v(Et.$$.fragment,t),v(jt.$$.fragment,t),v(zt.$$.fragment,t),v(Nt.$$.fragment,t),v(Pt.$$.fragment,t),v(Jt.$$.fragment,t),v(Rt.$$.fragment,t),v(St.$$.fragment,t),v(Bt.$$.fragment,t),v(Ot.$$.fragment,t),v(Ue.$$.fragment,t),v(Pe.$$.fragment,t),v(Vt.$$.fragment,t),v(Xt.$$.fragment,t),v(Gt.$$.fragment,t),v(Je.$$.fragment,t),v(Ce.$$.fragment,t),v(Re.$$.fragment,t),qs=!0)},o(t){M(c.$$.fragment,t),M(fe.$$.fragment,t),M(Ve.$$.fragment,t),M(Ke.$$.fragment,t),M(et.$$.fragment,t),M(st.$$.fragment,t),M(rt.$$.fragment,t),M(nt.$$.fragment,t),M(lt.$$.fragment,t),M(ct.$$.fragment,t),M(ve.$$.fragment,t),M(ht.$$.fragment,t),M(gt.$$.fragment,t),M(_t.$$.fragment,t),M(bt.$$.fragment,t),M(yt.$$.fragment,t),M(vt.$$.fragment,t),M(Ft.$$.fragment,t),M(Tt.$$.fragment,t),M($t.$$.fragment,t),M(Et.$$.fragment,t),M(jt.$$.fragment,t),M(zt.$$.fragment,t),M(Nt.$$.fragment,t),M(Pt.$$.fragment,t),M(Jt.$$.fragment,t),M(Rt.$$.fragment,t),M(St.$$.fragment,t),M(Bt.$$.fragment,t),M(Ot.$$.fragment,t),M(Ue.$$.fragment,t),M(Pe.$$.fragment,t),M(Vt.$$.fragment,t),M(Xt.$$.fragment,t),M(Gt.$$.fragment,t),M(Je.$$.fragment,t),M(Ce.$$.fragment,t),M(Re.$$.fragment,t),qs=!1},d(t){o(h),t&&o(T),t&&o(_),F(c),t&&o(Fs),F(fe,t),t&&o(ws),t&&o(ee),F(Ve),t&&o(Ts),t&&o(ue),t&&o(xs),t&&o(Yt),t&&o($s),t&&o(Ht),t&&o(Is),t&&o(Qt),t&&o(Es),t&&o(R),t&&o(js),t&&o(_e),t&&o(zs),t&&o(Ye),t&&o(Ns),t&&o(D),t&&o(Us),t&&o(te),F(Ke),t&&o(Ps),F(et,t),t&&o(Zs),t&&o(ao),t&&o(Js),t&&o(oe),F(st),t&&o(Cs),t&&o(se),F(rt),t&&o(Rs),t&&o(L),F(nt),t&&o(Ws),t&&o(re),F(lt),t&&o(Ss),t&&o(I),F(ct),F(ve),F(ht),F(gt),t&&o(Bs),t&&o(ne),F(_t),t&&o(Ls),t&&o(x),F(bt),F(yt),F(vt),F(Ft),F(Tt),F($t),t&&o(As),t&&o(ie),F(Et),t&&o(Os),t&&o(E),F(jt),F(zt),F(Nt),F(Pt),F(Jt),F(Rt),t&&o(Vs),t&&o(le),F(St),t&&o(Xs),t&&o(G),F(Bt),F(Ot),F(Ue),F(Pe),t&&o(Gs),t&&o(de),F(Vt),t&&o(Ds),t&&o(me),F(Xt),F(Gt),F(Je),F(Ce),F(Re)}}}const pd={local:"maskformer",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput",title:"MaskFormer specific outputs"},{local:"transformers.MaskFormerConfig",title:"MaskFormerConfig"},{local:"transformers.MaskFormerImageProcessor",title:"MaskFormerImageProcessor"},{local:"transformers.MaskFormerFeatureExtractor",title:"MaskFormerFeatureExtractor"},{local:"transformers.MaskFormerModel",title:"MaskFormerModel"},{local:"transformers.MaskFormerForInstanceSegmentation",title:"MaskFormerForInstanceSegmentation"}],title:"MaskFormer"};function hd(j){return od(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vd extends Hc{constructor(h){super();Qc(this,h,hd,md,Kc,{})}}export{vd as default,pd as metadata};
