import{S as Rg,i as Hg,s as Ug,e as s,k as d,w as b,t as n,M as Wg,c as a,d as t,m as c,a as i,x as v,h as r,b as l,G as e,g as m,y as D,q as y,o as w,B as T,v as Gg,L as Ja}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ka}from"../../chunks/Tip-hf-doc-builder.js";import{D as N}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Oo}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as xt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Za}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Bg(C){let f,E,g,u,x;return u=new Oo({props:{code:`from transformers import DetrConfig, DetrModel

# Initializing a DETR facebook/detr-resnet-50 style configuration
configuration = DetrConfig()

# Initializing a model (with random weights) from the facebook/detr-resnet-50 style configuration
model = DetrModel(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> DetrConfig, DetrModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a DETR facebook/detr-resnet-50 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = DetrConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the facebook/detr-resnet-50 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DetrModel(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(){f=s("p"),E=n("Examples:"),g=d(),b(u.$$.fragment)},l(p){f=a(p,"P",{});var _=i(f);E=r(_,"Examples:"),_.forEach(t),g=c(p),v(u.$$.fragment,p)},m(p,_){m(p,f,_),e(f,E),m(p,g,_),D(u,p,_),x=!0},p:Ja,i(p){x||(y(u.$$.fragment,p),x=!0)},o(p){w(u.$$.fragment,p),x=!1},d(p){p&&t(f),p&&t(g),T(u,p)}}}function Vg(C){let f,E;return{c(){f=s("p"),E=n(`NumPy arrays and PyTorch tensors are converted to PIL images when resizing, so the most efficient is to pass
PIL images.`)},l(g){f=a(g,"P",{});var u=i(f);E=r(u,`NumPy arrays and PyTorch tensors are converted to PIL images when resizing, so the most efficient is to pass
PIL images.`),u.forEach(t)},m(g,u){m(g,f,u),e(f,E)},d(g){g&&t(f)}}}function Yg(C){let f,E,g,u,x;return{c(){f=s("p"),E=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),u=n("Module"),x=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(p){f=a(p,"P",{});var _=i(f);E=r(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(_,"CODE",{});var U=i(g);u=r(U,"Module"),U.forEach(t),x=r(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(t)},m(p,_){m(p,f,_),e(f,E),e(f,g),e(g,u),e(f,x)},d(p){p&&t(f)}}}function Qg(C){let f,E,g,u,x;return u=new Oo({props:{code:`from transformers import DetrFeatureExtractor, DetrModel
from PIL import Image
import requests

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

feature_extractor = DetrFeatureExtractor.from_pretrained("facebook/detr-resnet-50")
model = DetrModel.from_pretrained("facebook/detr-resnet-50")

# prepare image for the model
inputs = feature_extractor(images=image, return_tensors="pt")

# forward pass
outputs = model(**inputs)

# the last hidden states are the final query embeddings of the Transformer decoder
# these are of shape (batch_size, num_queries, hidden_size)
last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DetrFeatureExtractor, DetrModel
<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>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>feature_extractor = DetrFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;facebook/detr-resnet-50&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DetrModel.from_pretrained(<span class="hljs-string">&quot;facebook/detr-resnet-50&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare image for the model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># the last hidden states are the final query embeddings of the Transformer decoder</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># these are of shape (batch_size, num_queries, hidden_size)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">100</span>, <span class="hljs-number">256</span>]`}}),{c(){f=s("p"),E=n("Examples:"),g=d(),b(u.$$.fragment)},l(p){f=a(p,"P",{});var _=i(f);E=r(_,"Examples:"),_.forEach(t),g=c(p),v(u.$$.fragment,p)},m(p,_){m(p,f,_),e(f,E),m(p,g,_),D(u,p,_),x=!0},p:Ja,i(p){x||(y(u.$$.fragment,p),x=!0)},o(p){w(u.$$.fragment,p),x=!1},d(p){p&&t(f),p&&t(g),T(u,p)}}}function Kg(C){let f,E,g,u,x;return{c(){f=s("p"),E=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),u=n("Module"),x=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(p){f=a(p,"P",{});var _=i(f);E=r(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(_,"CODE",{});var U=i(g);u=r(U,"Module"),U.forEach(t),x=r(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(t)},m(p,_){m(p,f,_),e(f,E),e(f,g),e(g,u),e(f,x)},d(p){p&&t(f)}}}function Zg(C){let f,E,g,u,x;return u=new Oo({props:{code:`from transformers import DetrFeatureExtractor, DetrForObjectDetection
import torch
from PIL import Image
import requests

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

feature_extractor = DetrFeatureExtractor.from_pretrained("facebook/detr-resnet-50")
model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50")

inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)

# convert outputs (bounding boxes and class logits) to COCO API
target_sizes = torch.tensor([image.size[::-1]])
results = feature_extractor.post_process_object_detection(
    outputs, threshold=0.9, target_sizes=target_sizes
)[0]

for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
    box = [round(i, 2) for i in box.tolist()]
    print(
        f"Detected {model.config.id2label[label.item()]} with confidence "
        f"{round(score.item(), 3)} at location {box}"
    )`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DetrFeatureExtractor, DetrForObjectDetection
<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>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>feature_extractor = DetrFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;facebook/detr-resnet-50&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DetrForObjectDetection.from_pretrained(<span class="hljs-string">&quot;facebook/detr-resnet-50&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># convert outputs (bounding boxes and class logits) to COCO API</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_sizes = torch.tensor([image.size[::-<span class="hljs-number">1</span>]])
<span class="hljs-meta">&gt;&gt;&gt; </span>results = feature_extractor.post_process_object_detection(
<span class="hljs-meta">... </span>    outputs, threshold=<span class="hljs-number">0.9</span>, target_sizes=target_sizes
<span class="hljs-meta">... </span>)[<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> score, label, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(results[<span class="hljs-string">&quot;scores&quot;</span>], results[<span class="hljs-string">&quot;labels&quot;</span>], results[<span class="hljs-string">&quot;boxes&quot;</span>]):
<span class="hljs-meta">... </span>    box = [<span class="hljs-built_in">round</span>(i, <span class="hljs-number">2</span>) <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> box.tolist()]
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(
<span class="hljs-meta">... </span>        <span class="hljs-string">f&quot;Detected <span class="hljs-subst">{model.config.id2label[label.item()]}</span> with confidence &quot;</span>
<span class="hljs-meta">... </span>        <span class="hljs-string">f&quot;<span class="hljs-subst">{<span class="hljs-built_in">round</span>(score.item(), <span class="hljs-number">3</span>)}</span> at location <span class="hljs-subst">{box}</span>&quot;</span>
<span class="hljs-meta">... </span>    )
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.998</span> at location [<span class="hljs-number">40.16</span>, <span class="hljs-number">70.81</span>, <span class="hljs-number">175.55</span>, <span class="hljs-number">117.98</span>]
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.996</span> at location [<span class="hljs-number">333.24</span>, <span class="hljs-number">72.55</span>, <span class="hljs-number">368.33</span>, <span class="hljs-number">187.66</span>]
Detected couch <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.995</span> at location [-<span class="hljs-number">0.02</span>, <span class="hljs-number">1.15</span>, <span class="hljs-number">639.73</span>, <span class="hljs-number">473.76</span>]
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.999</span> at location [<span class="hljs-number">13.24</span>, <span class="hljs-number">52.05</span>, <span class="hljs-number">314.02</span>, <span class="hljs-number">470.93</span>]
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.999</span> at location [<span class="hljs-number">345.4</span>, <span class="hljs-number">23.85</span>, <span class="hljs-number">640.37</span>, <span class="hljs-number">368.72</span>]`}}),{c(){f=s("p"),E=n("Examples:"),g=d(),b(u.$$.fragment)},l(p){f=a(p,"P",{});var _=i(f);E=r(_,"Examples:"),_.forEach(t),g=c(p),v(u.$$.fragment,p)},m(p,_){m(p,f,_),e(f,E),m(p,g,_),D(u,p,_),x=!0},p:Ja,i(p){x||(y(u.$$.fragment,p),x=!0)},o(p){w(u.$$.fragment,p),x=!1},d(p){p&&t(f),p&&t(g),T(u,p)}}}function Jg(C){let f,E,g,u,x;return{c(){f=s("p"),E=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),u=n("Module"),x=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(p){f=a(p,"P",{});var _=i(f);E=r(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=a(_,"CODE",{});var U=i(g);u=r(U,"Module"),U.forEach(t),x=r(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(t)},m(p,_){m(p,f,_),e(f,E),e(f,g),e(g,u),e(f,x)},d(p){p&&t(f)}}}function Xg(C){let f,E,g,u,x;return u=new Oo({props:{code:`import io
import requests
from PIL import Image
import torch
import numpy

from transformers import DetrFeatureExtractor, DetrForSegmentation
from transformers.models.detr.feature_extraction_detr import rgb_to_id

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

feature_extractor = DetrFeatureExtractor.from_pretrained("facebook/detr-resnet-50-panoptic")
model = DetrForSegmentation.from_pretrained("facebook/detr-resnet-50-panoptic")

# prepare image for the model
inputs = feature_extractor(images=image, return_tensors="pt")

# forward pass
outputs = model(**inputs)

# Use the \`post_process_panoptic_segmentation\` method of \`DetrFeatureExtractor\` to retrieve post-processed panoptic segmentation maps
# Segmentation results are returned as a list of dictionaries
result = feature_extractor.post_process_panoptic_segmentation(outputs, target_sizes=[(300, 500)])

# A tensor of shape (height, width) where each value denotes a segment id, filled with -1 if no segment is found
panoptic_seg = result[0]["segmentation"]
# Get prediction score and segment_id to class_id mapping of each segment
panoptic_segments_info = result[0]["segments_info"]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> io
<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> PIL <span class="hljs-keyword">import</span> Image
<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">import</span> numpy

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DetrFeatureExtractor, DetrForSegmentation
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.models.detr.feature_extraction_detr <span class="hljs-keyword">import</span> rgb_to_id

<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>feature_extractor = DetrFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;facebook/detr-resnet-50-panoptic&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DetrForSegmentation.from_pretrained(<span class="hljs-string">&quot;facebook/detr-resnet-50-panoptic&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare image for the model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Use the \`post_process_panoptic_segmentation\` method of \`DetrFeatureExtractor\` to retrieve post-processed panoptic segmentation maps</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Segmentation results are returned as a list of dictionaries</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>result = feature_extractor.post_process_panoptic_segmentation(outputs, target_sizes=[(<span class="hljs-number">300</span>, <span class="hljs-number">500</span>)])

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># A tensor of shape (height, width) where each value denotes a segment id, filled with -1 if no segment is found</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>panoptic_seg = result[<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-comment"># Get prediction score and segment_id to class_id mapping of each segment</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>panoptic_segments_info = result[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;segments_info&quot;</span>]`}}),{c(){f=s("p"),E=n("Examples:"),g=d(),b(u.$$.fragment)},l(p){f=a(p,"P",{});var _=i(f);E=r(_,"Examples:"),_.forEach(t),g=c(p),v(u.$$.fragment,p)},m(p,_){m(p,f,_),e(f,E),m(p,g,_),D(u,p,_),x=!0},p:Ja,i(p){x||(y(u.$$.fragment,p),x=!0)},o(p){w(u.$$.fragment,p),x=!1},d(p){p&&t(f),p&&t(g),T(u,p)}}}function e_(C){let f,E,g,u,x,p,_,U,Xa,As,De,Me,Cn,Et,ei,zn,ti,Ms,Ie,oi,Ft,ni,ri,Is,Co,si,Ls,zo,qn,ai,Rs,fe,ii,jt,di,ci,kt,li,hi,Hs,Le,pi,$t,mi,fi,Us,Re,ui,qo,gi,_i,Ws,k,bi,Pn,vi,Di,Nn,yi,wi,Sn,Ti,xi,An,Ei,Fi,Mn,ji,ki,In,$i,Oi,Ln,Ci,zi,Rn,qi,Pi,Gs,z,Ni,Hn,Si,Ai,Un,Mi,Ii,Wn,Li,Ri,Gn,Hi,Ui,Bn,Wi,Gi,Vn,Bi,Vi,Bs,Y,Yi,Yn,Qi,Ki,Ot,Zi,Ji,Ct,Xi,ed,Vs,Q,td,Po,od,nd,No,rd,sd,So,ad,id,Ys,Ao,dd,Qs,$,te,cd,Qn,ld,hd,Kn,pd,md,Mo,fd,ud,gd,Zn,_d,bd,oe,vd,Jn,Dd,yd,Io,wd,Td,Xn,xd,Ed,Fd,ne,jd,er,kd,$d,Lo,Od,Cd,tr,zd,qd,Pd,G,Nd,or,Sd,Ad,nr,Md,Id,rr,Ld,Rd,zt,Hd,Ud,Wd,S,Ro,Gd,Bd,Ho,Vd,Yd,qt,Qd,Kd,sr,Zd,Jd,Uo,Xd,ec,ar,tc,oc,nc,re,rc,Wo,sc,ac,ir,ic,dc,Go,cc,lc,hc,ye,pc,dr,mc,fc,Pt,uc,gc,Ks,Bo,_c,Zs,Vo,bc,Js,Nt,Xs,Yo,vc,ea,St,ta,Qo,Dc,oa,At,na,Ko,yc,ra,He,cr,se,lr,wc,Tc,hr,xc,Ec,pr,Fc,jc,mr,kc,$c,M,ae,fr,ur,Oc,Cc,gr,zc,qc,_r,Pc,Nc,br,Sc,Ac,ie,vr,Dr,Mc,Ic,yr,Zo,Lc,Rc,wr,Jo,Hc,Uc,Tr,Xo,Wc,Gc,de,xr,Er,Bc,Vc,Fr,Yc,Qc,jr,Kc,Zc,kr,Jc,Xc,ce,Mt,$r,el,tl,en,ol,nl,we,rl,Or,sl,al,Cr,il,dl,cl,I,ll,zr,hl,pl,qr,ml,fl,Pr,ul,gl,Nr,_l,bl,Sr,vl,Dl,yl,le,wl,Ar,Tl,xl,Mr,El,Fl,Ir,jl,kl,$l,he,tn,Lr,Ol,Cl,zl,Rr,Hr,ql,Pl,Ur,Wr,Nl,Sl,It,Gr,Al,Ml,Br,Il,Ll,pe,Vr,Yr,Rl,Hl,Lt,Qr,Ul,Wl,Kr,Gl,Bl,Te,Zr,Vl,Yl,Jr,Ql,Kl,Xr,Zl,Jl,me,es,Xl,eh,ts,th,oh,os,nh,rh,ns,sh,sa,F,ah,on,ih,dh,rs,ch,lh,ss,hh,ph,as,mh,fh,nn,uh,gh,is,_h,bh,ds,vh,Dh,Rt,yh,wh,Ht,Th,xh,aa,xe,Ue,cs,Ut,Eh,ls,Fh,ia,Ee,Wt,jh,hs,kh,da,Fe,Gt,$h,Bt,Oh,rn,Ch,zh,ca,je,Vt,qh,Yt,Ph,sn,Nh,Sh,la,ke,We,ps,Qt,Ah,ms,Mh,ha,B,Kt,Ih,$e,Lh,an,Rh,Hh,Zt,Uh,Wh,Gh,Oe,Bh,dn,Vh,Yh,cn,Qh,Kh,Zh,Ge,pa,Ce,Be,fs,Jt,Jh,us,Xh,ma,j,Xt,ep,gs,tp,op,eo,np,ln,rp,sp,ap,ue,to,ip,_s,dp,cp,Ve,lp,Ye,oo,hp,no,pp,bs,mp,fp,up,Qe,ro,gp,so,_p,hn,bp,vp,Dp,pn,ao,yp,mn,io,wp,fn,co,fa,ze,Ke,vs,lo,Tp,Ds,xp,ua,L,ho,Ep,ys,Fp,jp,po,kp,un,$p,Op,Cp,mo,zp,fo,qp,Pp,Np,K,uo,Sp,qe,Ap,gn,Mp,Ip,ws,Lp,Rp,Hp,Ze,Up,Je,ga,Pe,Xe,Ts,go,Wp,xs,Gp,_a,R,_o,Bp,Es,Vp,Yp,bo,Qp,_n,Kp,Zp,Jp,vo,Xp,Do,em,tm,om,Z,yo,nm,Ne,rm,bn,sm,am,Fs,im,dm,cm,et,lm,tt,ba,Se,ot,js,wo,hm,ks,pm,va,H,To,mm,$s,fm,um,xo,gm,vn,_m,bm,vm,Eo,Dm,Fo,ym,wm,Tm,J,jo,xm,Ae,Em,Dn,Fm,jm,Os,km,$m,Om,nt,Cm,rt,Da;return p=new xt({}),Et=new xt({}),Nt=new Oo({props:{code:`from transformers import DetrForObjectDetection

model = DetrForObjectDetection.from_pretrained("facebook/resnet-50")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DetrForObjectDetection

<span class="hljs-meta">&gt;&gt;&gt; </span>model = DetrForObjectDetection.from_pretrained(<span class="hljs-string">&quot;facebook/resnet-50&quot;</span>)`}}),St=new Oo({props:{code:`from transformers import DetrConfig, DetrForObjectDetection

config = DetrConfig()
model = DetrForObjectDetection(config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DetrConfig, DetrForObjectDetection

<span class="hljs-meta">&gt;&gt;&gt; </span>config = DetrConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DetrForObjectDetection(config)`}}),At=new Oo({props:{code:`config = DetrConfig(use_pretrained_backbone=False)
model = DetrForObjectDetection(config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>config = DetrConfig(use_pretrained_backbone=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DetrForObjectDetection(config)`}}),Ut=new xt({}),Wt=new N({props:{name:"class transformers.models.detr.modeling_detr.DetrModelOutput",anchor:"transformers.models.detr.modeling_detr.DetrModelOutput",parameters:[{name:"last_hidden_state",val:": FloatTensor = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"decoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"decoder_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"cross_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"intermediate_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"transformers.models.detr.modeling_detr.DetrModelOutput.last_hidden_state",description:`<strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) &#x2014;
Sequence of hidden-states at the output of the last layer of the decoder of the model.`,name:"last_hidden_state"},{anchor:"transformers.models.detr.modeling_detr.DetrModelOutput.decoder_hidden_states",description:`<strong>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 layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the decoder at the output of each
layer plus the initial embedding outputs.`,name:"decoder_hidden_states"},{anchor:"transformers.models.detr.modeling_detr.DetrModelOutput.decoder_attentions",description:`<strong>decoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.`,name:"decoder_attentions"},{anchor:"transformers.models.detr.modeling_detr.DetrModelOutput.cross_attentions",description:`<strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder&#x2019;s cross-attention layer, after the attention softmax,
used to compute the weighted average in the cross-attention heads.`,name:"cross_attentions"},{anchor:"transformers.models.detr.modeling_detr.DetrModelOutput.encoder_last_hidden_state",description:`<strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder of the model.`,name:"encoder_last_hidden_state"},{anchor:"transformers.models.detr.modeling_detr.DetrModelOutput.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 layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the encoder at the output of each
layer plus the initial embedding outputs.`,name:"encoder_hidden_states"},{anchor:"transformers.models.detr.modeling_detr.DetrModelOutput.encoder_attentions",description:`<strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the encoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.`,name:"encoder_attentions"},{anchor:"transformers.models.detr.modeling_detr.DetrModelOutput.intermediate_hidden_states",description:`<strong>intermediate_hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(config.decoder_layers, batch_size, sequence_length, hidden_size)</code>, <em>optional</em>, returned when <code>config.auxiliary_loss=True</code>) &#x2014;
Intermediate decoder activations, i.e. the output of each decoder layer, each of them gone through a
layernorm.`,name:"intermediate_hidden_states"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/modeling_detr.py#L91"}}),Gt=new N({props:{name:"class transformers.models.detr.modeling_detr.DetrObjectDetectionOutput",anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"loss_dict",val:": typing.Optional[typing.Dict] = None"},{name:"logits",val:": FloatTensor = None"},{name:"pred_boxes",val:": FloatTensor = None"},{name:"auxiliary_outputs",val:": typing.Optional[typing.List[typing.Dict]] = None"},{name:"last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"decoder_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"cross_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> are provided)) &#x2014;
Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a
bounding box loss. The latter is defined as a linear combination of the L1 loss and the generalized
scale-invariant IoU loss.`,name:"loss"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.loss_dict",description:`<strong>loss_dict</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
A dictionary containing the individual losses. Useful for logging.`,name:"loss_dict"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.logits",description:`<strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, num_classes + 1)</code>) &#x2014;
Classification logits (including no-object) for all queries.`,name:"logits"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.pred_boxes",description:`<strong>pred_boxes</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, 4)</code>) &#x2014;
Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding
possible padding). You can use <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.post_process_object_detection">post_process_object_detection()</a> to retrieve the
unnormalized bounding boxes.`,name:"pred_boxes"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.auxiliary_outputs",description:`<strong>auxiliary_outputs</strong> (<code>list[Dict]</code>, <em>optional</em>) &#x2014;
Optional, only returned when auxilary losses are activated (i.e. <code>config.auxiliary_loss</code> is set to <code>True</code>)
and labels are provided. It is a list of dictionaries containing the two above keys (<code>logits</code> and
<code>pred_boxes</code>) for each decoder layer.`,name:"auxiliary_outputs"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.last_hidden_state",description:`<strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the decoder of the model.`,name:"last_hidden_state"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.decoder_hidden_states",description:`<strong>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 layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the decoder at the output of each
layer plus the initial embedding outputs.`,name:"decoder_hidden_states"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.decoder_attentions",description:`<strong>decoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.`,name:"decoder_attentions"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.cross_attentions",description:`<strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder&#x2019;s cross-attention layer, after the attention softmax,
used to compute the weighted average in the cross-attention heads.`,name:"cross_attentions"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.encoder_last_hidden_state",description:`<strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder of the model.`,name:"encoder_last_hidden_state"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.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 layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the encoder at the output of each
layer plus the initial embedding outputs.`,name:"encoder_hidden_states"},{anchor:"transformers.models.detr.modeling_detr.DetrObjectDetectionOutput.encoder_attentions",description:`<strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the encoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.`,name:"encoder_attentions"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/modeling_detr.py#L131"}}),Vt=new N({props:{name:"class transformers.models.detr.modeling_detr.DetrSegmentationOutput",anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"loss_dict",val:": typing.Optional[typing.Dict] = None"},{name:"logits",val:": FloatTensor = None"},{name:"pred_boxes",val:": FloatTensor = None"},{name:"pred_masks",val:": FloatTensor = None"},{name:"auxiliary_outputs",val:": typing.Optional[typing.List[typing.Dict]] = None"},{name:"last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"decoder_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"cross_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_last_hidden_state",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> are provided)) &#x2014;
Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a
bounding box loss. The latter is defined as a linear combination of the L1 loss and the generalized
scale-invariant IoU loss.`,name:"loss"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.loss_dict",description:`<strong>loss_dict</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
A dictionary containing the individual losses. Useful for logging.`,name:"loss_dict"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.logits",description:`<strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, num_classes + 1)</code>) &#x2014;
Classification logits (including no-object) for all queries.`,name:"logits"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.pred_boxes",description:`<strong>pred_boxes</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, 4)</code>) &#x2014;
Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding
possible padding). You can use <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.post_process_object_detection">post_process_object_detection()</a> to retrieve the
unnormalized bounding boxes.`,name:"pred_boxes"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.pred_masks",description:`<strong>pred_masks</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, height/4, width/4)</code>) &#x2014;
Segmentation masks logits for all queries. See also
<a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.post_process_semantic_segmentation">post_process_semantic_segmentation()</a> or
<a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.post_process_instance_segmentation">post_process_instance_segmentation()</a>
<a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.post_process_panoptic_segmentation">post_process_panoptic_segmentation()</a> to evaluate semantic, instance and panoptic
segmentation masks respectively.`,name:"pred_masks"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.auxiliary_outputs",description:`<strong>auxiliary_outputs</strong> (<code>list[Dict]</code>, <em>optional</em>) &#x2014;
Optional, only returned when auxiliary losses are activated (i.e. <code>config.auxiliary_loss</code> is set to <code>True</code>)
and labels are provided. It is a list of dictionaries containing the two above keys (<code>logits</code> and
<code>pred_boxes</code>) for each decoder layer.`,name:"auxiliary_outputs"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.last_hidden_state",description:`<strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the decoder of the model.`,name:"last_hidden_state"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.decoder_hidden_states",description:`<strong>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 layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the decoder at the output of each
layer plus the initial embedding outputs.`,name:"decoder_hidden_states"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.decoder_attentions",description:`<strong>decoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.`,name:"decoder_attentions"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.cross_attentions",description:`<strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder&#x2019;s cross-attention layer, after the attention softmax,
used to compute the weighted average in the cross-attention heads.`,name:"cross_attentions"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.encoder_last_hidden_state",description:`<strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder of the model.`,name:"encoder_last_hidden_state"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.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 layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the encoder at the output of each
layer plus the initial embedding outputs.`,name:"encoder_hidden_states"},{anchor:"transformers.models.detr.modeling_detr.DetrSegmentationOutput.encoder_attentions",description:`<strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the encoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.`,name:"encoder_attentions"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/modeling_detr.py#L194"}}),Qt=new xt({}),Kt=new N({props:{name:"class transformers.DetrConfig",anchor:"transformers.DetrConfig",parameters:[{name:"num_channels",val:" = 3"},{name:"num_queries",val:" = 100"},{name:"max_position_embeddings",val:" = 1024"},{name:"encoder_layers",val:" = 6"},{name:"encoder_ffn_dim",val:" = 2048"},{name:"encoder_attention_heads",val:" = 8"},{name:"decoder_layers",val:" = 6"},{name:"decoder_ffn_dim",val:" = 2048"},{name:"decoder_attention_heads",val:" = 8"},{name:"encoder_layerdrop",val:" = 0.0"},{name:"decoder_layerdrop",val:" = 0.0"},{name:"is_encoder_decoder",val:" = True"},{name:"activation_function",val:" = 'relu'"},{name:"d_model",val:" = 256"},{name:"dropout",val:" = 0.1"},{name:"attention_dropout",val:" = 0.0"},{name:"activation_dropout",val:" = 0.0"},{name:"init_std",val:" = 0.02"},{name:"init_xavier_std",val:" = 1.0"},{name:"classifier_dropout",val:" = 0.0"},{name:"scale_embedding",val:" = False"},{name:"auxiliary_loss",val:" = False"},{name:"position_embedding_type",val:" = 'sine'"},{name:"backbone",val:" = 'resnet50'"},{name:"use_pretrained_backbone",val:" = True"},{name:"dilation",val:" = False"},{name:"class_cost",val:" = 1"},{name:"bbox_cost",val:" = 5"},{name:"giou_cost",val:" = 2"},{name:"mask_loss_coefficient",val:" = 1"},{name:"dice_loss_coefficient",val:" = 1"},{name:"bbox_loss_coefficient",val:" = 5"},{name:"giou_loss_coefficient",val:" = 2"},{name:"eos_coefficient",val:" = 0.1"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DetrConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of input channels.`,name:"num_channels"},{anchor:"transformers.DetrConfig.num_queries",description:`<strong>num_queries</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
Number of object queries, i.e. detection slots. This is the maximal number of objects <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrModel">DetrModel</a> can
detect in a single image. For COCO, we recommend 100 queries.`,name:"num_queries"},{anchor:"transformers.DetrConfig.d_model",description:`<strong>d_model</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
Dimension of the layers.`,name:"d_model"},{anchor:"transformers.DetrConfig.encoder_layers",description:`<strong>encoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 6) &#x2014;
Number of encoder layers.`,name:"encoder_layers"},{anchor:"transformers.DetrConfig.decoder_layers",description:`<strong>decoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 6) &#x2014;
Number of decoder layers.`,name:"decoder_layers"},{anchor:"transformers.DetrConfig.encoder_attention_heads",description:`<strong>encoder_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"encoder_attention_heads"},{anchor:"transformers.DetrConfig.decoder_attention_heads",description:`<strong>decoder_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads for each attention layer in the Transformer decoder.`,name:"decoder_attention_heads"},{anchor:"transformers.DetrConfig.decoder_ffn_dim",description:`<strong>decoder_ffn_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimension of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in decoder.`,name:"decoder_ffn_dim"},{anchor:"transformers.DetrConfig.encoder_ffn_dim",description:`<strong>encoder_ffn_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimension of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in decoder.`,name:"encoder_ffn_dim"},{anchor:"transformers.DetrConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;relu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"activation_function"},{anchor:"transformers.DetrConfig.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, and pooler.`,name:"dropout"},{anchor:"transformers.DetrConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.DetrConfig.activation_dropout",description:`<strong>activation_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for activations inside the fully connected layer.`,name:"activation_dropout"},{anchor:"transformers.DetrConfig.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.DetrConfig.init_xavier_std",description:`<strong>init_xavier_std</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
The scaling factor used for the Xavier initialization gain in the HM Attention map module.`,name:"init_xavier_std"},{anchor:"transformers.DetrConfig.encoder_layerdrop",description:`<strong>encoder_layerdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The LayerDrop probability for the encoder. See the [LayerDrop paper](see <a href="https://arxiv.org/abs/1909.11556" rel="nofollow">https://arxiv.org/abs/1909.11556</a>)
for more details.`,name:"encoder_layerdrop"},{anchor:"transformers.DetrConfig.decoder_layerdrop",description:`<strong>decoder_layerdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The LayerDrop probability for the decoder. See the [LayerDrop paper](see <a href="https://arxiv.org/abs/1909.11556" rel="nofollow">https://arxiv.org/abs/1909.11556</a>)
for more details.`,name:"decoder_layerdrop"},{anchor:"transformers.DetrConfig.auxiliary_loss",description:`<strong>auxiliary_loss</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether auxiliary decoding losses (loss at each decoder layer) are to be used.`,name:"auxiliary_loss"},{anchor:"transformers.DetrConfig.position_embedding_type",description:`<strong>position_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;sine&quot;</code>) &#x2014;
Type of position embeddings to be used on top of the image features. One of <code>&quot;sine&quot;</code> or <code>&quot;learned&quot;</code>.`,name:"position_embedding_type"},{anchor:"transformers.DetrConfig.backbone",description:`<strong>backbone</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;resnet50&quot;</code>) &#x2014;
Name of convolutional backbone to use. Supports any convolutional backbone from the timm package. For a
list of all available models, see <a href="https://rwightman.github.io/pytorch-image-models/#load-a-pretrained-model" rel="nofollow">this
page</a>.`,name:"backbone"},{anchor:"transformers.DetrConfig.use_pretrained_backbone",description:`<strong>use_pretrained_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use pretrained weights for the backbone.`,name:"use_pretrained_backbone"},{anchor:"transformers.DetrConfig.dilation",description:`<strong>dilation</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to replace stride with dilation in the last convolutional block (DC5).`,name:"dilation"},{anchor:"transformers.DetrConfig.class_cost",description:`<strong>class_cost</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
Relative weight of the classification error in the Hungarian matching cost.`,name:"class_cost"},{anchor:"transformers.DetrConfig.bbox_cost",description:`<strong>bbox_cost</strong> (<code>float</code>, <em>optional</em>, defaults to 5) &#x2014;
Relative weight of the L1 error of the bounding box coordinates in the Hungarian matching cost.`,name:"bbox_cost"},{anchor:"transformers.DetrConfig.giou_cost",description:`<strong>giou_cost</strong> (<code>float</code>, <em>optional</em>, defaults to 2) &#x2014;
Relative weight of the generalized IoU loss of the bounding box in the Hungarian matching cost.`,name:"giou_cost"},{anchor:"transformers.DetrConfig.mask_loss_coefficient",description:`<strong>mask_loss_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
Relative weight of the Focal loss in the panoptic segmentation loss.`,name:"mask_loss_coefficient"},{anchor:"transformers.DetrConfig.dice_loss_coefficient",description:`<strong>dice_loss_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
Relative weight of the DICE/F-1 loss in the panoptic segmentation loss.`,name:"dice_loss_coefficient"},{anchor:"transformers.DetrConfig.bbox_loss_coefficient",description:`<strong>bbox_loss_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 5) &#x2014;
Relative weight of the L1 bounding box loss in the object detection loss.`,name:"bbox_loss_coefficient"},{anchor:"transformers.DetrConfig.giou_loss_coefficient",description:`<strong>giou_loss_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 2) &#x2014;
Relative weight of the generalized IoU loss in the object detection loss.`,name:"giou_loss_coefficient"},{anchor:"transformers.DetrConfig.eos_coefficient",description:`<strong>eos_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Relative classification weight of the &#x2018;no-object&#x2019; class in the object detection loss.`,name:"eos_coefficient"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/configuration_detr.py#L35"}}),Ge=new Za({props:{anchor:"transformers.DetrConfig.example",$$slots:{default:[Bg]},$$scope:{ctx:C}}}),Jt=new xt({}),Xt=new N({props:{name:"class transformers.DetrFeatureExtractor",anchor:"transformers.DetrFeatureExtractor",parameters:[{name:"format",val:" = 'coco_detection'"},{name:"do_resize",val:" = True"},{name:"size",val:" = 800"},{name:"max_size",val:" = 1333"},{name:"do_normalize",val:" = True"},{name:"image_mean",val:" = None"},{name:"image_std",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DetrFeatureExtractor.format",description:`<strong>format</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;coco_detection&quot;</code>) &#x2014;
Data format of the annotations. One of &#x201C;coco_detection&#x201D; or &#x201C;coco_panoptic&#x201D;.`,name:"format"},{anchor:"transformers.DetrFeatureExtractor.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.DetrFeatureExtractor.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.DetrFeatureExtractor.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.DetrFeatureExtractor.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.DetrFeatureExtractor.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.DetrFeatureExtractor.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"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/feature_extraction_detr.py#L271"}}),to=new N({props:{name:"__call__",anchor:"transformers.DetrFeatureExtractor.__call__",parameters:[{name:"images",val:": typing.Union[PIL.Image.Image, numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"annotations",val:": typing.Union[typing.List[typing.Dict], typing.List[typing.List[typing.Dict]]] = None"},{name:"return_segmentation_masks",val:": typing.Optional[bool] = False"},{name:"masks_path",val:": typing.Optional[pathlib.Path] = None"},{name:"pad_and_return_pixel_mask",val:": typing.Optional[bool] = True"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DetrFeatureExtractor.__call__.images",description:`<strong>images</strong> (<code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>torch.Tensor</code>, <code>List[PIL.Image.Image]</code>, <code>List[np.ndarray]</code>, <code>List[torch.Tensor]</code>) &#x2014;
The image or batch of images to be prepared. Each image can be a PIL image, NumPy array or PyTorch
tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
number of channels, H and W are image height and width.`,name:"images"},{anchor:"transformers.DetrFeatureExtractor.__call__.annotations",description:`<strong>annotations</strong> (<code>Dict</code>, <code>List[Dict]</code>, <em>optional</em>) &#x2014;
The corresponding annotations in COCO format.</p>
<p>In case <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor">DetrFeatureExtractor</a> was initialized with <code>format = &quot;coco_detection&quot;</code>, the annotations for
each image should have the following format: {&#x2018;image_id&#x2019;: int, &#x2018;annotations&#x2019;: [annotation]}, with the
annotations being a list of COCO object annotations.</p>
<p>In case <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor">DetrFeatureExtractor</a> was initialized with <code>format = &quot;coco_panoptic&quot;</code>, the annotations for
each image should have the following format: {&#x2018;image_id&#x2019;: int, &#x2018;file_name&#x2019;: str, &#x2018;segments_info&#x2019;:
[segment_info]} with segments_info being a list of COCO panoptic annotations.`,name:"annotations"},{anchor:"transformers.DetrFeatureExtractor.__call__.return_segmentation_masks",description:`<strong>return_segmentation_masks</strong> (<code>Dict</code>, <code>List[Dict]</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to also include instance segmentation masks as part of the labels in case <code>format = &quot;coco_detection&quot;</code>.`,name:"return_segmentation_masks"},{anchor:"transformers.DetrFeatureExtractor.__call__.masks_path",description:`<strong>masks_path</strong> (<code>pathlib.Path</code>, <em>optional</em>) &#x2014;
Path to the directory containing the PNG files that store the class-agnostic image segmentations. Only
relevant in case <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor">DetrFeatureExtractor</a> was initialized with <code>format = &quot;coco_panoptic&quot;</code>.`,name:"masks_path"},{anchor:"transformers.DetrFeatureExtractor.__call__.pad_and_return_pixel_mask",description:`<strong>pad_and_return_pixel_mask</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
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:"pad_and_return_pixel_mask"},{anchor:"transformers.DetrFeatureExtractor.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/pr_19907/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/vr_19907/src/transformers/models/detr/feature_extraction_detr.py#L552",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_19907/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>pad_and_return_pixel_mask=True</code> or if
<em>\u201Cpixel_mask\u201D</em> is in <code>self.model_input_names</code>).</li>
<li><strong>labels</strong> \u2014 Optional labels to be fed to a model (when <code>annotations</code> are provided)</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_19907/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),Ve=new Ka({props:{warning:!0,$$slots:{default:[Vg]},$$scope:{ctx:C}}}),oo=new N({props:{name:"pad_and_create_pixel_mask",anchor:"transformers.DetrFeatureExtractor.pad_and_create_pixel_mask",parameters:[{name:"pixel_values_list",val:": typing.List[ForwardRef('torch.Tensor')]"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"}],parametersDescription:[{anchor:"transformers.DetrFeatureExtractor.pad_and_create_pixel_mask.pixel_values_list",description:`<strong>pixel_values_list</strong> (<code>List[torch.Tensor]</code>) &#x2014;
List of images (pixel values) to be padded. Each image should be a tensor of shape (C, H, W).`,name:"pixel_values_list"},{anchor:"transformers.DetrFeatureExtractor.pad_and_create_pixel_mask.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/pr_19907/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/vr_19907/src/transformers/models/detr/feature_extraction_detr.py#L790",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_19907/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>pad_and_return_pixel_mask=True</code> or if
<em>\u201Cpixel_mask\u201D</em> is in <code>self.model_input_names</code>).</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_19907/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),ro=new N({props:{name:"post_process_object_detection",anchor:"transformers.DetrFeatureExtractor.post_process_object_detection",parameters:[{name:"outputs",val:""},{name:"threshold",val:": float = 0.5"},{name:"target_sizes",val:": typing.Union[transformers.utils.generic.TensorType, typing.List[typing.Tuple]] = None"}],parametersDescription:[{anchor:"transformers.DetrFeatureExtractor.post_process_object_detection.outputs",description:`<strong>outputs</strong> (<code>DetrObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.DetrFeatureExtractor.post_process_object_detection.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Score threshold to keep object detection predictions.`,name:"threshold"},{anchor:"transformers.DetrFeatureExtractor.post_process_object_detection.target_sizes",description:`<strong>target_sizes</strong> (<code>torch.Tensor</code> or <code>List[Tuple[int, int]]</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Tensor of shape <code>(batch_size, 2)</code> or list of tuples (<code>Tuple[int, int]</code>) containing the target size
(height, width) of each image in the batch. If left to None, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/feature_extraction_detr.py#L1112",returnDescription:`
<p>A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
in the batch as predicted by the model.</p>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),ao=new N({props:{name:"post_process_semantic_segmentation",anchor:"transformers.DetrFeatureExtractor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": typing.List[typing.Tuple[int, int]] = None"}],parametersDescription:[{anchor:"transformers.DetrFeatureExtractor.post_process_semantic_segmentation.Converts",description:`<strong>Converts</strong> the output of <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a> into semantic segmentation maps. Only supports PyTorch. &#x2014;
outputs (<a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>):
Raw outputs of the model.
target_sizes (<code>List[Tuple[int, int]]</code>, <em>optional</em>, defaults to <code>None</code>):
A list of tuples (<code>Tuple[int, int]</code>) containing the target size (height, width) of each image in the
batch. If left to None, predictions will not be resized.`,name:"Converts"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/feature_extraction_detr.py#L1166",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>
`}}),io=new N({props:{name:"post_process_instance_segmentation",anchor:"transformers.DetrFeatureExtractor.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"}],parametersDescription:[{anchor:"transformers.DetrFeatureExtractor.post_process_instance_segmentation.Converts",description:`<strong>Converts</strong> the output of <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a> into instance segmentation predictions. Only supports PyTorch. &#x2014;
outputs (<a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>):
Raw outputs of the model.
threshold (<code>float</code>, <em>optional</em>, defaults to 0.5):
The probability score threshold to keep predicted instance masks.
mask_threshold (<code>float</code>, <em>optional</em>, defaults to 0.5):
Threshold to use when turning the predicted masks into binary values.
overlap_mask_area_threshold (<code>float</code>, <em>optional</em>, defaults to 0.8):
The overlap mask area threshold to merge or discard small disconnected parts within each binary
instance mask.
target_sizes (<code>List[Tuple]</code>, <em>optional</em>):
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.
return_coco_annotation (<code>bool</code>, <em>optional</em>):
Defaults to <code>False</code>. If set to <code>True</code>, segmentation maps are returned in COCO run-length encoding (RLE)
format.`,name:"Converts"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/feature_extraction_detr.py#L1212",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>
`}}),co=new N({props:{name:"post_process_panoptic_segmentation",anchor:"transformers.DetrFeatureExtractor.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.DetrFeatureExtractor.post_process_panoptic_segmentation.Converts",description:`<strong>Converts</strong> the output of <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a> into image panoptic segmentation predictions. Only supports &#x2014;
PyTorch. &#x2014;
outputs (<a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>):
The outputs from <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>.
threshold (<code>float</code>, <em>optional</em>, defaults to 0.5):
The probability score threshold to keep predicted instance masks.
mask_threshold (<code>float</code>, <em>optional</em>, defaults to 0.5):
Threshold to use when turning the predicted masks into binary values.
overlap_mask_area_threshold (<code>float</code>, <em>optional</em>, defaults to 0.8):
The overlap mask area threshold to merge or discard small disconnected parts within each binary
instance mask.
label_ids_to_fuse (<code>Set[int]</code>, <em>optional</em>):
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.
target_sizes (<code>List[Tuple]</code>, <em>optional</em>):
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:"Converts"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/feature_extraction_detr.py#L1294",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>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>
`}}),lo=new xt({}),ho=new N({props:{name:"class transformers.DetrModel",anchor:"transformers.DetrModel",parameters:[{name:"config",val:": DetrConfig"}],parametersDescription:[{anchor:"transformers.DetrModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrConfig">DetrConfig</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/pr_19907/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/vr_19907/src/transformers/models/detr/modeling_detr.py#L1186"}}),uo=new N({props:{name:"forward",anchor:"transformers.DetrModel.forward",parameters:[{name:"pixel_values",val:""},{name:"pixel_mask",val:" = None"},{name:"decoder_attention_mask",val:" = None"},{name:"encoder_outputs",val:" = None"},{name:"inputs_embeds",val:" = None"},{name:"decoder_inputs_embeds",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],parametersDescription:[{anchor:"transformers.DetrModel.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. Padding will be ignored by default should you provide it.</p>
<p>Pixel values can be obtained using <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor">DetrFeatureExtractor</a>. See <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.__call__">DetrFeatureExtractor.<strong>call</strong>()</a> for
details.`,name:"pixel_values"},{anchor:"transformers.DetrModel.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.DetrModel.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_queries)</code>, <em>optional</em>) &#x2014;
Not used by default. Can be used to mask object queries.`,name:"decoder_attention_mask"},{anchor:"transformers.DetrModel.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <em>optional</em>: <code>hidden_states</code>, <em>optional</em>: <code>attentions</code>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) is a sequence of
hidden-states at the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.DetrModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing the flattened feature map (output of the backbone + projection layer), you
can choose to directly pass a flattened representation of an image.`,name:"inputs_embeds"},{anchor:"transformers.DetrModel.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of initializing the queries with a tensor of zeros, you can choose to directly pass an
embedded representation.`,name:"decoder_inputs_embeds"},{anchor:"transformers.DetrModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.DetrModel.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.DetrModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_19907/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/modeling_detr.py#L1222",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.models.detr.modeling_detr.DetrModelOutput"
>transformers.models.detr.modeling_detr.DetrModelOutput</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/pr_19907/en/model_doc/detr#transformers.DetrConfig"
>DetrConfig</a>) and inputs.</p>
<ul>
<li><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the decoder of the model.</li>
<li><strong>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 layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the decoder at the output of each
layer plus the initial embedding outputs.</li>
<li><strong>decoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.</li>
<li><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax,
used to compute the weighted average in the cross-attention heads.</li>
<li><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the encoder of the model.</li>
<li><strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the encoder at the output of each
layer plus the initial embedding outputs.</li>
<li><strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the encoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.</li>
<li><strong>intermediate_hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(config.decoder_layers, batch_size, sequence_length, hidden_size)</code>, <em>optional</em>, returned when <code>config.auxiliary_loss=True</code>) \u2014 Intermediate decoder activations, i.e. the output of each decoder layer, each of them gone through a
layernorm.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.models.detr.modeling_detr.DetrModelOutput"
>transformers.models.detr.modeling_detr.DetrModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ze=new Ka({props:{$$slots:{default:[Yg]},$$scope:{ctx:C}}}),Je=new Za({props:{anchor:"transformers.DetrModel.forward.example",$$slots:{default:[Qg]},$$scope:{ctx:C}}}),go=new xt({}),_o=new N({props:{name:"class transformers.DetrForObjectDetection",anchor:"transformers.DetrForObjectDetection",parameters:[{name:"config",val:": DetrConfig"}],parametersDescription:[{anchor:"transformers.DetrForObjectDetection.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrConfig">DetrConfig</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/pr_19907/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/vr_19907/src/transformers/models/detr/modeling_detr.py#L1356"}}),yo=new N({props:{name:"forward",anchor:"transformers.DetrForObjectDetection.forward",parameters:[{name:"pixel_values",val:""},{name:"pixel_mask",val:" = None"},{name:"decoder_attention_mask",val:" = None"},{name:"encoder_outputs",val:" = None"},{name:"inputs_embeds",val:" = None"},{name:"decoder_inputs_embeds",val:" = None"},{name:"labels",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],parametersDescription:[{anchor:"transformers.DetrForObjectDetection.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. Padding will be ignored by default should you provide it.</p>
<p>Pixel values can be obtained using <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor">DetrFeatureExtractor</a>. See <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.__call__">DetrFeatureExtractor.<strong>call</strong>()</a> for
details.`,name:"pixel_values"},{anchor:"transformers.DetrForObjectDetection.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.DetrForObjectDetection.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_queries)</code>, <em>optional</em>) &#x2014;
Not used by default. Can be used to mask object queries.`,name:"decoder_attention_mask"},{anchor:"transformers.DetrForObjectDetection.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <em>optional</em>: <code>hidden_states</code>, <em>optional</em>: <code>attentions</code>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) is a sequence of
hidden-states at the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.DetrForObjectDetection.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing the flattened feature map (output of the backbone + projection layer), you
can choose to directly pass a flattened representation of an image.`,name:"inputs_embeds"},{anchor:"transformers.DetrForObjectDetection.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of initializing the queries with a tensor of zeros, you can choose to directly pass an
embedded representation.`,name:"decoder_inputs_embeds"},{anchor:"transformers.DetrForObjectDetection.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.DetrForObjectDetection.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.DetrForObjectDetection.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_19907/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DetrForObjectDetection.forward.labels",description:`<strong>labels</strong> (<code>List[Dict]</code> of len <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the bipartite matching loss. List of dicts, each dictionary containing at least the
following 2 keys: &#x2018;class_labels&#x2019; and &#x2018;boxes&#x2019; (the class labels and bounding boxes of an image in the batch
respectively). The class labels themselves should be a <code>torch.LongTensor</code> of len <code>(number of bounding boxes in the image,)</code> and the boxes a <code>torch.FloatTensor</code> of shape <code>(number of bounding boxes in the image, 4)</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/modeling_detr.py#L1382",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.models.detr.modeling_detr.DetrObjectDetectionOutput"
>transformers.models.detr.modeling_detr.DetrObjectDetectionOutput</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/pr_19907/en/model_doc/detr#transformers.DetrConfig"
>DetrConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> are provided)) \u2014 Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a
bounding box loss. The latter is defined as a linear combination of the L1 loss and the generalized
scale-invariant IoU loss.</li>
<li><strong>loss_dict</strong> (<code>Dict</code>, <em>optional</em>) \u2014 A dictionary containing the individual losses. Useful for logging.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, num_classes + 1)</code>) \u2014 Classification logits (including no-object) for all queries.</li>
<li><strong>pred_boxes</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, 4)</code>) \u2014 Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding
possible padding). You can use <a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.post_process_object_detection"
>post_process_object_detection()</a> to retrieve the
unnormalized bounding boxes.</li>
<li><strong>auxiliary_outputs</strong> (<code>list[Dict]</code>, <em>optional</em>) \u2014 Optional, only returned when auxilary losses are activated (i.e. <code>config.auxiliary_loss</code> is set to <code>True</code>)
and labels are provided. It is a list of dictionaries containing the two above keys (<code>logits</code> and
<code>pred_boxes</code>) for each decoder layer.</li>
<li><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the decoder of the model.</li>
<li><strong>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 layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the decoder at the output of each
layer plus the initial embedding outputs.</li>
<li><strong>decoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.</li>
<li><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax,
used to compute the weighted average in the cross-attention heads.</li>
<li><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the encoder of the model.</li>
<li><strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the encoder at the output of each
layer plus the initial embedding outputs.</li>
<li><strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the encoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.models.detr.modeling_detr.DetrObjectDetectionOutput"
>transformers.models.detr.modeling_detr.DetrObjectDetectionOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),et=new Ka({props:{$$slots:{default:[Kg]},$$scope:{ctx:C}}}),tt=new Za({props:{anchor:"transformers.DetrForObjectDetection.forward.example",$$slots:{default:[Zg]},$$scope:{ctx:C}}}),wo=new xt({}),To=new N({props:{name:"class transformers.DetrForSegmentation",anchor:"transformers.DetrForSegmentation",parameters:[{name:"config",val:": DetrConfig"}],parametersDescription:[{anchor:"transformers.DetrForSegmentation.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrConfig">DetrConfig</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/pr_19907/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/vr_19907/src/transformers/models/detr/modeling_detr.py#L1530"}}),jo=new N({props:{name:"forward",anchor:"transformers.DetrForSegmentation.forward",parameters:[{name:"pixel_values",val:""},{name:"pixel_mask",val:" = None"},{name:"decoder_attention_mask",val:" = None"},{name:"encoder_outputs",val:" = None"},{name:"inputs_embeds",val:" = None"},{name:"decoder_inputs_embeds",val:" = None"},{name:"labels",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],parametersDescription:[{anchor:"transformers.DetrForSegmentation.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. Padding will be ignored by default should you provide it.</p>
<p>Pixel values can be obtained using <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor">DetrFeatureExtractor</a>. See <a href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.__call__">DetrFeatureExtractor.<strong>call</strong>()</a> for
details.`,name:"pixel_values"},{anchor:"transformers.DetrForSegmentation.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.DetrForSegmentation.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_queries)</code>, <em>optional</em>) &#x2014;
Not used by default. Can be used to mask object queries.`,name:"decoder_attention_mask"},{anchor:"transformers.DetrForSegmentation.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <em>optional</em>: <code>hidden_states</code>, <em>optional</em>: <code>attentions</code>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) is a sequence of
hidden-states at the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.DetrForSegmentation.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing the flattened feature map (output of the backbone + projection layer), you
can choose to directly pass a flattened representation of an image.`,name:"inputs_embeds"},{anchor:"transformers.DetrForSegmentation.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of initializing the queries with a tensor of zeros, you can choose to directly pass an
embedded representation.`,name:"decoder_inputs_embeds"},{anchor:"transformers.DetrForSegmentation.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.DetrForSegmentation.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.DetrForSegmentation.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/pr_19907/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DetrForSegmentation.forward.labels",description:`<strong>labels</strong> (<code>List[Dict]</code> of len <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the bipartite matching loss, DICE/F-1 loss and Focal loss. List of dicts, each
dictionary containing at least the following 3 keys: &#x2018;class_labels&#x2019;, &#x2018;boxes&#x2019; and &#x2018;masks&#x2019; (the class labels,
bounding boxes and segmentation masks of an image in the batch respectively). The class labels themselves
should be a <code>torch.LongTensor</code> of len <code>(number of bounding boxes in the image,)</code>, the boxes a
<code>torch.FloatTensor</code> of shape <code>(number of bounding boxes in the image, 4)</code> and the masks a
<code>torch.FloatTensor</code> of shape <code>(number of bounding boxes in the image, height, width)</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_19907/src/transformers/models/detr/modeling_detr.py#L1552",returnDescription:`
<p>A <a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.models.detr.modeling_detr.DetrSegmentationOutput"
>transformers.models.detr.modeling_detr.DetrSegmentationOutput</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/pr_19907/en/model_doc/detr#transformers.DetrConfig"
>DetrConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> are provided)) \u2014 Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a
bounding box loss. The latter is defined as a linear combination of the L1 loss and the generalized
scale-invariant IoU loss.</li>
<li><strong>loss_dict</strong> (<code>Dict</code>, <em>optional</em>) \u2014 A dictionary containing the individual losses. Useful for logging.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, num_classes + 1)</code>) \u2014 Classification logits (including no-object) for all queries.</li>
<li><strong>pred_boxes</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, 4)</code>) \u2014 Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding
possible padding). You can use <a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.post_process_object_detection"
>post_process_object_detection()</a> to retrieve the
unnormalized bounding boxes.</li>
<li><strong>pred_masks</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, height/4, width/4)</code>) \u2014 Segmentation masks logits for all queries. See also
<a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.post_process_semantic_segmentation"
>post_process_semantic_segmentation()</a> or
<a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.post_process_instance_segmentation"
>post_process_instance_segmentation()</a>
<a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.post_process_panoptic_segmentation"
>post_process_panoptic_segmentation()</a> to evaluate semantic, instance and panoptic
segmentation masks respectively.</li>
<li><strong>auxiliary_outputs</strong> (<code>list[Dict]</code>, <em>optional</em>) \u2014 Optional, only returned when auxiliary losses are activated (i.e. <code>config.auxiliary_loss</code> is set to <code>True</code>)
and labels are provided. It is a list of dictionaries containing the two above keys (<code>logits</code> and
<code>pred_boxes</code>) for each decoder layer.</li>
<li><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the decoder of the model.</li>
<li><strong>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 layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the decoder at the output of each
layer plus the initial embedding outputs.</li>
<li><strong>decoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.</li>
<li><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax,
used to compute the weighted average in the cross-attention heads.</li>
<li><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the encoder of the model.</li>
<li><strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the encoder at the output of each
layer plus the initial embedding outputs.</li>
<li><strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights of the encoder, after the attention softmax, used to compute the
weighted average in the self-attention heads.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/pr_19907/en/model_doc/detr#transformers.models.detr.modeling_detr.DetrSegmentationOutput"
>transformers.models.detr.modeling_detr.DetrSegmentationOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),nt=new Ka({props:{$$slots:{default:[Jg]},$$scope:{ctx:C}}}),rt=new Za({props:{anchor:"transformers.DetrForSegmentation.forward.example",$$slots:{default:[Xg]},$$scope:{ctx:C}}}),{c(){f=s("meta"),E=d(),g=s("h1"),u=s("a"),x=s("span"),b(p.$$.fragment),_=d(),U=s("span"),Xa=n("DETR"),As=d(),De=s("h2"),Me=s("a"),Cn=s("span"),b(Et.$$.fragment),ei=d(),zn=s("span"),ti=n("Overview"),Ms=d(),Ie=s("p"),oi=n("The DETR model was proposed in "),Ft=s("a"),ni=n("End-to-End Object Detection with Transformers"),ri=n(` by
Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov and Sergey Zagoruyko. DETR
consists of a convolutional backbone followed by an encoder-decoder Transformer which can be trained end-to-end for
object detection. It greatly simplifies a lot of the complexity of models like Faster-R-CNN and Mask-R-CNN, which use
things like region proposals, non-maximum suppression procedure and anchor generation. Moreover, DETR can also be
naturally extended to perform panoptic segmentation, by simply adding a mask head on top of the decoder outputs.`),Is=d(),Co=s("p"),si=n("The abstract from the paper is the following:"),Ls=d(),zo=s("p"),qn=s("em"),ai=n(`We present a new method that views object detection as a direct set prediction problem. Our approach streamlines the
detection pipeline, effectively removing the need for many hand-designed components like a non-maximum suppression
procedure or anchor generation that explicitly encode our prior knowledge about the task. The main ingredients of the
new framework, called DEtection TRansformer or DETR, are a set-based global loss that forces unique predictions via
bipartite matching, and a transformer encoder-decoder architecture. Given a fixed small set of learned object queries,
DETR reasons about the relations of the objects and the global image context to directly output the final set of
predictions in parallel. The new model is conceptually simple and does not require a specialized library, unlike many
other modern detectors. DETR demonstrates accuracy and run-time performance on par with the well-established and
highly-optimized Faster RCNN baseline on the challenging COCO object detection dataset. Moreover, DETR can be easily
generalized to produce panoptic segmentation in a unified manner. We show that it significantly outperforms competitive
baselines.`),Rs=d(),fe=s("p"),ii=n("This model was contributed by "),jt=s("a"),di=n("nielsr"),ci=n(". The original code can be found "),kt=s("a"),li=n("here"),hi=n("."),Hs=d(),Le=s("p"),pi=n("The quickest way to get started with DETR is by checking the "),$t=s("a"),mi=n("example notebooks"),fi=n(` (which showcase both inference and
fine-tuning on custom data).`),Us=d(),Re=s("p"),ui=n("Here\u2019s a TLDR explaining how "),qo=s("a"),gi=n("DetrForObjectDetection"),_i=n(" works:"),Ws=d(),k=s("p"),bi=n(`First, an image is sent through a pre-trained convolutional backbone (in the paper, the authors use
ResNet-50/ResNet-101). Let\u2019s assume we also add a batch dimension. This means that the input to the backbone is a
tensor of shape `),Pn=s("code"),vi=n("(batch_size, 3, height, width)"),Di=n(`, assuming the image has 3 color channels (RGB). The CNN backbone
outputs a new lower-resolution feature map, typically of shape `),Nn=s("code"),yi=n("(batch_size, 2048, height/32, width/32)"),wi=n(`. This is
then projected to match the hidden dimension of the Transformer of DETR, which is `),Sn=s("code"),Ti=n("256"),xi=n(` by default, using a
`),An=s("code"),Ei=n("nn.Conv2D"),Fi=n(" layer. So now, we have a tensor of shape "),Mn=s("code"),ji=n("(batch_size, 256, height/32, width/32)."),ki=n(` Next, the
feature map is flattened and transposed to obtain a tensor of shape `),In=s("code"),$i=n("(batch_size, seq_len, d_model)"),Oi=n(` =
`),Ln=s("code"),Ci=n("(batch_size, width/32*height/32, 256)"),zi=n(`. So a difference with NLP models is that the sequence length is actually
longer than usual, but with a smaller `),Rn=s("code"),qi=n("d_model"),Pi=n(" (which in NLP is typically 768 or higher)."),Gs=d(),z=s("p"),Ni=n("Next, this is sent through the encoder, outputting "),Hn=s("code"),Si=n("encoder_hidden_states"),Ai=n(` of the same shape (you can consider
these as image features). Next, so-called `),Un=s("strong"),Mi=n("object queries"),Ii=n(` are sent through the decoder. This is a tensor of shape
`),Wn=s("code"),Li=n("(batch_size, num_queries, d_model)"),Ri=n(", with "),Gn=s("code"),Hi=n("num_queries"),Ui=n(` typically set to 100 and initialized with zeros.
These input embeddings are learnt positional encodings that the authors refer to as object queries, and similarly to
the encoder, they are added to the input of each attention layer. Each object query will look for a particular object
in the image. The decoder updates these embeddings through multiple self-attention and encoder-decoder attention layers
to output `),Bn=s("code"),Wi=n("decoder_hidden_states"),Gi=n(" of the same shape: "),Vn=s("code"),Bi=n("(batch_size, num_queries, d_model)"),Vi=n(`. Next, two heads
are added on top for object detection: a linear layer for classifying each object query into one of the objects or \u201Cno
object\u201D, and a MLP to predict bounding boxes for each query.`),Bs=d(),Y=s("p"),Yi=n("The model is trained using a "),Yn=s("strong"),Qi=n("bipartite matching loss"),Ki=n(`: so what we actually do is compare the predicted classes +
bounding boxes of each of the N = 100 object queries to the ground truth annotations, padded up to the same length N
(so if an image only contains 4 objects, 96 annotations will just have a \u201Cno object\u201D as class and \u201Cno bounding box\u201D as
bounding box). The `),Ot=s("a"),Zi=n("Hungarian matching algorithm"),Ji=n(` is used to find
an optimal one-to-one mapping of each of the N queries to each of the N annotations. Next, standard cross-entropy (for
the classes) and a linear combination of the L1 and `),Ct=s("a"),Xi=n("generalized IoU loss"),ed=n(` (for the
bounding boxes) are used to optimize the parameters of the model.`),Vs=d(),Q=s("p"),td=n(`DETR can be naturally extended to perform panoptic segmentation (which unifies semantic segmentation and instance
segmentation). `),Po=s("a"),od=n("DetrForSegmentation"),nd=n(` adds a segmentation mask head on top of
`),No=s("a"),rd=n("DetrForObjectDetection"),sd=n(`. The mask head can be trained either jointly, or in a two steps process,
where one first trains a `),So=s("a"),ad=n("DetrForObjectDetection"),id=n(` model to detect bounding boxes around both
\u201Cthings\u201D (instances) and \u201Cstuff\u201D (background things like trees, roads, sky), then freeze all the weights and train only
the mask head for 25 epochs. Experimentally, these two approaches give similar results. Note that predicting boxes is
required for the training to be possible, since the Hungarian matching is computed using distances between boxes.`),Ys=d(),Ao=s("p"),dd=n("Tips:"),Qs=d(),$=s("ul"),te=s("li"),cd=n("DETR uses so-called "),Qn=s("strong"),ld=n("object queries"),hd=n(` to detect objects in an image. The number of queries determines the maximum
number of objects that can be detected in a single image, and is set to 100 by default (see parameter
`),Kn=s("code"),pd=n("num_queries"),md=n(" of "),Mo=s("a"),fd=n("DetrConfig"),ud=n(`). Note that it\u2019s good to have some slack (in COCO, the
authors used 100, while the maximum number of objects in a COCO image is ~70).`),gd=d(),Zn=s("li"),_d=n(`The decoder of DETR updates the query embeddings in parallel. This is different from language models like GPT-2,
which use autoregressive decoding instead of parallel. Hence, no causal attention mask is used.`),bd=d(),oe=s("li"),vd=n(`DETR adds position embeddings to the hidden states at each self-attention and cross-attention layer before projecting
to queries and keys. For the position embeddings of the image, one can choose between fixed sinusoidal or learned
absolute position embeddings. By default, the parameter `),Jn=s("code"),Dd=n("position_embedding_type"),yd=n(` of
`),Io=s("a"),wd=n("DetrConfig"),Td=n(" is set to "),Xn=s("code"),xd=n('"sine"'),Ed=n("."),Fd=d(),ne=s("li"),jd=n(`During training, the authors of DETR did find it helpful to use auxiliary losses in the decoder, especially to help
the model output the correct number of objects of each class. If you set the parameter `),er=s("code"),kd=n("auxiliary_loss"),$d=n(` of
`),Lo=s("a"),Od=n("DetrConfig"),Cd=n(" to "),tr=s("code"),zd=n("True"),qd=n(`, then prediction feedforward neural networks and Hungarian losses
are added after each decoder layer (with the FFNs sharing parameters).`),Pd=d(),G=s("li"),Nd=n(`If you want to train the model in a distributed environment across multiple nodes, then one should update the
`),or=s("em"),Sd=n("num_boxes"),Ad=n(" variable in the "),nr=s("em"),Md=n("DetrLoss"),Id=n(" class of "),rr=s("em"),Ld=n("modeling_detr.py"),Rd=n(`. When training on multiple nodes, this should be
set to the average number of target boxes across all nodes, as can be seen in the original implementation `),zt=s("a"),Hd=n("here"),Ud=n("."),Wd=d(),S=s("li"),Ro=s("a"),Gd=n("DetrForObjectDetection"),Bd=n(" and "),Ho=s("a"),Vd=n("DetrForSegmentation"),Yd=n(` can be initialized with
any convolutional backbone available in the `),qt=s("a"),Qd=n("timm library"),Kd=n(`.
Initializing with a MobileNet backbone for example can be done by setting the `),sr=s("code"),Zd=n("backbone"),Jd=n(` attribute of
`),Uo=s("a"),Xd=n("DetrConfig"),ec=n(" to "),ar=s("code"),tc=n('"tf_mobilenetv3_small_075"'),oc=n(`, and then initializing the model with that
config.`),nc=d(),re=s("li"),rc=n(`DETR resizes the input images such that the shortest side is at least a certain amount of pixels while the longest is
at most 1333 pixels. At training time, scale augmentation is used such that the shortest side is randomly set to at
least 480 and at most 800 pixels. At inference time, the shortest side is set to 800. One can use
`),Wo=s("a"),sc=n("DetrFeatureExtractor"),ac=n(` to prepare images (and optional annotations in COCO format) for the
model. Due to this resizing, images in a batch can have different sizes. DETR solves this by padding images up to the
largest size in a batch, and by creating a pixel mask that indicates which pixels are real/which are padding.
Alternatively, one can also define a custom `),ir=s("code"),ic=n("collate_fn"),dc=n(` in order to batch images together, using
`),Go=s("a"),cc=n("pad_and_create_pixel_mask()"),lc=n("."),hc=d(),ye=s("li"),pc=n("The size of the images will determine the amount of memory being used, and will thus determine the "),dr=s("code"),mc=n("batch_size"),fc=n(`.
It is advised to use a batch size of 2 per GPU. See `),Pt=s("a"),uc=n("this Github thread"),gc=n(" for more info."),Ks=d(),Bo=s("p"),_c=n("There are three ways to instantiate a DETR model (depending on what you prefer):"),Zs=d(),Vo=s("p"),bc=n("Option 1: Instantiate DETR with pre-trained weights for entire model"),Js=d(),b(Nt.$$.fragment),Xs=d(),Yo=s("p"),vc=n("Option 2: Instantiate DETR with randomly initialized weights for Transformer, but pre-trained weights for backbone"),ea=d(),b(St.$$.fragment),ta=d(),Qo=s("p"),Dc=n("Option 3: Instantiate DETR with randomly initialized weights for backbone + Transformer"),oa=d(),b(At.$$.fragment),na=d(),Ko=s("p"),yc=n("As a summary, consider the following table:"),ra=d(),He=s("table"),cr=s("thead"),se=s("tr"),lr=s("th"),wc=n("Task"),Tc=d(),hr=s("th"),xc=n("Object detection"),Ec=d(),pr=s("th"),Fc=n("Instance segmentation"),jc=d(),mr=s("th"),kc=n("Panoptic segmentation"),$c=d(),M=s("tbody"),ae=s("tr"),fr=s("td"),ur=s("strong"),Oc=n("Description"),Cc=d(),gr=s("td"),zc=n("Predicting bounding boxes and class labels around objects in an image"),qc=d(),_r=s("td"),Pc=n("Predicting masks around objects (i.e. instances) in an image"),Nc=d(),br=s("td"),Sc=n("Predicting masks around both objects (i.e. instances) as well as \u201Cstuff\u201D (i.e. background things like trees and roads) in an image"),Ac=d(),ie=s("tr"),vr=s("td"),Dr=s("strong"),Mc=n("Model"),Ic=d(),yr=s("td"),Zo=s("a"),Lc=n("DetrForObjectDetection"),Rc=d(),wr=s("td"),Jo=s("a"),Hc=n("DetrForSegmentation"),Uc=d(),Tr=s("td"),Xo=s("a"),Wc=n("DetrForSegmentation"),Gc=d(),de=s("tr"),xr=s("td"),Er=s("strong"),Bc=n("Example dataset"),Vc=d(),Fr=s("td"),Yc=n("COCO detection"),Qc=d(),jr=s("td"),Kc=n("COCO detection, COCO panoptic"),Zc=d(),kr=s("td"),Jc=n("COCO panoptic"),Xc=d(),ce=s("tr"),Mt=s("td"),$r=s("strong"),el=n("Format of annotations to provide to"),tl=d(),en=s("a"),ol=n("DetrFeatureExtractor"),nl=d(),we=s("td"),rl=n("{\u2018image_id\u2019: "),Or=s("code"),sl=n("int"),al=n(", \u2018annotations\u2019: "),Cr=s("code"),il=n("List[Dict]"),dl=n("} each Dict being a COCO object annotation"),cl=d(),I=s("td"),ll=n("{\u2018image_id\u2019: "),zr=s("code"),hl=n("int"),pl=n(", \u2018annotations\u2019: "),qr=s("code"),ml=n("List[Dict]"),fl=n("}  (in case of COCO detection) or {\u2018file_name\u2019: "),Pr=s("code"),ul=n("str"),gl=n(", \u2018image_id\u2019: "),Nr=s("code"),_l=n("int"),bl=n(", \u2018segments_info\u2019: "),Sr=s("code"),vl=n("List[Dict]"),Dl=n("} (in case of COCO panoptic)"),yl=d(),le=s("td"),wl=n("{\u2018file_name\u2019: "),Ar=s("code"),Tl=n("str"),xl=n(", \u2018image_id\u2019: "),Mr=s("code"),El=n("int"),Fl=n(", \u2018segments_info\u2019: "),Ir=s("code"),jl=n("List[Dict]"),kl=n("} and masks_path (path to directory containing PNG files of the masks)"),$l=d(),he=s("tr"),tn=s("td"),Lr=s("strong"),Ol=n("Postprocessing"),Cl=n(" (i.e. converting the output of the model to COCO API)"),zl=d(),Rr=s("td"),Hr=s("code"),ql=n("post_process()"),Pl=d(),Ur=s("td"),Wr=s("code"),Nl=n("post_process_segmentation()"),Sl=d(),It=s("td"),Gr=s("code"),Al=n("post_process_segmentation()"),Ml=n(", "),Br=s("code"),Il=n("post_process_panoptic()"),Ll=d(),pe=s("tr"),Vr=s("td"),Yr=s("strong"),Rl=n("evaluators"),Hl=d(),Lt=s("td"),Qr=s("code"),Ul=n("CocoEvaluator"),Wl=n(" with "),Kr=s("code"),Gl=n('iou_types="bbox"'),Bl=d(),Te=s("td"),Zr=s("code"),Vl=n("CocoEvaluator"),Yl=n(" with "),Jr=s("code"),Ql=n('iou_types="bbox"'),Kl=n(" or "),Xr=s("code"),Zl=n('"segm"'),Jl=d(),me=s("td"),es=s("code"),Xl=n("CocoEvaluator"),eh=n(" with "),ts=s("code"),th=n('iou_tupes="bbox"'),oh=n(" or "),os=s("code"),nh=n('"segm"'),rh=n(", "),ns=s("code"),sh=n("PanopticEvaluator"),sa=d(),F=s("p"),ah=n(`In short, one should prepare the data either in COCO detection or COCO panoptic format, then use
`),on=s("a"),ih=n("DetrFeatureExtractor"),dh=n(" to create "),rs=s("code"),ch=n("pixel_values"),lh=n(", "),ss=s("code"),hh=n("pixel_mask"),ph=n(` and optional
`),as=s("code"),mh=n("labels"),fh=n(`, which can then be used to train (or fine-tune) a model. For evaluation, one should first convert the
outputs of the model using one of the postprocessing methods of `),nn=s("a"),uh=n("DetrFeatureExtractor"),gh=n(`. These can
be be provided to either `),is=s("code"),_h=n("CocoEvaluator"),bh=n(" or "),ds=s("code"),vh=n("PanopticEvaluator"),Dh=n(`, which allow you to calculate metrics like
mean Average Precision (mAP) and Panoptic Quality (PQ). The latter objects are implemented in the `),Rt=s("a"),yh=n("original repository"),wh=n(". See the "),Ht=s("a"),Th=n("example notebooks"),xh=n(" for more info regarding evaluation."),aa=d(),xe=s("h2"),Ue=s("a"),cs=s("span"),b(Ut.$$.fragment),Eh=d(),ls=s("span"),Fh=n("DETR specific outputs"),ia=d(),Ee=s("div"),b(Wt.$$.fragment),jh=d(),hs=s("p"),kh=n(`Base class for outputs of the DETR encoder-decoder model. This class adds one attribute to Seq2SeqModelOutput,
namely an optional stack of intermediate decoder activations, i.e. the output of each decoder layer, each of them
gone through a layernorm. This is useful when training the model with auxiliary decoding losses.`),da=d(),Fe=s("div"),b(Gt.$$.fragment),$h=d(),Bt=s("p"),Oh=n("Output type of "),rn=s("a"),Ch=n("DetrForObjectDetection"),zh=n("."),ca=d(),je=s("div"),b(Vt.$$.fragment),qh=d(),Yt=s("p"),Ph=n("Output type of "),sn=s("a"),Nh=n("DetrForSegmentation"),Sh=n("."),la=d(),ke=s("h2"),We=s("a"),ps=s("span"),b(Qt.$$.fragment),Ah=d(),ms=s("span"),Mh=n("DetrConfig"),ha=d(),B=s("div"),b(Kt.$$.fragment),Ih=d(),$e=s("p"),Lh=n("This is the configuration class to store the configuration of a "),an=s("a"),Rh=n("DetrModel"),Hh=n(`. It is used to instantiate a DETR
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 DETR
`),Zt=s("a"),Uh=n("facebook/detr-resnet-50"),Wh=n(" architecture."),Gh=d(),Oe=s("p"),Bh=n("Configuration objects inherit from "),dn=s("a"),Vh=n("PretrainedConfig"),Yh=n(` and can be used to control the model outputs. Read the
documentation from `),cn=s("a"),Qh=n("PretrainedConfig"),Kh=n(" for more information."),Zh=d(),b(Ge.$$.fragment),pa=d(),Ce=s("h2"),Be=s("a"),fs=s("span"),b(Jt.$$.fragment),Jh=d(),us=s("span"),Xh=n("DetrFeatureExtractor"),ma=d(),j=s("div"),b(Xt.$$.fragment),ep=d(),gs=s("p"),tp=n("Constructs a DETR feature extractor."),op=d(),eo=s("p"),np=n("This feature extractor inherits from "),ln=s("a"),rp=n("FeatureExtractionMixin"),sp=n(` which contains most of the main methods. Users
should refer to this superclass for more information regarding those methods.`),ap=d(),ue=s("div"),b(to.$$.fragment),ip=d(),_s=s("p"),dp=n(`Main method to prepare for the model one or several image(s) and optional annotations. Images are by default
padded up to the largest image in a batch, and a pixel mask is created that indicates which pixels are
real/which are padding.`),cp=d(),b(Ve.$$.fragment),lp=d(),Ye=s("div"),b(oo.$$.fragment),hp=d(),no=s("p"),pp=n("Pad images up to the largest image in a batch and create a corresponding "),bs=s("code"),mp=n("pixel_mask"),fp=n("."),up=d(),Qe=s("div"),b(ro.$$.fragment),gp=d(),so=s("p"),_p=n("Converts the output of "),hn=s("a"),bp=n("DetrForObjectDetection"),vp=n(` into the format expected by the COCO api. Only supports
PyTorch.`),Dp=d(),pn=s("div"),b(ao.$$.fragment),yp=d(),mn=s("div"),b(io.$$.fragment),wp=d(),fn=s("div"),b(co.$$.fragment),fa=d(),ze=s("h2"),Ke=s("a"),vs=s("span"),b(lo.$$.fragment),Tp=d(),Ds=s("span"),xp=n("DetrModel"),ua=d(),L=s("div"),b(ho.$$.fragment),Ep=d(),ys=s("p"),Fp=n(`The bare DETR Model (consisting of a backbone and encoder-decoder Transformer) outputting raw hidden-states without
any specific head on top.`),jp=d(),po=s("p"),kp=n("This model inherits from "),un=s("a"),$p=n("PreTrainedModel"),Op=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Cp=d(),mo=s("p"),zp=n("This model is also a PyTorch "),fo=s("a"),qp=n("torch.nn.Module"),Pp=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Np=d(),K=s("div"),b(uo.$$.fragment),Sp=d(),qe=s("p"),Ap=n("The "),gn=s("a"),Mp=n("DetrModel"),Ip=n(" forward method, overrides the "),ws=s("code"),Lp=n("__call__"),Rp=n(" special method."),Hp=d(),b(Ze.$$.fragment),Up=d(),b(Je.$$.fragment),ga=d(),Pe=s("h2"),Xe=s("a"),Ts=s("span"),b(go.$$.fragment),Wp=d(),xs=s("span"),Gp=n("DetrForObjectDetection"),_a=d(),R=s("div"),b(_o.$$.fragment),Bp=d(),Es=s("p"),Vp=n(`DETR Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on top, for tasks
such as COCO detection.`),Yp=d(),bo=s("p"),Qp=n("This model inherits from "),_n=s("a"),Kp=n("PreTrainedModel"),Zp=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Jp=d(),vo=s("p"),Xp=n("This model is also a PyTorch "),Do=s("a"),em=n("torch.nn.Module"),tm=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),om=d(),Z=s("div"),b(yo.$$.fragment),nm=d(),Ne=s("p"),rm=n("The "),bn=s("a"),sm=n("DetrForObjectDetection"),am=n(" forward method, overrides the "),Fs=s("code"),im=n("__call__"),dm=n(" special method."),cm=d(),b(et.$$.fragment),lm=d(),b(tt.$$.fragment),ba=d(),Se=s("h2"),ot=s("a"),js=s("span"),b(wo.$$.fragment),hm=d(),ks=s("span"),pm=n("DetrForSegmentation"),va=d(),H=s("div"),b(To.$$.fragment),mm=d(),$s=s("p"),fm=n(`DETR Model (consisting of a backbone and encoder-decoder Transformer) with a segmentation head on top, for tasks
such as COCO panoptic.`),um=d(),xo=s("p"),gm=n("This model inherits from "),vn=s("a"),_m=n("PreTrainedModel"),bm=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),vm=d(),Eo=s("p"),Dm=n("This model is also a PyTorch "),Fo=s("a"),ym=n("torch.nn.Module"),wm=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Tm=d(),J=s("div"),b(jo.$$.fragment),xm=d(),Ae=s("p"),Em=n("The "),Dn=s("a"),Fm=n("DetrForSegmentation"),jm=n(" forward method, overrides the "),Os=s("code"),km=n("__call__"),$m=n(" special method."),Om=d(),b(nt.$$.fragment),Cm=d(),b(rt.$$.fragment),this.h()},l(o){const h=Wg('[data-svelte="svelte-1phssyn"]',document.head);f=a(h,"META",{name:!0,content:!0}),h.forEach(t),E=c(o),g=a(o,"H1",{class:!0});var ko=i(g);u=a(ko,"A",{id:!0,class:!0,href:!0});var Cs=i(u);x=a(Cs,"SPAN",{});var zs=i(x);v(p.$$.fragment,zs),zs.forEach(t),Cs.forEach(t),_=c(ko),U=a(ko,"SPAN",{});var qs=i(U);Xa=r(qs,"DETR"),qs.forEach(t),ko.forEach(t),As=c(o),De=a(o,"H2",{class:!0});var $o=i(De);Me=a($o,"A",{id:!0,class:!0,href:!0});var Ps=i(Me);Cn=a(Ps,"SPAN",{});var Ns=i(Cn);v(Et.$$.fragment,Ns),Ns.forEach(t),Ps.forEach(t),ei=c($o),zn=a($o,"SPAN",{});var Ss=i(zn);ti=r(Ss,"Overview"),Ss.forEach(t),$o.forEach(t),Ms=c(o),Ie=a(o,"P",{});var ya=i(Ie);oi=r(ya,"The DETR model was proposed in "),Ft=a(ya,"A",{href:!0,rel:!0});var qm=i(Ft);ni=r(qm,"End-to-End Object Detection with Transformers"),qm.forEach(t),ri=r(ya,` by
Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov and Sergey Zagoruyko. DETR
consists of a convolutional backbone followed by an encoder-decoder Transformer which can be trained end-to-end for
object detection. It greatly simplifies a lot of the complexity of models like Faster-R-CNN and Mask-R-CNN, which use
things like region proposals, non-maximum suppression procedure and anchor generation. Moreover, DETR can also be
naturally extended to perform panoptic segmentation, by simply adding a mask head on top of the decoder outputs.`),ya.forEach(t),Is=c(o),Co=a(o,"P",{});var Pm=i(Co);si=r(Pm,"The abstract from the paper is the following:"),Pm.forEach(t),Ls=c(o),zo=a(o,"P",{});var Nm=i(zo);qn=a(Nm,"EM",{});var Sm=i(qn);ai=r(Sm,`We present a new method that views object detection as a direct set prediction problem. Our approach streamlines the
detection pipeline, effectively removing the need for many hand-designed components like a non-maximum suppression
procedure or anchor generation that explicitly encode our prior knowledge about the task. The main ingredients of the
new framework, called DEtection TRansformer or DETR, are a set-based global loss that forces unique predictions via
bipartite matching, and a transformer encoder-decoder architecture. Given a fixed small set of learned object queries,
DETR reasons about the relations of the objects and the global image context to directly output the final set of
predictions in parallel. The new model is conceptually simple and does not require a specialized library, unlike many
other modern detectors. DETR demonstrates accuracy and run-time performance on par with the well-established and
highly-optimized Faster RCNN baseline on the challenging COCO object detection dataset. Moreover, DETR can be easily
generalized to produce panoptic segmentation in a unified manner. We show that it significantly outperforms competitive
baselines.`),Sm.forEach(t),Nm.forEach(t),Rs=c(o),fe=a(o,"P",{});var yn=i(fe);ii=r(yn,"This model was contributed by "),jt=a(yn,"A",{href:!0,rel:!0});var Am=i(jt);di=r(Am,"nielsr"),Am.forEach(t),ci=r(yn,". The original code can be found "),kt=a(yn,"A",{href:!0,rel:!0});var Mm=i(kt);li=r(Mm,"here"),Mm.forEach(t),hi=r(yn,"."),yn.forEach(t),Hs=c(o),Le=a(o,"P",{});var wa=i(Le);pi=r(wa,"The quickest way to get started with DETR is by checking the "),$t=a(wa,"A",{href:!0,rel:!0});var Im=i($t);mi=r(Im,"example notebooks"),Im.forEach(t),fi=r(wa,` (which showcase both inference and
fine-tuning on custom data).`),wa.forEach(t),Us=c(o),Re=a(o,"P",{});var Ta=i(Re);ui=r(Ta,"Here\u2019s a TLDR explaining how "),qo=a(Ta,"A",{href:!0});var Lm=i(qo);gi=r(Lm,"DetrForObjectDetection"),Lm.forEach(t),_i=r(Ta," works:"),Ta.forEach(t),Ws=c(o),k=a(o,"P",{});var q=i(k);bi=r(q,`First, an image is sent through a pre-trained convolutional backbone (in the paper, the authors use
ResNet-50/ResNet-101). Let\u2019s assume we also add a batch dimension. This means that the input to the backbone is a
tensor of shape `),Pn=a(q,"CODE",{});var Rm=i(Pn);vi=r(Rm,"(batch_size, 3, height, width)"),Rm.forEach(t),Di=r(q,`, assuming the image has 3 color channels (RGB). The CNN backbone
outputs a new lower-resolution feature map, typically of shape `),Nn=a(q,"CODE",{});var Hm=i(Nn);yi=r(Hm,"(batch_size, 2048, height/32, width/32)"),Hm.forEach(t),wi=r(q,`. This is
then projected to match the hidden dimension of the Transformer of DETR, which is `),Sn=a(q,"CODE",{});var Um=i(Sn);Ti=r(Um,"256"),Um.forEach(t),xi=r(q,` by default, using a
`),An=a(q,"CODE",{});var Wm=i(An);Ei=r(Wm,"nn.Conv2D"),Wm.forEach(t),Fi=r(q," layer. So now, we have a tensor of shape "),Mn=a(q,"CODE",{});var Gm=i(Mn);ji=r(Gm,"(batch_size, 256, height/32, width/32)."),Gm.forEach(t),ki=r(q,` Next, the
feature map is flattened and transposed to obtain a tensor of shape `),In=a(q,"CODE",{});var Bm=i(In);$i=r(Bm,"(batch_size, seq_len, d_model)"),Bm.forEach(t),Oi=r(q,` =
`),Ln=a(q,"CODE",{});var Vm=i(Ln);Ci=r(Vm,"(batch_size, width/32*height/32, 256)"),Vm.forEach(t),zi=r(q,`. So a difference with NLP models is that the sequence length is actually
longer than usual, but with a smaller `),Rn=a(q,"CODE",{});var Ym=i(Rn);qi=r(Ym,"d_model"),Ym.forEach(t),Pi=r(q," (which in NLP is typically 768 or higher)."),q.forEach(t),Gs=c(o),z=a(o,"P",{});var W=i(z);Ni=r(W,"Next, this is sent through the encoder, outputting "),Hn=a(W,"CODE",{});var Qm=i(Hn);Si=r(Qm,"encoder_hidden_states"),Qm.forEach(t),Ai=r(W,` of the same shape (you can consider
these as image features). Next, so-called `),Un=a(W,"STRONG",{});var Km=i(Un);Mi=r(Km,"object queries"),Km.forEach(t),Ii=r(W,` are sent through the decoder. This is a tensor of shape
`),Wn=a(W,"CODE",{});var Zm=i(Wn);Li=r(Zm,"(batch_size, num_queries, d_model)"),Zm.forEach(t),Ri=r(W,", with "),Gn=a(W,"CODE",{});var Jm=i(Gn);Hi=r(Jm,"num_queries"),Jm.forEach(t),Ui=r(W,` typically set to 100 and initialized with zeros.
These input embeddings are learnt positional encodings that the authors refer to as object queries, and similarly to
the encoder, they are added to the input of each attention layer. Each object query will look for a particular object
in the image. The decoder updates these embeddings through multiple self-attention and encoder-decoder attention layers
to output `),Bn=a(W,"CODE",{});var Xm=i(Bn);Wi=r(Xm,"decoder_hidden_states"),Xm.forEach(t),Gi=r(W," of the same shape: "),Vn=a(W,"CODE",{});var ef=i(Vn);Bi=r(ef,"(batch_size, num_queries, d_model)"),ef.forEach(t),Vi=r(W,`. Next, two heads
are added on top for object detection: a linear layer for classifying each object query into one of the objects or \u201Cno
object\u201D, and a MLP to predict bounding boxes for each query.`),W.forEach(t),Bs=c(o),Y=a(o,"P",{});var st=i(Y);Yi=r(st,"The model is trained using a "),Yn=a(st,"STRONG",{});var tf=i(Yn);Qi=r(tf,"bipartite matching loss"),tf.forEach(t),Ki=r(st,`: so what we actually do is compare the predicted classes +
bounding boxes of each of the N = 100 object queries to the ground truth annotations, padded up to the same length N
(so if an image only contains 4 objects, 96 annotations will just have a \u201Cno object\u201D as class and \u201Cno bounding box\u201D as
bounding box). The `),Ot=a(st,"A",{href:!0,rel:!0});var of=i(Ot);Zi=r(of,"Hungarian matching algorithm"),of.forEach(t),Ji=r(st,` is used to find
an optimal one-to-one mapping of each of the N queries to each of the N annotations. Next, standard cross-entropy (for
the classes) and a linear combination of the L1 and `),Ct=a(st,"A",{href:!0,rel:!0});var nf=i(Ct);Xi=r(nf,"generalized IoU loss"),nf.forEach(t),ed=r(st,` (for the
bounding boxes) are used to optimize the parameters of the model.`),st.forEach(t),Vs=c(o),Q=a(o,"P",{});var at=i(Q);td=r(at,`DETR can be naturally extended to perform panoptic segmentation (which unifies semantic segmentation and instance
segmentation). `),Po=a(at,"A",{href:!0});var rf=i(Po);od=r(rf,"DetrForSegmentation"),rf.forEach(t),nd=r(at,` adds a segmentation mask head on top of
`),No=a(at,"A",{href:!0});var sf=i(No);rd=r(sf,"DetrForObjectDetection"),sf.forEach(t),sd=r(at,`. The mask head can be trained either jointly, or in a two steps process,
where one first trains a `),So=a(at,"A",{href:!0});var af=i(So);ad=r(af,"DetrForObjectDetection"),af.forEach(t),id=r(at,` model to detect bounding boxes around both
\u201Cthings\u201D (instances) and \u201Cstuff\u201D (background things like trees, roads, sky), then freeze all the weights and train only
the mask head for 25 epochs. Experimentally, these two approaches give similar results. Note that predicting boxes is
required for the training to be possible, since the Hungarian matching is computed using distances between boxes.`),at.forEach(t),Ys=c(o),Ao=a(o,"P",{});var df=i(Ao);dd=r(df,"Tips:"),df.forEach(t),Qs=c(o),$=a(o,"UL",{});var A=i($);te=a(A,"LI",{});var it=i(te);cd=r(it,"DETR uses so-called "),Qn=a(it,"STRONG",{});var cf=i(Qn);ld=r(cf,"object queries"),cf.forEach(t),hd=r(it,` to detect objects in an image. The number of queries determines the maximum
number of objects that can be detected in a single image, and is set to 100 by default (see parameter
`),Kn=a(it,"CODE",{});var lf=i(Kn);pd=r(lf,"num_queries"),lf.forEach(t),md=r(it," of "),Mo=a(it,"A",{href:!0});var hf=i(Mo);fd=r(hf,"DetrConfig"),hf.forEach(t),ud=r(it,`). Note that it\u2019s good to have some slack (in COCO, the
authors used 100, while the maximum number of objects in a COCO image is ~70).`),it.forEach(t),gd=c(A),Zn=a(A,"LI",{});var pf=i(Zn);_d=r(pf,`The decoder of DETR updates the query embeddings in parallel. This is different from language models like GPT-2,
which use autoregressive decoding instead of parallel. Hence, no causal attention mask is used.`),pf.forEach(t),bd=c(A),oe=a(A,"LI",{});var dt=i(oe);vd=r(dt,`DETR adds position embeddings to the hidden states at each self-attention and cross-attention layer before projecting
to queries and keys. For the position embeddings of the image, one can choose between fixed sinusoidal or learned
absolute position embeddings. By default, the parameter `),Jn=a(dt,"CODE",{});var mf=i(Jn);Dd=r(mf,"position_embedding_type"),mf.forEach(t),yd=r(dt,` of
`),Io=a(dt,"A",{href:!0});var ff=i(Io);wd=r(ff,"DetrConfig"),ff.forEach(t),Td=r(dt," is set to "),Xn=a(dt,"CODE",{});var uf=i(Xn);xd=r(uf,'"sine"'),uf.forEach(t),Ed=r(dt,"."),dt.forEach(t),Fd=c(A),ne=a(A,"LI",{});var ct=i(ne);jd=r(ct,`During training, the authors of DETR did find it helpful to use auxiliary losses in the decoder, especially to help
the model output the correct number of objects of each class. If you set the parameter `),er=a(ct,"CODE",{});var gf=i(er);kd=r(gf,"auxiliary_loss"),gf.forEach(t),$d=r(ct,` of
`),Lo=a(ct,"A",{href:!0});var _f=i(Lo);Od=r(_f,"DetrConfig"),_f.forEach(t),Cd=r(ct," to "),tr=a(ct,"CODE",{});var bf=i(tr);zd=r(bf,"True"),bf.forEach(t),qd=r(ct,`, then prediction feedforward neural networks and Hungarian losses
are added after each decoder layer (with the FFNs sharing parameters).`),ct.forEach(t),Pd=c(A),G=a(A,"LI",{});var ge=i(G);Nd=r(ge,`If you want to train the model in a distributed environment across multiple nodes, then one should update the
`),or=a(ge,"EM",{});var vf=i(or);Sd=r(vf,"num_boxes"),vf.forEach(t),Ad=r(ge," variable in the "),nr=a(ge,"EM",{});var Df=i(nr);Md=r(Df,"DetrLoss"),Df.forEach(t),Id=r(ge," class of "),rr=a(ge,"EM",{});var yf=i(rr);Ld=r(yf,"modeling_detr.py"),yf.forEach(t),Rd=r(ge,`. When training on multiple nodes, this should be
set to the average number of target boxes across all nodes, as can be seen in the original implementation `),zt=a(ge,"A",{href:!0,rel:!0});var wf=i(zt);Hd=r(wf,"here"),wf.forEach(t),Ud=r(ge,"."),ge.forEach(t),Wd=c(A),S=a(A,"LI",{});var V=i(S);Ro=a(V,"A",{href:!0});var Tf=i(Ro);Gd=r(Tf,"DetrForObjectDetection"),Tf.forEach(t),Bd=r(V," and "),Ho=a(V,"A",{href:!0});var xf=i(Ho);Vd=r(xf,"DetrForSegmentation"),xf.forEach(t),Yd=r(V,` can be initialized with
any convolutional backbone available in the `),qt=a(V,"A",{href:!0,rel:!0});var Ef=i(qt);Qd=r(Ef,"timm library"),Ef.forEach(t),Kd=r(V,`.
Initializing with a MobileNet backbone for example can be done by setting the `),sr=a(V,"CODE",{});var Ff=i(sr);Zd=r(Ff,"backbone"),Ff.forEach(t),Jd=r(V,` attribute of
`),Uo=a(V,"A",{href:!0});var jf=i(Uo);Xd=r(jf,"DetrConfig"),jf.forEach(t),ec=r(V," to "),ar=a(V,"CODE",{});var kf=i(ar);tc=r(kf,'"tf_mobilenetv3_small_075"'),kf.forEach(t),oc=r(V,`, and then initializing the model with that
config.`),V.forEach(t),nc=c(A),re=a(A,"LI",{});var lt=i(re);rc=r(lt,`DETR resizes the input images such that the shortest side is at least a certain amount of pixels while the longest is
at most 1333 pixels. At training time, scale augmentation is used such that the shortest side is randomly set to at
least 480 and at most 800 pixels. At inference time, the shortest side is set to 800. One can use
`),Wo=a(lt,"A",{href:!0});var $f=i(Wo);sc=r($f,"DetrFeatureExtractor"),$f.forEach(t),ac=r(lt,` to prepare images (and optional annotations in COCO format) for the
model. Due to this resizing, images in a batch can have different sizes. DETR solves this by padding images up to the
largest size in a batch, and by creating a pixel mask that indicates which pixels are real/which are padding.
Alternatively, one can also define a custom `),ir=a(lt,"CODE",{});var Of=i(ir);ic=r(Of,"collate_fn"),Of.forEach(t),dc=r(lt,` in order to batch images together, using
`),Go=a(lt,"A",{href:!0});var Cf=i(Go);cc=r(Cf,"pad_and_create_pixel_mask()"),Cf.forEach(t),lc=r(lt,"."),lt.forEach(t),hc=c(A),ye=a(A,"LI",{});var wn=i(ye);pc=r(wn,"The size of the images will determine the amount of memory being used, and will thus determine the "),dr=a(wn,"CODE",{});var zf=i(dr);mc=r(zf,"batch_size"),zf.forEach(t),fc=r(wn,`.
It is advised to use a batch size of 2 per GPU. See `),Pt=a(wn,"A",{href:!0,rel:!0});var qf=i(Pt);uc=r(qf,"this Github thread"),qf.forEach(t),gc=r(wn," for more info."),wn.forEach(t),A.forEach(t),Ks=c(o),Bo=a(o,"P",{});var Pf=i(Bo);_c=r(Pf,"There are three ways to instantiate a DETR model (depending on what you prefer):"),Pf.forEach(t),Zs=c(o),Vo=a(o,"P",{});var Nf=i(Vo);bc=r(Nf,"Option 1: Instantiate DETR with pre-trained weights for entire model"),Nf.forEach(t),Js=c(o),v(Nt.$$.fragment,o),Xs=c(o),Yo=a(o,"P",{});var Sf=i(Yo);vc=r(Sf,"Option 2: Instantiate DETR with randomly initialized weights for Transformer, but pre-trained weights for backbone"),Sf.forEach(t),ea=c(o),v(St.$$.fragment,o),ta=c(o),Qo=a(o,"P",{});var Af=i(Qo);Dc=r(Af,"Option 3: Instantiate DETR with randomly initialized weights for backbone + Transformer"),Af.forEach(t),oa=c(o),v(At.$$.fragment,o),na=c(o),Ko=a(o,"P",{});var Mf=i(Ko);yc=r(Mf,"As a summary, consider the following table:"),Mf.forEach(t),ra=c(o),He=a(o,"TABLE",{});var xa=i(He);cr=a(xa,"THEAD",{});var If=i(cr);se=a(If,"TR",{});var ht=i(se);lr=a(ht,"TH",{});var Lf=i(lr);wc=r(Lf,"Task"),Lf.forEach(t),Tc=c(ht),hr=a(ht,"TH",{});var Rf=i(hr);xc=r(Rf,"Object detection"),Rf.forEach(t),Ec=c(ht),pr=a(ht,"TH",{});var Hf=i(pr);Fc=r(Hf,"Instance segmentation"),Hf.forEach(t),jc=c(ht),mr=a(ht,"TH",{});var Uf=i(mr);kc=r(Uf,"Panoptic segmentation"),Uf.forEach(t),ht.forEach(t),If.forEach(t),$c=c(xa),M=a(xa,"TBODY",{});var X=i(M);ae=a(X,"TR",{});var pt=i(ae);fr=a(pt,"TD",{});var Wf=i(fr);ur=a(Wf,"STRONG",{});var Gf=i(ur);Oc=r(Gf,"Description"),Gf.forEach(t),Wf.forEach(t),Cc=c(pt),gr=a(pt,"TD",{});var Bf=i(gr);zc=r(Bf,"Predicting bounding boxes and class labels around objects in an image"),Bf.forEach(t),qc=c(pt),_r=a(pt,"TD",{});var Vf=i(_r);Pc=r(Vf,"Predicting masks around objects (i.e. instances) in an image"),Vf.forEach(t),Nc=c(pt),br=a(pt,"TD",{});var Yf=i(br);Sc=r(Yf,"Predicting masks around both objects (i.e. instances) as well as \u201Cstuff\u201D (i.e. background things like trees and roads) in an image"),Yf.forEach(t),pt.forEach(t),Ac=c(X),ie=a(X,"TR",{});var mt=i(ie);vr=a(mt,"TD",{});var Qf=i(vr);Dr=a(Qf,"STRONG",{});var Kf=i(Dr);Mc=r(Kf,"Model"),Kf.forEach(t),Qf.forEach(t),Ic=c(mt),yr=a(mt,"TD",{});var Zf=i(yr);Zo=a(Zf,"A",{href:!0});var Jf=i(Zo);Lc=r(Jf,"DetrForObjectDetection"),Jf.forEach(t),Zf.forEach(t),Rc=c(mt),wr=a(mt,"TD",{});var Xf=i(wr);Jo=a(Xf,"A",{href:!0});var eu=i(Jo);Hc=r(eu,"DetrForSegmentation"),eu.forEach(t),Xf.forEach(t),Uc=c(mt),Tr=a(mt,"TD",{});var tu=i(Tr);Xo=a(tu,"A",{href:!0});var ou=i(Xo);Wc=r(ou,"DetrForSegmentation"),ou.forEach(t),tu.forEach(t),mt.forEach(t),Gc=c(X),de=a(X,"TR",{});var ft=i(de);xr=a(ft,"TD",{});var nu=i(xr);Er=a(nu,"STRONG",{});var ru=i(Er);Bc=r(ru,"Example dataset"),ru.forEach(t),nu.forEach(t),Vc=c(ft),Fr=a(ft,"TD",{});var su=i(Fr);Yc=r(su,"COCO detection"),su.forEach(t),Qc=c(ft),jr=a(ft,"TD",{});var au=i(jr);Kc=r(au,"COCO detection, COCO panoptic"),au.forEach(t),Zc=c(ft),kr=a(ft,"TD",{});var iu=i(kr);Jc=r(iu,"COCO panoptic"),iu.forEach(t),ft.forEach(t),Xc=c(X),ce=a(X,"TR",{});var ut=i(ce);Mt=a(ut,"TD",{});var Ea=i(Mt);$r=a(Ea,"STRONG",{});var du=i($r);el=r(du,"Format of annotations to provide to"),du.forEach(t),tl=c(Ea),en=a(Ea,"A",{href:!0});var cu=i(en);ol=r(cu,"DetrFeatureExtractor"),cu.forEach(t),Ea.forEach(t),nl=c(ut),we=a(ut,"TD",{});var Tn=i(we);rl=r(Tn,"{\u2018image_id\u2019: "),Or=a(Tn,"CODE",{});var lu=i(Or);sl=r(lu,"int"),lu.forEach(t),al=r(Tn,", \u2018annotations\u2019: "),Cr=a(Tn,"CODE",{});var hu=i(Cr);il=r(hu,"List[Dict]"),hu.forEach(t),dl=r(Tn,"} each Dict being a COCO object annotation"),Tn.forEach(t),cl=c(ut),I=a(ut,"TD",{});var ee=i(I);ll=r(ee,"{\u2018image_id\u2019: "),zr=a(ee,"CODE",{});var pu=i(zr);hl=r(pu,"int"),pu.forEach(t),pl=r(ee,", \u2018annotations\u2019: "),qr=a(ee,"CODE",{});var mu=i(qr);ml=r(mu,"List[Dict]"),mu.forEach(t),fl=r(ee,"}  (in case of COCO detection) or {\u2018file_name\u2019: "),Pr=a(ee,"CODE",{});var fu=i(Pr);ul=r(fu,"str"),fu.forEach(t),gl=r(ee,", \u2018image_id\u2019: "),Nr=a(ee,"CODE",{});var uu=i(Nr);_l=r(uu,"int"),uu.forEach(t),bl=r(ee,", \u2018segments_info\u2019: "),Sr=a(ee,"CODE",{});var gu=i(Sr);vl=r(gu,"List[Dict]"),gu.forEach(t),Dl=r(ee,"} (in case of COCO panoptic)"),ee.forEach(t),yl=c(ut),le=a(ut,"TD",{});var gt=i(le);wl=r(gt,"{\u2018file_name\u2019: "),Ar=a(gt,"CODE",{});var _u=i(Ar);Tl=r(_u,"str"),_u.forEach(t),xl=r(gt,", \u2018image_id\u2019: "),Mr=a(gt,"CODE",{});var bu=i(Mr);El=r(bu,"int"),bu.forEach(t),Fl=r(gt,", \u2018segments_info\u2019: "),Ir=a(gt,"CODE",{});var vu=i(Ir);jl=r(vu,"List[Dict]"),vu.forEach(t),kl=r(gt,"} and masks_path (path to directory containing PNG files of the masks)"),gt.forEach(t),ut.forEach(t),$l=c(X),he=a(X,"TR",{});var _t=i(he);tn=a(_t,"TD",{});var zm=i(tn);Lr=a(zm,"STRONG",{});var Du=i(Lr);Ol=r(Du,"Postprocessing"),Du.forEach(t),Cl=r(zm," (i.e. converting the output of the model to COCO API)"),zm.forEach(t),zl=c(_t),Rr=a(_t,"TD",{});var yu=i(Rr);Hr=a(yu,"CODE",{});var wu=i(Hr);ql=r(wu,"post_process()"),wu.forEach(t),yu.forEach(t),Pl=c(_t),Ur=a(_t,"TD",{});var Tu=i(Ur);Wr=a(Tu,"CODE",{});var xu=i(Wr);Nl=r(xu,"post_process_segmentation()"),xu.forEach(t),Tu.forEach(t),Sl=c(_t),It=a(_t,"TD",{});var Fa=i(It);Gr=a(Fa,"CODE",{});var Eu=i(Gr);Al=r(Eu,"post_process_segmentation()"),Eu.forEach(t),Ml=r(Fa,", "),Br=a(Fa,"CODE",{});var Fu=i(Br);Il=r(Fu,"post_process_panoptic()"),Fu.forEach(t),Fa.forEach(t),_t.forEach(t),Ll=c(X),pe=a(X,"TR",{});var bt=i(pe);Vr=a(bt,"TD",{});var ju=i(Vr);Yr=a(ju,"STRONG",{});var ku=i(Yr);Rl=r(ku,"evaluators"),ku.forEach(t),ju.forEach(t),Hl=c(bt),Lt=a(bt,"TD",{});var ja=i(Lt);Qr=a(ja,"CODE",{});var $u=i(Qr);Ul=r($u,"CocoEvaluator"),$u.forEach(t),Wl=r(ja," with "),Kr=a(ja,"CODE",{});var Ou=i(Kr);Gl=r(Ou,'iou_types="bbox"'),Ou.forEach(t),ja.forEach(t),Bl=c(bt),Te=a(bt,"TD",{});var xn=i(Te);Zr=a(xn,"CODE",{});var Cu=i(Zr);Vl=r(Cu,"CocoEvaluator"),Cu.forEach(t),Yl=r(xn," with "),Jr=a(xn,"CODE",{});var zu=i(Jr);Ql=r(zu,'iou_types="bbox"'),zu.forEach(t),Kl=r(xn," or "),Xr=a(xn,"CODE",{});var qu=i(Xr);Zl=r(qu,'"segm"'),qu.forEach(t),xn.forEach(t),Jl=c(bt),me=a(bt,"TD",{});var vt=i(me);es=a(vt,"CODE",{});var Pu=i(es);Xl=r(Pu,"CocoEvaluator"),Pu.forEach(t),eh=r(vt," with "),ts=a(vt,"CODE",{});var Nu=i(ts);th=r(Nu,'iou_tupes="bbox"'),Nu.forEach(t),oh=r(vt," or "),os=a(vt,"CODE",{});var Su=i(os);nh=r(Su,'"segm"'),Su.forEach(t),rh=r(vt,", "),ns=a(vt,"CODE",{});var Au=i(ns);sh=r(Au,"PanopticEvaluator"),Au.forEach(t),vt.forEach(t),bt.forEach(t),X.forEach(t),xa.forEach(t),sa=c(o),F=a(o,"P",{});var O=i(F);ah=r(O,`In short, one should prepare the data either in COCO detection or COCO panoptic format, then use
`),on=a(O,"A",{href:!0});var Mu=i(on);ih=r(Mu,"DetrFeatureExtractor"),Mu.forEach(t),dh=r(O," to create "),rs=a(O,"CODE",{});var Iu=i(rs);ch=r(Iu,"pixel_values"),Iu.forEach(t),lh=r(O,", "),ss=a(O,"CODE",{});var Lu=i(ss);hh=r(Lu,"pixel_mask"),Lu.forEach(t),ph=r(O,` and optional
`),as=a(O,"CODE",{});var Ru=i(as);mh=r(Ru,"labels"),Ru.forEach(t),fh=r(O,`, which can then be used to train (or fine-tune) a model. For evaluation, one should first convert the
outputs of the model using one of the postprocessing methods of `),nn=a(O,"A",{href:!0});var Hu=i(nn);uh=r(Hu,"DetrFeatureExtractor"),Hu.forEach(t),gh=r(O,`. These can
be be provided to either `),is=a(O,"CODE",{});var Uu=i(is);_h=r(Uu,"CocoEvaluator"),Uu.forEach(t),bh=r(O," or "),ds=a(O,"CODE",{});var Wu=i(ds);vh=r(Wu,"PanopticEvaluator"),Wu.forEach(t),Dh=r(O,`, which allow you to calculate metrics like
mean Average Precision (mAP) and Panoptic Quality (PQ). The latter objects are implemented in the `),Rt=a(O,"A",{href:!0,rel:!0});var Gu=i(Rt);yh=r(Gu,"original repository"),Gu.forEach(t),wh=r(O,". See the "),Ht=a(O,"A",{href:!0,rel:!0});var Bu=i(Ht);Th=r(Bu,"example notebooks"),Bu.forEach(t),xh=r(O," for more info regarding evaluation."),O.forEach(t),aa=c(o),xe=a(o,"H2",{class:!0});var ka=i(xe);Ue=a(ka,"A",{id:!0,class:!0,href:!0});var Vu=i(Ue);cs=a(Vu,"SPAN",{});var Yu=i(cs);v(Ut.$$.fragment,Yu),Yu.forEach(t),Vu.forEach(t),Eh=c(ka),ls=a(ka,"SPAN",{});var Qu=i(ls);Fh=r(Qu,"DETR specific outputs"),Qu.forEach(t),ka.forEach(t),ia=c(o),Ee=a(o,"DIV",{class:!0});var $a=i(Ee);v(Wt.$$.fragment,$a),jh=c($a),hs=a($a,"P",{});var Ku=i(hs);kh=r(Ku,`Base class for outputs of the DETR encoder-decoder model. This class adds one attribute to Seq2SeqModelOutput,
namely an optional stack of intermediate decoder activations, i.e. the output of each decoder layer, each of them
gone through a layernorm. This is useful when training the model with auxiliary decoding losses.`),Ku.forEach(t),$a.forEach(t),da=c(o),Fe=a(o,"DIV",{class:!0});var Oa=i(Fe);v(Gt.$$.fragment,Oa),$h=c(Oa),Bt=a(Oa,"P",{});var Ca=i(Bt);Oh=r(Ca,"Output type of "),rn=a(Ca,"A",{href:!0});var Zu=i(rn);Ch=r(Zu,"DetrForObjectDetection"),Zu.forEach(t),zh=r(Ca,"."),Ca.forEach(t),Oa.forEach(t),ca=c(o),je=a(o,"DIV",{class:!0});var za=i(je);v(Vt.$$.fragment,za),qh=c(za),Yt=a(za,"P",{});var qa=i(Yt);Ph=r(qa,"Output type of "),sn=a(qa,"A",{href:!0});var Ju=i(sn);Nh=r(Ju,"DetrForSegmentation"),Ju.forEach(t),Sh=r(qa,"."),qa.forEach(t),za.forEach(t),la=c(o),ke=a(o,"H2",{class:!0});var Pa=i(ke);We=a(Pa,"A",{id:!0,class:!0,href:!0});var Xu=i(We);ps=a(Xu,"SPAN",{});var eg=i(ps);v(Qt.$$.fragment,eg),eg.forEach(t),Xu.forEach(t),Ah=c(Pa),ms=a(Pa,"SPAN",{});var tg=i(ms);Mh=r(tg,"DetrConfig"),tg.forEach(t),Pa.forEach(t),ha=c(o),B=a(o,"DIV",{class:!0});var Dt=i(B);v(Kt.$$.fragment,Dt),Ih=c(Dt),$e=a(Dt,"P",{});var En=i($e);Lh=r(En,"This is the configuration class to store the configuration of a "),an=a(En,"A",{href:!0});var og=i(an);Rh=r(og,"DetrModel"),og.forEach(t),Hh=r(En,`. It is used to instantiate a DETR
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 DETR
`),Zt=a(En,"A",{href:!0,rel:!0});var ng=i(Zt);Uh=r(ng,"facebook/detr-resnet-50"),ng.forEach(t),Wh=r(En," architecture."),En.forEach(t),Gh=c(Dt),Oe=a(Dt,"P",{});var Fn=i(Oe);Bh=r(Fn,"Configuration objects inherit from "),dn=a(Fn,"A",{href:!0});var rg=i(dn);Vh=r(rg,"PretrainedConfig"),rg.forEach(t),Yh=r(Fn,` and can be used to control the model outputs. Read the
documentation from `),cn=a(Fn,"A",{href:!0});var sg=i(cn);Qh=r(sg,"PretrainedConfig"),sg.forEach(t),Kh=r(Fn," for more information."),Fn.forEach(t),Zh=c(Dt),v(Ge.$$.fragment,Dt),Dt.forEach(t),pa=c(o),Ce=a(o,"H2",{class:!0});var Na=i(Ce);Be=a(Na,"A",{id:!0,class:!0,href:!0});var ag=i(Be);fs=a(ag,"SPAN",{});var ig=i(fs);v(Jt.$$.fragment,ig),ig.forEach(t),ag.forEach(t),Jh=c(Na),us=a(Na,"SPAN",{});var dg=i(us);Xh=r(dg,"DetrFeatureExtractor"),dg.forEach(t),Na.forEach(t),ma=c(o),j=a(o,"DIV",{class:!0});var P=i(j);v(Xt.$$.fragment,P),ep=c(P),gs=a(P,"P",{});var cg=i(gs);tp=r(cg,"Constructs a DETR feature extractor."),cg.forEach(t),op=c(P),eo=a(P,"P",{});var Sa=i(eo);np=r(Sa,"This feature extractor inherits from "),ln=a(Sa,"A",{href:!0});var lg=i(ln);rp=r(lg,"FeatureExtractionMixin"),lg.forEach(t),sp=r(Sa,` which contains most of the main methods. Users
should refer to this superclass for more information regarding those methods.`),Sa.forEach(t),ap=c(P),ue=a(P,"DIV",{class:!0});var jn=i(ue);v(to.$$.fragment,jn),ip=c(jn),_s=a(jn,"P",{});var hg=i(_s);dp=r(hg,`Main method to prepare for the model one or several image(s) and optional annotations. Images are by default
padded up to the largest image in a batch, and a pixel mask is created that indicates which pixels are
real/which are padding.`),hg.forEach(t),cp=c(jn),v(Ve.$$.fragment,jn),jn.forEach(t),lp=c(P),Ye=a(P,"DIV",{class:!0});var Aa=i(Ye);v(oo.$$.fragment,Aa),hp=c(Aa),no=a(Aa,"P",{});var Ma=i(no);pp=r(Ma,"Pad images up to the largest image in a batch and create a corresponding "),bs=a(Ma,"CODE",{});var pg=i(bs);mp=r(pg,"pixel_mask"),pg.forEach(t),fp=r(Ma,"."),Ma.forEach(t),Aa.forEach(t),up=c(P),Qe=a(P,"DIV",{class:!0});var Ia=i(Qe);v(ro.$$.fragment,Ia),gp=c(Ia),so=a(Ia,"P",{});var La=i(so);_p=r(La,"Converts the output of "),hn=a(La,"A",{href:!0});var mg=i(hn);bp=r(mg,"DetrForObjectDetection"),mg.forEach(t),vp=r(La,` into the format expected by the COCO api. Only supports
PyTorch.`),La.forEach(t),Ia.forEach(t),Dp=c(P),pn=a(P,"DIV",{class:!0});var fg=i(pn);v(ao.$$.fragment,fg),fg.forEach(t),yp=c(P),mn=a(P,"DIV",{class:!0});var ug=i(mn);v(io.$$.fragment,ug),ug.forEach(t),wp=c(P),fn=a(P,"DIV",{class:!0});var gg=i(fn);v(co.$$.fragment,gg),gg.forEach(t),P.forEach(t),fa=c(o),ze=a(o,"H2",{class:!0});var Ra=i(ze);Ke=a(Ra,"A",{id:!0,class:!0,href:!0});var _g=i(Ke);vs=a(_g,"SPAN",{});var bg=i(vs);v(lo.$$.fragment,bg),bg.forEach(t),_g.forEach(t),Tp=c(Ra),Ds=a(Ra,"SPAN",{});var vg=i(Ds);xp=r(vg,"DetrModel"),vg.forEach(t),Ra.forEach(t),ua=c(o),L=a(o,"DIV",{class:!0});var _e=i(L);v(ho.$$.fragment,_e),Ep=c(_e),ys=a(_e,"P",{});var Dg=i(ys);Fp=r(Dg,`The bare DETR Model (consisting of a backbone and encoder-decoder Transformer) outputting raw hidden-states without
any specific head on top.`),Dg.forEach(t),jp=c(_e),po=a(_e,"P",{});var Ha=i(po);kp=r(Ha,"This model inherits from "),un=a(Ha,"A",{href:!0});var yg=i(un);$p=r(yg,"PreTrainedModel"),yg.forEach(t),Op=r(Ha,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Ha.forEach(t),Cp=c(_e),mo=a(_e,"P",{});var Ua=i(mo);zp=r(Ua,"This model is also a PyTorch "),fo=a(Ua,"A",{href:!0,rel:!0});var wg=i(fo);qp=r(wg,"torch.nn.Module"),wg.forEach(t),Pp=r(Ua,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ua.forEach(t),Np=c(_e),K=a(_e,"DIV",{class:!0});var yt=i(K);v(uo.$$.fragment,yt),Sp=c(yt),qe=a(yt,"P",{});var kn=i(qe);Ap=r(kn,"The "),gn=a(kn,"A",{href:!0});var Tg=i(gn);Mp=r(Tg,"DetrModel"),Tg.forEach(t),Ip=r(kn," forward method, overrides the "),ws=a(kn,"CODE",{});var xg=i(ws);Lp=r(xg,"__call__"),xg.forEach(t),Rp=r(kn," special method."),kn.forEach(t),Hp=c(yt),v(Ze.$$.fragment,yt),Up=c(yt),v(Je.$$.fragment,yt),yt.forEach(t),_e.forEach(t),ga=c(o),Pe=a(o,"H2",{class:!0});var Wa=i(Pe);Xe=a(Wa,"A",{id:!0,class:!0,href:!0});var Eg=i(Xe);Ts=a(Eg,"SPAN",{});var Fg=i(Ts);v(go.$$.fragment,Fg),Fg.forEach(t),Eg.forEach(t),Wp=c(Wa),xs=a(Wa,"SPAN",{});var jg=i(xs);Gp=r(jg,"DetrForObjectDetection"),jg.forEach(t),Wa.forEach(t),_a=c(o),R=a(o,"DIV",{class:!0});var be=i(R);v(_o.$$.fragment,be),Bp=c(be),Es=a(be,"P",{});var kg=i(Es);Vp=r(kg,`DETR Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on top, for tasks
such as COCO detection.`),kg.forEach(t),Yp=c(be),bo=a(be,"P",{});var Ga=i(bo);Qp=r(Ga,"This model inherits from "),_n=a(Ga,"A",{href:!0});var $g=i(_n);Kp=r($g,"PreTrainedModel"),$g.forEach(t),Zp=r(Ga,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Ga.forEach(t),Jp=c(be),vo=a(be,"P",{});var Ba=i(vo);Xp=r(Ba,"This model is also a PyTorch "),Do=a(Ba,"A",{href:!0,rel:!0});var Og=i(Do);em=r(Og,"torch.nn.Module"),Og.forEach(t),tm=r(Ba,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ba.forEach(t),om=c(be),Z=a(be,"DIV",{class:!0});var wt=i(Z);v(yo.$$.fragment,wt),nm=c(wt),Ne=a(wt,"P",{});var $n=i(Ne);rm=r($n,"The "),bn=a($n,"A",{href:!0});var Cg=i(bn);sm=r(Cg,"DetrForObjectDetection"),Cg.forEach(t),am=r($n," forward method, overrides the "),Fs=a($n,"CODE",{});var zg=i(Fs);im=r(zg,"__call__"),zg.forEach(t),dm=r($n," special method."),$n.forEach(t),cm=c(wt),v(et.$$.fragment,wt),lm=c(wt),v(tt.$$.fragment,wt),wt.forEach(t),be.forEach(t),ba=c(o),Se=a(o,"H2",{class:!0});var Va=i(Se);ot=a(Va,"A",{id:!0,class:!0,href:!0});var qg=i(ot);js=a(qg,"SPAN",{});var Pg=i(js);v(wo.$$.fragment,Pg),Pg.forEach(t),qg.forEach(t),hm=c(Va),ks=a(Va,"SPAN",{});var Ng=i(ks);pm=r(Ng,"DetrForSegmentation"),Ng.forEach(t),Va.forEach(t),va=c(o),H=a(o,"DIV",{class:!0});var ve=i(H);v(To.$$.fragment,ve),mm=c(ve),$s=a(ve,"P",{});var Sg=i($s);fm=r(Sg,`DETR Model (consisting of a backbone and encoder-decoder Transformer) with a segmentation head on top, for tasks
such as COCO panoptic.`),Sg.forEach(t),um=c(ve),xo=a(ve,"P",{});var Ya=i(xo);gm=r(Ya,"This model inherits from "),vn=a(Ya,"A",{href:!0});var Ag=i(vn);_m=r(Ag,"PreTrainedModel"),Ag.forEach(t),bm=r(Ya,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Ya.forEach(t),vm=c(ve),Eo=a(ve,"P",{});var Qa=i(Eo);Dm=r(Qa,"This model is also a PyTorch "),Fo=a(Qa,"A",{href:!0,rel:!0});var Mg=i(Fo);ym=r(Mg,"torch.nn.Module"),Mg.forEach(t),wm=r(Qa,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Qa.forEach(t),Tm=c(ve),J=a(ve,"DIV",{class:!0});var Tt=i(J);v(jo.$$.fragment,Tt),xm=c(Tt),Ae=a(Tt,"P",{});var On=i(Ae);Em=r(On,"The "),Dn=a(On,"A",{href:!0});var Ig=i(Dn);Fm=r(Ig,"DetrForSegmentation"),Ig.forEach(t),jm=r(On," forward method, overrides the "),Os=a(On,"CODE",{});var Lg=i(Os);km=r(Lg,"__call__"),Lg.forEach(t),$m=r(On," special method."),On.forEach(t),Om=c(Tt),v(nt.$$.fragment,Tt),Cm=c(Tt),v(rt.$$.fragment,Tt),Tt.forEach(t),ve.forEach(t),this.h()},h(){l(f,"name","hf:doc:metadata"),l(f,"content",JSON.stringify(t_)),l(u,"id","detr"),l(u,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(u,"href","#detr"),l(g,"class","relative group"),l(Me,"id","overview"),l(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"),l(Me,"href","#overview"),l(De,"class","relative group"),l(Ft,"href","https://arxiv.org/abs/2005.12872"),l(Ft,"rel","nofollow"),l(jt,"href","https://huggingface.co/nielsr"),l(jt,"rel","nofollow"),l(kt,"href","https://github.com/facebookresearch/detr"),l(kt,"rel","nofollow"),l($t,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/DETR"),l($t,"rel","nofollow"),l(qo,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForObjectDetection"),l(Ot,"href","https://en.wikipedia.org/wiki/Hungarian_algorithm"),l(Ot,"rel","nofollow"),l(Ct,"href","https://giou.stanford.edu/"),l(Ct,"rel","nofollow"),l(Po,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation"),l(No,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForObjectDetection"),l(So,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForObjectDetection"),l(Mo,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrConfig"),l(Io,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrConfig"),l(Lo,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrConfig"),l(zt,"href","https://github.com/facebookresearch/detr/blob/a54b77800eb8e64e3ad0d8237789fcbf2f8350c5/models/detr.py#L227-L232"),l(zt,"rel","nofollow"),l(Ro,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForObjectDetection"),l(Ho,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation"),l(qt,"href","https://github.com/rwightman/pytorch-image-models"),l(qt,"rel","nofollow"),l(Uo,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrConfig"),l(Wo,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor"),l(Go,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor.pad_and_create_pixel_mask"),l(Pt,"href","https://github.com/facebookresearch/detr/issues/150"),l(Pt,"rel","nofollow"),l(Zo,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForObjectDetection"),l(Jo,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation"),l(Xo,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation"),l(en,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor"),l(on,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor"),l(nn,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrFeatureExtractor"),l(Rt,"href","https://github.com/facebookresearch/detr"),l(Rt,"rel","nofollow"),l(Ht,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/DETR"),l(Ht,"rel","nofollow"),l(Ue,"id","transformers.models.detr.modeling_detr.DetrModelOutput"),l(Ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ue,"href","#transformers.models.detr.modeling_detr.DetrModelOutput"),l(xe,"class","relative group"),l(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(rn,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForObjectDetection"),l(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(sn,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation"),l(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(We,"id","transformers.DetrConfig"),l(We,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(We,"href","#transformers.DetrConfig"),l(ke,"class","relative group"),l(an,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrModel"),l(Zt,"href","https://huggingface.co/facebook/detr-resnet-50"),l(Zt,"rel","nofollow"),l(dn,"href","/docs/transformers/pr_19907/en/main_classes/configuration#transformers.PretrainedConfig"),l(cn,"href","/docs/transformers/pr_19907/en/main_classes/configuration#transformers.PretrainedConfig"),l(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Be,"id","transformers.DetrFeatureExtractor"),l(Be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Be,"href","#transformers.DetrFeatureExtractor"),l(Ce,"class","relative group"),l(ln,"href","/docs/transformers/pr_19907/en/internal/image_processing_utils#transformers.FeatureExtractionMixin"),l(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(hn,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForObjectDetection"),l(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(pn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(mn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(fn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ke,"id","transformers.DetrModel"),l(Ke,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ke,"href","#transformers.DetrModel"),l(ze,"class","relative group"),l(un,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.PreTrainedModel"),l(fo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(fo,"rel","nofollow"),l(gn,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrModel"),l(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Xe,"id","transformers.DetrForObjectDetection"),l(Xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Xe,"href","#transformers.DetrForObjectDetection"),l(Pe,"class","relative group"),l(_n,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.PreTrainedModel"),l(Do,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Do,"rel","nofollow"),l(bn,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForObjectDetection"),l(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ot,"id","transformers.DetrForSegmentation"),l(ot,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(ot,"href","#transformers.DetrForSegmentation"),l(Se,"class","relative group"),l(vn,"href","/docs/transformers/pr_19907/en/main_classes/model#transformers.PreTrainedModel"),l(Fo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Fo,"rel","nofollow"),l(Dn,"href","/docs/transformers/pr_19907/en/model_doc/detr#transformers.DetrForSegmentation"),l(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(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(o,h){e(document.head,f),m(o,E,h),m(o,g,h),e(g,u),e(u,x),D(p,x,null),e(g,_),e(g,U),e(U,Xa),m(o,As,h),m(o,De,h),e(De,Me),e(Me,Cn),D(Et,Cn,null),e(De,ei),e(De,zn),e(zn,ti),m(o,Ms,h),m(o,Ie,h),e(Ie,oi),e(Ie,Ft),e(Ft,ni),e(Ie,ri),m(o,Is,h),m(o,Co,h),e(Co,si),m(o,Ls,h),m(o,zo,h),e(zo,qn),e(qn,ai),m(o,Rs,h),m(o,fe,h),e(fe,ii),e(fe,jt),e(jt,di),e(fe,ci),e(fe,kt),e(kt,li),e(fe,hi),m(o,Hs,h),m(o,Le,h),e(Le,pi),e(Le,$t),e($t,mi),e(Le,fi),m(o,Us,h),m(o,Re,h),e(Re,ui),e(Re,qo),e(qo,gi),e(Re,_i),m(o,Ws,h),m(o,k,h),e(k,bi),e(k,Pn),e(Pn,vi),e(k,Di),e(k,Nn),e(Nn,yi),e(k,wi),e(k,Sn),e(Sn,Ti),e(k,xi),e(k,An),e(An,Ei),e(k,Fi),e(k,Mn),e(Mn,ji),e(k,ki),e(k,In),e(In,$i),e(k,Oi),e(k,Ln),e(Ln,Ci),e(k,zi),e(k,Rn),e(Rn,qi),e(k,Pi),m(o,Gs,h),m(o,z,h),e(z,Ni),e(z,Hn),e(Hn,Si),e(z,Ai),e(z,Un),e(Un,Mi),e(z,Ii),e(z,Wn),e(Wn,Li),e(z,Ri),e(z,Gn),e(Gn,Hi),e(z,Ui),e(z,Bn),e(Bn,Wi),e(z,Gi),e(z,Vn),e(Vn,Bi),e(z,Vi),m(o,Bs,h),m(o,Y,h),e(Y,Yi),e(Y,Yn),e(Yn,Qi),e(Y,Ki),e(Y,Ot),e(Ot,Zi),e(Y,Ji),e(Y,Ct),e(Ct,Xi),e(Y,ed),m(o,Vs,h),m(o,Q,h),e(Q,td),e(Q,Po),e(Po,od),e(Q,nd),e(Q,No),e(No,rd),e(Q,sd),e(Q,So),e(So,ad),e(Q,id),m(o,Ys,h),m(o,Ao,h),e(Ao,dd),m(o,Qs,h),m(o,$,h),e($,te),e(te,cd),e(te,Qn),e(Qn,ld),e(te,hd),e(te,Kn),e(Kn,pd),e(te,md),e(te,Mo),e(Mo,fd),e(te,ud),e($,gd),e($,Zn),e(Zn,_d),e($,bd),e($,oe),e(oe,vd),e(oe,Jn),e(Jn,Dd),e(oe,yd),e(oe,Io),e(Io,wd),e(oe,Td),e(oe,Xn),e(Xn,xd),e(oe,Ed),e($,Fd),e($,ne),e(ne,jd),e(ne,er),e(er,kd),e(ne,$d),e(ne,Lo),e(Lo,Od),e(ne,Cd),e(ne,tr),e(tr,zd),e(ne,qd),e($,Pd),e($,G),e(G,Nd),e(G,or),e(or,Sd),e(G,Ad),e(G,nr),e(nr,Md),e(G,Id),e(G,rr),e(rr,Ld),e(G,Rd),e(G,zt),e(zt,Hd),e(G,Ud),e($,Wd),e($,S),e(S,Ro),e(Ro,Gd),e(S,Bd),e(S,Ho),e(Ho,Vd),e(S,Yd),e(S,qt),e(qt,Qd),e(S,Kd),e(S,sr),e(sr,Zd),e(S,Jd),e(S,Uo),e(Uo,Xd),e(S,ec),e(S,ar),e(ar,tc),e(S,oc),e($,nc),e($,re),e(re,rc),e(re,Wo),e(Wo,sc),e(re,ac),e(re,ir),e(ir,ic),e(re,dc),e(re,Go),e(Go,cc),e(re,lc),e($,hc),e($,ye),e(ye,pc),e(ye,dr),e(dr,mc),e(ye,fc),e(ye,Pt),e(Pt,uc),e(ye,gc),m(o,Ks,h),m(o,Bo,h),e(Bo,_c),m(o,Zs,h),m(o,Vo,h),e(Vo,bc),m(o,Js,h),D(Nt,o,h),m(o,Xs,h),m(o,Yo,h),e(Yo,vc),m(o,ea,h),D(St,o,h),m(o,ta,h),m(o,Qo,h),e(Qo,Dc),m(o,oa,h),D(At,o,h),m(o,na,h),m(o,Ko,h),e(Ko,yc),m(o,ra,h),m(o,He,h),e(He,cr),e(cr,se),e(se,lr),e(lr,wc),e(se,Tc),e(se,hr),e(hr,xc),e(se,Ec),e(se,pr),e(pr,Fc),e(se,jc),e(se,mr),e(mr,kc),e(He,$c),e(He,M),e(M,ae),e(ae,fr),e(fr,ur),e(ur,Oc),e(ae,Cc),e(ae,gr),e(gr,zc),e(ae,qc),e(ae,_r),e(_r,Pc),e(ae,Nc),e(ae,br),e(br,Sc),e(M,Ac),e(M,ie),e(ie,vr),e(vr,Dr),e(Dr,Mc),e(ie,Ic),e(ie,yr),e(yr,Zo),e(Zo,Lc),e(ie,Rc),e(ie,wr),e(wr,Jo),e(Jo,Hc),e(ie,Uc),e(ie,Tr),e(Tr,Xo),e(Xo,Wc),e(M,Gc),e(M,de),e(de,xr),e(xr,Er),e(Er,Bc),e(de,Vc),e(de,Fr),e(Fr,Yc),e(de,Qc),e(de,jr),e(jr,Kc),e(de,Zc),e(de,kr),e(kr,Jc),e(M,Xc),e(M,ce),e(ce,Mt),e(Mt,$r),e($r,el),e(Mt,tl),e(Mt,en),e(en,ol),e(ce,nl),e(ce,we),e(we,rl),e(we,Or),e(Or,sl),e(we,al),e(we,Cr),e(Cr,il),e(we,dl),e(ce,cl),e(ce,I),e(I,ll),e(I,zr),e(zr,hl),e(I,pl),e(I,qr),e(qr,ml),e(I,fl),e(I,Pr),e(Pr,ul),e(I,gl),e(I,Nr),e(Nr,_l),e(I,bl),e(I,Sr),e(Sr,vl),e(I,Dl),e(ce,yl),e(ce,le),e(le,wl),e(le,Ar),e(Ar,Tl),e(le,xl),e(le,Mr),e(Mr,El),e(le,Fl),e(le,Ir),e(Ir,jl),e(le,kl),e(M,$l),e(M,he),e(he,tn),e(tn,Lr),e(Lr,Ol),e(tn,Cl),e(he,zl),e(he,Rr),e(Rr,Hr),e(Hr,ql),e(he,Pl),e(he,Ur),e(Ur,Wr),e(Wr,Nl),e(he,Sl),e(he,It),e(It,Gr),e(Gr,Al),e(It,Ml),e(It,Br),e(Br,Il),e(M,Ll),e(M,pe),e(pe,Vr),e(Vr,Yr),e(Yr,Rl),e(pe,Hl),e(pe,Lt),e(Lt,Qr),e(Qr,Ul),e(Lt,Wl),e(Lt,Kr),e(Kr,Gl),e(pe,Bl),e(pe,Te),e(Te,Zr),e(Zr,Vl),e(Te,Yl),e(Te,Jr),e(Jr,Ql),e(Te,Kl),e(Te,Xr),e(Xr,Zl),e(pe,Jl),e(pe,me),e(me,es),e(es,Xl),e(me,eh),e(me,ts),e(ts,th),e(me,oh),e(me,os),e(os,nh),e(me,rh),e(me,ns),e(ns,sh),m(o,sa,h),m(o,F,h),e(F,ah),e(F,on),e(on,ih),e(F,dh),e(F,rs),e(rs,ch),e(F,lh),e(F,ss),e(ss,hh),e(F,ph),e(F,as),e(as,mh),e(F,fh),e(F,nn),e(nn,uh),e(F,gh),e(F,is),e(is,_h),e(F,bh),e(F,ds),e(ds,vh),e(F,Dh),e(F,Rt),e(Rt,yh),e(F,wh),e(F,Ht),e(Ht,Th),e(F,xh),m(o,aa,h),m(o,xe,h),e(xe,Ue),e(Ue,cs),D(Ut,cs,null),e(xe,Eh),e(xe,ls),e(ls,Fh),m(o,ia,h),m(o,Ee,h),D(Wt,Ee,null),e(Ee,jh),e(Ee,hs),e(hs,kh),m(o,da,h),m(o,Fe,h),D(Gt,Fe,null),e(Fe,$h),e(Fe,Bt),e(Bt,Oh),e(Bt,rn),e(rn,Ch),e(Bt,zh),m(o,ca,h),m(o,je,h),D(Vt,je,null),e(je,qh),e(je,Yt),e(Yt,Ph),e(Yt,sn),e(sn,Nh),e(Yt,Sh),m(o,la,h),m(o,ke,h),e(ke,We),e(We,ps),D(Qt,ps,null),e(ke,Ah),e(ke,ms),e(ms,Mh),m(o,ha,h),m(o,B,h),D(Kt,B,null),e(B,Ih),e(B,$e),e($e,Lh),e($e,an),e(an,Rh),e($e,Hh),e($e,Zt),e(Zt,Uh),e($e,Wh),e(B,Gh),e(B,Oe),e(Oe,Bh),e(Oe,dn),e(dn,Vh),e(Oe,Yh),e(Oe,cn),e(cn,Qh),e(Oe,Kh),e(B,Zh),D(Ge,B,null),m(o,pa,h),m(o,Ce,h),e(Ce,Be),e(Be,fs),D(Jt,fs,null),e(Ce,Jh),e(Ce,us),e(us,Xh),m(o,ma,h),m(o,j,h),D(Xt,j,null),e(j,ep),e(j,gs),e(gs,tp),e(j,op),e(j,eo),e(eo,np),e(eo,ln),e(ln,rp),e(eo,sp),e(j,ap),e(j,ue),D(to,ue,null),e(ue,ip),e(ue,_s),e(_s,dp),e(ue,cp),D(Ve,ue,null),e(j,lp),e(j,Ye),D(oo,Ye,null),e(Ye,hp),e(Ye,no),e(no,pp),e(no,bs),e(bs,mp),e(no,fp),e(j,up),e(j,Qe),D(ro,Qe,null),e(Qe,gp),e(Qe,so),e(so,_p),e(so,hn),e(hn,bp),e(so,vp),e(j,Dp),e(j,pn),D(ao,pn,null),e(j,yp),e(j,mn),D(io,mn,null),e(j,wp),e(j,fn),D(co,fn,null),m(o,fa,h),m(o,ze,h),e(ze,Ke),e(Ke,vs),D(lo,vs,null),e(ze,Tp),e(ze,Ds),e(Ds,xp),m(o,ua,h),m(o,L,h),D(ho,L,null),e(L,Ep),e(L,ys),e(ys,Fp),e(L,jp),e(L,po),e(po,kp),e(po,un),e(un,$p),e(po,Op),e(L,Cp),e(L,mo),e(mo,zp),e(mo,fo),e(fo,qp),e(mo,Pp),e(L,Np),e(L,K),D(uo,K,null),e(K,Sp),e(K,qe),e(qe,Ap),e(qe,gn),e(gn,Mp),e(qe,Ip),e(qe,ws),e(ws,Lp),e(qe,Rp),e(K,Hp),D(Ze,K,null),e(K,Up),D(Je,K,null),m(o,ga,h),m(o,Pe,h),e(Pe,Xe),e(Xe,Ts),D(go,Ts,null),e(Pe,Wp),e(Pe,xs),e(xs,Gp),m(o,_a,h),m(o,R,h),D(_o,R,null),e(R,Bp),e(R,Es),e(Es,Vp),e(R,Yp),e(R,bo),e(bo,Qp),e(bo,_n),e(_n,Kp),e(bo,Zp),e(R,Jp),e(R,vo),e(vo,Xp),e(vo,Do),e(Do,em),e(vo,tm),e(R,om),e(R,Z),D(yo,Z,null),e(Z,nm),e(Z,Ne),e(Ne,rm),e(Ne,bn),e(bn,sm),e(Ne,am),e(Ne,Fs),e(Fs,im),e(Ne,dm),e(Z,cm),D(et,Z,null),e(Z,lm),D(tt,Z,null),m(o,ba,h),m(o,Se,h),e(Se,ot),e(ot,js),D(wo,js,null),e(Se,hm),e(Se,ks),e(ks,pm),m(o,va,h),m(o,H,h),D(To,H,null),e(H,mm),e(H,$s),e($s,fm),e(H,um),e(H,xo),e(xo,gm),e(xo,vn),e(vn,_m),e(xo,bm),e(H,vm),e(H,Eo),e(Eo,Dm),e(Eo,Fo),e(Fo,ym),e(Eo,wm),e(H,Tm),e(H,J),D(jo,J,null),e(J,xm),e(J,Ae),e(Ae,Em),e(Ae,Dn),e(Dn,Fm),e(Ae,jm),e(Ae,Os),e(Os,km),e(Ae,$m),e(J,Om),D(nt,J,null),e(J,Cm),D(rt,J,null),Da=!0},p(o,[h]){const ko={};h&2&&(ko.$$scope={dirty:h,ctx:o}),Ge.$set(ko);const Cs={};h&2&&(Cs.$$scope={dirty:h,ctx:o}),Ve.$set(Cs);const zs={};h&2&&(zs.$$scope={dirty:h,ctx:o}),Ze.$set(zs);const qs={};h&2&&(qs.$$scope={dirty:h,ctx:o}),Je.$set(qs);const $o={};h&2&&($o.$$scope={dirty:h,ctx:o}),et.$set($o);const Ps={};h&2&&(Ps.$$scope={dirty:h,ctx:o}),tt.$set(Ps);const Ns={};h&2&&(Ns.$$scope={dirty:h,ctx:o}),nt.$set(Ns);const Ss={};h&2&&(Ss.$$scope={dirty:h,ctx:o}),rt.$set(Ss)},i(o){Da||(y(p.$$.fragment,o),y(Et.$$.fragment,o),y(Nt.$$.fragment,o),y(St.$$.fragment,o),y(At.$$.fragment,o),y(Ut.$$.fragment,o),y(Wt.$$.fragment,o),y(Gt.$$.fragment,o),y(Vt.$$.fragment,o),y(Qt.$$.fragment,o),y(Kt.$$.fragment,o),y(Ge.$$.fragment,o),y(Jt.$$.fragment,o),y(Xt.$$.fragment,o),y(to.$$.fragment,o),y(Ve.$$.fragment,o),y(oo.$$.fragment,o),y(ro.$$.fragment,o),y(ao.$$.fragment,o),y(io.$$.fragment,o),y(co.$$.fragment,o),y(lo.$$.fragment,o),y(ho.$$.fragment,o),y(uo.$$.fragment,o),y(Ze.$$.fragment,o),y(Je.$$.fragment,o),y(go.$$.fragment,o),y(_o.$$.fragment,o),y(yo.$$.fragment,o),y(et.$$.fragment,o),y(tt.$$.fragment,o),y(wo.$$.fragment,o),y(To.$$.fragment,o),y(jo.$$.fragment,o),y(nt.$$.fragment,o),y(rt.$$.fragment,o),Da=!0)},o(o){w(p.$$.fragment,o),w(Et.$$.fragment,o),w(Nt.$$.fragment,o),w(St.$$.fragment,o),w(At.$$.fragment,o),w(Ut.$$.fragment,o),w(Wt.$$.fragment,o),w(Gt.$$.fragment,o),w(Vt.$$.fragment,o),w(Qt.$$.fragment,o),w(Kt.$$.fragment,o),w(Ge.$$.fragment,o),w(Jt.$$.fragment,o),w(Xt.$$.fragment,o),w(to.$$.fragment,o),w(Ve.$$.fragment,o),w(oo.$$.fragment,o),w(ro.$$.fragment,o),w(ao.$$.fragment,o),w(io.$$.fragment,o),w(co.$$.fragment,o),w(lo.$$.fragment,o),w(ho.$$.fragment,o),w(uo.$$.fragment,o),w(Ze.$$.fragment,o),w(Je.$$.fragment,o),w(go.$$.fragment,o),w(_o.$$.fragment,o),w(yo.$$.fragment,o),w(et.$$.fragment,o),w(tt.$$.fragment,o),w(wo.$$.fragment,o),w(To.$$.fragment,o),w(jo.$$.fragment,o),w(nt.$$.fragment,o),w(rt.$$.fragment,o),Da=!1},d(o){t(f),o&&t(E),o&&t(g),T(p),o&&t(As),o&&t(De),T(Et),o&&t(Ms),o&&t(Ie),o&&t(Is),o&&t(Co),o&&t(Ls),o&&t(zo),o&&t(Rs),o&&t(fe),o&&t(Hs),o&&t(Le),o&&t(Us),o&&t(Re),o&&t(Ws),o&&t(k),o&&t(Gs),o&&t(z),o&&t(Bs),o&&t(Y),o&&t(Vs),o&&t(Q),o&&t(Ys),o&&t(Ao),o&&t(Qs),o&&t($),o&&t(Ks),o&&t(Bo),o&&t(Zs),o&&t(Vo),o&&t(Js),T(Nt,o),o&&t(Xs),o&&t(Yo),o&&t(ea),T(St,o),o&&t(ta),o&&t(Qo),o&&t(oa),T(At,o),o&&t(na),o&&t(Ko),o&&t(ra),o&&t(He),o&&t(sa),o&&t(F),o&&t(aa),o&&t(xe),T(Ut),o&&t(ia),o&&t(Ee),T(Wt),o&&t(da),o&&t(Fe),T(Gt),o&&t(ca),o&&t(je),T(Vt),o&&t(la),o&&t(ke),T(Qt),o&&t(ha),o&&t(B),T(Kt),T(Ge),o&&t(pa),o&&t(Ce),T(Jt),o&&t(ma),o&&t(j),T(Xt),T(to),T(Ve),T(oo),T(ro),T(ao),T(io),T(co),o&&t(fa),o&&t(ze),T(lo),o&&t(ua),o&&t(L),T(ho),T(uo),T(Ze),T(Je),o&&t(ga),o&&t(Pe),T(go),o&&t(_a),o&&t(R),T(_o),T(yo),T(et),T(tt),o&&t(ba),o&&t(Se),T(wo),o&&t(va),o&&t(H),T(To),T(jo),T(nt),T(rt)}}}const t_={local:"detr",sections:[{local:"overview",title:"Overview"},{local:"transformers.models.detr.modeling_detr.DetrModelOutput",title:"DETR specific outputs"},{local:"transformers.DetrConfig",title:"DetrConfig"},{local:"transformers.DetrFeatureExtractor",title:"DetrFeatureExtractor"},{local:"transformers.DetrModel",title:"DetrModel"},{local:"transformers.DetrForObjectDetection",title:"DetrForObjectDetection"},{local:"transformers.DetrForSegmentation",title:"DetrForSegmentation"}],title:"DETR"};function o_(C){return Gg(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class c_ extends Rg{constructor(f){super();Hg(this,f,o_,e_,Ug,{})}}export{c_ as default,t_ as metadata};
