import{S as Wc,i as Sc,s as Bc,e as a,k as d,w as b,t as s,M as Lc,c as n,d as o,m,a as i,x as k,h as r,b as l,N as Ac,G as e,g as f,y,q as M,o as v,B as F,v as Oc,L as Ir}from"../../chunks/vendor-hf-doc-builder.js";import{T as dl}from"../../chunks/Tip-hf-doc-builder.js";import{D as I}from"../../chunks/Docstring-hf-doc-builder.js";import{C as $r}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as he}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as xr}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Vc}from"../../chunks/PipelineTag-hf-doc-builder.js";function Xc(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 Gc(j){let h,T,_,g,w;return g=new $r({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:Ir,i(c){w||(M(g.$$.fragment,c),w=!0)},o(c){v(g.$$.fragment,c),w=!1},d(c){c&&o(h),c&&o(_),F(g,c)}}}function Dc(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 qc(j){let h,T,_,g,w;return g=new $r({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:Ir,i(c){w||(M(g.$$.fragment,c),w=!0)},o(c){v(g.$$.fragment,c),w=!1},d(c){c&&o(h),c&&o(_),F(g,c)}}}function Yc(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 Hc(j){let h,T,_,g,w;return g=new $r({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:Ir,i(c){w||(M(g.$$.fragment,c),w=!0)},o(c){v(g.$$.fragment,c),w=!1},d(c){c&&o(h),c&&o(_),F(g,c)}}}function Qc(j){let h,T,_,g,w;return g=new $r({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:Ir,i(c){w||(M(g.$$.fragment,c),w=!0)},o(c){v(g.$$.fragment,c),w=!1},d(c){c&&o(h),c&&o(_),F(g,c)}}}function Kc(j){let h,T,_,g,w,c,u,U,Er,ks,fe,ys,ee,ge,$o,Oe,jr,Eo,zr,Ms,ue,Nr,Ve,Ur,Zr,vs,Gt,Pr,Fs,Dt,jo,Jr,ws,qt,Cr,Ts,C,Z,Rr,Yt,Wr,Sr,zo,Br,Lr,Ht,Ar,Or,No,Vr,Xr,Gr,P,Dr,Uo,qr,Yr,Zo,Hr,Qr,Po,Kr,ea,Xe,ta,oa,sa,Ge,ra,Qt,aa,na,ia,J,la,Kt,ca,da,eo,ma,pa,to,ha,fa,Jo,ga,ua,xs,_e,_a,De,ba,ka,Is,qe,ml,$s,D,ya,Ye,Ma,va,He,Fa,wa,Es,te,be,Co,Qe,Ta,Ro,xa,js,Ke,zs,oo,et,Ia,tt,$a,Ea,Ns,oe,ke,Wo,ot,ja,So,za,Us,se,st,Na,rt,Ua,so,Za,Pa,Zs,L,at,Ja,nt,Ca,ro,Ra,Wa,Sa,A,Ba,ao,La,Aa,no,Oa,Va,io,Xa,Ga,Ps,re,ye,Bo,it,Da,Lo,qa,Js,$,lt,Ya,O,Ha,lo,Qa,Ka,ct,en,tn,dt,on,sn,rn,ae,an,co,nn,ln,mo,cn,dn,mn,mt,pn,po,hn,fn,gn,Me,un,ve,pt,_n,ht,bn,ho,kn,yn,Cs,ne,Fe,Ao,ft,Mn,Oo,vn,Rs,x,gt,Fn,Vo,wn,Tn,ut,xn,Xo,In,$n,En,fo,_t,jn,q,bt,zn,kt,Nn,Go,Un,Zn,Pn,V,Jn,Do,Cn,Rn,qo,Wn,Sn,Yo,Bn,Ln,An,we,yt,On,Mt,Vn,go,Xn,Gn,Dn,Te,vt,qn,Ft,Yn,Ho,Hn,Qn,Kn,xe,wt,ei,Tt,ti,Qo,oi,si,Ws,ie,Ie,Ko,xt,ri,es,ai,Ss,E,It,ni,uo,$t,ii,Y,Et,li,jt,ci,ts,di,mi,pi,X,hi,os,fi,gi,ss,ui,_i,rs,bi,ki,yi,$e,zt,Mi,Nt,vi,_o,Fi,wi,Ti,Ee,Ut,xi,Zt,Ii,as,$i,Ei,ji,je,Pt,zi,Jt,Ni,ns,Ui,Zi,Bs,le,ze,is,Ct,Pi,ls,Ji,Ls,G,Rt,Ci,Wt,Ri,St,Wi,Si,Bi,R,Bt,Li,ce,Ai,bo,Oi,Vi,cs,Xi,Gi,Di,Ne,qi,Ue,As,de,Ze,ds,Lt,Yi,ms,Hi,Os,me,At,Qi,z,Ot,Ki,pe,el,ko,tl,ol,ps,sl,rl,al,Pe,nl,hs,il,ll,Je,cl,Ce,Vs;return c=new he({}),fe=new dl({props:{$$slots:{default:[Xc]},$$scope:{ctx:j}}}),Oe=new he({}),Qe=new he({}),Ke=new Vc({props:{pipeline:"image-segmentation"}}),ot=new he({}),st=new I({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/main/src/transformers/models/maskformer/modeling_maskformer.py#L145"}}),at=new I({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/main/src/transformers/models/maskformer/modeling_maskformer.py#L188"}}),it=new he({}),lt=new I({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/main/src/transformers/models/maskformer/configuration_maskformer.py#L35",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>
`}}),Me=new xr({props:{anchor:"transformers.MaskFormerConfig.example",$$slots:{default:[Gc]},$$scope:{ctx:j}}}),pt=new I({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/main/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/main/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/main/src/transformers/models/maskformer/configuration_maskformer.py#L181",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerConfig"
>MaskFormerConfig</a></p>
`}}),ft=new he({}),gt=new I({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/main/src/transformers/models/maskformer/image_processing_maskformer.py#L344"}}),_t=new I({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[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/maskformer/image_processing_maskformer.py#L672"}}),bt=new I({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[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, 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/main/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/main/src/transformers/models/maskformer/image_processing_maskformer.py#L870",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),yt=new I({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/main/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/main/src/transformers/models/maskformer/image_processing_maskformer.py#L1024",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>
`}}),vt=new I({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/main/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/main/src/transformers/models/maskformer/image_processing_maskformer.py#L1074",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>
`}}),wt=new I({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/main/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/main/src/transformers/models/maskformer/image_processing_maskformer.py#L1188",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>
`}}),xt=new he({}),It=new I({props:{name:"class transformers.MaskFormerFeatureExtractor",anchor:"transformers.MaskFormerFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/maskformer/feature_extraction_maskformer.py#L26"}}),$t=new I({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/main/src/transformers/models/maskformer/image_processing_maskformer.py#L571"}}),Et=new I({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[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, 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/main/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/main/src/transformers/models/maskformer/image_processing_maskformer.py#L870",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),zt=new I({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/main/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/main/src/transformers/models/maskformer/image_processing_maskformer.py#L1024",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>
`}}),Ut=new I({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/main/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/main/src/transformers/models/maskformer/image_processing_maskformer.py#L1074",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>
`}}),Pt=new I({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/main/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/main/src/transformers/models/maskformer/image_processing_maskformer.py#L1188",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>
`}}),Ct=new he({}),Rt=new I({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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/maskformer/modeling_maskformer.py#L1554"}}),Bt=new I({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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/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/main/src/transformers/models/maskformer/modeling_maskformer.py#L1564",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/maskformer#transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput"
>transformers.models.maskformer.modeling_maskformer.MaskFormerModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ne=new dl({props:{$$slots:{default:[Dc]},$$scope:{ctx:j}}}),Ue=new xr({props:{anchor:"transformers.MaskFormerModel.forward.example",$$slots:{default:[qc]},$$scope:{ctx:j}}}),Lt=new he({}),At=new I({props:{name:"class transformers.MaskFormerForInstanceSegmentation",anchor:"transformers.MaskFormerForInstanceSegmentation",parameters:[{name:"config",val:": MaskFormerConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/maskformer/modeling_maskformer.py#L1653"}}),Ot=new I({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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/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/main/src/transformers/models/maskformer/modeling_maskformer.py#L1745",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/maskformer#transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput"
>transformers.models.maskformer.modeling_maskformer.MaskFormerForInstanceSegmentationOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Pe=new dl({props:{$$slots:{default:[Yc]},$$scope:{ctx:j}}}),Je=new xr({props:{anchor:"transformers.MaskFormerForInstanceSegmentation.forward.example",$$slots:{default:[Hc]},$$scope:{ctx:j}}}),Ce=new xr({props:{anchor:"transformers.MaskFormerForInstanceSegmentation.forward.example-2",$$slots:{default:[Qc]},$$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"),Er=s("MaskFormer"),ks=d(),b(fe.$$.fragment),ys=d(),ee=a("h2"),ge=a("a"),$o=a("span"),b(Oe.$$.fragment),jr=d(),Eo=a("span"),zr=s("Overview"),Ms=d(),ue=a("p"),Nr=s("The MaskFormer model was proposed in "),Ve=a("a"),Ur=s("Per-Pixel Classification is Not All You Need for Semantic Segmentation"),Zr=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."),vs=d(),Gt=a("p"),Pr=s("The abstract from the paper is the following:"),Fs=d(),Dt=a("p"),jo=a("em"),Jr=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."),ws=d(),qt=a("p"),Cr=s("Tips:"),Ts=d(),C=a("ul"),Z=a("li"),Rr=s("MaskFormer\u2019s Transformer decoder is identical to the decoder of "),Yt=a("a"),Wr=s("DETR"),Sr=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"),Br=s("use_auxilary_loss"),Lr=s(" of "),Ht=a("a"),Ar=s("MaskFormerConfig"),Or=s(" to "),No=a("code"),Vr=s("True"),Xr=s(", then prediction feedforward neural networks and Hungarian losses are added after each decoder layer (with the FFNs sharing parameters)."),Gr=d(),P=a("li"),Dr=s(`If you want to train the model in a distributed environment across multiple nodes, then one should update the
`),Uo=a("code"),qr=s("get_num_masks"),Yr=s(" function inside in the "),Zo=a("code"),Hr=s("MaskFormerLoss"),Qr=s(" class of "),Po=a("code"),Kr=s("modeling_maskformer.py"),ea=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 `),Xe=a("a"),ta=s("here"),oa=s("."),sa=d(),Ge=a("li"),ra=s("One can use "),Qt=a("a"),aa=s("MaskFormerImageProcessor"),na=s(" to prepare images for the model and optional targets for the model."),ia=d(),J=a("li"),la=s("To get the final segmentation, depending on the task, you can call "),Kt=a("a"),ca=s("post_process_semantic_segmentation()"),da=s(" or "),eo=a("a"),ma=s("post_process_panoptic_segmentation()"),pa=s(". Both tasks can be solved using "),to=a("a"),ha=s("MaskFormerForInstanceSegmentation"),fa=s(" output, panoptic segmentation accepts an optional "),Jo=a("code"),ga=s("label_ids_to_fuse"),ua=s(" argument to fuse instances of the target object/s (e.g. sky) together."),xs=d(),_e=a("p"),_a=s("The figure below illustrates the architecture of MaskFormer. Taken from the "),De=a("a"),ba=s("original paper"),ka=s("."),Is=d(),qe=a("img"),$s=d(),D=a("p"),ya=s("This model was contributed by "),Ye=a("a"),Ma=s("francesco"),va=s(". The original code can be found "),He=a("a"),Fa=s("here"),wa=s("."),Es=d(),te=a("h2"),be=a("a"),Co=a("span"),b(Qe.$$.fragment),Ta=d(),Ro=a("span"),xa=s("Resources"),js=d(),b(Ke.$$.fragment),zs=d(),oo=a("ul"),et=a("li"),Ia=s("All notebooks that illustrate inference as well as fine-tuning on custom data with MaskFormer can be found "),tt=a("a"),$a=s("here"),Ea=s("."),Ns=d(),oe=a("h2"),ke=a("a"),Wo=a("span"),b(ot.$$.fragment),ja=d(),So=a("span"),za=s("MaskFormer specific outputs"),Us=d(),se=a("div"),b(st.$$.fragment),Na=d(),rt=a("p"),Ua=s("Class for outputs of "),so=a("a"),Za=s("MaskFormerModel"),Pa=s(". This class returns all the needed hidden states to compute the logits."),Zs=d(),L=a("div"),b(at.$$.fragment),Ja=d(),nt=a("p"),Ca=s("Class for outputs of "),ro=a("a"),Ra=s("MaskFormerForInstanceSegmentation"),Wa=s("."),Sa=d(),A=a("p"),Ba=s("This output can be directly passed to "),ao=a("a"),La=s("post_process_semantic_segmentation()"),Aa=s(` or or
`),no=a("a"),Oa=s("post_process_instance_segmentation()"),Va=s(` or
`),io=a("a"),Xa=s("post_process_panoptic_segmentation()"),Ga=s(" depending on the task. Please, see\n[`~MaskFormerImageProcessor] for details regarding usage."),Ps=d(),re=a("h2"),ye=a("a"),Bo=a("span"),b(it.$$.fragment),Da=d(),Lo=a("span"),qa=s("MaskFormerConfig"),Js=d(),$=a("div"),b(lt.$$.fragment),Ya=d(),O=a("p"),Ha=s("This is the configuration class to store the configuration of a "),lo=a("a"),Qa=s("MaskFormerModel"),Ka=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
`),ct=a("a"),en=s("facebook/maskformer-swin-base-ade"),tn=s(` architecture trained
on `),dt=a("a"),on=s("ADE20k-150"),sn=s("."),rn=d(),ae=a("p"),an=s("Configuration objects inherit from "),co=a("a"),nn=s("PretrainedConfig"),ln=s(` and can be used to control the model outputs. Read the
documentation from `),mo=a("a"),cn=s("PretrainedConfig"),dn=s(" for more information."),mn=d(),mt=a("p"),pn=s("Currently, MaskFormer only supports the "),po=a("a"),hn=s("Swin Transformer"),fn=s(" as backbone."),gn=d(),b(Me.$$.fragment),un=d(),ve=a("div"),b(pt.$$.fragment),_n=d(),ht=a("p"),bn=s("Instantiate a "),ho=a("a"),kn=s("MaskFormerConfig"),yn=s(` (or a derived class) from a pre-trained backbone model configuration and DETR model
configuration.`),Cs=d(),ne=a("h2"),Fe=a("a"),Ao=a("span"),b(ft.$$.fragment),Mn=d(),Oo=a("span"),vn=s("MaskFormerImageProcessor"),Rs=d(),x=a("div"),b(gt.$$.fragment),Fn=d(),Vo=a("p"),wn=s(`Constructs a MaskFormer image processor. The image processor can be used to prepare image(s) and optional targets
for the model.`),Tn=d(),ut=a("p"),xn=s("This image processor inherits from "),Xo=a("code"),In=s("BaseImageProcessor"),$n=s(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),En=d(),fo=a("div"),b(_t.$$.fragment),jn=d(),q=a("div"),b(bt.$$.fragment),zn=d(),kt=a("p"),Nn=s("Pad images up to the largest image in a batch and create a corresponding "),Go=a("code"),Un=s("pixel_mask"),Zn=s("."),Pn=d(),V=a("p"),Jn=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
`),Do=a("code"),Cn=s("segmentation_maps = [[2,6,7,9]]"),Rn=s(", the output will contain "),qo=a("code"),Wn=s("mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),Sn=s(" (four binary masks) and "),Yo=a("code"),Bn=s("class_labels = [2,6,7,9]"),Ln=s(`, the labels for
each mask.`),An=d(),we=a("div"),b(yt.$$.fragment),On=d(),Mt=a("p"),Vn=s("Converts the output of "),go=a("a"),Xn=s("MaskFormerForInstanceSegmentation"),Gn=s(` into semantic segmentation maps. Only supports
PyTorch.`),Dn=d(),Te=a("div"),b(vt.$$.fragment),qn=d(),Ft=a("p"),Yn=s("Converts the output of "),Ho=a("code"),Hn=s("MaskFormerForInstanceSegmentationOutput"),Qn=s(` into instance segmentation predictions. Only
supports PyTorch.`),Kn=d(),xe=a("div"),b(wt.$$.fragment),ei=d(),Tt=a("p"),ti=s("Converts the output of "),Qo=a("code"),oi=s("MaskFormerForInstanceSegmentationOutput"),si=s(` into image panoptic segmentation
predictions. Only supports PyTorch.`),Ws=d(),ie=a("h2"),Ie=a("a"),Ko=a("span"),b(xt.$$.fragment),ri=d(),es=a("span"),ai=s("MaskFormerFeatureExtractor"),Ss=d(),E=a("div"),b(It.$$.fragment),ni=d(),uo=a("div"),b($t.$$.fragment),ii=d(),Y=a("div"),b(Et.$$.fragment),li=d(),jt=a("p"),ci=s("Pad images up to the largest image in a batch and create a corresponding "),ts=a("code"),di=s("pixel_mask"),mi=s("."),pi=d(),X=a("p"),hi=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
`),os=a("code"),fi=s("segmentation_maps = [[2,6,7,9]]"),gi=s(", the output will contain "),ss=a("code"),ui=s("mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),_i=s(" (four binary masks) and "),rs=a("code"),bi=s("class_labels = [2,6,7,9]"),ki=s(`, the labels for
each mask.`),yi=d(),$e=a("div"),b(zt.$$.fragment),Mi=d(),Nt=a("p"),vi=s("Converts the output of "),_o=a("a"),Fi=s("MaskFormerForInstanceSegmentation"),wi=s(` into semantic segmentation maps. Only supports
PyTorch.`),Ti=d(),Ee=a("div"),b(Ut.$$.fragment),xi=d(),Zt=a("p"),Ii=s("Converts the output of "),as=a("code"),$i=s("MaskFormerForInstanceSegmentationOutput"),Ei=s(` into instance segmentation predictions. Only
supports PyTorch.`),ji=d(),je=a("div"),b(Pt.$$.fragment),zi=d(),Jt=a("p"),Ni=s("Converts the output of "),ns=a("code"),Ui=s("MaskFormerForInstanceSegmentationOutput"),Zi=s(` into image panoptic segmentation
predictions. Only supports PyTorch.`),Bs=d(),le=a("h2"),ze=a("a"),is=a("span"),b(Ct.$$.fragment),Pi=d(),ls=a("span"),Ji=s("MaskFormerModel"),Ls=d(),G=a("div"),b(Rt.$$.fragment),Ci=d(),Wt=a("p"),Ri=s(`The bare MaskFormer Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),St=a("a"),Wi=s("torch.nn.Module"),Si=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.`),Bi=d(),R=a("div"),b(Bt.$$.fragment),Li=d(),ce=a("p"),Ai=s("The "),bo=a("a"),Oi=s("MaskFormerModel"),Vi=s(" forward method, overrides the "),cs=a("code"),Xi=s("__call__"),Gi=s(" special method."),Di=d(),b(Ne.$$.fragment),qi=d(),b(Ue.$$.fragment),As=d(),de=a("h2"),Ze=a("a"),ds=a("span"),b(Lt.$$.fragment),Yi=d(),ms=a("span"),Hi=s("MaskFormerForInstanceSegmentation"),Os=d(),me=a("div"),b(At.$$.fragment),Qi=d(),z=a("div"),b(Ot.$$.fragment),Ki=d(),pe=a("p"),el=s("The "),ko=a("a"),tl=s("MaskFormerForInstanceSegmentation"),ol=s(" forward method, overrides the "),ps=a("code"),sl=s("__call__"),rl=s(" special method."),al=d(),b(Pe.$$.fragment),nl=d(),hs=a("p"),il=s("Examples:"),ll=d(),b(Je.$$.fragment),cl=d(),b(Ce.$$.fragment),this.h()},l(t){const p=Lc('[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 Vt=i(_);g=n(Vt,"A",{id:!0,class:!0,href:!0});var fs=i(g);w=n(fs,"SPAN",{});var gs=i(w);k(c.$$.fragment,gs),gs.forEach(o),fs.forEach(o),u=m(Vt),U=n(Vt,"SPAN",{});var us=i(U);Er=r(us,"MaskFormer"),us.forEach(o),Vt.forEach(o),ks=m(t),k(fe.$$.fragment,t),ys=m(t),ee=n(t,"H2",{class:!0});var Xt=i(ee);ge=n(Xt,"A",{id:!0,class:!0,href:!0});var _s=i(ge);$o=n(_s,"SPAN",{});var bs=i($o);k(Oe.$$.fragment,bs),bs.forEach(o),_s.forEach(o),jr=m(Xt),Eo=n(Xt,"SPAN",{});var pl=i(Eo);zr=r(pl,"Overview"),pl.forEach(o),Xt.forEach(o),Ms=m(t),ue=n(t,"P",{});var Xs=i(ue);Nr=r(Xs,"The MaskFormer model was proposed in "),Ve=n(Xs,"A",{href:!0,rel:!0});var hl=i(Ve);Ur=r(hl,"Per-Pixel Classification is Not All You Need for Semantic Segmentation"),hl.forEach(o),Zr=r(Xs," 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.forEach(o),vs=m(t),Gt=n(t,"P",{});var fl=i(Gt);Pr=r(fl,"The abstract from the paper is the following:"),fl.forEach(o),Fs=m(t),Dt=n(t,"P",{});var gl=i(Dt);jo=n(gl,"EM",{});var ul=i(jo);Jr=r(ul,"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."),ul.forEach(o),gl.forEach(o),ws=m(t),qt=n(t,"P",{});var _l=i(qt);Cr=r(_l,"Tips:"),_l.forEach(o),Ts=m(t),C=n(t,"UL",{});var Re=i(C);Z=n(Re,"LI",{});var H=i(Z);Rr=r(H,"MaskFormer\u2019s Transformer decoder is identical to the decoder of "),Yt=n(H,"A",{href:!0});var bl=i(Yt);Wr=r(bl,"DETR"),bl.forEach(o),Sr=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 kl=i(zo);Br=r(kl,"use_auxilary_loss"),kl.forEach(o),Lr=r(H," of "),Ht=n(H,"A",{href:!0});var yl=i(Ht);Ar=r(yl,"MaskFormerConfig"),yl.forEach(o),Or=r(H," to "),No=n(H,"CODE",{});var Ml=i(No);Vr=r(Ml,"True"),Ml.forEach(o),Xr=r(H,", then prediction feedforward neural networks and Hungarian losses are added after each decoder layer (with the FFNs sharing parameters)."),H.forEach(o),Gr=m(Re),P=n(Re,"LI",{});var Q=i(P);Dr=r(Q,`If you want to train the model in a distributed environment across multiple nodes, then one should update the
`),Uo=n(Q,"CODE",{});var vl=i(Uo);qr=r(vl,"get_num_masks"),vl.forEach(o),Yr=r(Q," function inside in the "),Zo=n(Q,"CODE",{});var Fl=i(Zo);Hr=r(Fl,"MaskFormerLoss"),Fl.forEach(o),Qr=r(Q," class of "),Po=n(Q,"CODE",{});var wl=i(Po);Kr=r(wl,"modeling_maskformer.py"),wl.forEach(o),ea=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 `),Xe=n(Q,"A",{href:!0,rel:!0});var Tl=i(Xe);ta=r(Tl,"here"),Tl.forEach(o),oa=r(Q,"."),Q.forEach(o),sa=m(Re),Ge=n(Re,"LI",{});var Gs=i(Ge);ra=r(Gs,"One can use "),Qt=n(Gs,"A",{href:!0});var xl=i(Qt);aa=r(xl,"MaskFormerImageProcessor"),xl.forEach(o),na=r(Gs," to prepare images for the model and optional targets for the model."),Gs.forEach(o),ia=m(Re),J=n(Re,"LI",{});var K=i(J);la=r(K,"To get the final segmentation, depending on the task, you can call "),Kt=n(K,"A",{href:!0});var Il=i(Kt);ca=r(Il,"post_process_semantic_segmentation()"),Il.forEach(o),da=r(K," or "),eo=n(K,"A",{href:!0});var $l=i(eo);ma=r($l,"post_process_panoptic_segmentation()"),$l.forEach(o),pa=r(K,". Both tasks can be solved using "),to=n(K,"A",{href:!0});var El=i(to);ha=r(El,"MaskFormerForInstanceSegmentation"),El.forEach(o),fa=r(K," output, panoptic segmentation accepts an optional "),Jo=n(K,"CODE",{});var jl=i(Jo);ga=r(jl,"label_ids_to_fuse"),jl.forEach(o),ua=r(K," argument to fuse instances of the target object/s (e.g. sky) together."),K.forEach(o),Re.forEach(o),xs=m(t),_e=n(t,"P",{});var Ds=i(_e);_a=r(Ds,"The figure below illustrates the architecture of MaskFormer. Taken from the "),De=n(Ds,"A",{href:!0,rel:!0});var zl=i(De);ba=r(zl,"original paper"),zl.forEach(o),ka=r(Ds,"."),Ds.forEach(o),Is=m(t),qe=n(t,"IMG",{width:!0,src:!0}),$s=m(t),D=n(t,"P",{});var yo=i(D);ya=r(yo,"This model was contributed by "),Ye=n(yo,"A",{href:!0,rel:!0});var Nl=i(Ye);Ma=r(Nl,"francesco"),Nl.forEach(o),va=r(yo,". The original code can be found "),He=n(yo,"A",{href:!0,rel:!0});var Ul=i(He);Fa=r(Ul,"here"),Ul.forEach(o),wa=r(yo,"."),yo.forEach(o),Es=m(t),te=n(t,"H2",{class:!0});var qs=i(te);be=n(qs,"A",{id:!0,class:!0,href:!0});var Zl=i(be);Co=n(Zl,"SPAN",{});var Pl=i(Co);k(Qe.$$.fragment,Pl),Pl.forEach(o),Zl.forEach(o),Ta=m(qs),Ro=n(qs,"SPAN",{});var Jl=i(Ro);xa=r(Jl,"Resources"),Jl.forEach(o),qs.forEach(o),js=m(t),k(Ke.$$.fragment,t),zs=m(t),oo=n(t,"UL",{});var Cl=i(oo);et=n(Cl,"LI",{});var Ys=i(et);Ia=r(Ys,"All notebooks that illustrate inference as well as fine-tuning on custom data with MaskFormer can be found "),tt=n(Ys,"A",{href:!0,rel:!0});var Rl=i(tt);$a=r(Rl,"here"),Rl.forEach(o),Ea=r(Ys,"."),Ys.forEach(o),Cl.forEach(o),Ns=m(t),oe=n(t,"H2",{class:!0});var Hs=i(oe);ke=n(Hs,"A",{id:!0,class:!0,href:!0});var Wl=i(ke);Wo=n(Wl,"SPAN",{});var Sl=i(Wo);k(ot.$$.fragment,Sl),Sl.forEach(o),Wl.forEach(o),ja=m(Hs),So=n(Hs,"SPAN",{});var Bl=i(So);za=r(Bl,"MaskFormer specific outputs"),Bl.forEach(o),Hs.forEach(o),Us=m(t),se=n(t,"DIV",{class:!0});var Qs=i(se);k(st.$$.fragment,Qs),Na=m(Qs),rt=n(Qs,"P",{});var Ks=i(rt);Ua=r(Ks,"Class for outputs of "),so=n(Ks,"A",{href:!0});var Ll=i(so);Za=r(Ll,"MaskFormerModel"),Ll.forEach(o),Pa=r(Ks,". This class returns all the needed hidden states to compute the logits."),Ks.forEach(o),Qs.forEach(o),Zs=m(t),L=n(t,"DIV",{class:!0});var Mo=i(L);k(at.$$.fragment,Mo),Ja=m(Mo),nt=n(Mo,"P",{});var er=i(nt);Ca=r(er,"Class for outputs of "),ro=n(er,"A",{href:!0});var Al=i(ro);Ra=r(Al,"MaskFormerForInstanceSegmentation"),Al.forEach(o),Wa=r(er,"."),er.forEach(o),Sa=m(Mo),A=n(Mo,"P",{});var We=i(A);Ba=r(We,"This output can be directly passed to "),ao=n(We,"A",{href:!0});var Ol=i(ao);La=r(Ol,"post_process_semantic_segmentation()"),Ol.forEach(o),Aa=r(We,` or or
`),no=n(We,"A",{href:!0});var Vl=i(no);Oa=r(Vl,"post_process_instance_segmentation()"),Vl.forEach(o),Va=r(We,` or
`),io=n(We,"A",{href:!0});var Xl=i(io);Xa=r(Xl,"post_process_panoptic_segmentation()"),Xl.forEach(o),Ga=r(We," depending on the task. Please, see\n[`~MaskFormerImageProcessor] for details regarding usage."),We.forEach(o),Mo.forEach(o),Ps=m(t),re=n(t,"H2",{class:!0});var tr=i(re);ye=n(tr,"A",{id:!0,class:!0,href:!0});var Gl=i(ye);Bo=n(Gl,"SPAN",{});var Dl=i(Bo);k(it.$$.fragment,Dl),Dl.forEach(o),Gl.forEach(o),Da=m(tr),Lo=n(tr,"SPAN",{});var ql=i(Lo);qa=r(ql,"MaskFormerConfig"),ql.forEach(o),tr.forEach(o),Js=m(t),$=n(t,"DIV",{class:!0});var W=i($);k(lt.$$.fragment,W),Ya=m(W),O=n(W,"P",{});var Se=i(O);Ha=r(Se,"This is the configuration class to store the configuration of a "),lo=n(Se,"A",{href:!0});var Yl=i(lo);Qa=r(Yl,"MaskFormerModel"),Yl.forEach(o),Ka=r(Se,`. 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
`),ct=n(Se,"A",{href:!0,rel:!0});var Hl=i(ct);en=r(Hl,"facebook/maskformer-swin-base-ade"),Hl.forEach(o),tn=r(Se,` architecture trained
on `),dt=n(Se,"A",{href:!0,rel:!0});var Ql=i(dt);on=r(Ql,"ADE20k-150"),Ql.forEach(o),sn=r(Se,"."),Se.forEach(o),rn=m(W),ae=n(W,"P",{});var vo=i(ae);an=r(vo,"Configuration objects inherit from "),co=n(vo,"A",{href:!0});var Kl=i(co);nn=r(Kl,"PretrainedConfig"),Kl.forEach(o),ln=r(vo,` and can be used to control the model outputs. Read the
documentation from `),mo=n(vo,"A",{href:!0});var ec=i(mo);cn=r(ec,"PretrainedConfig"),ec.forEach(o),dn=r(vo," for more information."),vo.forEach(o),mn=m(W),mt=n(W,"P",{});var or=i(mt);pn=r(or,"Currently, MaskFormer only supports the "),po=n(or,"A",{href:!0});var tc=i(po);hn=r(tc,"Swin Transformer"),tc.forEach(o),fn=r(or," as backbone."),or.forEach(o),gn=m(W),k(Me.$$.fragment,W),un=m(W),ve=n(W,"DIV",{class:!0});var sr=i(ve);k(pt.$$.fragment,sr),_n=m(sr),ht=n(sr,"P",{});var rr=i(ht);bn=r(rr,"Instantiate a "),ho=n(rr,"A",{href:!0});var oc=i(ho);kn=r(oc,"MaskFormerConfig"),oc.forEach(o),yn=r(rr,` (or a derived class) from a pre-trained backbone model configuration and DETR model
configuration.`),rr.forEach(o),sr.forEach(o),W.forEach(o),Cs=m(t),ne=n(t,"H2",{class:!0});var ar=i(ne);Fe=n(ar,"A",{id:!0,class:!0,href:!0});var sc=i(Fe);Ao=n(sc,"SPAN",{});var rc=i(Ao);k(ft.$$.fragment,rc),rc.forEach(o),sc.forEach(o),Mn=m(ar),Oo=n(ar,"SPAN",{});var ac=i(Oo);vn=r(ac,"MaskFormerImageProcessor"),ac.forEach(o),ar.forEach(o),Rs=m(t),x=n(t,"DIV",{class:!0});var N=i(x);k(gt.$$.fragment,N),Fn=m(N),Vo=n(N,"P",{});var nc=i(Vo);wn=r(nc,`Constructs a MaskFormer image processor. The image processor can be used to prepare image(s) and optional targets
for the model.`),nc.forEach(o),Tn=m(N),ut=n(N,"P",{});var nr=i(ut);xn=r(nr,"This image processor inherits from "),Xo=n(nr,"CODE",{});var ic=i(Xo);In=r(ic,"BaseImageProcessor"),ic.forEach(o),$n=r(nr,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),nr.forEach(o),En=m(N),fo=n(N,"DIV",{class:!0});var lc=i(fo);k(_t.$$.fragment,lc),lc.forEach(o),jn=m(N),q=n(N,"DIV",{class:!0});var Fo=i(q);k(bt.$$.fragment,Fo),zn=m(Fo),kt=n(Fo,"P",{});var ir=i(kt);Nn=r(ir,"Pad images up to the largest image in a batch and create a corresponding "),Go=n(ir,"CODE",{});var cc=i(Go);Un=r(cc,"pixel_mask"),cc.forEach(o),Zn=r(ir,"."),ir.forEach(o),Pn=m(Fo),V=n(Fo,"P",{});var Be=i(V);Jn=r(Be,`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
`),Do=n(Be,"CODE",{});var dc=i(Do);Cn=r(dc,"segmentation_maps = [[2,6,7,9]]"),dc.forEach(o),Rn=r(Be,", the output will contain "),qo=n(Be,"CODE",{});var mc=i(qo);Wn=r(mc,"mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),mc.forEach(o),Sn=r(Be," (four binary masks) and "),Yo=n(Be,"CODE",{});var pc=i(Yo);Bn=r(pc,"class_labels = [2,6,7,9]"),pc.forEach(o),Ln=r(Be,`, the labels for
each mask.`),Be.forEach(o),Fo.forEach(o),An=m(N),we=n(N,"DIV",{class:!0});var lr=i(we);k(yt.$$.fragment,lr),On=m(lr),Mt=n(lr,"P",{});var cr=i(Mt);Vn=r(cr,"Converts the output of "),go=n(cr,"A",{href:!0});var hc=i(go);Xn=r(hc,"MaskFormerForInstanceSegmentation"),hc.forEach(o),Gn=r(cr,` into semantic segmentation maps. Only supports
PyTorch.`),cr.forEach(o),lr.forEach(o),Dn=m(N),Te=n(N,"DIV",{class:!0});var dr=i(Te);k(vt.$$.fragment,dr),qn=m(dr),Ft=n(dr,"P",{});var mr=i(Ft);Yn=r(mr,"Converts the output of "),Ho=n(mr,"CODE",{});var fc=i(Ho);Hn=r(fc,"MaskFormerForInstanceSegmentationOutput"),fc.forEach(o),Qn=r(mr,` into instance segmentation predictions. Only
supports PyTorch.`),mr.forEach(o),dr.forEach(o),Kn=m(N),xe=n(N,"DIV",{class:!0});var pr=i(xe);k(wt.$$.fragment,pr),ei=m(pr),Tt=n(pr,"P",{});var hr=i(Tt);ti=r(hr,"Converts the output of "),Qo=n(hr,"CODE",{});var gc=i(Qo);oi=r(gc,"MaskFormerForInstanceSegmentationOutput"),gc.forEach(o),si=r(hr,` into image panoptic segmentation
predictions. Only supports PyTorch.`),hr.forEach(o),pr.forEach(o),N.forEach(o),Ws=m(t),ie=n(t,"H2",{class:!0});var fr=i(ie);Ie=n(fr,"A",{id:!0,class:!0,href:!0});var uc=i(Ie);Ko=n(uc,"SPAN",{});var _c=i(Ko);k(xt.$$.fragment,_c),_c.forEach(o),uc.forEach(o),ri=m(fr),es=n(fr,"SPAN",{});var bc=i(es);ai=r(bc,"MaskFormerFeatureExtractor"),bc.forEach(o),fr.forEach(o),Ss=m(t),E=n(t,"DIV",{class:!0});var S=i(E);k(It.$$.fragment,S),ni=m(S),uo=n(S,"DIV",{class:!0});var kc=i(uo);k($t.$$.fragment,kc),kc.forEach(o),ii=m(S),Y=n(S,"DIV",{class:!0});var wo=i(Y);k(Et.$$.fragment,wo),li=m(wo),jt=n(wo,"P",{});var gr=i(jt);ci=r(gr,"Pad images up to the largest image in a batch and create a corresponding "),ts=n(gr,"CODE",{});var yc=i(ts);di=r(yc,"pixel_mask"),yc.forEach(o),mi=r(gr,"."),gr.forEach(o),pi=m(wo),X=n(wo,"P",{});var Le=i(X);hi=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
`),os=n(Le,"CODE",{});var Mc=i(os);fi=r(Mc,"segmentation_maps = [[2,6,7,9]]"),Mc.forEach(o),gi=r(Le,", the output will contain "),ss=n(Le,"CODE",{});var vc=i(ss);ui=r(vc,"mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),vc.forEach(o),_i=r(Le," (four binary masks) and "),rs=n(Le,"CODE",{});var Fc=i(rs);bi=r(Fc,"class_labels = [2,6,7,9]"),Fc.forEach(o),ki=r(Le,`, the labels for
each mask.`),Le.forEach(o),wo.forEach(o),yi=m(S),$e=n(S,"DIV",{class:!0});var ur=i($e);k(zt.$$.fragment,ur),Mi=m(ur),Nt=n(ur,"P",{});var _r=i(Nt);vi=r(_r,"Converts the output of "),_o=n(_r,"A",{href:!0});var wc=i(_o);Fi=r(wc,"MaskFormerForInstanceSegmentation"),wc.forEach(o),wi=r(_r,` into semantic segmentation maps. Only supports
PyTorch.`),_r.forEach(o),ur.forEach(o),Ti=m(S),Ee=n(S,"DIV",{class:!0});var br=i(Ee);k(Ut.$$.fragment,br),xi=m(br),Zt=n(br,"P",{});var kr=i(Zt);Ii=r(kr,"Converts the output of "),as=n(kr,"CODE",{});var Tc=i(as);$i=r(Tc,"MaskFormerForInstanceSegmentationOutput"),Tc.forEach(o),Ei=r(kr,` into instance segmentation predictions. Only
supports PyTorch.`),kr.forEach(o),br.forEach(o),ji=m(S),je=n(S,"DIV",{class:!0});var yr=i(je);k(Pt.$$.fragment,yr),zi=m(yr),Jt=n(yr,"P",{});var Mr=i(Jt);Ni=r(Mr,"Converts the output of "),ns=n(Mr,"CODE",{});var xc=i(ns);Ui=r(xc,"MaskFormerForInstanceSegmentationOutput"),xc.forEach(o),Zi=r(Mr,` into image panoptic segmentation
predictions. Only supports PyTorch.`),Mr.forEach(o),yr.forEach(o),S.forEach(o),Bs=m(t),le=n(t,"H2",{class:!0});var vr=i(le);ze=n(vr,"A",{id:!0,class:!0,href:!0});var Ic=i(ze);is=n(Ic,"SPAN",{});var $c=i(is);k(Ct.$$.fragment,$c),$c.forEach(o),Ic.forEach(o),Pi=m(vr),ls=n(vr,"SPAN",{});var Ec=i(ls);Ji=r(Ec,"MaskFormerModel"),Ec.forEach(o),vr.forEach(o),Ls=m(t),G=n(t,"DIV",{class:!0});var To=i(G);k(Rt.$$.fragment,To),Ci=m(To),Wt=n(To,"P",{});var Fr=i(Wt);Ri=r(Fr,`The bare MaskFormer Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),St=n(Fr,"A",{href:!0,rel:!0});var jc=i(St);Wi=r(jc,"torch.nn.Module"),jc.forEach(o),Si=r(Fr,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Fr.forEach(o),Bi=m(To),R=n(To,"DIV",{class:!0});var Ae=i(R);k(Bt.$$.fragment,Ae),Li=m(Ae),ce=n(Ae,"P",{});var xo=i(ce);Ai=r(xo,"The "),bo=n(xo,"A",{href:!0});var zc=i(bo);Oi=r(zc,"MaskFormerModel"),zc.forEach(o),Vi=r(xo," forward method, overrides the "),cs=n(xo,"CODE",{});var Nc=i(cs);Xi=r(Nc,"__call__"),Nc.forEach(o),Gi=r(xo," special method."),xo.forEach(o),Di=m(Ae),k(Ne.$$.fragment,Ae),qi=m(Ae),k(Ue.$$.fragment,Ae),Ae.forEach(o),To.forEach(o),As=m(t),de=n(t,"H2",{class:!0});var wr=i(de);Ze=n(wr,"A",{id:!0,class:!0,href:!0});var Uc=i(Ze);ds=n(Uc,"SPAN",{});var Zc=i(ds);k(Lt.$$.fragment,Zc),Zc.forEach(o),Uc.forEach(o),Yi=m(wr),ms=n(wr,"SPAN",{});var Pc=i(ms);Hi=r(Pc,"MaskFormerForInstanceSegmentation"),Pc.forEach(o),wr.forEach(o),Os=m(t),me=n(t,"DIV",{class:!0});var Tr=i(me);k(At.$$.fragment,Tr),Qi=m(Tr),z=n(Tr,"DIV",{class:!0});var B=i(z);k(Ot.$$.fragment,B),Ki=m(B),pe=n(B,"P",{});var Io=i(pe);el=r(Io,"The "),ko=n(Io,"A",{href:!0});var Jc=i(ko);tl=r(Jc,"MaskFormerForInstanceSegmentation"),Jc.forEach(o),ol=r(Io," forward method, overrides the "),ps=n(Io,"CODE",{});var Cc=i(ps);sl=r(Cc,"__call__"),Cc.forEach(o),rl=r(Io," special method."),Io.forEach(o),al=m(B),k(Pe.$$.fragment,B),nl=m(B),hs=n(B,"P",{});var Rc=i(hs);il=r(Rc,"Examples:"),Rc.forEach(o),ll=m(B),k(Je.$$.fragment,B),cl=m(B),k(Ce.$$.fragment,B),B.forEach(o),Tr.forEach(o),this.h()},h(){l(h,"name","hf:doc:metadata"),l(h,"content",JSON.stringify(ed)),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(Ve,"href","https://arxiv.org/abs/2107.06278"),l(Ve,"rel","nofollow"),l(Yt,"href","detr"),l(Ht,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerConfig"),l(Xe,"href","https://github.com/facebookresearch/MaskFormer/blob/da3e60d85fdeedcb31476b5edd7d328826ce56cc/mask_former/modeling/criterion.py#L169"),l(Xe,"rel","nofollow"),l(Qt,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerImageProcessor"),l(Kt,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerFeatureExtractor.post_process_semantic_segmentation"),l(eo,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerFeatureExtractor.post_process_panoptic_segmentation"),l(to,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation"),l(De,"href","https://arxiv.org/abs/2107.06278"),l(De,"rel","nofollow"),l(qe,"width","600"),Ac(qe.src,ml="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/maskformer_architecture.png")||l(qe,"src",ml),l(Ye,"href","https://huggingface.co/francesco"),l(Ye,"rel","nofollow"),l(He,"href","https://github.com/facebookresearch/MaskFormer"),l(He,"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(tt,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/MaskFormer"),l(tt,"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(so,"href","/docs/transformers/main/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(ro,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation"),l(ao,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerFeatureExtractor.post_process_semantic_segmentation"),l(no,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerFeatureExtractor.post_process_instance_segmentation"),l(io,"href","/docs/transformers/main/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(lo,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerModel"),l(ct,"href","https://huggingface.co/facebook/maskformer-swin-base-ade"),l(ct,"rel","nofollow"),l(dt,"href","https://huggingface.co/datasets/scene_parse_150"),l(dt,"rel","nofollow"),l(co,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(mo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(po,"href","swin"),l(ho,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerConfig"),l(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(Fe,"id","transformers.MaskFormerImageProcessor"),l(Fe,"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(Fe,"href","#transformers.MaskFormerImageProcessor"),l(ne,"class","relative group"),l(fo,"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(go,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation"),l(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(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(uo,"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(_o,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerForInstanceSegmentation"),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(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(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(ze,"id","transformers.MaskFormerModel"),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.MaskFormerModel"),l(le,"class","relative group"),l(St,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(St,"rel","nofollow"),l(bo,"href","/docs/transformers/main/en/model_doc/maskformer#transformers.MaskFormerModel"),l(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(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(ko,"href","/docs/transformers/main/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,Er),f(t,ks,p),y(fe,t,p),f(t,ys,p),f(t,ee,p),e(ee,ge),e(ge,$o),y(Oe,$o,null),e(ee,jr),e(ee,Eo),e(Eo,zr),f(t,Ms,p),f(t,ue,p),e(ue,Nr),e(ue,Ve),e(Ve,Ur),e(ue,Zr),f(t,vs,p),f(t,Gt,p),e(Gt,Pr),f(t,Fs,p),f(t,Dt,p),e(Dt,jo),e(jo,Jr),f(t,ws,p),f(t,qt,p),e(qt,Cr),f(t,Ts,p),f(t,C,p),e(C,Z),e(Z,Rr),e(Z,Yt),e(Yt,Wr),e(Z,Sr),e(Z,zo),e(zo,Br),e(Z,Lr),e(Z,Ht),e(Ht,Ar),e(Z,Or),e(Z,No),e(No,Vr),e(Z,Xr),e(C,Gr),e(C,P),e(P,Dr),e(P,Uo),e(Uo,qr),e(P,Yr),e(P,Zo),e(Zo,Hr),e(P,Qr),e(P,Po),e(Po,Kr),e(P,ea),e(P,Xe),e(Xe,ta),e(P,oa),e(C,sa),e(C,Ge),e(Ge,ra),e(Ge,Qt),e(Qt,aa),e(Ge,na),e(C,ia),e(C,J),e(J,la),e(J,Kt),e(Kt,ca),e(J,da),e(J,eo),e(eo,ma),e(J,pa),e(J,to),e(to,ha),e(J,fa),e(J,Jo),e(Jo,ga),e(J,ua),f(t,xs,p),f(t,_e,p),e(_e,_a),e(_e,De),e(De,ba),e(_e,ka),f(t,Is,p),f(t,qe,p),f(t,$s,p),f(t,D,p),e(D,ya),e(D,Ye),e(Ye,Ma),e(D,va),e(D,He),e(He,Fa),e(D,wa),f(t,Es,p),f(t,te,p),e(te,be),e(be,Co),y(Qe,Co,null),e(te,Ta),e(te,Ro),e(Ro,xa),f(t,js,p),y(Ke,t,p),f(t,zs,p),f(t,oo,p),e(oo,et),e(et,Ia),e(et,tt),e(tt,$a),e(et,Ea),f(t,Ns,p),f(t,oe,p),e(oe,ke),e(ke,Wo),y(ot,Wo,null),e(oe,ja),e(oe,So),e(So,za),f(t,Us,p),f(t,se,p),y(st,se,null),e(se,Na),e(se,rt),e(rt,Ua),e(rt,so),e(so,Za),e(rt,Pa),f(t,Zs,p),f(t,L,p),y(at,L,null),e(L,Ja),e(L,nt),e(nt,Ca),e(nt,ro),e(ro,Ra),e(nt,Wa),e(L,Sa),e(L,A),e(A,Ba),e(A,ao),e(ao,La),e(A,Aa),e(A,no),e(no,Oa),e(A,Va),e(A,io),e(io,Xa),e(A,Ga),f(t,Ps,p),f(t,re,p),e(re,ye),e(ye,Bo),y(it,Bo,null),e(re,Da),e(re,Lo),e(Lo,qa),f(t,Js,p),f(t,$,p),y(lt,$,null),e($,Ya),e($,O),e(O,Ha),e(O,lo),e(lo,Qa),e(O,Ka),e(O,ct),e(ct,en),e(O,tn),e(O,dt),e(dt,on),e(O,sn),e($,rn),e($,ae),e(ae,an),e(ae,co),e(co,nn),e(ae,ln),e(ae,mo),e(mo,cn),e(ae,dn),e($,mn),e($,mt),e(mt,pn),e(mt,po),e(po,hn),e(mt,fn),e($,gn),y(Me,$,null),e($,un),e($,ve),y(pt,ve,null),e(ve,_n),e(ve,ht),e(ht,bn),e(ht,ho),e(ho,kn),e(ht,yn),f(t,Cs,p),f(t,ne,p),e(ne,Fe),e(Fe,Ao),y(ft,Ao,null),e(ne,Mn),e(ne,Oo),e(Oo,vn),f(t,Rs,p),f(t,x,p),y(gt,x,null),e(x,Fn),e(x,Vo),e(Vo,wn),e(x,Tn),e(x,ut),e(ut,xn),e(ut,Xo),e(Xo,In),e(ut,$n),e(x,En),e(x,fo),y(_t,fo,null),e(x,jn),e(x,q),y(bt,q,null),e(q,zn),e(q,kt),e(kt,Nn),e(kt,Go),e(Go,Un),e(kt,Zn),e(q,Pn),e(q,V),e(V,Jn),e(V,Do),e(Do,Cn),e(V,Rn),e(V,qo),e(qo,Wn),e(V,Sn),e(V,Yo),e(Yo,Bn),e(V,Ln),e(x,An),e(x,we),y(yt,we,null),e(we,On),e(we,Mt),e(Mt,Vn),e(Mt,go),e(go,Xn),e(Mt,Gn),e(x,Dn),e(x,Te),y(vt,Te,null),e(Te,qn),e(Te,Ft),e(Ft,Yn),e(Ft,Ho),e(Ho,Hn),e(Ft,Qn),e(x,Kn),e(x,xe),y(wt,xe,null),e(xe,ei),e(xe,Tt),e(Tt,ti),e(Tt,Qo),e(Qo,oi),e(Tt,si),f(t,Ws,p),f(t,ie,p),e(ie,Ie),e(Ie,Ko),y(xt,Ko,null),e(ie,ri),e(ie,es),e(es,ai),f(t,Ss,p),f(t,E,p),y(It,E,null),e(E,ni),e(E,uo),y($t,uo,null),e(E,ii),e(E,Y),y(Et,Y,null),e(Y,li),e(Y,jt),e(jt,ci),e(jt,ts),e(ts,di),e(jt,mi),e(Y,pi),e(Y,X),e(X,hi),e(X,os),e(os,fi),e(X,gi),e(X,ss),e(ss,ui),e(X,_i),e(X,rs),e(rs,bi),e(X,ki),e(E,yi),e(E,$e),y(zt,$e,null),e($e,Mi),e($e,Nt),e(Nt,vi),e(Nt,_o),e(_o,Fi),e(Nt,wi),e(E,Ti),e(E,Ee),y(Ut,Ee,null),e(Ee,xi),e(Ee,Zt),e(Zt,Ii),e(Zt,as),e(as,$i),e(Zt,Ei),e(E,ji),e(E,je),y(Pt,je,null),e(je,zi),e(je,Jt),e(Jt,Ni),e(Jt,ns),e(ns,Ui),e(Jt,Zi),f(t,Bs,p),f(t,le,p),e(le,ze),e(ze,is),y(Ct,is,null),e(le,Pi),e(le,ls),e(ls,Ji),f(t,Ls,p),f(t,G,p),y(Rt,G,null),e(G,Ci),e(G,Wt),e(Wt,Ri),e(Wt,St),e(St,Wi),e(Wt,Si),e(G,Bi),e(G,R),y(Bt,R,null),e(R,Li),e(R,ce),e(ce,Ai),e(ce,bo),e(bo,Oi),e(ce,Vi),e(ce,cs),e(cs,Xi),e(ce,Gi),e(R,Di),y(Ne,R,null),e(R,qi),y(Ue,R,null),f(t,As,p),f(t,de,p),e(de,Ze),e(Ze,ds),y(Lt,ds,null),e(de,Yi),e(de,ms),e(ms,Hi),f(t,Os,p),f(t,me,p),y(At,me,null),e(me,Qi),e(me,z),y(Ot,z,null),e(z,Ki),e(z,pe),e(pe,el),e(pe,ko),e(ko,tl),e(pe,ol),e(pe,ps),e(ps,sl),e(pe,rl),e(z,al),y(Pe,z,null),e(z,nl),e(z,hs),e(hs,il),e(z,ll),y(Je,z,null),e(z,cl),y(Ce,z,null),Vs=!0},p(t,[p]){const Vt={};p&2&&(Vt.$$scope={dirty:p,ctx:t}),fe.$set(Vt);const fs={};p&2&&(fs.$$scope={dirty:p,ctx:t}),Me.$set(fs);const gs={};p&2&&(gs.$$scope={dirty:p,ctx:t}),Ne.$set(gs);const us={};p&2&&(us.$$scope={dirty:p,ctx:t}),Ue.$set(us);const Xt={};p&2&&(Xt.$$scope={dirty:p,ctx:t}),Pe.$set(Xt);const _s={};p&2&&(_s.$$scope={dirty:p,ctx:t}),Je.$set(_s);const bs={};p&2&&(bs.$$scope={dirty:p,ctx:t}),Ce.$set(bs)},i(t){Vs||(M(c.$$.fragment,t),M(fe.$$.fragment,t),M(Oe.$$.fragment,t),M(Qe.$$.fragment,t),M(Ke.$$.fragment,t),M(ot.$$.fragment,t),M(st.$$.fragment,t),M(at.$$.fragment,t),M(it.$$.fragment,t),M(lt.$$.fragment,t),M(Me.$$.fragment,t),M(pt.$$.fragment,t),M(ft.$$.fragment,t),M(gt.$$.fragment,t),M(_t.$$.fragment,t),M(bt.$$.fragment,t),M(yt.$$.fragment,t),M(vt.$$.fragment,t),M(wt.$$.fragment,t),M(xt.$$.fragment,t),M(It.$$.fragment,t),M($t.$$.fragment,t),M(Et.$$.fragment,t),M(zt.$$.fragment,t),M(Ut.$$.fragment,t),M(Pt.$$.fragment,t),M(Ct.$$.fragment,t),M(Rt.$$.fragment,t),M(Bt.$$.fragment,t),M(Ne.$$.fragment,t),M(Ue.$$.fragment,t),M(Lt.$$.fragment,t),M(At.$$.fragment,t),M(Ot.$$.fragment,t),M(Pe.$$.fragment,t),M(Je.$$.fragment,t),M(Ce.$$.fragment,t),Vs=!0)},o(t){v(c.$$.fragment,t),v(fe.$$.fragment,t),v(Oe.$$.fragment,t),v(Qe.$$.fragment,t),v(Ke.$$.fragment,t),v(ot.$$.fragment,t),v(st.$$.fragment,t),v(at.$$.fragment,t),v(it.$$.fragment,t),v(lt.$$.fragment,t),v(Me.$$.fragment,t),v(pt.$$.fragment,t),v(ft.$$.fragment,t),v(gt.$$.fragment,t),v(_t.$$.fragment,t),v(bt.$$.fragment,t),v(yt.$$.fragment,t),v(vt.$$.fragment,t),v(wt.$$.fragment,t),v(xt.$$.fragment,t),v(It.$$.fragment,t),v($t.$$.fragment,t),v(Et.$$.fragment,t),v(zt.$$.fragment,t),v(Ut.$$.fragment,t),v(Pt.$$.fragment,t),v(Ct.$$.fragment,t),v(Rt.$$.fragment,t),v(Bt.$$.fragment,t),v(Ne.$$.fragment,t),v(Ue.$$.fragment,t),v(Lt.$$.fragment,t),v(At.$$.fragment,t),v(Ot.$$.fragment,t),v(Pe.$$.fragment,t),v(Je.$$.fragment,t),v(Ce.$$.fragment,t),Vs=!1},d(t){o(h),t&&o(T),t&&o(_),F(c),t&&o(ks),F(fe,t),t&&o(ys),t&&o(ee),F(Oe),t&&o(Ms),t&&o(ue),t&&o(vs),t&&o(Gt),t&&o(Fs),t&&o(Dt),t&&o(ws),t&&o(qt),t&&o(Ts),t&&o(C),t&&o(xs),t&&o(_e),t&&o(Is),t&&o(qe),t&&o($s),t&&o(D),t&&o(Es),t&&o(te),F(Qe),t&&o(js),F(Ke,t),t&&o(zs),t&&o(oo),t&&o(Ns),t&&o(oe),F(ot),t&&o(Us),t&&o(se),F(st),t&&o(Zs),t&&o(L),F(at),t&&o(Ps),t&&o(re),F(it),t&&o(Js),t&&o($),F(lt),F(Me),F(pt),t&&o(Cs),t&&o(ne),F(ft),t&&o(Rs),t&&o(x),F(gt),F(_t),F(bt),F(yt),F(vt),F(wt),t&&o(Ws),t&&o(ie),F(xt),t&&o(Ss),t&&o(E),F(It),F($t),F(Et),F(zt),F(Ut),F(Pt),t&&o(Bs),t&&o(le),F(Ct),t&&o(Ls),t&&o(G),F(Rt),F(Bt),F(Ne),F(Ue),t&&o(As),t&&o(de),F(Lt),t&&o(Os),t&&o(me),F(At),F(Ot),F(Pe),F(Je),F(Ce)}}}const ed={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 td(j){return Oc(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class cd extends Wc{constructor(h){super();Sc(this,h,td,Kc,Bc,{})}}export{cd as default,ed as metadata};
