import{S as Di,i as Ki,s as el,e as s,k as m,w as y,t as n,M as ol,c as r,d as t,m as d,a,x as k,h as i,b as c,N as tl,G as e,g as f,y as M,q as v,o as w,B as F,v as sl,L as Xt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Hi}from"../../chunks/Tip-hf-doc-builder.js";import{D as N}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Vt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as $e}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as St}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function rl(J){let h,T,_,g,b;return g=new Vt({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(t),_=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:Xt,i(l){b||(v(g.$$.fragment,l),b=!0)},o(l){w(g.$$.fragment,l),b=!1},d(l){l&&t(h),l&&t(_),F(g,l)}}}function al(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(t),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(t)},m(l,u){f(l,h,u),e(h,T),e(h,_),e(_,g),e(h,b)},d(l){l&&t(h)}}}function nl(J){let h,T,_,g,b;return g=new Vt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvSW1hZ2VQcm9jZXNzb3IlMkMlMjBNYXNrMkZvcm1lck1vZGVsJTBBJTBBJTIzJTIwbG9hZCUyMGltYWdlJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQSUyMyUyMGxvYWQlMjBpbWFnZSUyMHByZXByb2Nlc3NvciUyMGFuZCUyME1hc2syRm9ybWVyTW9kZWwlMjB0cmFpbmVkJTIwb24lMjBDT0NPJTIwaW5zdGFuY2UlMjBzZWdtZW50YXRpb24lMjBkYXRhc2V0JTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm1hc2syZm9ybWVyLXN3aW4tc21hbGwtY29jby1pbnN0YW5jZSUyMiklMEFtb2RlbCUyMCUzRCUyME1hc2syRm9ybWVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGbWFzazJmb3JtZXItc3dpbi1zbWFsbC1jb2NvLWluc3RhbmNlJTIyKSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwZm9yd2FyZCUyMHBhc3MlMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQSUyMyUyMG1vZGVsJTIwb3V0cHV0cyUyMGxhc3QlMjBoaWRkZW4lMjBzdGF0ZXMlMjBvZiUyMHNoYXBlJTIwKGJhdGNoX3NpemUlMkMlMjBudW1fcXVlcmllcyUyQyUyMGhpZGRlbl9zaXplKSUwQXByaW50KG91dHB1dHMudHJhbnNmb3JtZXJfZGVjb2Rlcl9sYXN0X2hpZGRlbl9zdGF0ZS5zaGFwZSk=",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(t),_=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:Xt,i(l){b||(v(g.$$.fragment,l),b=!0)},o(l){w(g.$$.fragment,l),b=!1},d(l){l&&t(h),l&&t(_),F(g,l)}}}function il(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(t),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(t)},m(l,u){f(l,h,u),e(h,T),e(h,_),e(_,g),e(h,b)},d(l){l&&t(h)}}}function ll(J){let h,T,_,g,b;return g=new Vt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1hc2syRm9ybWVyRm9yVW5pdmVyc2FsU2VnbWVudGF0aW9uJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQSUyMyUyMExvYWQlMjBNYXNrMkZvcm1lciUyMHRyYWluZWQlMjBvbiUyMENPQ08lMjBpbnN0YW5jZSUyMHNlZ21lbnRhdGlvbiUyMGRhdGFzZXQlMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGbWFzazJmb3JtZXItc3dpbi1zbWFsbC1jb2NvLWluc3RhbmNlJTIyKSUwQW1vZGVsJTIwJTNEJTIwTWFzazJGb3JtZXJGb3JVbml2ZXJzYWxTZWdtZW50YXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmZhY2Vib29rJTJGbWFzazJmb3JtZXItc3dpbi1zbWFsbC1jb2NvLWluc3RhbmNlJTIyJTBBKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBJTIzJTIwTW9kZWwlMjBwcmVkaWN0cyUyMGNsYXNzX3F1ZXJpZXNfbG9naXRzJTIwb2YlMjBzaGFwZSUyMCU2MChiYXRjaF9zaXplJTJDJTIwbnVtX3F1ZXJpZXMpJTYwJTBBJTIzJTIwYW5kJTIwbWFza3NfcXVlcmllc19sb2dpdHMlMjBvZiUyMHNoYXBlJTIwJTYwKGJhdGNoX3NpemUlMkMlMjBudW1fcXVlcmllcyUyQyUyMGhlaWdodCUyQyUyMHdpZHRoKSU2MCUwQWNsYXNzX3F1ZXJpZXNfbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5jbGFzc19xdWVyaWVzX2xvZ2l0cyUwQW1hc2tzX3F1ZXJpZXNfbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5tYXNrc19xdWVyaWVzX2xvZ2l0cyUwQSUwQSUyMyUyMFBlcmZvcm0lMjBwb3N0LXByb2Nlc3NpbmclMjB0byUyMGdldCUyMGluc3RhbmNlJTIwc2VnbWVudGF0aW9uJTIwbWFwJTBBcHJlZF9pbnN0YW5jZV9tYXAlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IucG9zdF9wcm9jZXNzX3NlbWFudGljX3NlZ21lbnRhdGlvbiglMEElMjAlMjAlMjAlMjBvdXRwdXRzJTJDJTIwdGFyZ2V0X3NpemVzJTNEJTVCaW1hZ2Uuc2l6ZSU1QiUzQSUzQS0xJTVEJTVEJTBBKSU1QjAlNUQlMEFwcmludChwcmVkX2luc3RhbmNlX21hcC5zaGFwZSk=",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(t),_=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:Xt,i(l){b||(v(g.$$.fragment,l),b=!0)},o(l){w(g.$$.fragment,l),b=!1},d(l){l&&t(h),l&&t(_),F(g,l)}}}function cl(J){let h,T,_,g,b;return g=new Vt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1hc2syRm9ybWVyRm9yVW5pdmVyc2FsU2VnbWVudGF0aW9uJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQSUyMyUyMExvYWQlMjBNYXNrMkZvcm1lciUyMHRyYWluZWQlMjBvbiUyMEFERTIwayUyMHNlbWFudGljJTIwc2VnbWVudGF0aW9uJTIwZGF0YXNldCUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZtYXNrMmZvcm1lci1zd2luLXNtYWxsLWFkZS1zZW1hbnRpYyUyMiklMEFtb2RlbCUyMCUzRCUyME1hc2syRm9ybWVyRm9yVW5pdmVyc2FsU2VnbWVudGF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm1hc2syZm9ybWVyLXN3aW4tc21hbGwtYWRlLXNlbWFudGljJTIyKSUwQSUwQXVybCUyMCUzRCUyMCglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZml4dHVyZXNfYWRlMjBrJTJGcmVzb2x2ZSUyRm1haW4lMkZBREVfdmFsXzAwMDAwMDAxLmpwZyUyMiUwQSklMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBJTIzJTIwTW9kZWwlMjBwcmVkaWN0cyUyMGNsYXNzX3F1ZXJpZXNfbG9naXRzJTIwb2YlMjBzaGFwZSUyMCU2MChiYXRjaF9zaXplJTJDJTIwbnVtX3F1ZXJpZXMpJTYwJTBBJTIzJTIwYW5kJTIwbWFza3NfcXVlcmllc19sb2dpdHMlMjBvZiUyMHNoYXBlJTIwJTYwKGJhdGNoX3NpemUlMkMlMjBudW1fcXVlcmllcyUyQyUyMGhlaWdodCUyQyUyMHdpZHRoKSU2MCUwQWNsYXNzX3F1ZXJpZXNfbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5jbGFzc19xdWVyaWVzX2xvZ2l0cyUwQW1hc2tzX3F1ZXJpZXNfbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5tYXNrc19xdWVyaWVzX2xvZ2l0cyUwQSUwQSUyMyUyMFBlcmZvcm0lMjBwb3N0LXByb2Nlc3NpbmclMjB0byUyMGdldCUyMHNlbWFudGljJTIwc2VnbWVudGF0aW9uJTIwbWFwJTBBcHJlZF9zZW1hbnRpY19tYXAlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IucG9zdF9wcm9jZXNzX3NlbWFudGljX3NlZ21lbnRhdGlvbiglMEElMjAlMjAlMjAlMjBvdXRwdXRzJTJDJTIwdGFyZ2V0X3NpemVzJTNEJTVCaW1hZ2Uuc2l6ZSU1QiUzQSUzQS0xJTVEJTVEJTBBKSU1QjAlNUQlMEFwcmludChwcmVkX3NlbWFudGljX21hcC5zaGFwZSk=",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(t),_=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:Xt,i(l){b||(v(g.$$.fragment,l),b=!0)},o(l){w(g.$$.fragment,l),b=!1},d(l){l&&t(h),l&&t(_),F(g,l)}}}function ml(J){let h,T,_,g,b;return g=new Vt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1hc2syRm9ybWVyRm9yVW5pdmVyc2FsU2VnbWVudGF0aW9uJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQSUyMyUyMExvYWQlMjBNYXNrMkZvcm1lciUyMHRyYWluZWQlMjBvbiUyMENpdHlTY2FwZXMlMjBwYW5vcHRpYyUyMHNlZ21lbnRhdGlvbiUyMGRhdGFzZXQlMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGbWFzazJmb3JtZXItc3dpbi1zbWFsbC1jaXR5c2NhcGVzLXBhbm9wdGljJTIyKSUwQW1vZGVsJTIwJTNEJTIwTWFzazJGb3JtZXJGb3JVbml2ZXJzYWxTZWdtZW50YXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmZhY2Vib29rJTJGbWFzazJmb3JtZXItc3dpbi1zbWFsbC1jaXR5c2NhcGVzLXBhbm9wdGljJTIyJTBBKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGY2RuLW1lZGlhLmh1Z2dpbmdmYWNlLmNvJTJGSW5mZXJlbmNlLUFQSSUyRlNhbXBsZS1yZXN1bHRzLW9uLXRoZS1DaXR5c2NhcGVzLWRhdGFzZXQtVGhlLWFib3ZlLWltYWdlcy1zaG93LWhvdy1vdXItbWV0aG9kLWNhbi1oYW5kbGUucG5nJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQSUyMyUyME1vZGVsJTIwcHJlZGljdHMlMjBjbGFzc19xdWVyaWVzX2xvZ2l0cyUyMG9mJTIwc2hhcGUlMjAlNjAoYmF0Y2hfc2l6ZSUyQyUyMG51bV9xdWVyaWVzKSU2MCUwQSUyMyUyMGFuZCUyMG1hc2tzX3F1ZXJpZXNfbG9naXRzJTIwb2YlMjBzaGFwZSUyMCU2MChiYXRjaF9zaXplJTJDJTIwbnVtX3F1ZXJpZXMlMkMlMjBoZWlnaHQlMkMlMjB3aWR0aCklNjAlMEFjbGFzc19xdWVyaWVzX2xvZ2l0cyUyMCUzRCUyMG91dHB1dHMuY2xhc3NfcXVlcmllc19sb2dpdHMlMEFtYXNrc19xdWVyaWVzX2xvZ2l0cyUyMCUzRCUyMG91dHB1dHMubWFza3NfcXVlcmllc19sb2dpdHMlMEElMEElMjMlMjBQZXJmb3JtJTIwcG9zdC1wcm9jZXNzaW5nJTIwdG8lMjBnZXQlMjBwYW5vcHRpYyUyMHNlZ21lbnRhdGlvbiUyMG1hcCUwQXByZWRfcGFub3B0aWNfbWFwJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yLnBvc3RfcHJvY2Vzc19wYW5vcHRpY19zZWdtZW50YXRpb24oJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyQyUyMHRhcmdldF9zaXplcyUzRCU1QmltYWdlLnNpemUlNUIlM0ElM0EtMSU1RCU1RCUwQSklNUIwJTVEJTVCJTIyc2VnbWVudGF0aW9uJTIyJTVEJTBBcHJpbnQocHJlZF9wYW5vcHRpY19tYXAuc2hhcGUp",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("Panoptic segmentation example:"),_=m(),y(g.$$.fragment)},l(l){h=r(l,"P",{});var u=a(h);T=i(u,"Panoptic segmentation example:"),u.forEach(t),_=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:Xt,i(l){b||(v(g.$$.fragment,l),b=!0)},o(l){w(g.$$.fragment,l),b=!1},d(l){l&&t(h),l&&t(_),F(g,l)}}}function dl(J){let h,T,_,g,b,l,u,S,Zs,Pt,Y,ae,at,ze,Cs,nt,Ss,Bt,A,Xs,xe,Vs,Ps,vo,Bs,Rs,Rt,wo,Gs,Gt,Fo,it,As,At,To,Ls,Lt,ne,X,Ys,Uo,qs,Os,jo,Qs,Hs,Io,Ds,Ks,er,z,or,Jo,tr,sr,$o,rr,ar,zo,nr,ir,xo,lr,cr,lt,mr,dr,Yt,ie,En,qt,Ne,pr,No,hr,Ot,W,fr,We,gr,ur,Ee,_r,br,Ze,yr,kr,Qt,q,le,ct,Ce,Mr,mt,vr,Ht,Wo,wr,Dt,Eo,Se,Fr,Xe,Tr,Ur,Kt,Zo,jr,es,O,ce,dt,Ve,Ir,pt,Jr,os,Q,Pe,$r,Be,zr,Co,xr,Nr,ts,V,Re,Wr,Ge,Er,ht,Zr,Cr,Sr,P,Xr,So,Vr,Pr,Xo,Br,Rr,Vo,Gr,Ar,ss,H,me,ft,Ae,Lr,gt,Yr,rs,I,Le,qr,D,Or,Po,Qr,Hr,Ye,Dr,Kr,ea,K,oa,Bo,ta,sa,Ro,ra,aa,na,qe,ia,Go,la,ca,ma,de,da,pe,Oe,pa,Qe,ha,Ao,fa,ga,as,ee,he,ut,He,ua,_t,_a,ns,B,De,ba,Ke,ya,eo,ka,Ma,va,E,oo,wa,oe,Fa,Lo,Ta,Ua,bt,ja,Ia,Ja,fe,$a,ge,is,te,ue,yt,to,za,kt,xa,ls,R,so,Na,ro,Wa,ao,Ea,Za,Ca,j,no,Sa,se,Xa,Yo,Va,Pa,Mt,Ba,Ra,Ga,_e,Aa,vt,La,Ya,be,qa,ye,Oa,ke,cs,re,Me,wt,io,Qa,Ft,Ha,ms,U,lo,Da,Tt,Ka,en,co,on,Ut,tn,sn,rn,qo,mo,an,L,po,nn,ho,ln,jt,cn,mn,dn,G,pn,It,hn,fn,Jt,gn,un,$t,_n,bn,yn,ve,fo,kn,go,Mn,Oo,vn,wn,Fn,we,uo,Tn,_o,Un,zt,jn,In,Jn,Fe,bo,$n,yo,zn,xt,xn,Nn,ds;return l=new $e({}),ze=new $e({}),Ce=new $e({}),Ve=new $e({}),Pe=new N({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.32.0/src/transformers/models/mask2former/modeling_mask2former.py#L146"}}),Re=new N({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.32.0/src/transformers/models/mask2former/modeling_mask2former.py#L192"}}),Ae=new $e({}),Le=new N({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.32.0/src/transformers/models/mask2former/configuration_mask2former.py#L33"}}),de=new St({props:{anchor:"transformers.Mask2FormerConfig.example",$$slots:{default:[rl]},$$scope:{ctx:J}}}),Oe=new N({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.32.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The backbone configuration.`,name:"backbone_config"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/mask2former/configuration_mask2former.py#L217",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerConfig"
>Mask2FormerConfig</a></p>
`}}),He=new $e({}),De=new N({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.32.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.32.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.32.0/src/transformers/models/mask2former/modeling_mask2former.py#L2212"}}),oo=new N({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.32.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>AutoImageProcessor.preprocess</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.32.0/src/transformers/models/mask2former/modeling_mask2former.py#L2222",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.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.32.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.32.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>
`}}),fe=new Hi({props:{$$slots:{default:[al]},$$scope:{ctx:J}}}),ge=new St({props:{anchor:"transformers.Mask2FormerModel.forward.example",$$slots:{default:[nl]},$$scope:{ctx:J}}}),to=new $e({}),so=new N({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.32.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.32.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.32.0/src/transformers/models/mask2former/modeling_mask2former.py#L2316"}}),no=new N({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.32.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>AutoImageProcessor.preprocess</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.32.0/src/transformers/models/mask2former/modeling_mask2former.py#L2369",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.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.32.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.32.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>
`}}),_e=new Hi({props:{$$slots:{default:[il]},$$scope:{ctx:J}}}),be=new St({props:{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.example",$$slots:{default:[ll]},$$scope:{ctx:J}}}),ye=new St({props:{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.example-2",$$slots:{default:[cl]},$$scope:{ctx:J}}}),ke=new St({props:{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.example-3",$$slots:{default:[ml]},$$scope:{ctx:J}}}),io=new $e({}),lo=new N({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.32.0/src/transformers/models/mask2former/image_processing_mask2former.py#L342"}}),mo=new N({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[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/mask2former/image_processing_mask2former.py#L665"}}),po=new N({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[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"}],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.32.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"},{anchor:"transformers.Mask2FormerImageProcessor.encode_inputs.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format of the input image. If not provided, it will be inferred.`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/mask2former/image_processing_mask2former.py#L853",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a> with the following fields:</p>
<ul>
<li><strong>pixel_values</strong> \u2014 Pixel values to be fed to a model.</li>
<li><strong>pixel_mask</strong> \u2014 Pixel mask to be fed to a model (when <code>=True</code> or if <code>pixel_mask</code> is in
<code>self.model_input_names</code>).</li>
<li><strong>mask_labels</strong> \u2014 Optional list of mask labels of shape <code>(labels, height, width)</code> to be fed to a model
(when <code>annotations</code> are provided).</li>
<li><strong>class_labels</strong> \u2014 Optional list of class labels of shape <code>(labels)</code> to be fed to a model (when
<code>annotations</code> are provided). They identify the labels of <code>mask_labels</code>, e.g. the label of
<code>mask_labels[i][j]</code> if <code>class_labels[i][j]</code>.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.32.0/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),fo=new N({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.32.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.32.0/src/transformers/models/mask2former/image_processing_mask2former.py#L956",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>
`}}),uo=new N({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.32.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.32.0/src/transformers/models/mask2former/image_processing_mask2former.py#L1011",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>
`}}),bo=new N({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.32.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.32.0/src/transformers/models/mask2former/image_processing_mask2former.py#L1130",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"),Zs=n("Mask2Former"),Pt=m(),Y=s("h2"),ae=s("a"),at=s("span"),y(ze.$$.fragment),Cs=m(),nt=s("span"),Ss=n("Overview"),Bt=m(),A=s("p"),Xs=n("The Mask2Former model was proposed in "),xe=s("a"),Vs=n("Masked-attention Mask Transformer for Universal Image Segmentation"),Ps=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 "),vo=s("a"),Bs=n("MaskFormer"),Rs=n("."),Rt=m(),wo=s("p"),Gs=n("The abstract from the paper is the following:"),Gt=m(),Fo=s("p"),it=s("em"),As=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).`),At=m(),To=s("p"),Ls=n("Tips:"),Lt=m(),ne=s("ul"),X=s("li"),Ys=n("Mask2Former uses the same preprocessing and postprocessing steps as "),Uo=s("a"),qs=n("MaskFormer"),Os=n(". Use "),jo=s("a"),Qs=n("Mask2FormerImageProcessor"),Hs=n(" or "),Io=s("a"),Ds=n("AutoImageProcessor"),Ks=n(" to prepare images and optional targets for the model."),er=m(),z=s("li"),or=n("To get the final segmentation, depending on the task, you can call "),Jo=s("a"),tr=n("post_process_semantic_segmentation()"),sr=n(" or "),$o=s("a"),rr=n("post_process_instance_segmentation()"),ar=n(" or "),zo=s("a"),nr=n("post_process_panoptic_segmentation()"),ir=n(". All three tasks can be solved using "),xo=s("a"),lr=n("Mask2FormerForUniversalSegmentation"),cr=n(" output, panoptic segmentation accepts an optional "),lt=s("code"),mr=n("label_ids_to_fuse"),dr=n(" argument to fuse instances of the target object/s (e.g. sky) together."),Yt=m(),ie=s("img"),qt=m(),Ne=s("small"),pr=n("Mask2Former architecture. Taken from the "),No=s("a"),hr=n("original paper."),Ot=m(),W=s("p"),fr=n("This model was contributed by "),We=s("a"),gr=n("Shivalika Singh"),ur=n(" and "),Ee=s("a"),_r=n("Alara Dirik"),br=n(". The original code can be found "),Ze=s("a"),yr=n("here"),kr=n("."),Qt=m(),q=s("h2"),le=s("a"),ct=s("span"),y(Ce.$$.fragment),Mr=m(),mt=s("span"),vr=n("Resources"),Ht=m(),Wo=s("p"),wr=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Mask2Former."),Dt=m(),Eo=s("ul"),Se=s("li"),Fr=n("Demo notebooks regarding inference + fine-tuning Mask2Former on custom data can be found "),Xe=s("a"),Tr=n("here"),Ur=n("."),Kt=m(),Zo=s("p"),jr=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.`),es=m(),O=s("h2"),ce=s("a"),dt=s("span"),y(Ve.$$.fragment),Ir=m(),pt=s("span"),Jr=n("MaskFormer specific outputs"),os=m(),Q=s("div"),y(Pe.$$.fragment),$r=m(),Be=s("p"),zr=n("Class for outputs of "),Co=s("a"),xr=n("Mask2FormerModel"),Nr=n(". This class returns all the needed hidden states to compute the logits."),ts=m(),V=s("div"),y(Re.$$.fragment),Wr=m(),Ge=s("p"),Er=n("Class for outputs of "),ht=s("code"),Zr=n("Mask2FormerForUniversalSegmentationOutput"),Cr=n("."),Sr=m(),P=s("p"),Xr=n("This output can be directly passed to "),So=s("a"),Vr=n("post_process_semantic_segmentation()"),Pr=n(` or
`),Xo=s("a"),Br=n("post_process_instance_segmentation()"),Rr=n(` or
`),Vo=s("a"),Gr=n("post_process_panoptic_segmentation()"),Ar=n(" to compute final segmentation maps. Please, see\n[`~Mask2FormerImageProcessor] for details regarding usage."),ss=m(),H=s("h2"),me=s("a"),ft=s("span"),y(Ae.$$.fragment),Lr=m(),gt=s("span"),Yr=n("Mask2FormerConfig"),rs=m(),I=s("div"),y(Le.$$.fragment),qr=m(),D=s("p"),Or=n("This is the configuration class to store the configuration of a "),Po=s("a"),Qr=n("Mask2FormerModel"),Hr=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
`),Ye=s("a"),Dr=n("facebook/mask2former-swin-small-coco-instance"),Kr=n(`
architecture.`),ea=m(),K=s("p"),oa=n("Configuration objects inherit from "),Bo=s("a"),ta=n("PretrainedConfig"),sa=n(` and can be used to control the model outputs. Read the
documentation from `),Ro=s("a"),ra=n("PretrainedConfig"),aa=n(" for more information."),na=m(),qe=s("p"),ia=n("Currently, Mask2Former only supports the "),Go=s("a"),la=n("Swin Transformer"),ca=n(" as backbone."),ma=m(),y(de.$$.fragment),da=m(),pe=s("div"),y(Oe.$$.fragment),pa=m(),Qe=s("p"),ha=n("Instantiate a "),Ao=s("a"),fa=n("Mask2FormerConfig"),ga=n(" (or a derived class) from a pre-trained backbone model configuration."),as=m(),ee=s("h2"),he=s("a"),ut=s("span"),y(He.$$.fragment),ua=m(),_t=s("span"),_a=n("Mask2FormerModel"),ns=m(),B=s("div"),y(De.$$.fragment),ba=m(),Ke=s("p"),ya=n(`The bare Mask2Former Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),eo=s("a"),ka=n("torch.nn.Module"),Ma=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.`),va=m(),E=s("div"),y(oo.$$.fragment),wa=m(),oe=s("p"),Fa=n("The "),Lo=s("a"),Ta=n("Mask2FormerModel"),Ua=n(" forward method, overrides the "),bt=s("code"),ja=n("__call__"),Ia=n(" special method."),Ja=m(),y(fe.$$.fragment),$a=m(),y(ge.$$.fragment),is=m(),te=s("h2"),ue=s("a"),yt=s("span"),y(to.$$.fragment),za=m(),kt=s("span"),xa=n("Mask2FormerForUniversalSegmentation"),ls=m(),R=s("div"),y(so.$$.fragment),Na=m(),ro=s("p"),Wa=n(`The Mask2Former Model with heads on top for instance/semantic/panoptic segmentation.
This model is a PyTorch `),ao=s("a"),Ea=n("torch.nn.Module"),Za=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.`),Ca=m(),j=s("div"),y(no.$$.fragment),Sa=m(),se=s("p"),Xa=n("The "),Yo=s("a"),Va=n("Mask2FormerForUniversalSegmentation"),Pa=n(" forward method, overrides the "),Mt=s("code"),Ba=n("__call__"),Ra=n(" special method."),Ga=m(),y(_e.$$.fragment),Aa=m(),vt=s("p"),La=n("Examples:"),Ya=m(),y(be.$$.fragment),qa=m(),y(ye.$$.fragment),Oa=m(),y(ke.$$.fragment),cs=m(),re=s("h2"),Me=s("a"),wt=s("span"),y(io.$$.fragment),Qa=m(),Ft=s("span"),Ha=n("Mask2FormerImageProcessor"),ms=m(),U=s("div"),y(lo.$$.fragment),Da=m(),Tt=s("p"),Ka=n(`Constructs a Mask2Former image processor. The image processor can be used to prepare image(s) and optional targets
for the model.`),en=m(),co=s("p"),on=n("This image processor inherits from "),Ut=s("code"),tn=n("BaseImageProcessor"),sn=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),rn=m(),qo=s("div"),y(mo.$$.fragment),an=m(),L=s("div"),y(po.$$.fragment),nn=m(),ho=s("p"),ln=n("Pad images up to the largest image in a batch and create a corresponding "),jt=s("code"),cn=n("pixel_mask"),mn=n("."),dn=m(),G=s("p"),pn=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
`),It=s("code"),hn=n("segmentation_maps = [[2,6,7,9]]"),fn=n(", the output will contain "),Jt=s("code"),gn=n("mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),un=n(" (four binary masks) and "),$t=s("code"),_n=n("class_labels = [2,6,7,9]"),bn=n(`, the labels for
each mask.`),yn=m(),ve=s("div"),y(fo.$$.fragment),kn=m(),go=s("p"),Mn=n("Converts the output of "),Oo=s("a"),vn=n("Mask2FormerForUniversalSegmentation"),wn=n(` into semantic segmentation maps. Only supports
PyTorch.`),Fn=m(),we=s("div"),y(uo.$$.fragment),Tn=m(),_o=s("p"),Un=n("Converts the output of "),zt=s("code"),jn=n("Mask2FormerForUniversalSegmentationOutput"),In=n(` into instance segmentation predictions.
Only supports PyTorch.`),Jn=m(),Fe=s("div"),y(bo.$$.fragment),$n=m(),yo=s("p"),zn=n("Converts the output of "),xt=s("code"),xn=n("Mask2FormerForUniversalSegmentationOutput"),Nn=n(` into image panoptic segmentation
predictions. Only supports PyTorch.`),this.h()},l(o){const p=ol('[data-svelte="svelte-1phssyn"]',document.head);h=r(p,"META",{name:!0,content:!0}),p.forEach(t),T=d(o),_=r(o,"H1",{class:!0});var ko=a(_);g=r(ko,"A",{id:!0,class:!0,href:!0});var Nt=a(g);b=r(Nt,"SPAN",{});var Wt=a(b);k(l.$$.fragment,Wt),Wt.forEach(t),Nt.forEach(t),u=d(ko),S=r(ko,"SPAN",{});var Et=a(S);Zs=i(Et,"Mask2Former"),Et.forEach(t),ko.forEach(t),Pt=d(o),Y=r(o,"H2",{class:!0});var Mo=a(Y);ae=r(Mo,"A",{id:!0,class:!0,href:!0});var Zt=a(ae);at=r(Zt,"SPAN",{});var Ct=a(at);k(ze.$$.fragment,Ct),Ct.forEach(t),Zt.forEach(t),Cs=d(Mo),nt=r(Mo,"SPAN",{});var Zn=a(nt);Ss=i(Zn,"Overview"),Zn.forEach(t),Mo.forEach(t),Bt=d(o),A=r(o,"P",{});var Qo=a(A);Xs=i(Qo,"The Mask2Former model was proposed in "),xe=r(Qo,"A",{href:!0,rel:!0});var Cn=a(xe);Vs=i(Cn,"Masked-attention Mask Transformer for Universal Image Segmentation"),Cn.forEach(t),Ps=i(Qo," 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 "),vo=r(Qo,"A",{href:!0});var Sn=a(vo);Bs=i(Sn,"MaskFormer"),Sn.forEach(t),Rs=i(Qo,"."),Qo.forEach(t),Rt=d(o),wo=r(o,"P",{});var Xn=a(wo);Gs=i(Xn,"The abstract from the paper is the following:"),Xn.forEach(t),Gt=d(o),Fo=r(o,"P",{});var Vn=a(Fo);it=r(Vn,"EM",{});var Pn=a(it);As=i(Pn,`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).`),Pn.forEach(t),Vn.forEach(t),At=d(o),To=r(o,"P",{});var Bn=a(To);Ls=i(Bn,"Tips:"),Bn.forEach(t),Lt=d(o),ne=r(o,"UL",{});var ps=a(ne);X=r(ps,"LI",{});var Te=a(X);Ys=i(Te,"Mask2Former uses the same preprocessing and postprocessing steps as "),Uo=r(Te,"A",{href:!0});var Rn=a(Uo);qs=i(Rn,"MaskFormer"),Rn.forEach(t),Os=i(Te,". Use "),jo=r(Te,"A",{href:!0});var Gn=a(jo);Qs=i(Gn,"Mask2FormerImageProcessor"),Gn.forEach(t),Hs=i(Te," or "),Io=r(Te,"A",{href:!0});var An=a(Io);Ds=i(An,"AutoImageProcessor"),An.forEach(t),Ks=i(Te," to prepare images and optional targets for the model."),Te.forEach(t),er=d(ps),z=r(ps,"LI",{});var Z=a(z);or=i(Z,"To get the final segmentation, depending on the task, you can call "),Jo=r(Z,"A",{href:!0});var Ln=a(Jo);tr=i(Ln,"post_process_semantic_segmentation()"),Ln.forEach(t),sr=i(Z," or "),$o=r(Z,"A",{href:!0});var Yn=a($o);rr=i(Yn,"post_process_instance_segmentation()"),Yn.forEach(t),ar=i(Z," or "),zo=r(Z,"A",{href:!0});var qn=a(zo);nr=i(qn,"post_process_panoptic_segmentation()"),qn.forEach(t),ir=i(Z,". All three tasks can be solved using "),xo=r(Z,"A",{href:!0});var On=a(xo);lr=i(On,"Mask2FormerForUniversalSegmentation"),On.forEach(t),cr=i(Z," output, panoptic segmentation accepts an optional "),lt=r(Z,"CODE",{});var Qn=a(lt);mr=i(Qn,"label_ids_to_fuse"),Qn.forEach(t),dr=i(Z," argument to fuse instances of the target object/s (e.g. sky) together."),Z.forEach(t),ps.forEach(t),Yt=d(o),ie=r(o,"IMG",{src:!0,alt:!0,width:!0}),qt=d(o),Ne=r(o,"SMALL",{});var Wn=a(Ne);pr=i(Wn,"Mask2Former architecture. Taken from the "),No=r(Wn,"A",{href:!0});var Hn=a(No);hr=i(Hn,"original paper."),Hn.forEach(t),Wn.forEach(t),Ot=d(o),W=r(o,"P",{});var Ue=a(W);fr=i(Ue,"This model was contributed by "),We=r(Ue,"A",{href:!0,rel:!0});var Dn=a(We);gr=i(Dn,"Shivalika Singh"),Dn.forEach(t),ur=i(Ue," and "),Ee=r(Ue,"A",{href:!0,rel:!0});var Kn=a(Ee);_r=i(Kn,"Alara Dirik"),Kn.forEach(t),br=i(Ue,". The original code can be found "),Ze=r(Ue,"A",{href:!0,rel:!0});var ei=a(Ze);yr=i(ei,"here"),ei.forEach(t),kr=i(Ue,"."),Ue.forEach(t),Qt=d(o),q=r(o,"H2",{class:!0});var hs=a(q);le=r(hs,"A",{id:!0,class:!0,href:!0});var oi=a(le);ct=r(oi,"SPAN",{});var ti=a(ct);k(Ce.$$.fragment,ti),ti.forEach(t),oi.forEach(t),Mr=d(hs),mt=r(hs,"SPAN",{});var si=a(mt);vr=i(si,"Resources"),si.forEach(t),hs.forEach(t),Ht=d(o),Wo=r(o,"P",{});var ri=a(Wo);wr=i(ri,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Mask2Former."),ri.forEach(t),Dt=d(o),Eo=r(o,"UL",{});var ai=a(Eo);Se=r(ai,"LI",{});var fs=a(Se);Fr=i(fs,"Demo notebooks regarding inference + fine-tuning Mask2Former on custom data can be found "),Xe=r(fs,"A",{href:!0,rel:!0});var ni=a(Xe);Tr=i(ni,"here"),ni.forEach(t),Ur=i(fs,"."),fs.forEach(t),ai.forEach(t),Kt=d(o),Zo=r(o,"P",{});var ii=a(Zo);jr=i(ii,`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.`),ii.forEach(t),es=d(o),O=r(o,"H2",{class:!0});var gs=a(O);ce=r(gs,"A",{id:!0,class:!0,href:!0});var li=a(ce);dt=r(li,"SPAN",{});var ci=a(dt);k(Ve.$$.fragment,ci),ci.forEach(t),li.forEach(t),Ir=d(gs),pt=r(gs,"SPAN",{});var mi=a(pt);Jr=i(mi,"MaskFormer specific outputs"),mi.forEach(t),gs.forEach(t),os=d(o),Q=r(o,"DIV",{class:!0});var us=a(Q);k(Pe.$$.fragment,us),$r=d(us),Be=r(us,"P",{});var _s=a(Be);zr=i(_s,"Class for outputs of "),Co=r(_s,"A",{href:!0});var di=a(Co);xr=i(di,"Mask2FormerModel"),di.forEach(t),Nr=i(_s,". This class returns all the needed hidden states to compute the logits."),_s.forEach(t),us.forEach(t),ts=d(o),V=r(o,"DIV",{class:!0});var Ho=a(V);k(Re.$$.fragment,Ho),Wr=d(Ho),Ge=r(Ho,"P",{});var bs=a(Ge);Er=i(bs,"Class for outputs of "),ht=r(bs,"CODE",{});var pi=a(ht);Zr=i(pi,"Mask2FormerForUniversalSegmentationOutput"),pi.forEach(t),Cr=i(bs,"."),bs.forEach(t),Sr=d(Ho),P=r(Ho,"P",{});var je=a(P);Xr=i(je,"This output can be directly passed to "),So=r(je,"A",{href:!0});var hi=a(So);Vr=i(hi,"post_process_semantic_segmentation()"),hi.forEach(t),Pr=i(je,` or
`),Xo=r(je,"A",{href:!0});var fi=a(Xo);Br=i(fi,"post_process_instance_segmentation()"),fi.forEach(t),Rr=i(je,` or
`),Vo=r(je,"A",{href:!0});var gi=a(Vo);Gr=i(gi,"post_process_panoptic_segmentation()"),gi.forEach(t),Ar=i(je," to compute final segmentation maps. Please, see\n[`~Mask2FormerImageProcessor] for details regarding usage."),je.forEach(t),Ho.forEach(t),ss=d(o),H=r(o,"H2",{class:!0});var ys=a(H);me=r(ys,"A",{id:!0,class:!0,href:!0});var ui=a(me);ft=r(ui,"SPAN",{});var _i=a(ft);k(Ae.$$.fragment,_i),_i.forEach(t),ui.forEach(t),Lr=d(ys),gt=r(ys,"SPAN",{});var bi=a(gt);Yr=i(bi,"Mask2FormerConfig"),bi.forEach(t),ys.forEach(t),rs=d(o),I=r(o,"DIV",{class:!0});var C=a(I);k(Le.$$.fragment,C),qr=d(C),D=r(C,"P",{});var Do=a(D);Or=i(Do,"This is the configuration class to store the configuration of a "),Po=r(Do,"A",{href:!0});var yi=a(Po);Qr=i(yi,"Mask2FormerModel"),yi.forEach(t),Hr=i(Do,`. 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
`),Ye=r(Do,"A",{href:!0,rel:!0});var ki=a(Ye);Dr=i(ki,"facebook/mask2former-swin-small-coco-instance"),ki.forEach(t),Kr=i(Do,`
architecture.`),Do.forEach(t),ea=d(C),K=r(C,"P",{});var Ko=a(K);oa=i(Ko,"Configuration objects inherit from "),Bo=r(Ko,"A",{href:!0});var Mi=a(Bo);ta=i(Mi,"PretrainedConfig"),Mi.forEach(t),sa=i(Ko,` and can be used to control the model outputs. Read the
documentation from `),Ro=r(Ko,"A",{href:!0});var vi=a(Ro);ra=i(vi,"PretrainedConfig"),vi.forEach(t),aa=i(Ko," for more information."),Ko.forEach(t),na=d(C),qe=r(C,"P",{});var ks=a(qe);ia=i(ks,"Currently, Mask2Former only supports the "),Go=r(ks,"A",{href:!0});var wi=a(Go);la=i(wi,"Swin Transformer"),wi.forEach(t),ca=i(ks," as backbone."),ks.forEach(t),ma=d(C),k(de.$$.fragment,C),da=d(C),pe=r(C,"DIV",{class:!0});var Ms=a(pe);k(Oe.$$.fragment,Ms),pa=d(Ms),Qe=r(Ms,"P",{});var vs=a(Qe);ha=i(vs,"Instantiate a "),Ao=r(vs,"A",{href:!0});var Fi=a(Ao);fa=i(Fi,"Mask2FormerConfig"),Fi.forEach(t),ga=i(vs," (or a derived class) from a pre-trained backbone model configuration."),vs.forEach(t),Ms.forEach(t),C.forEach(t),as=d(o),ee=r(o,"H2",{class:!0});var ws=a(ee);he=r(ws,"A",{id:!0,class:!0,href:!0});var Ti=a(he);ut=r(Ti,"SPAN",{});var Ui=a(ut);k(He.$$.fragment,Ui),Ui.forEach(t),Ti.forEach(t),ua=d(ws),_t=r(ws,"SPAN",{});var ji=a(_t);_a=i(ji,"Mask2FormerModel"),ji.forEach(t),ws.forEach(t),ns=d(o),B=r(o,"DIV",{class:!0});var et=a(B);k(De.$$.fragment,et),ba=d(et),Ke=r(et,"P",{});var Fs=a(Ke);ya=i(Fs,`The bare Mask2Former Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),eo=r(Fs,"A",{href:!0,rel:!0});var Ii=a(eo);ka=i(Ii,"torch.nn.Module"),Ii.forEach(t),Ma=i(Fs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Fs.forEach(t),va=d(et),E=r(et,"DIV",{class:!0});var Ie=a(E);k(oo.$$.fragment,Ie),wa=d(Ie),oe=r(Ie,"P",{});var ot=a(oe);Fa=i(ot,"The "),Lo=r(ot,"A",{href:!0});var Ji=a(Lo);Ta=i(Ji,"Mask2FormerModel"),Ji.forEach(t),Ua=i(ot," forward method, overrides the "),bt=r(ot,"CODE",{});var $i=a(bt);ja=i($i,"__call__"),$i.forEach(t),Ia=i(ot," special method."),ot.forEach(t),Ja=d(Ie),k(fe.$$.fragment,Ie),$a=d(Ie),k(ge.$$.fragment,Ie),Ie.forEach(t),et.forEach(t),is=d(o),te=r(o,"H2",{class:!0});var Ts=a(te);ue=r(Ts,"A",{id:!0,class:!0,href:!0});var zi=a(ue);yt=r(zi,"SPAN",{});var xi=a(yt);k(to.$$.fragment,xi),xi.forEach(t),zi.forEach(t),za=d(Ts),kt=r(Ts,"SPAN",{});var Ni=a(kt);xa=i(Ni,"Mask2FormerForUniversalSegmentation"),Ni.forEach(t),Ts.forEach(t),ls=d(o),R=r(o,"DIV",{class:!0});var tt=a(R);k(so.$$.fragment,tt),Na=d(tt),ro=r(tt,"P",{});var Us=a(ro);Wa=i(Us,`The Mask2Former Model with heads on top for instance/semantic/panoptic segmentation.
This model is a PyTorch `),ao=r(Us,"A",{href:!0,rel:!0});var Wi=a(ao);Ea=i(Wi,"torch.nn.Module"),Wi.forEach(t),Za=i(Us,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Us.forEach(t),Ca=d(tt),j=r(tt,"DIV",{class:!0});var x=a(j);k(no.$$.fragment,x),Sa=d(x),se=r(x,"P",{});var st=a(se);Xa=i(st,"The "),Yo=r(st,"A",{href:!0});var Ei=a(Yo);Va=i(Ei,"Mask2FormerForUniversalSegmentation"),Ei.forEach(t),Pa=i(st," forward method, overrides the "),Mt=r(st,"CODE",{});var Zi=a(Mt);Ba=i(Zi,"__call__"),Zi.forEach(t),Ra=i(st," special method."),st.forEach(t),Ga=d(x),k(_e.$$.fragment,x),Aa=d(x),vt=r(x,"P",{});var Ci=a(vt);La=i(Ci,"Examples:"),Ci.forEach(t),Ya=d(x),k(be.$$.fragment,x),qa=d(x),k(ye.$$.fragment,x),Oa=d(x),k(ke.$$.fragment,x),x.forEach(t),tt.forEach(t),cs=d(o),re=r(o,"H2",{class:!0});var js=a(re);Me=r(js,"A",{id:!0,class:!0,href:!0});var Si=a(Me);wt=r(Si,"SPAN",{});var Xi=a(wt);k(io.$$.fragment,Xi),Xi.forEach(t),Si.forEach(t),Qa=d(js),Ft=r(js,"SPAN",{});var Vi=a(Ft);Ha=i(Vi,"Mask2FormerImageProcessor"),Vi.forEach(t),js.forEach(t),ms=d(o),U=r(o,"DIV",{class:!0});var $=a(U);k(lo.$$.fragment,$),Da=d($),Tt=r($,"P",{});var Pi=a(Tt);Ka=i(Pi,`Constructs a Mask2Former image processor. The image processor can be used to prepare image(s) and optional targets
for the model.`),Pi.forEach(t),en=d($),co=r($,"P",{});var Is=a(co);on=i(Is,"This image processor inherits from "),Ut=r(Is,"CODE",{});var Bi=a(Ut);tn=i(Bi,"BaseImageProcessor"),Bi.forEach(t),sn=i(Is,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Is.forEach(t),rn=d($),qo=r($,"DIV",{class:!0});var Ri=a(qo);k(mo.$$.fragment,Ri),Ri.forEach(t),an=d($),L=r($,"DIV",{class:!0});var rt=a(L);k(po.$$.fragment,rt),nn=d(rt),ho=r(rt,"P",{});var Js=a(ho);ln=i(Js,"Pad images up to the largest image in a batch and create a corresponding "),jt=r(Js,"CODE",{});var Gi=a(jt);cn=i(Gi,"pixel_mask"),Gi.forEach(t),mn=i(Js,"."),Js.forEach(t),dn=d(rt),G=r(rt,"P",{});var Je=a(G);pn=i(Je,`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
`),It=r(Je,"CODE",{});var Ai=a(It);hn=i(Ai,"segmentation_maps = [[2,6,7,9]]"),Ai.forEach(t),fn=i(Je,", the output will contain "),Jt=r(Je,"CODE",{});var Li=a(Jt);gn=i(Li,"mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),Li.forEach(t),un=i(Je," (four binary masks) and "),$t=r(Je,"CODE",{});var Yi=a($t);_n=i(Yi,"class_labels = [2,6,7,9]"),Yi.forEach(t),bn=i(Je,`, the labels for
each mask.`),Je.forEach(t),rt.forEach(t),yn=d($),ve=r($,"DIV",{class:!0});var $s=a(ve);k(fo.$$.fragment,$s),kn=d($s),go=r($s,"P",{});var zs=a(go);Mn=i(zs,"Converts the output of "),Oo=r(zs,"A",{href:!0});var qi=a(Oo);vn=i(qi,"Mask2FormerForUniversalSegmentation"),qi.forEach(t),wn=i(zs,` into semantic segmentation maps. Only supports
PyTorch.`),zs.forEach(t),$s.forEach(t),Fn=d($),we=r($,"DIV",{class:!0});var xs=a(we);k(uo.$$.fragment,xs),Tn=d(xs),_o=r(xs,"P",{});var Ns=a(_o);Un=i(Ns,"Converts the output of "),zt=r(Ns,"CODE",{});var Oi=a(zt);jn=i(Oi,"Mask2FormerForUniversalSegmentationOutput"),Oi.forEach(t),In=i(Ns,` into instance segmentation predictions.
Only supports PyTorch.`),Ns.forEach(t),xs.forEach(t),Jn=d($),Fe=r($,"DIV",{class:!0});var Ws=a(Fe);k(bo.$$.fragment,Ws),$n=d(Ws),yo=r(Ws,"P",{});var Es=a(yo);zn=i(Es,"Converts the output of "),xt=r(Es,"CODE",{});var Qi=a(xt);xn=i(Qi,"Mask2FormerForUniversalSegmentationOutput"),Qi.forEach(t),Nn=i(Es,` into image panoptic segmentation
predictions. Only supports PyTorch.`),Es.forEach(t),Ws.forEach(t),$.forEach(t),this.h()},h(){c(h,"name","hf:doc:metadata"),c(h,"content",JSON.stringify(pl)),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(xe,"href","https://arxiv.org/abs/2112.01527"),c(xe,"rel","nofollow"),c(vo,"href","maskformer"),c(Uo,"href","maskformer"),c(jo,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor"),c(Io,"href","/docs/transformers/v4.32.0/en/model_doc/auto#transformers.AutoImageProcessor"),c(Jo,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_semantic_segmentation"),c($o,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_instance_segmentation"),c(zo,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_panoptic_segmentation"),c(xo,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation"),tl(ie.src,En="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/mask2former_architecture.jpg")||c(ie,"src",En),c(ie,"alt","drawing"),c(ie,"width","600"),c(No,"href","https://arxiv.org/abs/2112.01527"),c(We,"href","https://huggingface.co/shivi"),c(We,"rel","nofollow"),c(Ee,"href","https://huggingface.co/adirik"),c(Ee,"rel","nofollow"),c(Ze,"href","https://github.com/facebookresearch/Mask2Former"),c(Ze,"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(Co,"href","/docs/transformers/v4.32.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(So,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_semantic_segmentation"),c(Xo,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_instance_segmentation"),c(Vo,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_panoptic_segmentation"),c(V,"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(Po,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerModel"),c(Ye,"href","https://huggingface.co/facebook/mask2former-swin-small-coco-instance"),c(Ye,"rel","nofollow"),c(Bo,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(Ro,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(Go,"href","swin"),c(Ao,"href","/docs/transformers/v4.32.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(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(he,"id","transformers.Mask2FormerModel"),c(he,"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(he,"href","#transformers.Mask2FormerModel"),c(ee,"class","relative group"),c(eo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(eo,"rel","nofollow"),c(Lo,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerModel"),c(E,"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(ue,"id","transformers.Mask2FormerForUniversalSegmentation"),c(ue,"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(ue,"href","#transformers.Mask2FormerForUniversalSegmentation"),c(te,"class","relative group"),c(ao,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(ao,"rel","nofollow"),c(Yo,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation"),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(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(Me,"id","transformers.Mask2FormerImageProcessor"),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.Mask2FormerImageProcessor"),c(re,"class","relative group"),c(qo,"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(Oo,"href","/docs/transformers/v4.32.0/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation"),c(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(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(o,p){e(document.head,h),f(o,T,p),f(o,_,p),e(_,g),e(g,b),M(l,b,null),e(_,u),e(_,S),e(S,Zs),f(o,Pt,p),f(o,Y,p),e(Y,ae),e(ae,at),M(ze,at,null),e(Y,Cs),e(Y,nt),e(nt,Ss),f(o,Bt,p),f(o,A,p),e(A,Xs),e(A,xe),e(xe,Vs),e(A,Ps),e(A,vo),e(vo,Bs),e(A,Rs),f(o,Rt,p),f(o,wo,p),e(wo,Gs),f(o,Gt,p),f(o,Fo,p),e(Fo,it),e(it,As),f(o,At,p),f(o,To,p),e(To,Ls),f(o,Lt,p),f(o,ne,p),e(ne,X),e(X,Ys),e(X,Uo),e(Uo,qs),e(X,Os),e(X,jo),e(jo,Qs),e(X,Hs),e(X,Io),e(Io,Ds),e(X,Ks),e(ne,er),e(ne,z),e(z,or),e(z,Jo),e(Jo,tr),e(z,sr),e(z,$o),e($o,rr),e(z,ar),e(z,zo),e(zo,nr),e(z,ir),e(z,xo),e(xo,lr),e(z,cr),e(z,lt),e(lt,mr),e(z,dr),f(o,Yt,p),f(o,ie,p),f(o,qt,p),f(o,Ne,p),e(Ne,pr),e(Ne,No),e(No,hr),f(o,Ot,p),f(o,W,p),e(W,fr),e(W,We),e(We,gr),e(W,ur),e(W,Ee),e(Ee,_r),e(W,br),e(W,Ze),e(Ze,yr),e(W,kr),f(o,Qt,p),f(o,q,p),e(q,le),e(le,ct),M(Ce,ct,null),e(q,Mr),e(q,mt),e(mt,vr),f(o,Ht,p),f(o,Wo,p),e(Wo,wr),f(o,Dt,p),f(o,Eo,p),e(Eo,Se),e(Se,Fr),e(Se,Xe),e(Xe,Tr),e(Se,Ur),f(o,Kt,p),f(o,Zo,p),e(Zo,jr),f(o,es,p),f(o,O,p),e(O,ce),e(ce,dt),M(Ve,dt,null),e(O,Ir),e(O,pt),e(pt,Jr),f(o,os,p),f(o,Q,p),M(Pe,Q,null),e(Q,$r),e(Q,Be),e(Be,zr),e(Be,Co),e(Co,xr),e(Be,Nr),f(o,ts,p),f(o,V,p),M(Re,V,null),e(V,Wr),e(V,Ge),e(Ge,Er),e(Ge,ht),e(ht,Zr),e(Ge,Cr),e(V,Sr),e(V,P),e(P,Xr),e(P,So),e(So,Vr),e(P,Pr),e(P,Xo),e(Xo,Br),e(P,Rr),e(P,Vo),e(Vo,Gr),e(P,Ar),f(o,ss,p),f(o,H,p),e(H,me),e(me,ft),M(Ae,ft,null),e(H,Lr),e(H,gt),e(gt,Yr),f(o,rs,p),f(o,I,p),M(Le,I,null),e(I,qr),e(I,D),e(D,Or),e(D,Po),e(Po,Qr),e(D,Hr),e(D,Ye),e(Ye,Dr),e(D,Kr),e(I,ea),e(I,K),e(K,oa),e(K,Bo),e(Bo,ta),e(K,sa),e(K,Ro),e(Ro,ra),e(K,aa),e(I,na),e(I,qe),e(qe,ia),e(qe,Go),e(Go,la),e(qe,ca),e(I,ma),M(de,I,null),e(I,da),e(I,pe),M(Oe,pe,null),e(pe,pa),e(pe,Qe),e(Qe,ha),e(Qe,Ao),e(Ao,fa),e(Qe,ga),f(o,as,p),f(o,ee,p),e(ee,he),e(he,ut),M(He,ut,null),e(ee,ua),e(ee,_t),e(_t,_a),f(o,ns,p),f(o,B,p),M(De,B,null),e(B,ba),e(B,Ke),e(Ke,ya),e(Ke,eo),e(eo,ka),e(Ke,Ma),e(B,va),e(B,E),M(oo,E,null),e(E,wa),e(E,oe),e(oe,Fa),e(oe,Lo),e(Lo,Ta),e(oe,Ua),e(oe,bt),e(bt,ja),e(oe,Ia),e(E,Ja),M(fe,E,null),e(E,$a),M(ge,E,null),f(o,is,p),f(o,te,p),e(te,ue),e(ue,yt),M(to,yt,null),e(te,za),e(te,kt),e(kt,xa),f(o,ls,p),f(o,R,p),M(so,R,null),e(R,Na),e(R,ro),e(ro,Wa),e(ro,ao),e(ao,Ea),e(ro,Za),e(R,Ca),e(R,j),M(no,j,null),e(j,Sa),e(j,se),e(se,Xa),e(se,Yo),e(Yo,Va),e(se,Pa),e(se,Mt),e(Mt,Ba),e(se,Ra),e(j,Ga),M(_e,j,null),e(j,Aa),e(j,vt),e(vt,La),e(j,Ya),M(be,j,null),e(j,qa),M(ye,j,null),e(j,Oa),M(ke,j,null),f(o,cs,p),f(o,re,p),e(re,Me),e(Me,wt),M(io,wt,null),e(re,Qa),e(re,Ft),e(Ft,Ha),f(o,ms,p),f(o,U,p),M(lo,U,null),e(U,Da),e(U,Tt),e(Tt,Ka),e(U,en),e(U,co),e(co,on),e(co,Ut),e(Ut,tn),e(co,sn),e(U,rn),e(U,qo),M(mo,qo,null),e(U,an),e(U,L),M(po,L,null),e(L,nn),e(L,ho),e(ho,ln),e(ho,jt),e(jt,cn),e(ho,mn),e(L,dn),e(L,G),e(G,pn),e(G,It),e(It,hn),e(G,fn),e(G,Jt),e(Jt,gn),e(G,un),e(G,$t),e($t,_n),e(G,bn),e(U,yn),e(U,ve),M(fo,ve,null),e(ve,kn),e(ve,go),e(go,Mn),e(go,Oo),e(Oo,vn),e(go,wn),e(U,Fn),e(U,we),M(uo,we,null),e(we,Tn),e(we,_o),e(_o,Un),e(_o,zt),e(zt,jn),e(_o,In),e(U,Jn),e(U,Fe),M(bo,Fe,null),e(Fe,$n),e(Fe,yo),e(yo,zn),e(yo,xt),e(xt,xn),e(yo,Nn),ds=!0},p(o,[p]){const ko={};p&2&&(ko.$$scope={dirty:p,ctx:o}),de.$set(ko);const Nt={};p&2&&(Nt.$$scope={dirty:p,ctx:o}),fe.$set(Nt);const Wt={};p&2&&(Wt.$$scope={dirty:p,ctx:o}),ge.$set(Wt);const Et={};p&2&&(Et.$$scope={dirty:p,ctx:o}),_e.$set(Et);const Mo={};p&2&&(Mo.$$scope={dirty:p,ctx:o}),be.$set(Mo);const Zt={};p&2&&(Zt.$$scope={dirty:p,ctx:o}),ye.$set(Zt);const Ct={};p&2&&(Ct.$$scope={dirty:p,ctx:o}),ke.$set(Ct)},i(o){ds||(v(l.$$.fragment,o),v(ze.$$.fragment,o),v(Ce.$$.fragment,o),v(Ve.$$.fragment,o),v(Pe.$$.fragment,o),v(Re.$$.fragment,o),v(Ae.$$.fragment,o),v(Le.$$.fragment,o),v(de.$$.fragment,o),v(Oe.$$.fragment,o),v(He.$$.fragment,o),v(De.$$.fragment,o),v(oo.$$.fragment,o),v(fe.$$.fragment,o),v(ge.$$.fragment,o),v(to.$$.fragment,o),v(so.$$.fragment,o),v(no.$$.fragment,o),v(_e.$$.fragment,o),v(be.$$.fragment,o),v(ye.$$.fragment,o),v(ke.$$.fragment,o),v(io.$$.fragment,o),v(lo.$$.fragment,o),v(mo.$$.fragment,o),v(po.$$.fragment,o),v(fo.$$.fragment,o),v(uo.$$.fragment,o),v(bo.$$.fragment,o),ds=!0)},o(o){w(l.$$.fragment,o),w(ze.$$.fragment,o),w(Ce.$$.fragment,o),w(Ve.$$.fragment,o),w(Pe.$$.fragment,o),w(Re.$$.fragment,o),w(Ae.$$.fragment,o),w(Le.$$.fragment,o),w(de.$$.fragment,o),w(Oe.$$.fragment,o),w(He.$$.fragment,o),w(De.$$.fragment,o),w(oo.$$.fragment,o),w(fe.$$.fragment,o),w(ge.$$.fragment,o),w(to.$$.fragment,o),w(so.$$.fragment,o),w(no.$$.fragment,o),w(_e.$$.fragment,o),w(be.$$.fragment,o),w(ye.$$.fragment,o),w(ke.$$.fragment,o),w(io.$$.fragment,o),w(lo.$$.fragment,o),w(mo.$$.fragment,o),w(po.$$.fragment,o),w(fo.$$.fragment,o),w(uo.$$.fragment,o),w(bo.$$.fragment,o),ds=!1},d(o){t(h),o&&t(T),o&&t(_),F(l),o&&t(Pt),o&&t(Y),F(ze),o&&t(Bt),o&&t(A),o&&t(Rt),o&&t(wo),o&&t(Gt),o&&t(Fo),o&&t(At),o&&t(To),o&&t(Lt),o&&t(ne),o&&t(Yt),o&&t(ie),o&&t(qt),o&&t(Ne),o&&t(Ot),o&&t(W),o&&t(Qt),o&&t(q),F(Ce),o&&t(Ht),o&&t(Wo),o&&t(Dt),o&&t(Eo),o&&t(Kt),o&&t(Zo),o&&t(es),o&&t(O),F(Ve),o&&t(os),o&&t(Q),F(Pe),o&&t(ts),o&&t(V),F(Re),o&&t(ss),o&&t(H),F(Ae),o&&t(rs),o&&t(I),F(Le),F(de),F(Oe),o&&t(as),o&&t(ee),F(He),o&&t(ns),o&&t(B),F(De),F(oo),F(fe),F(ge),o&&t(is),o&&t(te),F(to),o&&t(ls),o&&t(R),F(so),F(no),F(_e),F(be),F(ye),F(ke),o&&t(cs),o&&t(re),F(io),o&&t(ms),o&&t(U),F(lo),F(mo),F(po),F(fo),F(uo),F(bo)}}}const pl={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 hl(J){return sl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class kl extends Di{constructor(h){super();Ki(this,h,hl,dl,el,{})}}export{kl as default,pl as metadata};
