import{S as cl,i as dl,s as pl,e as s,k as c,w as v,t as n,M as hl,c as r,d as t,m as d,a,x as b,h as i,b as m,N as fl,G as e,g as f,y as F,q as w,o as y,B as M,v as gl,L as Ht}from"../../chunks/vendor-hf-doc-builder.js";import{T as ml}from"../../chunks/Tip-hf-doc-builder.js";import{D as z}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Wt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ee}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Rt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ul(P){let h,$,_,g,k;return g=new Wt({props:{code:`from transformers import Mask2FormerConfig, Mask2FormerModel

# Initializing a Mask2Former facebook/mask2former-swin-small-coco-instance configuration
configuration = Mask2FormerConfig()

# Initializing a model (with random weights) from the facebook/mask2former-swin-small-coco-instance style configuration
model = Mask2FormerModel(configuration)

# Accessing the model configuration
configuration = model.config`,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"),$=n("Examples:"),_=c(),v(g.$$.fragment)},l(l){h=r(l,"P",{});var u=a(h);$=i(u,"Examples:"),u.forEach(t),_=d(l),b(g.$$.fragment,l)},m(l,u){f(l,h,u),e(h,$),f(l,_,u),F(g,l,u),k=!0},p:Ht,i(l){k||(w(g.$$.fragment,l),k=!0)},o(l){y(g.$$.fragment,l),k=!1},d(l){l&&t(h),l&&t(_),M(g,l)}}}function _l(P){let h,$,_,g,k;return{c(){h=s("p"),$=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s("code"),g=n("Module"),k=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);$=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(u,"CODE",{});var L=a(_);g=i(L,"Module"),L.forEach(t),k=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,$),e(h,_),e(_,g),e(h,k)},d(l){l&&t(h)}}}function kl(P){let h,$,_,g,k;return g=new Wt({props:{code:`import torch
from PIL import Image
import requests
from transformers import AutoImageProcessor, Mask2FormerModel

# load image
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

# load image preprocessor and Mask2FormerModel trained on COCO instance segmentation dataset
image_processor = AutoImageProcessor.from_pretrained("facebook/mask2former-swin-small-coco-instance")
model = Mask2FormerModel.from_pretrained("facebook/mask2former-swin-small-coco-instance")
inputs = image_processor(image, return_tensors="pt")

# forward pass
with torch.no_grad():
    outputs = model(**inputs)

# model outputs last hidden states of shape (batch_size, num_queries, hidden_size)
print(outputs.transformer_decoder_last_hidden_state.shape)`,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"),$=n("Examples:"),_=c(),v(g.$$.fragment)},l(l){h=r(l,"P",{});var u=a(h);$=i(u,"Examples:"),u.forEach(t),_=d(l),b(g.$$.fragment,l)},m(l,u){f(l,h,u),e(h,$),f(l,_,u),F(g,l,u),k=!0},p:Ht,i(l){k||(w(g.$$.fragment,l),k=!0)},o(l){y(g.$$.fragment,l),k=!1},d(l){l&&t(h),l&&t(_),M(g,l)}}}function vl(P){let h,$,_,g,k;return{c(){h=s("p"),$=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s("code"),g=n("Module"),k=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);$=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(u,"CODE",{});var L=a(_);g=i(L,"Module"),L.forEach(t),k=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,$),e(h,_),e(_,g),e(h,k)},d(l){l&&t(h)}}}function bl(P){let h,$,_,g,k;return g=new Wt({props:{code:`from transformers import AutoImageProcessor, Mask2FormerForUniversalSegmentation
from PIL import Image
import requests
import torch

# Load Mask2Former trained on COCO instance segmentation dataset
image_processor = AutoImageProcessor.from_pretrained("facebook/mask2former-swin-small-coco-instance")
model = Mask2FormerForUniversalSegmentation.from_pretrained(
    "facebook/mask2former-swin-small-coco-instance"
)

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

# Model predicts class_queries_logits of shape \`(batch_size, num_queries)\`
# and masks_queries_logits of shape \`(batch_size, num_queries, height, width)\`
class_queries_logits = outputs.class_queries_logits
masks_queries_logits = outputs.masks_queries_logits

# Perform post-processing to get instance segmentation map
pred_instance_map = image_processor.post_process_semantic_segmentation(
    outputs, target_sizes=[image.size[::-1]]
)[0]
print(pred_instance_map.shape)`,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"),$=n("Instance segmentation example:"),_=c(),v(g.$$.fragment)},l(l){h=r(l,"P",{});var u=a(h);$=i(u,"Instance segmentation example:"),u.forEach(t),_=d(l),b(g.$$.fragment,l)},m(l,u){f(l,h,u),e(h,$),f(l,_,u),F(g,l,u),k=!0},p:Ht,i(l){k||(w(g.$$.fragment,l),k=!0)},o(l){y(g.$$.fragment,l),k=!1},d(l){l&&t(h),l&&t(_),M(g,l)}}}function Fl(P){let h,$,_,g,k;return g=new Wt({props:{code:`from transformers import AutoImageProcessor, Mask2FormerForUniversalSegmentation
from PIL import Image
import requests
import torch

# Load Mask2Former trained on ADE20k semantic segmentation dataset
image_processor = AutoImageProcessor.from_pretrained("facebook/mask2former-swin-small-ade-semantic")
model = Mask2FormerForUniversalSegmentation.from_pretrained("facebook/mask2former-swin-small-ade-semantic")

url = (
    "https://huggingface.co/datasets/hf-internal-testing/fixtures_ade20k/resolve/main/ADE_val_00000001.jpg"
)
image = Image.open(requests.get(url, stream=True).raw)
inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

# Model predicts class_queries_logits of shape \`(batch_size, num_queries)\`
# and masks_queries_logits of shape \`(batch_size, num_queries, height, width)\`
class_queries_logits = outputs.class_queries_logits
masks_queries_logits = outputs.masks_queries_logits

# Perform post-processing to get semantic segmentation map
pred_semantic_map = image_processor.post_process_semantic_segmentation(
    outputs, target_sizes=[image.size[::-1]]
)[0]
print(pred_semantic_map.shape)`,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"),$=n("Semantic segmentation example:"),_=c(),v(g.$$.fragment)},l(l){h=r(l,"P",{});var u=a(h);$=i(u,"Semantic segmentation example:"),u.forEach(t),_=d(l),b(g.$$.fragment,l)},m(l,u){f(l,h,u),e(h,$),f(l,_,u),F(g,l,u),k=!0},p:Ht,i(l){k||(w(g.$$.fragment,l),k=!0)},o(l){y(g.$$.fragment,l),k=!1},d(l){l&&t(h),l&&t(_),M(g,l)}}}function wl(P){let h,$,_,g,k;return g=new Wt({props:{code:`from transformers import AutoImageProcessor, Mask2FormerForUniversalSegmentation
from PIL import Image
import requests
import torch

# Load Mask2Former trained on CityScapes panoptic segmentation dataset
image_processor = AutoImageProcessor.from_pretrained("facebook/mask2former-swin-small-cityscapes-panoptic")
model = Mask2FormerForUniversalSegmentation.from_pretrained(
    "facebook/mask2former-swin-small-cityscapes-panoptic"
)

url = "https://cdn-media.huggingface.co/Inference-API/Sample-results-on-the-Cityscapes-dataset-The-above-images-show-how-our-method-can-handle.png"
image = Image.open(requests.get(url, stream=True).raw)
inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

# Model predicts class_queries_logits of shape \`(batch_size, num_queries)\`
# and masks_queries_logits of shape \`(batch_size, num_queries, height, width)\`
class_queries_logits = outputs.class_queries_logits
masks_queries_logits = outputs.masks_queries_logits

# Perform post-processing to get panoptic segmentation map
pred_panoptic_map = image_processor.post_process_panoptic_segmentation(
    outputs, target_sizes=[image.size[::-1]]
)[0]["segmentation"]
print(pred_panoptic_map.shape)`,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"),$=n("Panoptic segmentation example:"),_=c(),v(g.$$.fragment)},l(l){h=r(l,"P",{});var u=a(h);$=i(u,"Panoptic segmentation example:"),u.forEach(t),_=d(l),b(g.$$.fragment,l)},m(l,u){f(l,h,u),e(h,$),f(l,_,u),F(g,l,u),k=!0},p:Ht,i(l){k||(w(g.$$.fragment,l),k=!0)},o(l){y(g.$$.fragment,l),k=!1},d(l){l&&t(h),l&&t(_),M(g,l)}}}function yl(P){let h,$,_,g,k,l,u,L,Rs,Bt,G,ae,mt,ze,Hs,ct,Ws,Vt,B,Bs,qe,Vs,Gs,$o,Ks,Qs,Gt,To,Xs,Kt,xo,dt,Js,Qt,Io,Zs,Xt,ne,N,Ys,Po,er,or,jo,tr,sr,Eo,rr,ar,nr,E,ir,zo,lr,mr,qo,cr,dr,Co,pr,hr,Ao,fr,gr,pt,ur,_r,Jt,ie,Vn,Zt,Ce,kr,So,vr,Yt,A,br,Ae,Fr,wr,Se,yr,Mr,Oe,$r,Tr,es,K,le,ht,Le,xr,ft,Ir,os,Oo,Pr,ts,Lo,Ne,jr,Ue,Er,zr,ss,No,qr,rs,Q,me,gt,De,Cr,ut,Ar,as,X,Re,Sr,He,Or,Uo,Lr,Nr,ns,U,We,Ur,Be,Dr,_t,Rr,Hr,Wr,D,Br,Do,Vr,Gr,Ro,Kr,Qr,Ho,Xr,Jr,is,J,ce,kt,Ve,Zr,vt,Yr,ls,x,Ge,ea,Z,oa,Wo,ta,sa,Ke,ra,aa,na,Y,ia,Bo,la,ma,Vo,ca,da,pa,Qe,ha,Go,fa,ga,ua,de,_a,pe,Xe,ka,Je,va,Ko,ba,Fa,wa,he,Ze,ya,Ye,Ma,Qo,$a,Ta,ms,ee,fe,bt,eo,xa,Ft,Ia,cs,R,oo,Pa,to,ja,so,Ea,za,qa,S,ro,Ca,oe,Aa,Xo,Sa,Oa,wt,La,Na,Ua,ge,Da,ue,ds,te,_e,yt,ao,Ra,Mt,Ha,ps,H,no,Wa,io,Ba,lo,Va,Ga,Ka,I,mo,Qa,se,Xa,Jo,Ja,Za,$t,Ya,en,on,ke,tn,Tt,sn,rn,ve,an,be,nn,Fe,hs,re,we,xt,co,ln,It,mn,fs,T,po,cn,Pt,dn,pn,ho,hn,jt,fn,gn,un,Zo,fo,_n,V,go,kn,uo,vn,Et,bn,Fn,wn,W,yn,zt,Mn,$n,qt,Tn,xn,Ct,In,Pn,jn,ye,_o,En,ko,zn,Yo,qn,Cn,An,Me,vo,Sn,bo,On,At,Ln,Nn,Un,$e,Fo,Dn,wo,Rn,St,Hn,Wn,gs;return l=new Ee({}),ze=new Ee({}),Le=new Ee({}),De=new Ee({}),Re=new z({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/main/src/transformers/models/mask2former/modeling_mask2former.py#L148"}}),We=new z({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/main/src/transformers/models/mask2former/modeling_mask2former.py#L194"}}),Ve=new Ee({}),Ge=new z({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/main/src/transformers/models/mask2former/configuration_mask2former.py#L34"}}),de=new Rt({props:{anchor:"transformers.Mask2FormerConfig.example",$$slots:{default:[ul]},$$scope:{ctx:P}}}),Xe=new z({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/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The backbone configuration.`,name:"backbone_config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mask2former/configuration_mask2former.py#L210",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerConfig"
>Mask2FormerConfig</a></p>
`}}),Ze=new z({props:{name:"to_dict",anchor:"transformers.Mask2FormerConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mask2former/configuration_mask2former.py#L226",returnDescription:`
<p>Dictionary of all the attributes that make up this configuration instance,</p>
`,returnType:`
<p><code>Dict[str, any]</code></p>
`}}),eo=new Ee({}),oo=new z({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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mask2former/modeling_mask2former.py#L2216"}}),ro=new z({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/main/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a>. See
<code>AutoFeatureExtractor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.Mask2FormerModel.forward.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"pixel_mask"},{anchor:"transformers.Mask2FormerModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Mask2FormerModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of Detr&#x2019;s decoder attention layers.`,name:"output_attentions"},{anchor:"transformers.Mask2FormerModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <code>~Mask2FormerModelOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mask2former/modeling_mask2former.py#L2226",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/mask2former#transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput"
>transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ge=new ml({props:{$$slots:{default:[_l]},$$scope:{ctx:P}}}),ue=new Rt({props:{anchor:"transformers.Mask2FormerModel.forward.example",$$slots:{default:[kl]},$$scope:{ctx:P}}}),ao=new Ee({}),no=new z({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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mask2former/modeling_mask2former.py#L2320"}}),mo=new z({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/main/en/model_doc/auto#transformers.AutoFeatureExtractor">AutoFeatureExtractor</a>. See
<code>AutoFeatureExtractor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.pixel_mask",description:`<strong>pixel_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding pixel values. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"pixel_mask"},{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of Detr&#x2019;s decoder attention layers.`,name:"output_attentions"},{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <code>~Mask2FormerModelOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.mask_labels",description:`<strong>mask_labels</strong> (<code>List[torch.Tensor]</code>, <em>optional</em>) &#x2014;
List of mask labels of shape <code>(num_labels, height, width)</code> to be fed to a model`,name:"mask_labels"},{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.class_labels",description:`<strong>class_labels</strong> (<code>List[torch.LongTensor]</code>, <em>optional</em>) &#x2014;
list of target class labels of shape <code>(num_labels, height, width)</code> to be fed to a model. They identify the
labels of <code>mask_labels</code>, e.g. the label of <code>mask_labels[i][j]</code> if <code>class_labels[i][j]</code>.`,name:"class_labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mask2former/modeling_mask2former.py#L2373",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/mask2former#transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput"
>transformers.models.mask2former.modeling_mask2former.Mask2FormerForUniversalSegmentationOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ke=new ml({props:{$$slots:{default:[vl]},$$scope:{ctx:P}}}),ve=new Rt({props:{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.example",$$slots:{default:[bl]},$$scope:{ctx:P}}}),be=new Rt({props:{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.example-2",$$slots:{default:[Fl]},$$scope:{ctx:P}}}),Fe=new Rt({props:{anchor:"transformers.Mask2FormerForUniversalSegmentation.forward.example-3",$$slots:{default:[wl]},$$scope:{ctx:P}}}),co=new Ee({}),po=new z({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/main/src/transformers/models/mask2former/image_processing_mask2former.py#L331"}}),fo=new z({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:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mask2former/image_processing_mask2former.py#L629"}}),go=new z({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:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Mask2FormerImageProcessor.encode_inputs.pixel_values_list",description:`<strong>pixel_values_list</strong> (<code>List[ImageInput]</code>) &#x2014;
List of images (pixel values) to be padded. Each image should be a tensor of shape <code>(channels, height, width)</code>.`,name:"pixel_values_list"},{anchor:"transformers.Mask2FormerImageProcessor.encode_inputs.segmentation_maps",description:`<strong>segmentation_maps</strong> (<code>ImageInput</code>, <em>optional</em>) &#x2014;
The corresponding semantic segmentation maps with the pixel-wise annotations.</p>
<p>(<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
Whether or not to pad images up to the largest image in a batch and create a pixel mask.</p>
<p>If left to the default, will return a pixel mask that is:</p>
<ul>
<li>1 for pixels that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for pixels that are padding (i.e. <strong>masked</strong>).</li>
</ul>`,name:"segmentation_maps"},{anchor:"transformers.Mask2FormerImageProcessor.encode_inputs.instance_id_to_semantic_id",description:`<strong>instance_id_to_semantic_id</strong> (<code>List[Dict[int, int]]</code> or <code>Dict[int, int]</code>, <em>optional</em>) &#x2014;
A mapping between object instance ids and class ids. If passed, <code>segmentation_maps</code> is treated as an
instance segmentation map where each pixel represents an instance id. Can be provided as a single
dictionary with a global/dataset-level mapping or as a list of dictionaries (one per image), to map
instance ids in each image separately.`,name:"instance_id_to_semantic_id"},{anchor:"transformers.Mask2FormerImageProcessor.encode_inputs.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of NumPy arrays. If set to <code>&apos;pt&apos;</code>, return PyTorch <code>torch.Tensor</code>
objects.`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mask2former/image_processing_mask2former.py#L784",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a> with the following fields:</p>
<ul>
<li><strong>pixel_values</strong> \u2014 Pixel values to be fed to a model.</li>
<li><strong>pixel_mask</strong> \u2014 Pixel mask to be fed to a model (when <code>=True</code> or if <code>pixel_mask</code> is in
<code>self.model_input_names</code>).</li>
<li><strong>mask_labels</strong> \u2014 Optional list of mask labels of shape <code>(labels, height, width)</code> to be fed to a model
(when <code>annotations</code> are provided).</li>
<li><strong>class_labels</strong> \u2014 Optional list of class labels of shape <code>(labels)</code> to be fed to a model (when
<code>annotations</code> are provided). They identify the labels of <code>mask_labels</code>, e.g. the label of
<code>mask_labels[i][j]</code> if <code>class_labels[i][j]</code>.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),_o=new z({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/main/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/main/src/transformers/models/mask2former/image_processing_mask2former.py#L883",returnDescription:`
<p>A list of length <code>batch_size</code>, where each item is a semantic segmentation map of shape (height, width)
corresponding to the target_sizes entry (if <code>target_sizes</code> is specified). Each entry of each
<code>torch.Tensor</code> correspond to a semantic class id.</p>
`,returnType:`
<p><code>List[torch.Tensor]</code></p>
`}}),vo=new z({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/main/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/main/src/transformers/models/mask2former/image_processing_mask2former.py#L938",returnDescription:`
<p>A list of dictionaries, one per image, each dictionary containing two keys:</p>
<ul>
<li><strong>segmentation</strong> \u2014 A tensor of shape <code>(height, width)</code> where each pixel represents a <code>segment_id</code> or
<code>List[List]</code> run-length encoding (RLE) of the segmentation map if return_coco_annotation is set to
<code>True</code>. Set to <code>None</code> if no mask if found above <code>threshold</code>.</li>
<li><strong>segments_info</strong> \u2014 A dictionary that contains additional information on each segment.<ul>
<li><strong>id</strong> \u2014 An integer representing the <code>segment_id</code>.</li>
<li><strong>label_id</strong> \u2014 An integer representing the label / semantic class id corresponding to <code>segment_id</code>.</li>
<li><strong>score</strong> \u2014 Prediction score of segment with <code>segment_id</code>.</li>
</ul></li>
</ul>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),Fo=new z({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/main/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/main/src/transformers/models/mask2former/image_processing_mask2former.py#L1056",returnDescription:`
<p>A list of dictionaries, one per image, each dictionary containing two keys:</p>
<ul>
<li><strong>segmentation</strong> \u2014 a tensor of shape <code>(height, width)</code> where each pixel represents a <code>segment_id</code>, set
to <code>None</code> if no mask if found above <code>threshold</code>. If <code>target_sizes</code> is specified, segmentation is resized
to the corresponding <code>target_sizes</code> entry.</li>
<li><strong>segments_info</strong> \u2014 A dictionary that contains additional information on each segment.<ul>
<li><strong>id</strong> \u2014 an integer representing the <code>segment_id</code>.</li>
<li><strong>label_id</strong> \u2014 An integer representing the label / semantic class id corresponding to <code>segment_id</code>.</li>
<li><strong>was_fused</strong> \u2014 a boolean, <code>True</code> if <code>label_id</code> was in <code>label_ids_to_fuse</code>, <code>False</code> otherwise.
Multiple instances of the same class / label were fused and assigned a single <code>segment_id</code>.</li>
<li><strong>score</strong> \u2014 Prediction score of segment with <code>segment_id</code>.</li>
</ul></li>
</ul>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),{c(){h=s("meta"),$=c(),_=s("h1"),g=s("a"),k=s("span"),v(l.$$.fragment),u=c(),L=s("span"),Rs=n("Mask2Former"),Bt=c(),G=s("h2"),ae=s("a"),mt=s("span"),v(ze.$$.fragment),Hs=c(),ct=s("span"),Ws=n("Overview"),Vt=c(),B=s("p"),Bs=n("The Mask2Former model was proposed in "),qe=s("a"),Vs=n("Masked-attention Mask Transformer for Universal Image Segmentation"),Gs=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 "),$o=s("a"),Ks=n("MaskFormer"),Qs=n("."),Gt=c(),To=s("p"),Xs=n("The abstract from the paper is the following:"),Kt=c(),xo=s("p"),dt=s("em"),Js=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).`),Qt=c(),Io=s("p"),Zs=n("Tips:"),Xt=c(),ne=s("ul"),N=s("li"),Ys=n("Mask2Former uses the same preprocessing and postprocessing steps as "),Po=s("a"),er=n("MaskFormer"),or=n(". Use "),jo=s("a"),tr=n("Mask2FormerImageProcessor"),sr=n(" or "),Eo=s("a"),rr=n("AutoImageProcessor"),ar=n(" to prepare images and optional targets for the model."),nr=c(),E=s("li"),ir=n("To get the final segmentation, depending on the task, you can call "),zo=s("a"),lr=n("post_process_semantic_segmentation()"),mr=n(" or "),qo=s("a"),cr=n("post_process_instance_segmentation()"),dr=n(" or "),Co=s("a"),pr=n("post_process_panoptic_segmentation()"),hr=n(". All three tasks can be solved using "),Ao=s("a"),fr=n("Mask2FormerForUniversalSegmentation"),gr=n(" output, panoptic segmentation accepts an optional "),pt=s("code"),ur=n("label_ids_to_fuse"),_r=n(" argument to fuse instances of the target object/s (e.g. sky) together."),Jt=c(),ie=s("img"),Zt=c(),Ce=s("small"),kr=n("Mask2Former architecture. Taken from the "),So=s("a"),vr=n("original paper."),Yt=c(),A=s("p"),br=n("This model was contributed by "),Ae=s("a"),Fr=n("Shivalika Singh"),wr=n(" and "),Se=s("a"),yr=n("Alara Dirik"),Mr=n(". The original code can be found "),Oe=s("a"),$r=n("here"),Tr=n("."),es=c(),K=s("h2"),le=s("a"),ht=s("span"),v(Le.$$.fragment),xr=c(),ft=s("span"),Ir=n("Resources"),os=c(),Oo=s("p"),Pr=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Mask2Former."),ts=c(),Lo=s("ul"),Ne=s("li"),jr=n("Demo notebooks regarding inference + fine-tuning Mask2Former on custom data can be found "),Ue=s("a"),Er=n("here"),zr=n("."),ss=c(),No=s("p"),qr=n(`If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we will review it.
The resource should ideally demonstrate something new instead of duplicating an existing resource.`),rs=c(),Q=s("h2"),me=s("a"),gt=s("span"),v(De.$$.fragment),Cr=c(),ut=s("span"),Ar=n("MaskFormer specific outputs"),as=c(),X=s("div"),v(Re.$$.fragment),Sr=c(),He=s("p"),Or=n("Class for outputs of "),Uo=s("a"),Lr=n("Mask2FormerModel"),Nr=n(". This class returns all the needed hidden states to compute the logits."),ns=c(),U=s("div"),v(We.$$.fragment),Ur=c(),Be=s("p"),Dr=n("Class for outputs of "),_t=s("code"),Rr=n("Mask2FormerForUniversalSegmentationOutput"),Hr=n("."),Wr=c(),D=s("p"),Br=n("This output can be directly passed to "),Do=s("a"),Vr=n("post_process_semantic_segmentation()"),Gr=n(` or
`),Ro=s("a"),Kr=n("post_process_instance_segmentation()"),Qr=n(` or
`),Ho=s("a"),Xr=n("post_process_panoptic_segmentation()"),Jr=n(" to compute final segmentation maps. Please, see\n[`~Mask2FormerImageProcessor] for details regarding usage."),is=c(),J=s("h2"),ce=s("a"),kt=s("span"),v(Ve.$$.fragment),Zr=c(),vt=s("span"),Yr=n("Mask2FormerConfig"),ls=c(),x=s("div"),v(Ge.$$.fragment),ea=c(),Z=s("p"),oa=n("This is the configuration class to store the configuration of a "),Wo=s("a"),ta=n("Mask2FormerModel"),sa=n(`. It is used to instantiate a
Mask2Former model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the Mask2Former
`),Ke=s("a"),ra=n("facebook/mask2former-swin-small-coco-instance"),aa=n(`
architecture.`),na=c(),Y=s("p"),ia=n("Configuration objects inherit from "),Bo=s("a"),la=n("PretrainedConfig"),ma=n(` and can be used to control the model outputs. Read the
documentation from `),Vo=s("a"),ca=n("PretrainedConfig"),da=n(" for more information."),pa=c(),Qe=s("p"),ha=n("Currently, Mask2Former only supports the "),Go=s("a"),fa=n("Swin Transformer"),ga=n(" as backbone."),ua=c(),v(de.$$.fragment),_a=c(),pe=s("div"),v(Xe.$$.fragment),ka=c(),Je=s("p"),va=n("Instantiate a "),Ko=s("a"),ba=n("Mask2FormerConfig"),Fa=n(" (or a derived class) from a pre-trained backbone model configuration."),wa=c(),he=s("div"),v(Ze.$$.fragment),ya=c(),Ye=s("p"),Ma=n("Serializes this instance to a Python dictionary. Override the default "),Qo=s("a"),$a=n("to_dict()"),Ta=n("."),ms=c(),ee=s("h2"),fe=s("a"),bt=s("span"),v(eo.$$.fragment),xa=c(),Ft=s("span"),Ia=n("Mask2FormerModel"),cs=c(),R=s("div"),v(oo.$$.fragment),Pa=c(),to=s("p"),ja=n(`The bare Mask2Former Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),so=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.`),qa=c(),S=s("div"),v(ro.$$.fragment),Ca=c(),oe=s("p"),Aa=n("The "),Xo=s("a"),Sa=n("Mask2FormerModel"),Oa=n(" forward method, overrides the "),wt=s("code"),La=n("__call__"),Na=n(" special method."),Ua=c(),v(ge.$$.fragment),Da=c(),v(ue.$$.fragment),ds=c(),te=s("h2"),_e=s("a"),yt=s("span"),v(ao.$$.fragment),Ra=c(),Mt=s("span"),Ha=n("Mask2FormerForUniversalSegmentation"),ps=c(),H=s("div"),v(no.$$.fragment),Wa=c(),io=s("p"),Ba=n(`The Mask2Former Model with heads on top for instance/semantic/panoptic segmentation.
This model is a PyTorch `),lo=s("a"),Va=n("torch.nn.Module"),Ga=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.`),Ka=c(),I=s("div"),v(mo.$$.fragment),Qa=c(),se=s("p"),Xa=n("The "),Jo=s("a"),Ja=n("Mask2FormerForUniversalSegmentation"),Za=n(" forward method, overrides the "),$t=s("code"),Ya=n("__call__"),en=n(" special method."),on=c(),v(ke.$$.fragment),tn=c(),Tt=s("p"),sn=n("Examples:"),rn=c(),v(ve.$$.fragment),an=c(),v(be.$$.fragment),nn=c(),v(Fe.$$.fragment),hs=c(),re=s("h2"),we=s("a"),xt=s("span"),v(co.$$.fragment),ln=c(),It=s("span"),mn=n("Mask2FormerImageProcessor"),fs=c(),T=s("div"),v(po.$$.fragment),cn=c(),Pt=s("p"),dn=n(`Constructs a Mask2Former image processor. The image processor can be used to prepare image(s) and optional targets
for the model.`),pn=c(),ho=s("p"),hn=n("This image processor inherits from "),jt=s("code"),fn=n("BaseImageProcessor"),gn=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),un=c(),Zo=s("div"),v(fo.$$.fragment),_n=c(),V=s("div"),v(go.$$.fragment),kn=c(),uo=s("p"),vn=n("Pad images up to the largest image in a batch and create a corresponding "),Et=s("code"),bn=n("pixel_mask"),Fn=n("."),wn=c(),W=s("p"),yn=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
`),zt=s("code"),Mn=n("segmentation_maps = [[2,6,7,9]]"),$n=n(", the output will contain "),qt=s("code"),Tn=n("mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),xn=n(" (four binary masks) and "),Ct=s("code"),In=n("class_labels = [2,6,7,9]"),Pn=n(`, the labels for
each mask.`),jn=c(),ye=s("div"),v(_o.$$.fragment),En=c(),ko=s("p"),zn=n("Converts the output of "),Yo=s("a"),qn=n("Mask2FormerForUniversalSegmentation"),Cn=n(` into semantic segmentation maps. Only supports
PyTorch.`),An=c(),Me=s("div"),v(vo.$$.fragment),Sn=c(),bo=s("p"),On=n("Converts the output of "),At=s("code"),Ln=n("Mask2FormerForUniversalSegmentationOutput"),Nn=n(` into instance segmentation predictions.
Only supports PyTorch.`),Un=c(),$e=s("div"),v(Fo.$$.fragment),Dn=c(),wo=s("p"),Rn=n("Converts the output of "),St=s("code"),Hn=n("Mask2FormerForUniversalSegmentationOutput"),Wn=n(` into image panoptic segmentation
predictions. Only supports PyTorch.`),this.h()},l(o){const p=hl('[data-svelte="svelte-1phssyn"]',document.head);h=r(p,"META",{name:!0,content:!0}),p.forEach(t),$=d(o),_=r(o,"H1",{class:!0});var yo=a(_);g=r(yo,"A",{id:!0,class:!0,href:!0});var Ot=a(g);k=r(Ot,"SPAN",{});var Lt=a(k);b(l.$$.fragment,Lt),Lt.forEach(t),Ot.forEach(t),u=d(yo),L=r(yo,"SPAN",{});var Nt=a(L);Rs=i(Nt,"Mask2Former"),Nt.forEach(t),yo.forEach(t),Bt=d(o),G=r(o,"H2",{class:!0});var Mo=a(G);ae=r(Mo,"A",{id:!0,class:!0,href:!0});var Ut=a(ae);mt=r(Ut,"SPAN",{});var Dt=a(mt);b(ze.$$.fragment,Dt),Dt.forEach(t),Ut.forEach(t),Hs=d(Mo),ct=r(Mo,"SPAN",{});var Gn=a(ct);Ws=i(Gn,"Overview"),Gn.forEach(t),Mo.forEach(t),Vt=d(o),B=r(o,"P",{});var et=a(B);Bs=i(et,"The Mask2Former model was proposed in "),qe=r(et,"A",{href:!0,rel:!0});var Kn=a(qe);Vs=i(Kn,"Masked-attention Mask Transformer for Universal Image Segmentation"),Kn.forEach(t),Gs=i(et," 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 "),$o=r(et,"A",{href:!0});var Qn=a($o);Ks=i(Qn,"MaskFormer"),Qn.forEach(t),Qs=i(et,"."),et.forEach(t),Gt=d(o),To=r(o,"P",{});var Xn=a(To);Xs=i(Xn,"The abstract from the paper is the following:"),Xn.forEach(t),Kt=d(o),xo=r(o,"P",{});var Jn=a(xo);dt=r(Jn,"EM",{});var Zn=a(dt);Js=i(Zn,`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).`),Zn.forEach(t),Jn.forEach(t),Qt=d(o),Io=r(o,"P",{});var Yn=a(Io);Zs=i(Yn,"Tips:"),Yn.forEach(t),Xt=d(o),ne=r(o,"UL",{});var us=a(ne);N=r(us,"LI",{});var Te=a(N);Ys=i(Te,"Mask2Former uses the same preprocessing and postprocessing steps as "),Po=r(Te,"A",{href:!0});var ei=a(Po);er=i(ei,"MaskFormer"),ei.forEach(t),or=i(Te,". Use "),jo=r(Te,"A",{href:!0});var oi=a(jo);tr=i(oi,"Mask2FormerImageProcessor"),oi.forEach(t),sr=i(Te," or "),Eo=r(Te,"A",{href:!0});var ti=a(Eo);rr=i(ti,"AutoImageProcessor"),ti.forEach(t),ar=i(Te," to prepare images and optional targets for the model."),Te.forEach(t),nr=d(us),E=r(us,"LI",{});var O=a(E);ir=i(O,"To get the final segmentation, depending on the task, you can call "),zo=r(O,"A",{href:!0});var si=a(zo);lr=i(si,"post_process_semantic_segmentation()"),si.forEach(t),mr=i(O," or "),qo=r(O,"A",{href:!0});var ri=a(qo);cr=i(ri,"post_process_instance_segmentation()"),ri.forEach(t),dr=i(O," or "),Co=r(O,"A",{href:!0});var ai=a(Co);pr=i(ai,"post_process_panoptic_segmentation()"),ai.forEach(t),hr=i(O,". All three tasks can be solved using "),Ao=r(O,"A",{href:!0});var ni=a(Ao);fr=i(ni,"Mask2FormerForUniversalSegmentation"),ni.forEach(t),gr=i(O," output, panoptic segmentation accepts an optional "),pt=r(O,"CODE",{});var ii=a(pt);ur=i(ii,"label_ids_to_fuse"),ii.forEach(t),_r=i(O," argument to fuse instances of the target object/s (e.g. sky) together."),O.forEach(t),us.forEach(t),Jt=d(o),ie=r(o,"IMG",{src:!0,alt:!0,width:!0}),Zt=d(o),Ce=r(o,"SMALL",{});var Bn=a(Ce);kr=i(Bn,"Mask2Former architecture. Taken from the "),So=r(Bn,"A",{href:!0});var li=a(So);vr=i(li,"original paper."),li.forEach(t),Bn.forEach(t),Yt=d(o),A=r(o,"P",{});var xe=a(A);br=i(xe,"This model was contributed by "),Ae=r(xe,"A",{href:!0,rel:!0});var mi=a(Ae);Fr=i(mi,"Shivalika Singh"),mi.forEach(t),wr=i(xe," and "),Se=r(xe,"A",{href:!0,rel:!0});var ci=a(Se);yr=i(ci,"Alara Dirik"),ci.forEach(t),Mr=i(xe,". The original code can be found "),Oe=r(xe,"A",{href:!0,rel:!0});var di=a(Oe);$r=i(di,"here"),di.forEach(t),Tr=i(xe,"."),xe.forEach(t),es=d(o),K=r(o,"H2",{class:!0});var _s=a(K);le=r(_s,"A",{id:!0,class:!0,href:!0});var pi=a(le);ht=r(pi,"SPAN",{});var hi=a(ht);b(Le.$$.fragment,hi),hi.forEach(t),pi.forEach(t),xr=d(_s),ft=r(_s,"SPAN",{});var fi=a(ft);Ir=i(fi,"Resources"),fi.forEach(t),_s.forEach(t),os=d(o),Oo=r(o,"P",{});var gi=a(Oo);Pr=i(gi,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Mask2Former."),gi.forEach(t),ts=d(o),Lo=r(o,"UL",{});var ui=a(Lo);Ne=r(ui,"LI",{});var ks=a(Ne);jr=i(ks,"Demo notebooks regarding inference + fine-tuning Mask2Former on custom data can be found "),Ue=r(ks,"A",{href:!0,rel:!0});var _i=a(Ue);Er=i(_i,"here"),_i.forEach(t),zr=i(ks,"."),ks.forEach(t),ui.forEach(t),ss=d(o),No=r(o,"P",{});var ki=a(No);qr=i(ki,`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.`),ki.forEach(t),rs=d(o),Q=r(o,"H2",{class:!0});var vs=a(Q);me=r(vs,"A",{id:!0,class:!0,href:!0});var vi=a(me);gt=r(vi,"SPAN",{});var bi=a(gt);b(De.$$.fragment,bi),bi.forEach(t),vi.forEach(t),Cr=d(vs),ut=r(vs,"SPAN",{});var Fi=a(ut);Ar=i(Fi,"MaskFormer specific outputs"),Fi.forEach(t),vs.forEach(t),as=d(o),X=r(o,"DIV",{class:!0});var bs=a(X);b(Re.$$.fragment,bs),Sr=d(bs),He=r(bs,"P",{});var Fs=a(He);Or=i(Fs,"Class for outputs of "),Uo=r(Fs,"A",{href:!0});var wi=a(Uo);Lr=i(wi,"Mask2FormerModel"),wi.forEach(t),Nr=i(Fs,". This class returns all the needed hidden states to compute the logits."),Fs.forEach(t),bs.forEach(t),ns=d(o),U=r(o,"DIV",{class:!0});var ot=a(U);b(We.$$.fragment,ot),Ur=d(ot),Be=r(ot,"P",{});var ws=a(Be);Dr=i(ws,"Class for outputs of "),_t=r(ws,"CODE",{});var yi=a(_t);Rr=i(yi,"Mask2FormerForUniversalSegmentationOutput"),yi.forEach(t),Hr=i(ws,"."),ws.forEach(t),Wr=d(ot),D=r(ot,"P",{});var Ie=a(D);Br=i(Ie,"This output can be directly passed to "),Do=r(Ie,"A",{href:!0});var Mi=a(Do);Vr=i(Mi,"post_process_semantic_segmentation()"),Mi.forEach(t),Gr=i(Ie,` or
`),Ro=r(Ie,"A",{href:!0});var $i=a(Ro);Kr=i($i,"post_process_instance_segmentation()"),$i.forEach(t),Qr=i(Ie,` or
`),Ho=r(Ie,"A",{href:!0});var Ti=a(Ho);Xr=i(Ti,"post_process_panoptic_segmentation()"),Ti.forEach(t),Jr=i(Ie," to compute final segmentation maps. Please, see\n[`~Mask2FormerImageProcessor] for details regarding usage."),Ie.forEach(t),ot.forEach(t),is=d(o),J=r(o,"H2",{class:!0});var ys=a(J);ce=r(ys,"A",{id:!0,class:!0,href:!0});var xi=a(ce);kt=r(xi,"SPAN",{});var Ii=a(kt);b(Ve.$$.fragment,Ii),Ii.forEach(t),xi.forEach(t),Zr=d(ys),vt=r(ys,"SPAN",{});var Pi=a(vt);Yr=i(Pi,"Mask2FormerConfig"),Pi.forEach(t),ys.forEach(t),ls=d(o),x=r(o,"DIV",{class:!0});var q=a(x);b(Ge.$$.fragment,q),ea=d(q),Z=r(q,"P",{});var tt=a(Z);oa=i(tt,"This is the configuration class to store the configuration of a "),Wo=r(tt,"A",{href:!0});var ji=a(Wo);ta=i(ji,"Mask2FormerModel"),ji.forEach(t),sa=i(tt,`. 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
`),Ke=r(tt,"A",{href:!0,rel:!0});var Ei=a(Ke);ra=i(Ei,"facebook/mask2former-swin-small-coco-instance"),Ei.forEach(t),aa=i(tt,`
architecture.`),tt.forEach(t),na=d(q),Y=r(q,"P",{});var st=a(Y);ia=i(st,"Configuration objects inherit from "),Bo=r(st,"A",{href:!0});var zi=a(Bo);la=i(zi,"PretrainedConfig"),zi.forEach(t),ma=i(st,` and can be used to control the model outputs. Read the
documentation from `),Vo=r(st,"A",{href:!0});var qi=a(Vo);ca=i(qi,"PretrainedConfig"),qi.forEach(t),da=i(st," for more information."),st.forEach(t),pa=d(q),Qe=r(q,"P",{});var Ms=a(Qe);ha=i(Ms,"Currently, Mask2Former only supports the "),Go=r(Ms,"A",{href:!0});var Ci=a(Go);fa=i(Ci,"Swin Transformer"),Ci.forEach(t),ga=i(Ms," as backbone."),Ms.forEach(t),ua=d(q),b(de.$$.fragment,q),_a=d(q),pe=r(q,"DIV",{class:!0});var $s=a(pe);b(Xe.$$.fragment,$s),ka=d($s),Je=r($s,"P",{});var Ts=a(Je);va=i(Ts,"Instantiate a "),Ko=r(Ts,"A",{href:!0});var Ai=a(Ko);ba=i(Ai,"Mask2FormerConfig"),Ai.forEach(t),Fa=i(Ts," (or a derived class) from a pre-trained backbone model configuration."),Ts.forEach(t),$s.forEach(t),wa=d(q),he=r(q,"DIV",{class:!0});var xs=a(he);b(Ze.$$.fragment,xs),ya=d(xs),Ye=r(xs,"P",{});var Is=a(Ye);Ma=i(Is,"Serializes this instance to a Python dictionary. Override the default "),Qo=r(Is,"A",{href:!0});var Si=a(Qo);$a=i(Si,"to_dict()"),Si.forEach(t),Ta=i(Is,"."),Is.forEach(t),xs.forEach(t),q.forEach(t),ms=d(o),ee=r(o,"H2",{class:!0});var Ps=a(ee);fe=r(Ps,"A",{id:!0,class:!0,href:!0});var Oi=a(fe);bt=r(Oi,"SPAN",{});var Li=a(bt);b(eo.$$.fragment,Li),Li.forEach(t),Oi.forEach(t),xa=d(Ps),Ft=r(Ps,"SPAN",{});var Ni=a(Ft);Ia=i(Ni,"Mask2FormerModel"),Ni.forEach(t),Ps.forEach(t),cs=d(o),R=r(o,"DIV",{class:!0});var rt=a(R);b(oo.$$.fragment,rt),Pa=d(rt),to=r(rt,"P",{});var js=a(to);ja=i(js,`The bare Mask2Former Model outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),so=r(js,"A",{href:!0,rel:!0});var Ui=a(so);Ea=i(Ui,"torch.nn.Module"),Ui.forEach(t),za=i(js,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),js.forEach(t),qa=d(rt),S=r(rt,"DIV",{class:!0});var Pe=a(S);b(ro.$$.fragment,Pe),Ca=d(Pe),oe=r(Pe,"P",{});var at=a(oe);Aa=i(at,"The "),Xo=r(at,"A",{href:!0});var Di=a(Xo);Sa=i(Di,"Mask2FormerModel"),Di.forEach(t),Oa=i(at," forward method, overrides the "),wt=r(at,"CODE",{});var Ri=a(wt);La=i(Ri,"__call__"),Ri.forEach(t),Na=i(at," special method."),at.forEach(t),Ua=d(Pe),b(ge.$$.fragment,Pe),Da=d(Pe),b(ue.$$.fragment,Pe),Pe.forEach(t),rt.forEach(t),ds=d(o),te=r(o,"H2",{class:!0});var Es=a(te);_e=r(Es,"A",{id:!0,class:!0,href:!0});var Hi=a(_e);yt=r(Hi,"SPAN",{});var Wi=a(yt);b(ao.$$.fragment,Wi),Wi.forEach(t),Hi.forEach(t),Ra=d(Es),Mt=r(Es,"SPAN",{});var Bi=a(Mt);Ha=i(Bi,"Mask2FormerForUniversalSegmentation"),Bi.forEach(t),Es.forEach(t),ps=d(o),H=r(o,"DIV",{class:!0});var nt=a(H);b(no.$$.fragment,nt),Wa=d(nt),io=r(nt,"P",{});var zs=a(io);Ba=i(zs,`The Mask2Former Model with heads on top for instance/semantic/panoptic segmentation.
This model is a PyTorch `),lo=r(zs,"A",{href:!0,rel:!0});var Vi=a(lo);Va=i(Vi,"torch.nn.Module"),Vi.forEach(t),Ga=i(zs,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),zs.forEach(t),Ka=d(nt),I=r(nt,"DIV",{class:!0});var C=a(I);b(mo.$$.fragment,C),Qa=d(C),se=r(C,"P",{});var it=a(se);Xa=i(it,"The "),Jo=r(it,"A",{href:!0});var Gi=a(Jo);Ja=i(Gi,"Mask2FormerForUniversalSegmentation"),Gi.forEach(t),Za=i(it," forward method, overrides the "),$t=r(it,"CODE",{});var Ki=a($t);Ya=i(Ki,"__call__"),Ki.forEach(t),en=i(it," special method."),it.forEach(t),on=d(C),b(ke.$$.fragment,C),tn=d(C),Tt=r(C,"P",{});var Qi=a(Tt);sn=i(Qi,"Examples:"),Qi.forEach(t),rn=d(C),b(ve.$$.fragment,C),an=d(C),b(be.$$.fragment,C),nn=d(C),b(Fe.$$.fragment,C),C.forEach(t),nt.forEach(t),hs=d(o),re=r(o,"H2",{class:!0});var qs=a(re);we=r(qs,"A",{id:!0,class:!0,href:!0});var Xi=a(we);xt=r(Xi,"SPAN",{});var Ji=a(xt);b(co.$$.fragment,Ji),Ji.forEach(t),Xi.forEach(t),ln=d(qs),It=r(qs,"SPAN",{});var Zi=a(It);mn=i(Zi,"Mask2FormerImageProcessor"),Zi.forEach(t),qs.forEach(t),fs=d(o),T=r(o,"DIV",{class:!0});var j=a(T);b(po.$$.fragment,j),cn=d(j),Pt=r(j,"P",{});var Yi=a(Pt);dn=i(Yi,`Constructs a Mask2Former image processor. The image processor can be used to prepare image(s) and optional targets
for the model.`),Yi.forEach(t),pn=d(j),ho=r(j,"P",{});var Cs=a(ho);hn=i(Cs,"This image processor inherits from "),jt=r(Cs,"CODE",{});var el=a(jt);fn=i(el,"BaseImageProcessor"),el.forEach(t),gn=i(Cs,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Cs.forEach(t),un=d(j),Zo=r(j,"DIV",{class:!0});var ol=a(Zo);b(fo.$$.fragment,ol),ol.forEach(t),_n=d(j),V=r(j,"DIV",{class:!0});var lt=a(V);b(go.$$.fragment,lt),kn=d(lt),uo=r(lt,"P",{});var As=a(uo);vn=i(As,"Pad images up to the largest image in a batch and create a corresponding "),Et=r(As,"CODE",{});var tl=a(Et);bn=i(tl,"pixel_mask"),tl.forEach(t),Fn=i(As,"."),As.forEach(t),wn=d(lt),W=r(lt,"P",{});var je=a(W);yn=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
`),zt=r(je,"CODE",{});var sl=a(zt);Mn=i(sl,"segmentation_maps = [[2,6,7,9]]"),sl.forEach(t),$n=i(je,", the output will contain "),qt=r(je,"CODE",{});var rl=a(qt);Tn=i(rl,"mask_labels = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]"),rl.forEach(t),xn=i(je," (four binary masks) and "),Ct=r(je,"CODE",{});var al=a(Ct);In=i(al,"class_labels = [2,6,7,9]"),al.forEach(t),Pn=i(je,`, the labels for
each mask.`),je.forEach(t),lt.forEach(t),jn=d(j),ye=r(j,"DIV",{class:!0});var Ss=a(ye);b(_o.$$.fragment,Ss),En=d(Ss),ko=r(Ss,"P",{});var Os=a(ko);zn=i(Os,"Converts the output of "),Yo=r(Os,"A",{href:!0});var nl=a(Yo);qn=i(nl,"Mask2FormerForUniversalSegmentation"),nl.forEach(t),Cn=i(Os,` into semantic segmentation maps. Only supports
PyTorch.`),Os.forEach(t),Ss.forEach(t),An=d(j),Me=r(j,"DIV",{class:!0});var Ls=a(Me);b(vo.$$.fragment,Ls),Sn=d(Ls),bo=r(Ls,"P",{});var Ns=a(bo);On=i(Ns,"Converts the output of "),At=r(Ns,"CODE",{});var il=a(At);Ln=i(il,"Mask2FormerForUniversalSegmentationOutput"),il.forEach(t),Nn=i(Ns,` into instance segmentation predictions.
Only supports PyTorch.`),Ns.forEach(t),Ls.forEach(t),Un=d(j),$e=r(j,"DIV",{class:!0});var Us=a($e);b(Fo.$$.fragment,Us),Dn=d(Us),wo=r(Us,"P",{});var Ds=a(wo);Rn=i(Ds,"Converts the output of "),St=r(Ds,"CODE",{});var ll=a(St);Hn=i(ll,"Mask2FormerForUniversalSegmentationOutput"),ll.forEach(t),Wn=i(Ds,` into image panoptic segmentation
predictions. Only supports PyTorch.`),Ds.forEach(t),Us.forEach(t),j.forEach(t),this.h()},h(){m(h,"name","hf:doc:metadata"),m(h,"content",JSON.stringify(Ml)),m(g,"id","mask2former"),m(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"),m(g,"href","#mask2former"),m(_,"class","relative group"),m(ae,"id","overview"),m(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"),m(ae,"href","#overview"),m(G,"class","relative group"),m(qe,"href","https://arxiv.org/abs/2112.01527"),m(qe,"rel","nofollow"),m($o,"href","maskformer"),m(Po,"href","maskformer"),m(jo,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor"),m(Eo,"href","/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor"),m(zo,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_semantic_segmentation"),m(qo,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_instance_segmentation"),m(Co,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_panoptic_segmentation"),m(Ao,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation"),fl(ie.src,Vn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/mask2former_architecture.jpg")||m(ie,"src",Vn),m(ie,"alt","drawing"),m(ie,"width","600"),m(So,"href","https://arxiv.org/abs/2112.01527"),m(Ae,"href","https://huggingface.co/shivi"),m(Ae,"rel","nofollow"),m(Se,"href","https://huggingface.co/adirik"),m(Se,"rel","nofollow"),m(Oe,"href","https://github.com/facebookresearch/Mask2Former"),m(Oe,"rel","nofollow"),m(le,"id","resources"),m(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"),m(le,"href","#resources"),m(K,"class","relative group"),m(Ue,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Mask2Former"),m(Ue,"rel","nofollow"),m(me,"id","transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput"),m(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"),m(me,"href","#transformers.models.mask2former.modeling_mask2former.Mask2FormerModelOutput"),m(Q,"class","relative group"),m(Uo,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerModel"),m(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Do,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_semantic_segmentation"),m(Ro,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_instance_segmentation"),m(Ho,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerImageProcessor.post_process_panoptic_segmentation"),m(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(ce,"id","transformers.Mask2FormerConfig"),m(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"),m(ce,"href","#transformers.Mask2FormerConfig"),m(J,"class","relative group"),m(Wo,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerModel"),m(Ke,"href","https://huggingface.co/facebook/mask2former-swin-small-coco-instance"),m(Ke,"rel","nofollow"),m(Bo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),m(Vo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),m(Go,"href","swin"),m(Ko,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerConfig"),m(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Qo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig.to_dict"),m(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(fe,"id","transformers.Mask2FormerModel"),m(fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(fe,"href","#transformers.Mask2FormerModel"),m(ee,"class","relative group"),m(so,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(so,"rel","nofollow"),m(Xo,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerModel"),m(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(_e,"id","transformers.Mask2FormerForUniversalSegmentation"),m(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(_e,"href","#transformers.Mask2FormerForUniversalSegmentation"),m(te,"class","relative group"),m(lo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(lo,"rel","nofollow"),m(Jo,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation"),m(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(we,"id","transformers.Mask2FormerImageProcessor"),m(we,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(we,"href","#transformers.Mask2FormerImageProcessor"),m(re,"class","relative group"),m(Zo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Yo,"href","/docs/transformers/main/en/model_doc/mask2former#transformers.Mask2FormerForUniversalSegmentation"),m(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(T,"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,$,p),f(o,_,p),e(_,g),e(g,k),F(l,k,null),e(_,u),e(_,L),e(L,Rs),f(o,Bt,p),f(o,G,p),e(G,ae),e(ae,mt),F(ze,mt,null),e(G,Hs),e(G,ct),e(ct,Ws),f(o,Vt,p),f(o,B,p),e(B,Bs),e(B,qe),e(qe,Vs),e(B,Gs),e(B,$o),e($o,Ks),e(B,Qs),f(o,Gt,p),f(o,To,p),e(To,Xs),f(o,Kt,p),f(o,xo,p),e(xo,dt),e(dt,Js),f(o,Qt,p),f(o,Io,p),e(Io,Zs),f(o,Xt,p),f(o,ne,p),e(ne,N),e(N,Ys),e(N,Po),e(Po,er),e(N,or),e(N,jo),e(jo,tr),e(N,sr),e(N,Eo),e(Eo,rr),e(N,ar),e(ne,nr),e(ne,E),e(E,ir),e(E,zo),e(zo,lr),e(E,mr),e(E,qo),e(qo,cr),e(E,dr),e(E,Co),e(Co,pr),e(E,hr),e(E,Ao),e(Ao,fr),e(E,gr),e(E,pt),e(pt,ur),e(E,_r),f(o,Jt,p),f(o,ie,p),f(o,Zt,p),f(o,Ce,p),e(Ce,kr),e(Ce,So),e(So,vr),f(o,Yt,p),f(o,A,p),e(A,br),e(A,Ae),e(Ae,Fr),e(A,wr),e(A,Se),e(Se,yr),e(A,Mr),e(A,Oe),e(Oe,$r),e(A,Tr),f(o,es,p),f(o,K,p),e(K,le),e(le,ht),F(Le,ht,null),e(K,xr),e(K,ft),e(ft,Ir),f(o,os,p),f(o,Oo,p),e(Oo,Pr),f(o,ts,p),f(o,Lo,p),e(Lo,Ne),e(Ne,jr),e(Ne,Ue),e(Ue,Er),e(Ne,zr),f(o,ss,p),f(o,No,p),e(No,qr),f(o,rs,p),f(o,Q,p),e(Q,me),e(me,gt),F(De,gt,null),e(Q,Cr),e(Q,ut),e(ut,Ar),f(o,as,p),f(o,X,p),F(Re,X,null),e(X,Sr),e(X,He),e(He,Or),e(He,Uo),e(Uo,Lr),e(He,Nr),f(o,ns,p),f(o,U,p),F(We,U,null),e(U,Ur),e(U,Be),e(Be,Dr),e(Be,_t),e(_t,Rr),e(Be,Hr),e(U,Wr),e(U,D),e(D,Br),e(D,Do),e(Do,Vr),e(D,Gr),e(D,Ro),e(Ro,Kr),e(D,Qr),e(D,Ho),e(Ho,Xr),e(D,Jr),f(o,is,p),f(o,J,p),e(J,ce),e(ce,kt),F(Ve,kt,null),e(J,Zr),e(J,vt),e(vt,Yr),f(o,ls,p),f(o,x,p),F(Ge,x,null),e(x,ea),e(x,Z),e(Z,oa),e(Z,Wo),e(Wo,ta),e(Z,sa),e(Z,Ke),e(Ke,ra),e(Z,aa),e(x,na),e(x,Y),e(Y,ia),e(Y,Bo),e(Bo,la),e(Y,ma),e(Y,Vo),e(Vo,ca),e(Y,da),e(x,pa),e(x,Qe),e(Qe,ha),e(Qe,Go),e(Go,fa),e(Qe,ga),e(x,ua),F(de,x,null),e(x,_a),e(x,pe),F(Xe,pe,null),e(pe,ka),e(pe,Je),e(Je,va),e(Je,Ko),e(Ko,ba),e(Je,Fa),e(x,wa),e(x,he),F(Ze,he,null),e(he,ya),e(he,Ye),e(Ye,Ma),e(Ye,Qo),e(Qo,$a),e(Ye,Ta),f(o,ms,p),f(o,ee,p),e(ee,fe),e(fe,bt),F(eo,bt,null),e(ee,xa),e(ee,Ft),e(Ft,Ia),f(o,cs,p),f(o,R,p),F(oo,R,null),e(R,Pa),e(R,to),e(to,ja),e(to,so),e(so,Ea),e(to,za),e(R,qa),e(R,S),F(ro,S,null),e(S,Ca),e(S,oe),e(oe,Aa),e(oe,Xo),e(Xo,Sa),e(oe,Oa),e(oe,wt),e(wt,La),e(oe,Na),e(S,Ua),F(ge,S,null),e(S,Da),F(ue,S,null),f(o,ds,p),f(o,te,p),e(te,_e),e(_e,yt),F(ao,yt,null),e(te,Ra),e(te,Mt),e(Mt,Ha),f(o,ps,p),f(o,H,p),F(no,H,null),e(H,Wa),e(H,io),e(io,Ba),e(io,lo),e(lo,Va),e(io,Ga),e(H,Ka),e(H,I),F(mo,I,null),e(I,Qa),e(I,se),e(se,Xa),e(se,Jo),e(Jo,Ja),e(se,Za),e(se,$t),e($t,Ya),e(se,en),e(I,on),F(ke,I,null),e(I,tn),e(I,Tt),e(Tt,sn),e(I,rn),F(ve,I,null),e(I,an),F(be,I,null),e(I,nn),F(Fe,I,null),f(o,hs,p),f(o,re,p),e(re,we),e(we,xt),F(co,xt,null),e(re,ln),e(re,It),e(It,mn),f(o,fs,p),f(o,T,p),F(po,T,null),e(T,cn),e(T,Pt),e(Pt,dn),e(T,pn),e(T,ho),e(ho,hn),e(ho,jt),e(jt,fn),e(ho,gn),e(T,un),e(T,Zo),F(fo,Zo,null),e(T,_n),e(T,V),F(go,V,null),e(V,kn),e(V,uo),e(uo,vn),e(uo,Et),e(Et,bn),e(uo,Fn),e(V,wn),e(V,W),e(W,yn),e(W,zt),e(zt,Mn),e(W,$n),e(W,qt),e(qt,Tn),e(W,xn),e(W,Ct),e(Ct,In),e(W,Pn),e(T,jn),e(T,ye),F(_o,ye,null),e(ye,En),e(ye,ko),e(ko,zn),e(ko,Yo),e(Yo,qn),e(ko,Cn),e(T,An),e(T,Me),F(vo,Me,null),e(Me,Sn),e(Me,bo),e(bo,On),e(bo,At),e(At,Ln),e(bo,Nn),e(T,Un),e(T,$e),F(Fo,$e,null),e($e,Dn),e($e,wo),e(wo,Rn),e(wo,St),e(St,Hn),e(wo,Wn),gs=!0},p(o,[p]){const yo={};p&2&&(yo.$$scope={dirty:p,ctx:o}),de.$set(yo);const Ot={};p&2&&(Ot.$$scope={dirty:p,ctx:o}),ge.$set(Ot);const Lt={};p&2&&(Lt.$$scope={dirty:p,ctx:o}),ue.$set(Lt);const Nt={};p&2&&(Nt.$$scope={dirty:p,ctx:o}),ke.$set(Nt);const Mo={};p&2&&(Mo.$$scope={dirty:p,ctx:o}),ve.$set(Mo);const Ut={};p&2&&(Ut.$$scope={dirty:p,ctx:o}),be.$set(Ut);const Dt={};p&2&&(Dt.$$scope={dirty:p,ctx:o}),Fe.$set(Dt)},i(o){gs||(w(l.$$.fragment,o),w(ze.$$.fragment,o),w(Le.$$.fragment,o),w(De.$$.fragment,o),w(Re.$$.fragment,o),w(We.$$.fragment,o),w(Ve.$$.fragment,o),w(Ge.$$.fragment,o),w(de.$$.fragment,o),w(Xe.$$.fragment,o),w(Ze.$$.fragment,o),w(eo.$$.fragment,o),w(oo.$$.fragment,o),w(ro.$$.fragment,o),w(ge.$$.fragment,o),w(ue.$$.fragment,o),w(ao.$$.fragment,o),w(no.$$.fragment,o),w(mo.$$.fragment,o),w(ke.$$.fragment,o),w(ve.$$.fragment,o),w(be.$$.fragment,o),w(Fe.$$.fragment,o),w(co.$$.fragment,o),w(po.$$.fragment,o),w(fo.$$.fragment,o),w(go.$$.fragment,o),w(_o.$$.fragment,o),w(vo.$$.fragment,o),w(Fo.$$.fragment,o),gs=!0)},o(o){y(l.$$.fragment,o),y(ze.$$.fragment,o),y(Le.$$.fragment,o),y(De.$$.fragment,o),y(Re.$$.fragment,o),y(We.$$.fragment,o),y(Ve.$$.fragment,o),y(Ge.$$.fragment,o),y(de.$$.fragment,o),y(Xe.$$.fragment,o),y(Ze.$$.fragment,o),y(eo.$$.fragment,o),y(oo.$$.fragment,o),y(ro.$$.fragment,o),y(ge.$$.fragment,o),y(ue.$$.fragment,o),y(ao.$$.fragment,o),y(no.$$.fragment,o),y(mo.$$.fragment,o),y(ke.$$.fragment,o),y(ve.$$.fragment,o),y(be.$$.fragment,o),y(Fe.$$.fragment,o),y(co.$$.fragment,o),y(po.$$.fragment,o),y(fo.$$.fragment,o),y(go.$$.fragment,o),y(_o.$$.fragment,o),y(vo.$$.fragment,o),y(Fo.$$.fragment,o),gs=!1},d(o){t(h),o&&t($),o&&t(_),M(l),o&&t(Bt),o&&t(G),M(ze),o&&t(Vt),o&&t(B),o&&t(Gt),o&&t(To),o&&t(Kt),o&&t(xo),o&&t(Qt),o&&t(Io),o&&t(Xt),o&&t(ne),o&&t(Jt),o&&t(ie),o&&t(Zt),o&&t(Ce),o&&t(Yt),o&&t(A),o&&t(es),o&&t(K),M(Le),o&&t(os),o&&t(Oo),o&&t(ts),o&&t(Lo),o&&t(ss),o&&t(No),o&&t(rs),o&&t(Q),M(De),o&&t(as),o&&t(X),M(Re),o&&t(ns),o&&t(U),M(We),o&&t(is),o&&t(J),M(Ve),o&&t(ls),o&&t(x),M(Ge),M(de),M(Xe),M(Ze),o&&t(ms),o&&t(ee),M(eo),o&&t(cs),o&&t(R),M(oo),M(ro),M(ge),M(ue),o&&t(ds),o&&t(te),M(ao),o&&t(ps),o&&t(H),M(no),M(mo),M(ke),M(ve),M(be),M(Fe),o&&t(hs),o&&t(re),M(co),o&&t(fs),o&&t(T),M(po),M(fo),M(go),M(_o),M(vo),M(Fo)}}}const Ml={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 $l(P){return gl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class zl extends cl{constructor(h){super();dl(this,h,$l,yl,pl,{})}}export{zl as default,Ml as metadata};
