import{S as ml,i as dl,s as pl,e as s,k as m,w as y,t as n,M as hl,c as r,d as o,m as d,a,x as k,h as i,b as c,N as fl,G as e,g as f,y as M,q as v,o as w,B as F,v as gl,L as Ro}from"../../chunks/vendor-hf-doc-builder.js";import{T as cl}from"../../chunks/Tip-hf-doc-builder.js";import{D as x}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Go}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as ze}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Bo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ul(J){let h,T,_,g,b;return g=new Go({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1hc2syRm9ybWVyQ29uZmlnJTJDJTIwTWFzazJGb3JtZXJNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBNYXNrMkZvcm1lciUyMGZhY2Vib29rJTJGbWFzazJmb3JtZXItc3dpbi1zbWFsbC1jb2NvLWluc3RhbmNlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBNYXNrMkZvcm1lckNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBmYWNlYm9vayUyRm1hc2syZm9ybWVyLXN3aW4tc21hbGwtY29jby1pbnN0YW5jZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwTWFzazJGb3JtZXJNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Mask2FormerConfig, Mask2FormerModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Mask2Former facebook/mask2former-swin-small-coco-instance configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Mask2FormerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the facebook/mask2former-swin-small-coco-instance style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Mask2FormerModel(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=s("p"),T=n("Examples:"),_=m(),y(g.$$.fragment)},l(l){h=r(l,"P",{});var u=a(h);T=i(u,"Examples:"),u.forEach(o),_=d(l),k(g.$$.fragment,l)},m(l,u){f(l,h,u),e(h,T),f(l,_,u),M(g,l,u),b=!0},p:Ro,i(l){b||(v(g.$$.fragment,l),b=!0)},o(l){w(g.$$.fragment,l),b=!1},d(l){l&&o(h),l&&o(_),F(g,l)}}}function _l(J){let h,T,_,g,b;return{c(){h=s("p"),T=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s("code"),g=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){h=r(l,"P",{});var u=a(h);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(u,"CODE",{});var S=a(_);g=i(S,"Module"),S.forEach(o),b=i(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(l,u){f(l,h,u),e(h,T),e(h,_),e(_,g),e(h,b)},d(l){l&&o(h)}}}function bl(J){let h,T,_,g,b;return g=new Go({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUw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yUyMGxhc3QlMjBoaWRkZW4lMjBzdGF0ZXMlMjBvZiUyMHNoYXBlJTIwKGJhdGNoX3NpemUlMkMlMjBudW1fcXVlcmllcyUyQyUyMGhpZGRlbl9zaXplKSUwQXByaW50KG91dHB1dHMudHJhbnNmb3JtZXJfZGVjb2Rlcl9sYXN0X2hpZGRlbl9zdGF0ZS5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> 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-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Mask2FormerModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># load image</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><span class="hljs-comment"># load image preprocessor and Mask2FormerModel trained on COCO instance segmentation dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/mask2former-swin-small-coco-instance&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Mask2FormerModel.from_pretrained(<span class="hljs-string">&quot;facebook/mask2former-swin-small-coco-instance&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># model outputs last hidden states of shape (batch_size, num_queries, hidden_size)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(outputs.transformer_decoder_last_hidden_state.shape)
torch.Size([<span class="hljs-number">1</span>, <span class="hljs-number">100</span>, <span class="hljs-number">256</span>])`}}),{c(){h=s("p"),T=n("Examples:"),_=m(),y(g.$$.fragment)},l(l){h=r(l,"P",{});var u=a(h);T=i(u,"Examples:"),u.forEach(o),_=d(l),k(g.$$.fragment,l)},m(l,u){f(l,h,u),e(h,T),f(l,_,u),M(g,l,u),b=!0},p:Ro,i(l){b||(v(g.$$.fragment,l),b=!0)},o(l){w(g.$$.fragment,l),b=!1},d(l){l&&o(h),l&&o(_),F(g,l)}}}function yl(J){let h,T,_,g,b;return{c(){h=s("p"),T=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s("code"),g=n("Module"),b=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){h=r(l,"P",{});var u=a(h);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(u,"CODE",{});var S=a(_);g=i(S,"Module"),S.forEach(o),b=i(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(l,u){f(l,h,u),e(h,T),e(h,_),e(_,g),e(h,b)},d(l){l&&o(h)}}}function kl(J){let h,T,_,g,b;return g=new Go({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1hc2syRm9ybWVyRm9yVW5pdmVyc2FsU2VnbWVudGF0aW9uJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQS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NoYXBlJTIwJTYwKGJhdGNoX3NpemUlMkMlMjBudW1fcXVlcmllcyUyQyUyMGhlaWdodCUyQyUyMHdpZHRoKSU2MCUwQWNsYXNzX3F1ZXJpZXNfbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5jbGFzc19xdWVyaWVzX2xvZ2l0cyUwQW1hc2tzX3F1ZXJpZXNfbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5tYXNrc19xdWVyaWVzX2xvZ2l0cyUwQSUwQSUyMyUyMFBlcmZvcm0lMjBwb3N0LXByb2Nlc3NpbmclMjB0byUyMGdldCUyMGluc3RhbmNlJTIwc2VnbWVudGF0aW9uJTIwbWFwJTBBcHJlZF9pbnN0YW5jZV9tYXAlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IucG9zdF9wcm9jZXNzX3NlbWFudGljX3NlZ21lbnRhdGlvbiglMEElMjAlMjAlMjAlMjBvdXRwdXRzJTJDJTIwdGFyZ2V0X3NpemVzJTNEJTVCaW1hZ2Uuc2l6ZSU1QiUzQSUzQS0xJTVEJTVEJTBBKSU1QjAlNUQlMEFwcmludChwcmVkX2luc3RhbmNlX21hcC5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Mask2FormerForUniversalSegmentation
<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-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load Mask2Former trained on COCO instance segmentation dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/mask2former-swin-small-coco-instance&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Mask2FormerForUniversalSegmentation.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;facebook/mask2former-swin-small-coco-instance&quot;</span>
<span class="hljs-meta">... </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-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </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"># Perform post-processing to get instance segmentation map</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred_instance_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-built_in">print</span>(pred_instance_map.shape)
torch.Size([<span class="hljs-number">480</span>, <span class="hljs-number">640</span>])`}}),{c(){h=s("p"),T=n("Instance segmentation example:"),_=m(),y(g.$$.fragment)},l(l){h=r(l,"P",{});var u=a(h);T=i(u,"Instance segmentation example:"),u.forEach(o),_=d(l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C5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Mask2FormerForUniversalSegmentation
<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-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load Mask2Former trained on ADE20k semantic segmentation dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/mask2former-swin-small-ade-semantic&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Mask2FormerForUniversalSegmentation.from_pretrained(<span class="hljs-string">&quot;facebook/mask2former-swin-small-ade-semantic&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(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><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"># Perform post-processing to get semantic segmentation map</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred_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-built_in">print</span>(pred_semantic_map.shape)
torch.Size([<span class="hljs-number">512</span>, <span class="hljs-number">683</span>])`}}),{c(){h=s("p"),T=n("Semantic segmentation example:"),_=m(),y(g.$$.fragment)},l(l){h=r(l,"P",{});var u=a(h);T=i(u,"Semantic segmentation example:"),u.forEach(o),_=d(l),k(g.$$.fragment,l)},m(l,u){f(l,h,u),e(h,T),f(l,_,u),M(g,l,u),b=!0},p:Ro,i(l){b||(v(g.$$.fragment,l),b=!0)},o(l){w(g.$$.fragment,l),b=!1},d(l){l&&o(h),l&&o(_),F(g,l)}}}function vl(J){let h,T,_,g,b;return g=new Go({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1hc2syRm9ybWVyRm9yVW5pdmVyc2FsU2VnbWVudGF0aW9uJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQSUyMyUyMExvYWQlMjBNYXNrMkZvcm1lciUyMHRyYWluZWQlMjBvbiUyMENpdHlTY2FwZXMlMjBwYW5vcHRpYyUyMHNlZ21lbnRhdGlvbiUyMGRhdGFzZXQlMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3I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DJTIwbnVtX3F1ZXJpZXMlMkMlMjBoZWlnaHQlMkMlMjB3aWR0aCklNjAlMEFjbGFzc19xdWVyaWVzX2xvZ2l0cyUyMCUzRCUyMG91dHB1dHMuY2xhc3NfcXVlcmllc19sb2dpdHMlMEFtYXNrc19xdWVyaWVzX2xvZ2l0cyUyMCUzRCUyMG91dHB1dHMubWFza3NfcXVlcmllc19sb2dpdHMlMEElMEElMjMlMjBQZXJmb3JtJTIwcG9zdC1wcm9jZXNzaW5nJTIwdG8lMjBnZXQlMjBwYW5vcHRpYyUyMHNlZ21lbnRhdGlvbiUyMG1hcCUwQXByZWRfcGFub3B0aWNfbWFwJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yLnBvc3RfcHJvY2Vzc19wYW5vcHRpY19zZWdtZW50YXRpb24oJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyQyUyMHRhcmdldF9zaXplcyUzRCU1QmltYWdlLnNpemUlNUIlM0ElM0EtMSU1RCU1RCUwQSklNUIwJTVEJTVCJTIyc2VnbWVudGF0aW9uJTIyJTVEJTBBcHJpbnQocHJlZF9wYW5vcHRpY19tYXAuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Mask2FormerForUniversalSegmentation
<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-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load Mask2Former trained on CityScapes panoptic segmentation dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/mask2former-swin-small-cityscapes-panoptic&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Mask2FormerForUniversalSegmentation.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;facebook/mask2former-swin-small-cityscapes-panoptic&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://cdn-media.huggingface.co/Inference-API/Sample-results-on-the-Cityscapes-dataset-The-above-images-show-how-our-method-can-handle.png&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-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </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"># Perform post-processing to get panoptic segmentation map</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pred_panoptic_map = image_processor.post_process_panoptic_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-string">&quot;segmentation&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(pred_panoptic_map.shape)
torch.Size([<span class="hljs-number">338</span>, <span class="hljs-number">676</span>])`}}),{c(){h=s("p"),T=n("Pano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a,se,Qa,Qt,Ha,Da,To,Ka,en,tn,be,on,Uo,sn,rn,ye,an,ke,nn,Me,hs,re,ve,jo,mt,ln,Io,cn,fs,U,dt,mn,Jo,dn,pn,pt,hn,$o,fn,gn,un,Ht,ht,_n,L,ft,bn,gt,yn,zo,kn,Mn,vn,G,wn,xo,Fn,Tn,No,Un,jn,Wo,In,Jn,$n,we,ut,zn,_t,xn,Dt,Nn,Wn,En,Fe,bt,Zn,yt,Cn,Eo,Sn,Vn,Xn,Te,kt,Pn,Mt,Bn,Zo,Rn,Gn,gs;return l=new ze({}),xe=new ze({}),Se=new ze({}),Pe=new ze({}),Be=new x({props:{name:"class transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput",anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput",parameters:[{name:"encoder_last_hidden_state",val:": FloatTensor = None"},{name:"pixel_decoder_last_hidden_state",val:": FloatTensor = None"},{name:"transformer_decoder_last_hidden_state",val:": 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:"transformer_decoder_intermediate_states",val:": typing.Tuple[torch.FloatTensor] = None"},{name:"masks_queries_logits",val:": typing.Tuple[torch.FloatTensor] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput.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>, <em>optional</em>) &#x2014;
Last hidden states (final feature map) of the last stage of the encoder model (backbone). Returned when
<code>output_hidden_states=True</code> is passed.`,name:"encoder_last_hidden_state"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>) &#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. Returned when <code>output_hidden_states=True</code> is passed.`,name:"encoder_hidden_states"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput.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>, <em>optional</em>) &#x2014;
Last hidden states (final feature map) of the last stage of the pixel decoder model.`,name:"pixel_decoder_last_hidden_state"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput.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. Returned when <code>output_hidden_states=True</code> is passed.`,name:"pixel_decoder_hidden_states"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput.transformer_decoder_last_hidden_state",description:`<strong>transformer_decoder_last_hidden_state</strong> (<code>tuple(torch.FloatTensor)</code>) &#x2014;
Final output of the transformer decoder <code>(batch_size, sequence_length, hidden_size)</code>.`,name:"transformer_decoder_last_hidden_state"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput.transformer_decoder_hidden_states",description:`<strong>transformer_decoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>) &#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. Returned when <code>output_hidden_states=True</code> is passed.`,name:"transformer_decoder_hidden_states"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput.transformer_decoder_intermediate_states",description:`<strong>transformer_decoder_intermediate_states</strong> (<code>tuple(torch.FloatTensor)</code> of shape <code>(num_queries, 1, hidden_size)</code>) &#x2014;
Intermediate decoder activations, i.e. the output of each decoder layer, each of them gone through a
layernorm.`,name:"transformer_decoder_intermediate_states"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput.masks_queries_logits",description:`<strong>masks_queries_logits</strong> (<code>tuple(torch.FloatTensor)</code> of shape <code>(batch_size, num_queries, height, width)</code>) &#x2014;
Mask Predictions from each layer in the transformer decoder.`,name:"masks_queries_logits"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed) &#x2014;
Tuple of <code>tuple(torch.FloatTensor)</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Self attentions weights from transformer decoder.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/modeling_mask2former.py#L147"}}),Ge=new x({props:{name:"class transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput",anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput",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:": typing.Union[typing.List[typing.Dict[str, torch.FloatTensor]], NoneType] = None"},{name:"encoder_last_hidden_state",val:": FloatTensor = None"},{name:"pixel_decoder_last_hidden_state",val:": FloatTensor = None"},{name:"transformer_decoder_last_hidden_state",val:": 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[torch.FloatTensor] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.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.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.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.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.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.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.auxiliary_logits",description:`<strong>auxiliary_logits</strong> (<code>List[Dict(str, torch.FloatTensor)]</code>, <em>optional</em>) &#x2014;
List of class and mask predictions from each layer of the transformer decoder.`,name:"auxiliary_logits"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.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.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.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.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.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.`,name:"pixel_decoder_last_hidden_state"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.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.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.transformer_decoder_last_hidden_state",description:`<strong>transformer_decoder_last_hidden_state</strong> (<code>tuple(torch.FloatTensor)</code>) &#x2014;
Final output of the transformer decoder <code>(batch_size, sequence_length, hidden_size)</code>.`,name:"transformer_decoder_last_hidden_state"},{anchor:"transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.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.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(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>tuple(torch.FloatTensor)</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Self and Cross Attentions weights from transformer decoder.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/modeling_mask2former.py#L193"}}),Le=new ze({}),Ye=new x({props:{name:"class transformers.Mask2FormerConfig",anchor:"transformers.Mask2FormerConfig",parameters:[{name:"backbone_config",val:": typing.Optional[typing.Dict] = None"},{name:"feature_size",val:": int = 256"},{name:"mask_feature_size",val:": int = 256"},{name:"hidden_dim",val:": int = 256"},{name:"encoder_feedforward_dim",val:": int = 1024"},{name:"activation_function",val:": str = 'relu'"},{name:"encoder_layers",val:": int = 6"},{name:"decoder_layers",val:": int = 10"},{name:"num_attention_heads",val:": int = 8"},{name:"dropout",val:": float = 0.0"},{name:"dim_feedforward",val:": int = 2048"},{name:"pre_norm",val:": bool = False"},{name:"enforce_input_projection",val:": bool = False"},{name:"common_stride",val:": int = 4"},{name:"ignore_value",val:": int = 255"},{name:"num_queries",val:": int = 100"},{name:"no_object_weight",val:": float = 0.1"},{name:"class_weight",val:": float = 2.0"},{name:"mask_weight",val:": float = 5.0"},{name:"dice_weight",val:": float = 5.0"},{name:"train_num_points",val:": int = 12544"},{name:"oversample_ratio",val:": float = 3.0"},{name:"importance_sample_ratio",val:": float = 0.75"},{name:"init_std",val:": float = 0.02"},{name:"init_xavier_std",val:": float = 1.0"},{name:"use_auxiliary_loss",val:": bool = True"},{name:"feature_strides",val:": typing.List[int] = [4, 8, 16, 32]"},{name:"output_auxiliary_logits",val:": bool = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Mask2FormerConfig.backbone_config",description:`<strong>backbone_config</strong> (<code>PretrainedConfig</code> or <code>dict</code>, <em>optional</em>, defaults to <code>SwinConfig()</code>) &#x2014;
The configuration of the backbone model. If unset, the configuration corresponding to
<code>swin-base-patch4-window12-384</code> will be used.`,name:"backbone_config"},{anchor:"transformers.Mask2FormerConfig.feature_size",description:`<strong>feature_size</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
The features (channels) of the resulting feature maps.`,name:"feature_size"},{anchor:"transformers.Mask2FormerConfig.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.Mask2FormerConfig.hidden_dim",description:`<strong>hidden_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
Dimensionality of the encoder layers.`,name:"hidden_dim"},{anchor:"transformers.Mask2FormerConfig.encoder_feedforward_dim",description:`<strong>encoder_feedforward_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Dimension of feedforward network for deformable detr encoder used as part of pixel decoder.`,name:"encoder_feedforward_dim"},{anchor:"transformers.Mask2FormerConfig.encoder_layers",description:`<strong>encoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 6) &#x2014;
Number of layers in the deformable detr encoder used as part of pixel decoder.`,name:"encoder_layers"},{anchor:"transformers.Mask2FormerConfig.decoder_layers",description:`<strong>decoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 10) &#x2014;
Number of layers in the Transformer decoder.`,name:"decoder_layers"},{anchor:"transformers.Mask2FormerConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads for each attention layer.`,name:"num_attention_heads"},{anchor:"transformers.Mask2FormerConfig.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder.`,name:"dropout"},{anchor:"transformers.Mask2FormerConfig.dim_feedforward",description:`<strong>dim_feedforward</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Feature dimension in feedforward network for transformer decoder.`,name:"dim_feedforward"},{anchor:"transformers.Mask2FormerConfig.pre_norm",description:`<strong>pre_norm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use pre-LayerNorm or not for transformer decoder.`,name:"pre_norm"},{anchor:"transformers.Mask2FormerConfig.enforce_input_projection",description:`<strong>enforce_input_projection</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to add an input projection 1x1 convolution even if the input channels and hidden dim are identical
in the Transformer decoder.`,name:"enforce_input_projection"},{anchor:"transformers.Mask2FormerConfig.common_stride",description:`<strong>common_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Parameter used for determining number of FPN levels used as part of pixel decoder.`,name:"common_stride"},{anchor:"transformers.Mask2FormerConfig.ignore_value",description:`<strong>ignore_value</strong> (<code>int</code>, <em>optional</em>, defaults to 255) &#x2014;
Category id to be ignored during training.`,name:"ignore_value"},{anchor:"transformers.Mask2FormerConfig.num_queries",description:`<strong>num_queries</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
Number of queries for the decoder.`,name:"num_queries"},{anchor:"transformers.Mask2FormerConfig.no_object_weight",description:`<strong>no_object_weight</strong> (<code>int</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The weight to apply to the null (no object) class.`,name:"no_object_weight"},{anchor:"transformers.Mask2FormerConfig.class_weight",description:`<strong>class_weight</strong> (<code>int</code>, <em>optional</em>, defaults to 2.0) &#x2014;
The weight for the cross entropy loss.`,name:"class_weight"},{anchor:"transformers.Mask2FormerConfig.mask_weight",description:`<strong>mask_weight</strong> (<code>int</code>, <em>optional</em>, defaults to 5.0) &#x2014;
The weight for the mask loss.`,name:"mask_weight"},{anchor:"transformers.Mask2FormerConfig.dice_weight",description:`<strong>dice_weight</strong> (<code>int</code>, <em>optional</em>, defaults to 5.0) &#x2014;
The weight for the dice loss.`,name:"dice_weight"},{anchor:"transformers.Mask2FormerConfig.train_num_points",description:`<strong>train_num_points</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to 12544) &#x2014;
Number of points used for sampling during loss calculation.`,name:"train_num_points"},{anchor:"transformers.Mask2FormerConfig.oversample_ratio",description:`<strong>oversample_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 3.0) &#x2014;
Oversampling parameter used for calculating no. of sampled points`,name:"oversample_ratio"},{anchor:"transformers.Mask2FormerConfig.importance_sample_ratio",description:`<strong>importance_sample_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 0.75) &#x2014;
Ratio of points that are sampled via importance sampling.`,name:"importance_sample_ratio"},{anchor:"transformers.Mask2FormerConfig.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.Mask2FormerConfig.init_xavier_std",description:"<strong>init_xavier_std</strong> (`float&#x201C;, <em>optional</em>, defaults to 1.0) &#x2014;\nThe scaling factor used for the Xavier initialization gain in the HM Attention map module.",name:"init_xavier_std"},{anchor:"transformers.Mask2FormerConfig.use_auxiliary_loss",description:"<strong>use_auxiliary_loss</strong> (<code>boolean``, *optional*, defaults to </code>True<code>) -- If </code>True<code> </code>Mask2FormerForUniversalSegmentationOutput` will contain the auxiliary losses computed using\nthe logits from each decoder&#x2019;s stage.",name:"use_auxiliary_loss"},{anchor:"transformers.Mask2FormerConfig.feature_strides",description:`<strong>feature_strides</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[4, 8, 16, 32]</code>) &#x2014;
Feature strides corresponding to features generated from backbone network.`,name:"feature_strides"},{anchor:"transformers.Mask2FormerConfig.output_auxiliary_logits",description:`<strong>output_auxiliary_logits</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Should the model output its <code>auxiliary_logits</code> or not.`,name:"output_auxiliary_logits"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/configuration_mask2former.py#L34"}}),de=new Bo({props:{anchor:"transformers.Mask2FormerConfig.example",$$slots:{default:[ul]},$$scope:{ctx:J}}}),Qe=new x({props:{name:"from_backbone_config",anchor:"transformers.Mask2FormerConfig.from_backbone_config",parameters:[{name:"backbone_config",val:": PretrainedConfig"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Mask2FormerConfig.from_backbone_config.backbone_config",description:`<strong>backbone_config</strong> (<a href="/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The backbone configuration.`,name:"backbone_config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/configuration_mask2former.py#L210",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerConfig"
>Mask2FormerConfig</a></p>
`}}),De=new x({props:{name:"to_dict",anchor:"transformers.Mask2FormerConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/configuration_mask2former.py#L226",returnDescription:`
<p>Dictionary of all the attributes that make up this configuration instance,</p>
`,returnType:`
<p><code>Dict[str, any]</code></p>
`}}),et=new ze({}),tt=new x({props:{name:"class transformers.Mask2FormerModel",anchor:"transformers.Mask2FormerModel",parameters:[{name:"config",val:": Mask2FormerConfig"}],parametersDescription:[{anchor:"transformers.Mask2FormerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerConfig">Mask2FormerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/modeling_mask2former.py#L2211"}}),rt=new x({props:{name:"forward",anchor:"transformers.Mask2FormerModel.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.Mask2FormerModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a>. See
<code>AutoFeatureExtractor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.Mask2FormerModel.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.Mask2FormerModel.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.Mask2FormerModel.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.Mask2FormerModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <code>~Mask2FormerModelOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/modeling_mask2former.py#L2221",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput"
>transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerConfig"
>Mask2FormerConfig</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>, <em>optional</em>) \u2014 Last hidden states (final feature map) of the last stage of the encoder model (backbone). Returned when
<code>output_hidden_states=True</code> is passed.</li>
<li><strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>) \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. Returned when <code>output_hidden_states=True</code> is passed.</li>
<li><strong>pixel_decoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>, <em>optional</em>) \u2014 Last hidden states (final feature map) of the last stage of the pixel decoder model.</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. Returned when <code>output_hidden_states=True</code> is passed.</li>
<li><strong>transformer_decoder_last_hidden_state</strong> (<code>tuple(torch.FloatTensor)</code>) \u2014 Final output of the transformer decoder <code>(batch_size, sequence_length, hidden_size)</code>.</li>
<li><strong>transformer_decoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>) \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. Returned when <code>output_hidden_states=True</code> is passed.</li>
<li><strong>transformer_decoder_intermediate_states</strong> (<code>tuple(torch.FloatTensor)</code> of shape <code>(num_queries, 1, hidden_size)</code>) \u2014 Intermediate decoder activations, i.e. the output of each decoder layer, each of them gone through a
layernorm.</li>
<li><strong>masks_queries_logits</strong> (<code>tuple(torch.FloatTensor)</code> of shape <code>(batch_size, num_queries, height, width)</code>)
Mask Predictions from each layer in the transformer decoder.</li>
<li><strong>attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Self attentions weights from transformer decoder.</li>
</ul>
<p><code>Mask2FormerModelOutput</code></p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput"
>transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ge=new cl({props:{$$slots:{default:[_l]},$$scope:{ctx:J}}}),ue=new Bo({props:{anchor:"transformers.Mask2FormerModel.forward.example",$$slots:{default:[bl]},$$scope:{ctx:J}}}),at=new ze({}),nt=new x({props:{name:"class transformers.Mask2FormerForUniversalSegmentation",anchor:"transformers.Mask2FormerForUniversalSegmentation",parameters:[{name:"config",val:": Mask2FormerConfig"}],parametersDescription:[{anchor:"transformers.Mask2FormerForUniversalSegmentation.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerConfig">Mask2FormerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/modeling_mask2former.py#L2315"}}),ct=new x({props:{name:"forward",anchor:"transformers.Mask2FormerForUniversalSegmentation.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_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_auxiliary_logits",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a>. See
<code>AutoFeatureExtractor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.Mask2FormerForUniversalSegmentation.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.Mask2FormerForUniversalSegmentation.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.Mask2FormerForUniversalSegmentation.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.Mask2FormerForUniversalSegmentation.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <code>~Mask2FormerModelOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Mask2FormerForUniversalSegmentation.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.Mask2FormerForUniversalSegmentation.forward.class_labels",description:`<strong>class_labels</strong> (<code>List[torch.LongTensor]</code>, <em>optional</em>) &#x2014;
list of target class labels of shape <code>(num_labels, height, width)</code> to be fed to a model. They identify the
labels of <code>mask_labels</code>, e.g. the label of <code>mask_labels[i][j]</code> if <code>class_labels[i][j]</code>.`,name:"class_labels"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/modeling_mask2former.py#L2368",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput"
>transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerConfig"
>Mask2FormerConfig</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>auxiliary_logits</strong> (<code>List[Dict(str, torch.FloatTensor)]</code>, <em>optional</em>) \u2014 List of class and mask predictions from each layer of the transformer decoder.</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>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_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.</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_last_hidden_state</strong> (<code>tuple(torch.FloatTensor)</code>) \u2014 Final output of the transformer decoder <code>(batch_size, sequence_length, hidden_size)</code>.</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>attentions</strong> (<code>tuple(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>tuple(torch.FloatTensor)</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Self and Cross Attentions weights from transformer decoder.</li>
</ul>
<p><code>Mask2FormerUniversalSegmentationOutput</code></p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput"
>transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),be=new cl({props:{$$slots:{default:[yl]},$$scope:{ctx:J}}}),ye=new Bo({props:{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.example",$$slots:{default:[kl]},$$scope:{ctx:J}}}),ke=new Bo({props:{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.example-2",$$slots:{default:[Ml]},$$scope:{ctx:J}}}),Me=new Bo({props:{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.example-3",$$slots:{default:[vl]},$$scope:{ctx:J}}}),mt=new ze({}),dt=new x({props:{name:"class transformers.Mask2FormerImageProcessor",anchor:"transformers.Mask2FormerImageProcessor",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:"reduce_labels",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.reduce_labels",description:`<strong>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:"reduce_labels"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/image_processing_mask2former.py#L331"}}),ht=new x({props:{name:"preprocess",anchor:"transformers.Mask2FormerImageProcessor.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:"reduce_labels",val:": typing.Optional[bool] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/image_processing_mask2former.py#L629"}}),ft=new x({props:{name:"encode_inputs",anchor:"transformers.Mask2FormerImageProcessor.encode_inputs",parameters:[{name:"pixel_values_list",val:": typing.List[typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]]"},{name:"segmentation_maps",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]] = None"},{name:"instance_id_to_semantic_id",val:": typing.Union[typing.List[typing.Dict[int, int]], typing.Dict[int, int], NoneType] = None"},{name:"ignore_index",val:": typing.Optional[int] = None"},{name:"reduce_labels",val:": bool = False"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.encode_inputs.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/v4.30.0/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of NumPy arrays. If set to <code>&apos;pt&apos;</code>, return PyTorch <code>torch.Tensor</code>
objects.`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/image_processing_mask2former.py#L784",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/image_processor#transformers.BatchFeature"
>BatchFeature</a> with the following fields:</p>
<ul>
<li><strong>pixel_values</strong> \u2014 Pixel values to be fed to a model.</li>
<li><strong>pixel_mask</strong> \u2014 Pixel mask to be fed to a model (when <code>=True</code> or if <code>pixel_mask</code> is in
<code>self.model_input_names</code>).</li>
<li><strong>mask_labels</strong> \u2014 Optional list of mask labels of shape <code>(labels, height, width)</code> to be fed to a model
(when <code>annotations</code> are provided).</li>
<li><strong>class_labels</strong> \u2014 Optional list of class labels of shape <code>(labels)</code> to be fed to a model (when
<code>annotations</code> are provided). They identify the labels of <code>mask_labels</code>, e.g. the label of
<code>mask_labels[i][j]</code> if <code>class_labels[i][j]</code>.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/image_processor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),ut=new x({props:{name:"post_process_semantic_segmentation",anchor:"transformers.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation">Mask2FormerForUniversalSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.Mask2FormerImageProcessor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple[int, int]]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds to the requested
final size (height, width) of each prediction. If left to None, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/image_processing_mask2former.py#L883",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>
`}}),bt=new x({props:{name:"post_process_instance_segmentation",anchor:"transformers.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.post_process_instance_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation">Mask2FormerForUniversalSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.post_process_instance_segmentation.return_binary_maps",description:`<strong>return_binary_maps</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If set to <code>True</code>, segmentation maps are returned as a concatenated tensor of binary segmentation maps
(one per detected instance).`,name:"return_binary_maps"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/image_processing_mask2former.py#L938",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>
`}}),kt=new x({props:{name:"post_process_panoptic_segmentation",anchor:"transformers.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.post_process_panoptic_segmentation.outputs",description:`<strong>outputs</strong> (<code>Mask2FormerForUniversalSegmentationOutput</code>) &#x2014;
The outputs from <a href="/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation">Mask2FormerForUniversalSegmentation</a>.`,name:"outputs"},{anchor:"transformers.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.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.Mask2FormerImageProcessor.post_process_panoptic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds to the requested
final size (height, width) of each prediction in batch. If left to None, predictions will not be
resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/mask2former/image_processing_mask2former.py#L1056",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>
`}}),{c(){h=s("meta"),T=m(),_=s("h1"),g=s("a"),b=s("span"),y(l.$$.fragment),u=m(),S=s("span"),Bs=n("Mask2Former"),Ao=m(),Y=s("h2"),ae=s("a"),lo=s("span"),y(xe.$$.fragment),Rs=m(),co=s("span"),Gs=n("Overview"),Lo=m(),A=s("p"),As=n("The Mask2Former model was proposed in "),Ne=s("a"),Ls=n("Masked-attention Mask Transformer for Universal Image Segmentation"),Ys=n(" by Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar. Mask2Former is a unified framework for panoptic, instance and semantic segmentation and features significant performance and efficiency improvements over "),Ft=s("a"),qs=n("MaskFormer"),Os=n("."),Yo=m(),Tt=s("p"),Qs=n("The abstract from the paper is the following:"),qo=m(),Ut=s("p"),mo=s("em"),Hs=n(`Image segmentation groups pixels with different semantics, e.g., category or instance membership. Each choice
of semantics defines a task. While only the semantics of each task differ, current research focuses on designing specialized architectures for each task. We present Masked-attention Mask Transformer (Mask2Former), a new architecture capable of addressing any image segmentation task (panoptic, instance or semantic). Its key components include masked attention, which extracts localized features by constraining cross-attention within predicted mask regions. In addition to reducing the research effort by at least three times, it outperforms the best specialized architectures by a significant margin on four popular datasets. Most notably, Mask2Former sets a new state-of-the-art for panoptic segmentation (57.8 PQ on COCO), instance segmentation (50.1 AP on COCO) and semantic segmentation (57.7 mIoU on ADE20K).`),Oo=m(),jt=s("p"),Ds=n("Tips:"),Qo=m(),ne=s("ul"),V=s("li"),Ks=n("Mask2Former uses the same preprocessing and postprocessing steps as "),It=s("a"),er=n("MaskFormer"),tr=n(". Use "),Jt=s("a"),or=n("Mask2FormerImageProcessor"),sr=n(" or "),$t=s("a"),rr=n("AutoImageProcessor"),ar=n(" to prepare images and optional targets for the model."),nr=m(),z=s("li"),ir=n("To get the final segmentation, depending on the task, you can call "),zt=s("a"),lr=n("post_process_semantic_segmentation()"),cr=n(" or "),xt=s("a"),mr=n("post_process_instance_segmentation()"),dr=n(" or "),Nt=s("a"),pr=n("post_process_panoptic_segmentation()"),hr=n(". All three tasks can be solved using "),Wt=s("a"),fr=n("Mask2FormerForUniversalSegmentation"),gr=n(" output, panoptic segmentation accepts an optional "),po=s("code"),ur=n("label_ids_to_fuse"),_r=n(" argument to fuse instances of the target object/s (e.g. sky) together."),Ho=m(),ie=s("img"),Do=m(),We=s("small"),br=n("Mask2Former architecture. Taken from the "),Et=s("a"),yr=n("original paper."),Ko=m(),E=s("p"),kr=n("This model was contributed by "),Ee=s("a"),Mr=n("Shivalika Singh"),vr=n(" and "),Ze=s("a"),wr=n("Alara Dirik"),Fr=n(". The original code can be found "),Ce=s("a"),Tr=n("here"),Ur=n("."),es=m(),q=s("h2"),le=s("a"),ho=s("span"),y(Se.$$.fragment),jr=m(),fo=s("span"),Ir=n("Resources"),ts=m(),Zt=s("p"),Jr=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Mask2Former."),os=m(),Ct=s("ul"),Ve=s("li"),$r=n("Demo notebooks regarding inference + fine-tuning Mask2Former on custom data can be found "),Xe=s("a"),zr=n("here"),xr=n("."),ss=m(),St=s("p"),Nr=n(`If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we will review it.
The resource should ideally demonstrate something new instead of duplicating an existing resource.`),rs=m(),O=s("h2"),ce=s("a"),go=s("span"),y(Pe.$$.fragment),Wr=m(),uo=s("span"),Er=n("MaskFormer specific outputs"),as=m(),Q=s("div"),y(Be.$$.fragment),Zr=m(),Re=s("p"),Cr=n("Class for outputs of "),Vt=s("a"),Sr=n("Mask2FormerModel"),Vr=n(". This class returns all the needed hidden states to compute the logits."),ns=m(),X=s("div"),y(Ge.$$.fragment),Xr=m(),Ae=s("p"),Pr=n("Class for outputs of "),_o=s("code"),Br=n("Mask2FormerForUniversalSegmentationOutput"),Rr=n("."),Gr=m(),P=s("p"),Ar=n("This output can be directly passed to "),Xt=s("a"),Lr=n("post_process_semantic_segmentation()"),Yr=n(` or
`),Pt=s("a"),qr=n("post_process_instance_segmentation()"),Or=n(` or
`),Bt=s("a"),Qr=n("post_process_panoptic_segmentation()"),Hr=n(" to compute final segmentation maps. Please, see\n[`~Mask2FormerImageProcessor] for details regarding usage."),is=m(),H=s("h2"),me=s("a"),bo=s("span"),y(Le.$$.fragment),Dr=m(),yo=s("span"),Kr=n("Mask2FormerConfig"),ls=m(),j=s("div"),y(Ye.$$.fragment),ea=m(),D=s("p"),ta=n("This is the configuration class to store the configuration of a "),Rt=s("a"),oa=n("Mask2FormerModel"),sa=n(`. It is used to instantiate a
Mask2Former 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 Mask2Former
`),qe=s("a"),ra=n("facebook/mask2former-swin-small-coco-instance"),aa=n(`
architecture.`),na=m(),K=s("p"),ia=n("Configuration objects inherit from "),Gt=s("a"),la=n("PretrainedConfig"),ca=n(` and can be used to control the model outputs. Read the
documentation from `),At=s("a"),ma=n("PretrainedConfig"),da=n(" for more information."),pa=m(),Oe=s("p"),ha=n("Currently, Mask2Former only supports the "),Lt=s("a"),fa=n("Swin Transformer"),ga=n(" as backbone."),ua=m(),y(de.$$.fragment),_a=m(),pe=s("div"),y(Qe.$$.fragment),ba=m(),He=s("p"),ya=n("Instantiate a "),Yt=s("a"),ka=n("Mask2FormerConfig"),Ma=n(" (or a derived class) from a pre-trained backbone model configuration."),va=m(),he=s("div"),y(De.$$.fragment),wa=m(),Ke=s("p"),Fa=n("Serializes this instance to a Python dictionary. Override the default "),qt=s("a"),Ta=n("to_dict()"),Ua=n("."),cs=m(),ee=s("h2"),fe=s("a"),ko=s("span"),y(et.$$.fragment),ja=m(),Mo=s("span"),Ia=n("Mask2FormerModel"),ms=m(),B=s("div"),y(tt.$$.fragment),Ja=m(),ot=s("p"),$a=n(`The bare Mask2Former Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),st=s("a"),za=n("torch.nn.Module"),xa=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Na=m(),Z=s("div"),y(rt.$$.fragment),Wa=m(),te=s("p"),Ea=n("The "),Ot=s("a"),Za=n("Mask2FormerModel"),Ca=n(" forward method, overrides the "),vo=s("code"),Sa=n("__call__"),Va=n(" special method."),Xa=m(),y(ge.$$.fragment),Pa=m(),y(ue.$$.fragment),ds=m(),oe=s("h2"),_e=s("a"),wo=s("span"),y(at.$$.fragment),Ba=m(),Fo=s("span"),Ra=n("Mask2FormerForUniversalSegmentation"),ps=m(),R=s("div"),y(nt.$$.fragment),Ga=m(),it=s("p"),Aa=n(`The Mask2Former Model with heads on top for instance/semantic/panoptic segmentation.
This model is a PyTorch `),lt=s("a"),La=n("torch.nn.Module"),Ya=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),qa=m(),I=s("div"),y(ct.$$.fragment),Oa=m(),se=s("p"),Qa=n("The "),Qt=s("a"),Ha=n("Mask2FormerForUniversalSegmentation"),Da=n(" forward method, overrides the "),To=s("code"),Ka=n("__call__"),en=n(" special method."),tn=m(),y(be.$$.fragment),on=m(),Uo=s("p"),sn=n("Examples:"),rn=m(),y(ye.$$.fragment),an=m(),y(ke.$$.fragment),nn=m(),y(Me.$$.fragment),hs=m(),re=s("h2"),ve=s("a"),jo=s("span"),y(mt.$$.fragment),ln=m(),Io=s("span"),cn=n("Mask2FormerImageProcessor"),fs=m(),U=s("div"),y(dt.$$.fragment),mn=m(),Jo=s("p"),dn=n(`Constructs a Mask2Former image processor. The image processor can be used to prepare image(s) and optional targets
for the model.`),pn=m(),pt=s("p"),hn=n("This image processor inherits from "),$o=s("code"),fn=n("BaseImageProcessor"),gn=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),un=m(),Ht=s("div"),y(ht.$$.fragment),_n=m(),L=s("div"),y(ft.$$.fragment),bn=m(),gt=s("p"),yn=n("Pad images up to the largest image in a batch and create a corresponding "),zo=s("code"),kn=n("pixel_mask"),Mn=n("."),vn=m(),G=s("p"),wn=n(`Mask2Former 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
`),xo=s("code"),Fn=n("segmentation_maps = [[2,6,7,9]]"),Tn=n(", the output will contain "),No=s("code"),Un=n("mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),jn=n(" (four binary masks) and "),Wo=s("code"),In=n("class_labels = [2,6,7,9]"),Jn=n(`, the labels for
each mask.`),$n=m(),we=s("div"),y(ut.$$.fragment),zn=m(),_t=s("p"),xn=n("Converts the output of "),Dt=s("a"),Nn=n("Mask2FormerForUniversalSegmentation"),Wn=n(` into semantic segmentation maps. Only supports
PyTorch.`),En=m(),Fe=s("div"),y(bt.$$.fragment),Zn=m(),yt=s("p"),Cn=n("Converts the output of "),Eo=s("code"),Sn=n("Mask2FormerForUniversalSegmentationOutput"),Vn=n(` into instance segmentation predictions.
Only supports PyTorch.`),Xn=m(),Te=s("div"),y(kt.$$.fragment),Pn=m(),Mt=s("p"),Bn=n("Converts the output of "),Zo=s("code"),Rn=n("Mask2FormerForUniversalSegmentationOutput"),Gn=n(` into image panoptic segmentation
predictions. Only supports PyTorch.`),this.h()},l(t){const p=hl('[data-svelte="svelte-1phssyn"]',document.head);h=r(p,"META",{name:!0,content:!0}),p.forEach(o),T=d(t),_=r(t,"H1",{class:!0});var vt=a(_);g=r(vt,"A",{id:!0,class:!0,href:!0});var Co=a(g);b=r(Co,"SPAN",{});var So=a(b);k(l.$$.fragment,So),So.forEach(o),Co.forEach(o),u=d(vt),S=r(vt,"SPAN",{});var Vo=a(S);Bs=i(Vo,"Mask2Former"),Vo.forEach(o),vt.forEach(o),Ao=d(t),Y=r(t,"H2",{class:!0});var wt=a(Y);ae=r(wt,"A",{id:!0,class:!0,href:!0});var Xo=a(ae);lo=r(Xo,"SPAN",{});var Po=a(lo);k(xe.$$.fragment,Po),Po.forEach(o),Xo.forEach(o),Rs=d(wt),co=r(wt,"SPAN",{});var Yn=a(co);Gs=i(Yn,"Overview"),Yn.forEach(o),wt.forEach(o),Lo=d(t),A=r(t,"P",{});var Kt=a(A);As=i(Kt,"The Mask2Former model was proposed in "),Ne=r(Kt,"A",{href:!0,rel:!0});var qn=a(Ne);Ls=i(qn,"Masked-attention Mask Transformer for Universal Image Segmentation"),qn.forEach(o),Ys=i(Kt," by Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar. Mask2Former is a unified framework for panoptic, instance and semantic segmentation and features significant performance and efficiency improvements over "),Ft=r(Kt,"A",{href:!0});var On=a(Ft);qs=i(On,"MaskFormer"),On.forEach(o),Os=i(Kt,"."),Kt.forEach(o),Yo=d(t),Tt=r(t,"P",{});var Qn=a(Tt);Qs=i(Qn,"The abstract from the paper is the following:"),Qn.forEach(o),qo=d(t),Ut=r(t,"P",{});var Hn=a(Ut);mo=r(Hn,"EM",{});var Dn=a(mo);Hs=i(Dn,`Image segmentation groups pixels with different semantics, e.g., category or instance membership. Each choice
of semantics defines a task. While only the semantics of each task differ, current research focuses on designing specialized architectures for each task. We present Masked-attention Mask Transformer (Mask2Former), a new architecture capable of addressing any image segmentation task (panoptic, instance or semantic). Its key components include masked attention, which extracts localized features by constraining cross-attention within predicted mask regions. In addition to reducing the research effort by at least three times, it outperforms the best specialized architectures by a significant margin on four popular datasets. Most notably, Mask2Former sets a new state-of-the-art for panoptic segmentation (57.8 PQ on COCO), instance segmentation (50.1 AP on COCO) and semantic segmentation (57.7 mIoU on ADE20K).`),Dn.forEach(o),Hn.forEach(o),Oo=d(t),jt=r(t,"P",{});var Kn=a(jt);Ds=i(Kn,"Tips:"),Kn.forEach(o),Qo=d(t),ne=r(t,"UL",{});var us=a(ne);V=r(us,"LI",{});var Ue=a(V);Ks=i(Ue,"Mask2Former uses the same preprocessing and postprocessing steps as "),It=r(Ue,"A",{href:!0});var ei=a(It);er=i(ei,"MaskFormer"),ei.forEach(o),tr=i(Ue,". Use "),Jt=r(Ue,"A",{href:!0});var ti=a(Jt);or=i(ti,"Mask2FormerImageProcessor"),ti.forEach(o),sr=i(Ue," or "),$t=r(Ue,"A",{href:!0});var oi=a($t);rr=i(oi,"AutoImageProcessor"),oi.forEach(o),ar=i(Ue," to prepare images and optional targets for the model."),Ue.forEach(o),nr=d(us),z=r(us,"LI",{});var C=a(z);ir=i(C,"To get the final segmentation, depending on the task, you can call "),zt=r(C,"A",{href:!0});var si=a(zt);lr=i(si,"post_process_semantic_segmentation()"),si.forEach(o),cr=i(C," or "),xt=r(C,"A",{href:!0});var ri=a(xt);mr=i(ri,"post_process_instance_segmentation()"),ri.forEach(o),dr=i(C," or "),Nt=r(C,"A",{href:!0});var ai=a(Nt);pr=i(ai,"post_process_panoptic_segmentation()"),ai.forEach(o),hr=i(C,". All three tasks can be solved using "),Wt=r(C,"A",{href:!0});var ni=a(Wt);fr=i(ni,"Mask2FormerForUniversalSegmentation"),ni.forEach(o),gr=i(C," output, panoptic segmentation accepts an optional "),po=r(C,"CODE",{});var ii=a(po);ur=i(ii,"label_ids_to_fuse"),ii.forEach(o),_r=i(C," argument to fuse instances of the target object/s (e.g. sky) together."),C.forEach(o),us.forEach(o),Ho=d(t),ie=r(t,"IMG",{src:!0,alt:!0,width:!0}),Do=d(t),We=r(t,"SMALL",{});var An=a(We);br=i(An,"Mask2Former architecture. Taken from the "),Et=r(An,"A",{href:!0});var li=a(Et);yr=i(li,"original paper."),li.forEach(o),An.forEach(o),Ko=d(t),E=r(t,"P",{});var je=a(E);kr=i(je,"This model was contributed by "),Ee=r(je,"A",{href:!0,rel:!0});var ci=a(Ee);Mr=i(ci,"Shivalika Singh"),ci.forEach(o),vr=i(je," and "),Ze=r(je,"A",{href:!0,rel:!0});var mi=a(Ze);wr=i(mi,"Alara Dirik"),mi.forEach(o),Fr=i(je,". The original code can be found "),Ce=r(je,"A",{href:!0,rel:!0});var di=a(Ce);Tr=i(di,"here"),di.forEach(o),Ur=i(je,"."),je.forEach(o),es=d(t),q=r(t,"H2",{class:!0});var _s=a(q);le=r(_s,"A",{id:!0,class:!0,href:!0});var pi=a(le);ho=r(pi,"SPAN",{});var hi=a(ho);k(Se.$$.fragment,hi),hi.forEach(o),pi.forEach(o),jr=d(_s),fo=r(_s,"SPAN",{});var fi=a(fo);Ir=i(fi,"Resources"),fi.forEach(o),_s.forEach(o),ts=d(t),Zt=r(t,"P",{});var gi=a(Zt);Jr=i(gi,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Mask2Former."),gi.forEach(o),os=d(t),Ct=r(t,"UL",{});var ui=a(Ct);Ve=r(ui,"LI",{});var bs=a(Ve);$r=i(bs,"Demo notebooks regarding inference + fine-tuning Mask2Former on custom data can be found "),Xe=r(bs,"A",{href:!0,rel:!0});var _i=a(Xe);zr=i(_i,"here"),_i.forEach(o),xr=i(bs,"."),bs.forEach(o),ui.forEach(o),ss=d(t),St=r(t,"P",{});var bi=a(St);Nr=i(bi,`If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we will review it.
The resource should ideally demonstrate something new instead of duplicating an existing resource.`),bi.forEach(o),rs=d(t),O=r(t,"H2",{class:!0});var ys=a(O);ce=r(ys,"A",{id:!0,class:!0,href:!0});var yi=a(ce);go=r(yi,"SPAN",{});var ki=a(go);k(Pe.$$.fragment,ki),ki.forEach(o),yi.forEach(o),Wr=d(ys),uo=r(ys,"SPAN",{});var Mi=a(uo);Er=i(Mi,"MaskFormer specific outputs"),Mi.forEach(o),ys.forEach(o),as=d(t),Q=r(t,"DIV",{class:!0});var ks=a(Q);k(Be.$$.fragment,ks),Zr=d(ks),Re=r(ks,"P",{});var Ms=a(Re);Cr=i(Ms,"Class for outputs of "),Vt=r(Ms,"A",{href:!0});var vi=a(Vt);Sr=i(vi,"Mask2FormerModel"),vi.forEach(o),Vr=i(Ms,". This class returns all the needed hidden states to compute the logits."),Ms.forEach(o),ks.forEach(o),ns=d(t),X=r(t,"DIV",{class:!0});var eo=a(X);k(Ge.$$.fragment,eo),Xr=d(eo),Ae=r(eo,"P",{});var vs=a(Ae);Pr=i(vs,"Class for outputs of "),_o=r(vs,"CODE",{});var wi=a(_o);Br=i(wi,"Mask2FormerForUniversalSegmentationOutput"),wi.forEach(o),Rr=i(vs,"."),vs.forEach(o),Gr=d(eo),P=r(eo,"P",{});var Ie=a(P);Ar=i(Ie,"This output can be directly passed to "),Xt=r(Ie,"A",{href:!0});var Fi=a(Xt);Lr=i(Fi,"post_process_semantic_segmentation()"),Fi.forEach(o),Yr=i(Ie,` or
`),Pt=r(Ie,"A",{href:!0});var Ti=a(Pt);qr=i(Ti,"post_process_instance_segmentation()"),Ti.forEach(o),Or=i(Ie,` or
`),Bt=r(Ie,"A",{href:!0});var Ui=a(Bt);Qr=i(Ui,"post_process_panoptic_segmentation()"),Ui.forEach(o),Hr=i(Ie," to compute final segmentation maps. Please, see\n[`~Mask2FormerImageProcessor] for details regarding usage."),Ie.forEach(o),eo.forEach(o),is=d(t),H=r(t,"H2",{class:!0});var ws=a(H);me=r(ws,"A",{id:!0,class:!0,href:!0});var ji=a(me);bo=r(ji,"SPAN",{});var Ii=a(bo);k(Le.$$.fragment,Ii),Ii.forEach(o),ji.forEach(o),Dr=d(ws),yo=r(ws,"SPAN",{});var Ji=a(yo);Kr=i(Ji,"Mask2FormerConfig"),Ji.forEach(o),ws.forEach(o),ls=d(t),j=r(t,"DIV",{class:!0});var N=a(j);k(Ye.$$.fragment,N),ea=d(N),D=r(N,"P",{});var to=a(D);ta=i(to,"This is the configuration class to store the configuration of a "),Rt=r(to,"A",{href:!0});var $i=a(Rt);oa=i($i,"Mask2FormerModel"),$i.forEach(o),sa=i(to,`. It is used to instantiate a
Mask2Former 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 Mask2Former
`),qe=r(to,"A",{href:!0,rel:!0});var zi=a(qe);ra=i(zi,"facebook/mask2former-swin-small-coco-instance"),zi.forEach(o),aa=i(to,`
architecture.`),to.forEach(o),na=d(N),K=r(N,"P",{});var oo=a(K);ia=i(oo,"Configuration objects inherit from "),Gt=r(oo,"A",{href:!0});var xi=a(Gt);la=i(xi,"PretrainedConfig"),xi.forEach(o),ca=i(oo,` and can be used to control the model outputs. Read the
documentation from `),At=r(oo,"A",{href:!0});var Ni=a(At);ma=i(Ni,"PretrainedConfig"),Ni.forEach(o),da=i(oo," for more information."),oo.forEach(o),pa=d(N),Oe=r(N,"P",{});var Fs=a(Oe);ha=i(Fs,"Currently, Mask2Former only supports the "),Lt=r(Fs,"A",{href:!0});var Wi=a(Lt);fa=i(Wi,"Swin Transformer"),Wi.forEach(o),ga=i(Fs," as backbone."),Fs.forEach(o),ua=d(N),k(de.$$.fragment,N),_a=d(N),pe=r(N,"DIV",{class:!0});var Ts=a(pe);k(Qe.$$.fragment,Ts),ba=d(Ts),He=r(Ts,"P",{});var Us=a(He);ya=i(Us,"Instantiate a "),Yt=r(Us,"A",{href:!0});var Ei=a(Yt);ka=i(Ei,"Mask2FormerConfig"),Ei.forEach(o),Ma=i(Us," (or a derived class) from a pre-trained backbone model configuration."),Us.forEach(o),Ts.forEach(o),va=d(N),he=r(N,"DIV",{class:!0});var js=a(he);k(De.$$.fragment,js),wa=d(js),Ke=r(js,"P",{});var Is=a(Ke);Fa=i(Is,"Serializes this instance to a Python dictionary. Override the default "),qt=r(Is,"A",{href:!0});var Zi=a(qt);Ta=i(Zi,"to_dict()"),Zi.forEach(o),Ua=i(Is,"."),Is.forEach(o),js.forEach(o),N.forEach(o),cs=d(t),ee=r(t,"H2",{class:!0});var Js=a(ee);fe=r(Js,"A",{id:!0,class:!0,href:!0});var Ci=a(fe);ko=r(Ci,"SPAN",{});var Si=a(ko);k(et.$$.fragment,Si),Si.forEach(o),Ci.forEach(o),ja=d(Js),Mo=r(Js,"SPAN",{});var Vi=a(Mo);Ia=i(Vi,"Mask2FormerModel"),Vi.forEach(o),Js.forEach(o),ms=d(t),B=r(t,"DIV",{class:!0});var so=a(B);k(tt.$$.fragment,so),Ja=d(so),ot=r(so,"P",{});var $s=a(ot);$a=i($s,`The bare Mask2Former Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),st=r($s,"A",{href:!0,rel:!0});var Xi=a(st);za=i(Xi,"torch.nn.Module"),Xi.forEach(o),xa=i($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.`),$s.forEach(o),Na=d(so),Z=r(so,"DIV",{class:!0});var Je=a(Z);k(rt.$$.fragment,Je),Wa=d(Je),te=r(Je,"P",{});var ro=a(te);Ea=i(ro,"The "),Ot=r(ro,"A",{href:!0});var Pi=a(Ot);Za=i(Pi,"Mask2FormerModel"),Pi.forEach(o),Ca=i(ro," forward method, overrides the "),vo=r(ro,"CODE",{});var Bi=a(vo);Sa=i(Bi,"__call__"),Bi.forEach(o),Va=i(ro," special method."),ro.forEach(o),Xa=d(Je),k(ge.$$.fragment,Je),Pa=d(Je),k(ue.$$.fragment,Je),Je.forEach(o),so.forEach(o),ds=d(t),oe=r(t,"H2",{class:!0});var zs=a(oe);_e=r(zs,"A",{id:!0,class:!0,href:!0});var Ri=a(_e);wo=r(Ri,"SPAN",{});var Gi=a(wo);k(at.$$.fragment,Gi),Gi.forEach(o),Ri.forEach(o),Ba=d(zs),Fo=r(zs,"SPAN",{});var Ai=a(Fo);Ra=i(Ai,"Mask2FormerForUniversalSegmentation"),Ai.forEach(o),zs.forEach(o),ps=d(t),R=r(t,"DIV",{class:!0});var ao=a(R);k(nt.$$.fragment,ao),Ga=d(ao),it=r(ao,"P",{});var xs=a(it);Aa=i(xs,`The Mask2Former Model with heads on top for instance/semantic/panoptic segmentation.
This model is a PyTorch `),lt=r(xs,"A",{href:!0,rel:!0});var Li=a(lt);La=i(Li,"torch.nn.Module"),Li.forEach(o),Ya=i(xs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),xs.forEach(o),qa=d(ao),I=r(ao,"DIV",{class:!0});var W=a(I);k(ct.$$.fragment,W),Oa=d(W),se=r(W,"P",{});var no=a(se);Qa=i(no,"The "),Qt=r(no,"A",{href:!0});var Yi=a(Qt);Ha=i(Yi,"Mask2FormerForUniversalSegmentation"),Yi.forEach(o),Da=i(no," forward method, overrides the "),To=r(no,"CODE",{});var qi=a(To);Ka=i(qi,"__call__"),qi.forEach(o),en=i(no," special method."),no.forEach(o),tn=d(W),k(be.$$.fragment,W),on=d(W),Uo=r(W,"P",{});var Oi=a(Uo);sn=i(Oi,"Examples:"),Oi.forEach(o),rn=d(W),k(ye.$$.fragment,W),an=d(W),k(ke.$$.fragment,W),nn=d(W),k(Me.$$.fragment,W),W.forEach(o),ao.forEach(o),hs=d(t),re=r(t,"H2",{class:!0});var Ns=a(re);ve=r(Ns,"A",{id:!0,class:!0,href:!0});var Qi=a(ve);jo=r(Qi,"SPAN",{});var Hi=a(jo);k(mt.$$.fragment,Hi),Hi.forEach(o),Qi.forEach(o),ln=d(Ns),Io=r(Ns,"SPAN",{});var Di=a(Io);cn=i(Di,"Mask2FormerImageProcessor"),Di.forEach(o),Ns.forEach(o),fs=d(t),U=r(t,"DIV",{class:!0});var $=a(U);k(dt.$$.fragment,$),mn=d($),Jo=r($,"P",{});var Ki=a(Jo);dn=i(Ki,`Constructs a Mask2Former image processor. The image processor can be used to prepare image(s) and optional targets
for the model.`),Ki.forEach(o),pn=d($),pt=r($,"P",{});var Ws=a(pt);hn=i(Ws,"This image processor inherits from "),$o=r(Ws,"CODE",{});var el=a($o);fn=i(el,"BaseImageProcessor"),el.forEach(o),gn=i(Ws,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Ws.forEach(o),un=d($),Ht=r($,"DIV",{class:!0});var tl=a(Ht);k(ht.$$.fragment,tl),tl.forEach(o),_n=d($),L=r($,"DIV",{class:!0});var io=a(L);k(ft.$$.fragment,io),bn=d(io),gt=r(io,"P",{});var Es=a(gt);yn=i(Es,"Pad images up to the largest image in a batch and create a corresponding "),zo=r(Es,"CODE",{});var ol=a(zo);kn=i(ol,"pixel_mask"),ol.forEach(o),Mn=i(Es,"."),Es.forEach(o),vn=d(io),G=r(io,"P",{});var $e=a(G);wn=i($e,`Mask2Former 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
`),xo=r($e,"CODE",{});var sl=a(xo);Fn=i(sl,"segmentation_maps = [[2,6,7,9]]"),sl.forEach(o),Tn=i($e,", the output will contain "),No=r($e,"CODE",{});var rl=a(No);Un=i(rl,"mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),rl.forEach(o),jn=i($e," (four binary masks) and "),Wo=r($e,"CODE",{});var al=a(Wo);In=i(al,"class_labels = [2,6,7,9]"),al.forEach(o),Jn=i($e,`, the labels for
each mask.`),$e.forEach(o),io.forEach(o),$n=d($),we=r($,"DIV",{class:!0});var Zs=a(we);k(ut.$$.fragment,Zs),zn=d(Zs),_t=r(Zs,"P",{});var Cs=a(_t);xn=i(Cs,"Converts the output of "),Dt=r(Cs,"A",{href:!0});var nl=a(Dt);Nn=i(nl,"Mask2FormerForUniversalSegmentation"),nl.forEach(o),Wn=i(Cs,` into semantic segmentation maps. Only supports
PyTorch.`),Cs.forEach(o),Zs.forEach(o),En=d($),Fe=r($,"DIV",{class:!0});var Ss=a(Fe);k(bt.$$.fragment,Ss),Zn=d(Ss),yt=r(Ss,"P",{});var Vs=a(yt);Cn=i(Vs,"Converts the output of "),Eo=r(Vs,"CODE",{});var il=a(Eo);Sn=i(il,"Mask2FormerForUniversalSegmentationOutput"),il.forEach(o),Vn=i(Vs,` into instance segmentation predictions.
Only supports PyTorch.`),Vs.forEach(o),Ss.forEach(o),Xn=d($),Te=r($,"DIV",{class:!0});var Xs=a(Te);k(kt.$$.fragment,Xs),Pn=d(Xs),Mt=r(Xs,"P",{});var Ps=a(Mt);Bn=i(Ps,"Converts the output of "),Zo=r(Ps,"CODE",{});var ll=a(Zo);Rn=i(ll,"Mask2FormerForUniversalSegmentationOutput"),ll.forEach(o),Gn=i(Ps,` into image panoptic segmentation
predictions. Only supports PyTorch.`),Ps.forEach(o),Xs.forEach(o),$.forEach(o),this.h()},h(){c(h,"name","hf:doc:metadata"),c(h,"content",JSON.stringify(Fl)),c(g,"id","mask2former"),c(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"),c(g,"href","#mask2former"),c(_,"class","relative group"),c(ae,"id","overview"),c(ae,"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"),c(ae,"href","#overview"),c(Y,"class","relative group"),c(Ne,"href","https://arxiv.org/abs/2112.01527"),c(Ne,"rel","nofollow"),c(Ft,"href","maskformer"),c(It,"href","maskformer"),c(Jt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor"),c($t,"href","/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoImageProcessor"),c(zt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_semantic_segmentation"),c(xt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_instance_segmentation"),c(Nt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_panoptic_segmentation"),c(Wt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation"),fl(ie.src,Ln="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/mask2former_architecture.jpg")||c(ie,"src",Ln),c(ie,"alt","drawing"),c(ie,"width","600"),c(Et,"href","https://arxiv.org/abs/2112.01527"),c(Ee,"href","https://huggingface.co/shivi"),c(Ee,"rel","nofollow"),c(Ze,"href","https://huggingface.co/adirik"),c(Ze,"rel","nofollow"),c(Ce,"href","https://github.com/facebookresearch/Mask2Former"),c(Ce,"rel","nofollow"),c(le,"id","resources"),c(le,"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"),c(le,"href","#resources"),c(q,"class","relative group"),c(Xe,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Mask2Former"),c(Xe,"rel","nofollow"),c(ce,"id","transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput"),c(ce,"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"),c(ce,"href","#transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput"),c(O,"class","relative group"),c(Vt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerModel"),c(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Xt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_semantic_segmentation"),c(Pt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_instance_segmentation"),c(Bt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_panoptic_segmentation"),c(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(me,"id","transformers.Mask2FormerConfig"),c(me,"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"),c(me,"href","#transformers.Mask2FormerConfig"),c(H,"class","relative group"),c(Rt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerModel"),c(qe,"href","https://huggingface.co/facebook/mask2former-swin-small-coco-instance"),c(qe,"rel","nofollow"),c(Gt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(At,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(Lt,"href","swin"),c(Yt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerConfig"),c(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(qt,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig.to_dict"),c(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(fe,"id","transformers.Mask2FormerModel"),c(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"),c(fe,"href","#transformers.Mask2FormerModel"),c(ee,"class","relative group"),c(st,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(st,"rel","nofollow"),c(Ot,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerModel"),c(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(_e,"id","transformers.Mask2FormerForUniversalSegmentation"),c(_e,"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"),c(_e,"href","#transformers.Mask2FormerForUniversalSegmentation"),c(oe,"class","relative group"),c(lt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(lt,"rel","nofollow"),c(Qt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation"),c(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ve,"id","transformers.Mask2FormerImageProcessor"),c(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ve,"href","#transformers.Mask2FormerImageProcessor"),c(re,"class","relative group"),c(Ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Dt,"href","/docs/transformers/v4.30.0/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation"),c(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(U,"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,b),M(l,b,null),e(_,u),e(_,S),e(S,Bs),f(t,Ao,p),f(t,Y,p),e(Y,ae),e(ae,lo),M(xe,lo,null),e(Y,Rs),e(Y,co),e(co,Gs),f(t,Lo,p),f(t,A,p),e(A,As),e(A,Ne),e(Ne,Ls),e(A,Ys),e(A,Ft),e(Ft,qs),e(A,Os),f(t,Yo,p),f(t,Tt,p),e(Tt,Qs),f(t,qo,p),f(t,Ut,p),e(Ut,mo),e(mo,Hs),f(t,Oo,p),f(t,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),e(Rt,oa),e(D,sa),e(D,qe),e(qe,ra),e(D,aa),e(j,na),e(j,K),e(K,ia),e(K,Gt),e(Gt,la),e(K,ca),e(K,At),e(At,ma),e(K,da),e(j,pa),e(j,Oe),e(Oe,ha),e(Oe,Lt),e(Lt,fa),e(Oe,ga),e(j,ua),M(de,j,null),e(j,_a),e(j,pe),M(Qe,pe,null),e(pe,ba),e(pe,He),e(He,ya),e(He,Yt),e(Yt,ka),e(He,Ma),e(j,va),e(j,he),M(De,he,null),e(he,wa),e(he,Ke),e(Ke,Fa),e(Ke,qt),e(qt,Ta),e(Ke,Ua),f(t,cs,p),f(t,ee,p),e(ee,fe),e(fe,ko),M(et,ko,null),e(ee,ja),e(ee,Mo),e(Mo,Ia),f(t,ms,p),f(t,B,p),M(tt,B,null),e(B,Ja),e(B,ot),e(ot,$a),e(ot,st),e(st,za),e(ot,xa),e(B,Na),e(B,Z),M(rt,Z,null),e(Z,Wa),e(Z,te),e(te,Ea),e(te,Ot),e(Ot,Za),e(te,Ca),e(te,vo),e(vo,Sa),e(te,Va),e(Z,Xa),M(ge,Z,null),e(Z,Pa),M(ue,Z,null),f(t,ds,p),f(t,oe,p),e(oe,_e),e(_e,wo),M(at,wo,null),e(oe,Ba),e(oe,Fo),e(Fo,Ra),f(t,ps,p),f(t,R,p),M(nt,R,null),e(R,Ga),e(R,it),e(it,Aa),e(it,lt),e(lt,La),e(it,Ya),e(R,qa),e(R,I),M(ct,I,null),e(I,Oa),e(I,se),e(se,Qa),e(se,Qt),e(Qt,Ha),e(se,Da),e(se,To),e(To,Ka),e(se,en),e(I,tn),M(be,I,null),e(I,on),e(I,Uo),e(Uo,sn),e(I,rn),M(ye,I,null),e(I,an),M(ke,I,null),e(I,nn),M(Me,I,null),f(t,hs,p),f(t,re,p),e(re,ve),e(ve,jo),M(mt,jo,null),e(re,ln),e(re,Io),e(Io,cn),f(t,fs,p),f(t,U,p),M(dt,U,null),e(U,mn),e(U,Jo),e(Jo,dn),e(U,pn),e(U,pt),e(pt,hn),e(pt,$o),e($o,fn),e(pt,gn),e(U,un),e(U,Ht),M(ht,Ht,null),e(U,_n),e(U,L),M(ft,L,null),e(L,bn),e(L,gt),e(gt,yn),e(gt,zo),e(zo,kn),e(gt,Mn),e(L,vn),e(L,G),e(G,wn),e(G,xo),e(xo,Fn),e(G,Tn),e(G,No),e(No,Un),e(G,jn),e(G,Wo),e(Wo,In),e(G,Jn),e(U,$n),e(U,we),M(ut,we,null),e(we,zn),e(we,_t),e(_t,xn),e(_t,Dt),e(Dt,Nn),e(_t,Wn),e(U,En),e(U,Fe),M(bt,Fe,null),e(Fe,Zn),e(Fe,yt),e(yt,Cn),e(yt,Eo),e(Eo,Sn),e(yt,Vn),e(U,Xn),e(U,Te),M(kt,Te,null),e(Te,Pn),e(Te,Mt),e(Mt,Bn),e(Mt,Zo),e(Zo,Rn),e(Mt,Gn),gs=!0},p(t,[p]){const vt={};p&2&&(vt.$$scope={dirty:p,ctx:t}),de.$set(vt);const Co={};p&2&&(Co.$$scope={dirty:p,ctx:t}),ge.$set(Co);const So={};p&2&&(So.$$scope={dirty:p,ctx:t}),ue.$set(So);const Vo={};p&2&&(Vo.$$scope={dirty:p,ctx:t}),be.$set(Vo);const wt={};p&2&&(wt.$$scope={dirty:p,ctx:t}),ye.$set(wt);const Xo={};p&2&&(Xo.$$scope={dirty:p,ctx:t}),ke.$set(Xo);const Po={};p&2&&(Po.$$scope={dirty:p,ctx:t}),Me.$set(Po)},i(t){gs||(v(l.$$.fragment,t),v(xe.$$.fragment,t),v(Se.$$.fragment,t),v(Pe.$$.fragment,t),v(Be.$$.fragment,t),v(Ge.$$.fragment,t),v(Le.$$.fragment,t),v(Ye.$$.fragment,t),v(de.$$.fragment,t),v(Qe.$$.fragment,t),v(De.$$.fragment,t),v(et.$$.fragment,t),v(tt.$$.fragment,t),v(rt.$$.fragment,t),v(ge.$$.fragment,t),v(ue.$$.fragment,t),v(at.$$.fragment,t),v(nt.$$.fragment,t),v(ct.$$.fragment,t),v(be.$$.fragment,t),v(ye.$$.fragment,t),v(ke.$$.fragment,t),v(Me.$$.fragment,t),v(mt.$$.fragment,t),v(dt.$$.fragment,t),v(ht.$$.fragment,t),v(ft.$$.fragment,t),v(ut.$$.fragment,t),v(bt.$$.fragment,t),v(kt.$$.fragment,t),gs=!0)},o(t){w(l.$$.fragment,t),w(xe.$$.fragment,t),w(Se.$$.fragment,t),w(Pe.$$.fragment,t),w(Be.$$.fragment,t),w(Ge.$$.fragment,t),w(Le.$$.fragment,t),w(Ye.$$.fragment,t),w(de.$$.fragment,t),w(Qe.$$.fragment,t),w(De.$$.fragment,t),w(et.$$.fragment,t),w(tt.$$.fragment,t),w(rt.$$.fragment,t),w(ge.$$.fragment,t),w(ue.$$.fragment,t),w(at.$$.fragment,t),w(nt.$$.fragment,t),w(ct.$$.fragment,t),w(be.$$.fragment,t),w(ye.$$.fragment,t),w(ke.$$.fragment,t),w(Me.$$.fragment,t),w(mt.$$.fragment,t),w(dt.$$.fragment,t),w(ht.$$.fragment,t),w(ft.$$.fragment,t),w(ut.$$.fragment,t),w(bt.$$.fragment,t),w(kt.$$.fragment,t),gs=!1},d(t){o(h),t&&o(T),t&&o(_),F(l),t&&o(Ao),t&&o(Y),F(xe),t&&o(Lo),t&&o(A),t&&o(Yo),t&&o(Tt),t&&o(qo),t&&o(Ut),t&&o(Oo),t&&o(jt),t&&o(Qo),t&&o(ne),t&&o(Ho),t&&o(ie),t&&o(Do),t&&o(We),t&&o(Ko),t&&o(E),t&&o(es),t&&o(q),F(Se),t&&o(ts),t&&o(Zt),t&&o(os),t&&o(Ct),t&&o(ss),t&&o(St),t&&o(rs),t&&o(O),F(Pe),t&&o(as),t&&o(Q),F(Be),t&&o(ns),t&&o(X),F(Ge),t&&o(is),t&&o(H),F(Le),t&&o(ls),t&&o(j),F(Ye),F(de),F(Qe),F(De),t&&o(cs),t&&o(ee),F(et),t&&o(ms),t&&o(B),F(tt),F(rt),F(ge),F(ue),t&&o(ds),t&&o(oe),F(at),t&&o(ps),t&&o(R),F(nt),F(ct),F(be),F(ye),F(ke),F(Me),t&&o(hs),t&&o(re),F(mt),t&&o(fs),t&&o(U),F(dt),F(ht),F(ft),F(ut),F(bt),F(kt)}}}const Fl={local:"mask2former",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput",title:"MaskFormer specific outputs"},{local:"transformers.Mask2FormerConfig",title:"Mask2FormerConfig"},{local:"transformers.Mask2FormerModel",title:"Mask2FormerModel"},{local:"transformers.Mask2FormerForUniversalSegmentation",title:"Mask2FormerForUniversalSegmentation"},{local:"transformers.Mask2FormerImageProcessor",title:"Mask2FormerImageProcessor"}],title:"Mask2Former"};function Tl(J){return gl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xl extends ml{constructor(h){super();dl(this,h,Tl,wl,pl,{})}}export{xl as default,Fl as metadata};
