import{S as vb,i as Db,s as yb,e as s,k as d,w as b,t as n,M as wb,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 p,y as D,q as y,o as w,B as T,v as Tb,L as Ui}from"../../chunks/vendor-hf-doc-builder.js";import{T as og}from"../../chunks/Tip-hf-doc-builder.js";import{D as k}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Zo}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Re}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Mi}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function xb(q){let f,E,_,g,x;return g=new Zo({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:"),_=d(),b(g.$$.fragment)},l(m){f=a(m,"P",{});var u=i(f);E=r(u,"Examples:"),u.forEach(t),_=c(m),v(g.$$.fragment,m)},m(m,u){p(m,f,u),e(f,E),p(m,_,u),D(g,m,u),x=!0},p:Ui,i(m){x||(y(g.$$.fragment,m),x=!0)},o(m){w(g.$$.fragment,m),x=!1},d(m){m&&t(f),m&&t(_),T(g,m)}}}function Eb(q){let f,E,_,g,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 "),_=s("code"),g=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(m){f=a(m,"P",{});var u=i(f);E=r(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var G=i(_);g=r(G,"Module"),G.forEach(t),x=r(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(m,u){p(m,f,u),e(f,E),e(f,_),e(_,g),e(f,x)},d(m){m&&t(f)}}}function $b(q){let f,E,_,g,x;return g=new Zo({props:{code:`from transformers import DetrImageProcessor, DetrModel
from PIL import Image
import requests

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

image_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")
model = DetrModel.from_pretrained("facebook/detr-resnet-50")

# prepare image for the model
inputs = image_processor(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> DetrImageProcessor, 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>image_processor = DetrImageProcessor.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 = image_processor(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:"),_=d(),b(g.$$.fragment)},l(m){f=a(m,"P",{});var u=i(f);E=r(u,"Examples:"),u.forEach(t),_=c(m),v(g.$$.fragment,m)},m(m,u){p(m,f,u),e(f,E),p(m,_,u),D(g,m,u),x=!0},p:Ui,i(m){x||(y(g.$$.fragment,m),x=!0)},o(m){w(g.$$.fragment,m),x=!1},d(m){m&&t(f),m&&t(_),T(g,m)}}}function kb(q){let f,E,_,g,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 "),_=s("code"),g=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(m){f=a(m,"P",{});var u=i(f);E=r(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var G=i(_);g=r(G,"Module"),G.forEach(t),x=r(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(m,u){p(m,f,u),e(f,E),e(f,_),e(_,g),e(f,x)},d(m){m&&t(f)}}}function jb(q){let f,E,_,g,x;return g=new Zo({props:{code:`from transformers import DetrImageProcessor, 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)

image_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")
model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50")

inputs = image_processor(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 = image_processor.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> DetrImageProcessor, 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>image_processor = DetrImageProcessor.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 = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># 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 = image_processor.post_process_object_detection(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">... </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:"),_=d(),b(g.$$.fragment)},l(m){f=a(m,"P",{});var u=i(f);E=r(u,"Examples:"),u.forEach(t),_=c(m),v(g.$$.fragment,m)},m(m,u){p(m,f,u),e(f,E),p(m,_,u),D(g,m,u),x=!0},p:Ui,i(m){x||(y(g.$$.fragment,m),x=!0)},o(m){w(g.$$.fragment,m),x=!1},d(m){m&&t(f),m&&t(_),T(g,m)}}}function Ob(q){let f,E,_,g,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 "),_=s("code"),g=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(m){f=a(m,"P",{});var u=i(f);E=r(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var G=i(_);g=r(G,"Module"),G.forEach(t),x=r(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(m,u){p(m,f,u),e(f,E),e(f,_),e(_,g),e(f,x)},d(m){m&&t(f)}}}function zb(q){let f,E,_,g,x;return g=new Zo({props:{code:`import io
import requests
from PIL import Image
import torch
import numpy

from transformers import DetrImageProcessor, DetrForSegmentation
from transformers.image_transforms import rgb_to_id

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

image_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50-panoptic")
model = DetrForSegmentation.from_pretrained("facebook/detr-resnet-50-panoptic")

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

# forward pass
outputs = model(**inputs)

# Use the \`post_process_panoptic_segmentation\` method of \`DetrImageProcessor\` to retrieve post-processed panoptic segmentation maps
# Segmentation results are returned as a list of dictionaries
result = image_processor.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> DetrImageProcessor, DetrForSegmentation
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.image_transforms <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>image_processor = DetrImageProcessor.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 = image_processor(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 \`DetrImageProcessor\` 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 = image_processor.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:"),_=d(),b(g.$$.fragment)},l(m){f=a(m,"P",{});var u=i(f);E=r(u,"Examples:"),u.forEach(t),_=c(m),v(g.$$.fragment,m)},m(m,u){p(m,f,u),e(f,E),p(m,_,u),D(g,m,u),x=!0},p:Ui,i(m){x||(y(g.$$.fragment,m),x=!0)},o(m){w(g.$$.fragment,m),x=!1},d(m){m&&t(f),m&&t(_),T(g,m)}}}function Pb(q){let f,E,_,g,x,m,u,G,Hi,ha,ye,Me,or,Nt,Gi,nr,Wi,ma,Ue,Vi,St,Bi,Yi,pa,en,Qi,fa,tn,rr,Ji,ga,ue,Ki,At,Xi,Zi,Lt,ed,td,ua,He,od,Rt,nd,rd,_a,Ge,sd,on,ad,id,ba,j,dd,sr,cd,ld,ar,hd,md,ir,pd,fd,dr,gd,ud,cr,_d,bd,lr,vd,Dd,hr,yd,wd,mr,Td,xd,va,C,Ed,pr,$d,kd,fr,jd,Od,gr,zd,Pd,ur,Fd,Cd,_r,Id,qd,br,Nd,Sd,Da,J,Ad,vr,Ld,Rd,Mt,Md,Ud,Ut,Hd,Gd,ya,K,Wd,nn,Vd,Bd,rn,Yd,Qd,sn,Jd,Kd,wa,an,Xd,Ta,z,ne,Zd,Dr,ec,tc,yr,oc,nc,dn,rc,sc,ac,wr,ic,dc,re,cc,Tr,lc,hc,cn,mc,pc,xr,fc,gc,uc,se,_c,Er,bc,vc,ln,Dc,yc,$r,wc,Tc,xc,B,Ec,kr,$c,kc,jr,jc,Oc,Or,zc,Pc,Ht,Fc,Cc,Ic,N,hn,qc,Nc,mn,Sc,Ac,Gt,Lc,Rc,zr,Mc,Uc,pn,Hc,Gc,Pr,Wc,Vc,Bc,ae,Yc,fn,Qc,Jc,Fr,Kc,Xc,gn,Zc,el,tl,we,ol,Cr,nl,rl,Wt,sl,al,xa,un,il,Ea,_n,dl,$a,Vt,ka,bn,cl,ja,Bt,Oa,vn,ll,za,Yt,Pa,Dn,hl,Fa,We,Ir,ie,qr,ml,pl,Nr,fl,gl,Sr,ul,_l,Ar,bl,vl,L,de,Lr,Rr,Dl,yl,Mr,wl,Tl,Ur,xl,El,Hr,$l,kl,ce,Gr,Wr,jl,Ol,Vr,yn,zl,Pl,Br,wn,Fl,Cl,Yr,Tn,Il,ql,le,Qr,Jr,Nl,Sl,Kr,Al,Ll,Xr,Rl,Ml,Zr,Ul,Hl,he,Qt,es,Gl,Wl,xn,Vl,Bl,Te,Yl,ts,Ql,Jl,os,Kl,Xl,Zl,R,eh,ns,th,oh,rs,nh,rh,ss,sh,ah,as,ih,dh,is,ch,lh,hh,me,mh,ds,ph,fh,cs,gh,uh,ls,_h,bh,vh,pe,En,hs,Dh,yh,wh,ms,ps,Th,xh,fs,gs,Eh,$h,Jt,us,kh,jh,_s,Oh,zh,fe,bs,vs,Ph,Fh,Kt,Ds,Ch,Ih,ys,qh,Nh,xe,ws,Sh,Ah,Ts,Lh,Rh,xs,Mh,Uh,ge,Es,Hh,Gh,$s,Wh,Vh,ks,Bh,Yh,js,Qh,Ca,$,Jh,$n,Kh,Xh,Os,Zh,em,zs,tm,om,Ps,nm,rm,kn,sm,am,Fs,im,dm,Cs,cm,lm,Xt,hm,mm,Zt,pm,fm,Ia,Ee,Ve,Is,eo,gm,qs,um,qa,$e,to,_m,Ns,bm,Na,ke,oo,vm,no,Dm,jn,ym,wm,Sa,je,ro,Tm,so,xm,On,Em,$m,Aa,Oe,Be,Ss,ao,km,As,jm,La,Y,io,Om,ze,zm,zn,Pm,Fm,co,Cm,Im,qm,Pe,Nm,Pn,Sm,Am,Fn,Lm,Rm,Mm,Ye,Ra,Fe,Qe,Ls,lo,Um,Rs,Hm,Ma,F,ho,Gm,Ms,Wm,Vm,Je,mo,Bm,Us,Ym,Qm,Ke,po,Jm,fo,Km,Cn,Xm,Zm,ep,Xe,go,tp,uo,op,In,np,rp,sp,Ze,_o,ap,bo,ip,qn,dp,cp,lp,et,vo,hp,Do,mp,Nn,pp,fp,Ua,Ce,tt,Hs,yo,gp,Gs,up,Ha,O,wo,_p,Ws,bp,vp,ot,To,Dp,Vs,yp,wp,nt,xo,Tp,Bs,xp,Ep,rt,Eo,$p,$o,kp,Sn,jp,Op,zp,st,ko,Pp,jo,Fp,An,Cp,Ip,qp,at,Oo,Np,zo,Sp,Ln,Ap,Lp,Rp,it,Po,Mp,Fo,Up,Rn,Hp,Gp,Ga,Ie,dt,Ys,Co,Wp,Qs,Vp,Wa,M,Io,Bp,Js,Yp,Qp,qo,Jp,Mn,Kp,Xp,Zp,No,ef,So,tf,of,nf,X,Ao,rf,qe,sf,Un,af,df,Ks,cf,lf,hf,ct,mf,lt,Va,Ne,ht,Xs,Lo,pf,Zs,ff,Ba,U,Ro,gf,ea,uf,_f,Mo,bf,Hn,vf,Df,yf,Uo,wf,Ho,Tf,xf,Ef,Z,Go,$f,Se,kf,Gn,jf,Of,ta,zf,Pf,Ff,mt,Cf,pt,Ya,Ae,ft,oa,Wo,If,na,qf,Qa,H,Vo,Nf,ra,Sf,Af,Bo,Lf,Wn,Rf,Mf,Uf,Yo,Hf,Qo,Gf,Wf,Vf,ee,Jo,Bf,Le,Yf,Vn,Qf,Jf,sa,Kf,Xf,Zf,gt,eg,ut,Ja;return m=new Re({}),Nt=new Re({}),Vt=new Zo({props:{code:`from transformers import DetrForObjectDetection

model = DetrForObjectDetection.from_pretrained("facebook/detr-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/detr-resnet-50&quot;</span>)`}}),Bt=new Zo({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)`}}),Yt=new Zo({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)`}}),eo=new Re({}),to=new k({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/v4.25.1/src/transformers/models/detr/modeling_detr.py#L95"}}),oo=new k({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/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.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/v4.25.1/src/transformers/models/detr/modeling_detr.py#L135"}}),ro=new k({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/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.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/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.post_process_semantic_segmentation">post_process_semantic_segmentation()</a> or
<a href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.post_process_instance_segmentation">post_process_instance_segmentation()</a>
<a href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.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/v4.25.1/src/transformers/models/detr/modeling_detr.py#L198"}}),ao=new Re({}),io=new k({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/v4.25.1/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/v4.25.1/src/transformers/models/detr/configuration_detr.py#L35"}}),Ye=new Mi({props:{anchor:"transformers.DetrConfig.example",$$slots:{default:[xb]},$$scope:{ctx:q}}}),lo=new Re({}),ho=new k({props:{name:"class transformers.DetrImageProcessor",anchor:"transformers.DetrImageProcessor",parameters:[{name:"format",val:": typing.Union[str, transformers.models.detr.image_processing_detr.AnnotionFormat] = <AnnotionFormat.COCO_DETECTION: 'coco_detection'>"},{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float]] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float]] = None"},{name:"do_pad",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DetrImageProcessor.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.DetrImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Controls whether to resize the image&#x2019;s <code>(height, width)</code> dimensions to the specified <code>size</code>. Can be
overridden by the <code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.DetrImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 800, &quot;longest_edge&quot;: 1333}</code>):
Size of the image&#x2019;s <code>(height, width)</code> dimensions after resizing. Can be overridden by the <code>size</code> parameter
in the <code>preprocess</code> method.`,name:"size"},{anchor:"transformers.DetrImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image.`,name:"resample"},{anchor:"transformers.DetrImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Controls whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the
<code>do_rescale</code> parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.DetrImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by the <code>rescale_factor</code> parameter in the
<code>preprocess</code> method.
do_normalize &#x2014;
Controls whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the
<code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.DetrImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_DEFAULT_MEAN</code>) &#x2014;
Mean values to use when normalizing the image. Can be a single value or a list of values, one for each
channel. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.DetrImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_DEFAULT_STD</code>) &#x2014;
Standard deviation values to use when normalizing the image. Can be a single value or a list of values, one
for each channel. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.DetrImageProcessor.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Controls whether to pad the image to the largest image in a batch and create a pixel mask. Can be
overridden by the <code>do_pad</code> parameter in the <code>preprocess</code> method.`,name:"do_pad"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L718"}}),mo=new k({props:{name:"preprocess",anchor:"transformers.DetrImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"annotations",val:": typing.Union[typing.List[typing.Dict], typing.List[typing.List[typing.Dict]], NoneType] = None"},{name:"return_segmentation_masks",val:": bool = None"},{name:"masks_path",val:": typing.Union[str, pathlib.Path, NoneType] = None"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"resample",val:" = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Union[int, float, NoneType] = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_pad",val:": typing.Optional[bool] = None"},{name:"format",val:": typing.Union[str, transformers.models.detr.image_processing_detr.AnnotionFormat, NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DetrImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image or batch of images to preprocess.`,name:"images"},{anchor:"transformers.DetrImageProcessor.preprocess.annotations",description:`<strong>annotations</strong> (<code>List[Dict]</code> or <code>List[List[Dict]]</code>, <em>optional</em>) &#x2014;
List of annotations associated with the image or batch of images. If annotionation is for object
detection, the annotations should be a dictionary with the following keys:<ul>
<li>&#x201C;image_id&#x201D; (<code>int</code>): The image id.</li>
<li>&#x201C;annotations&#x201D; (<code>List[Dict]</code>): List of annotations for an image. Each annotation should be a
dictionary. An image can have no annotations, in which case the list should be empty.
If annotionation is for segmentation, the annotations should be a dictionary with the following keys:</li>
<li>&#x201C;image_id&#x201D; (<code>int</code>): The image id.</li>
<li>&#x201C;segments_info&#x201D; (<code>List[Dict]</code>): List of segments for an image. Each segment should be a dictionary.
An image can have no segments, in which case the list should be empty.</li>
<li>&#x201C;file_name&#x201D; (<code>str</code>): The file name of the image.</li>
</ul>`,name:"annotations"},{anchor:"transformers.DetrImageProcessor.preprocess.return_segmentation_masks",description:`<strong>return_segmentation_masks</strong> (<code>bool</code>, <em>optional</em>, defaults to self.return_segmentation_masks) &#x2014;
Whether to return segmentation masks.`,name:"return_segmentation_masks"},{anchor:"transformers.DetrImageProcessor.preprocess.masks_path",description:`<strong>masks_path</strong> (<code>str</code> or <code>pathlib.Path</code>, <em>optional</em>) &#x2014;
Path to the directory containing the segmentation masks.`,name:"masks_path"},{anchor:"transformers.DetrImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to self.do_resize) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.DetrImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to self.size) &#x2014;
Size of the image after resizing.`,name:"size"},{anchor:"transformers.DetrImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to self.resample) &#x2014;
Resampling filter to use when resizing the image.`,name:"resample"},{anchor:"transformers.DetrImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to self.do_rescale) &#x2014;
Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.DetrImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to self.rescale_factor) &#x2014;
Rescale factor to use when rescaling the image.`,name:"rescale_factor"},{anchor:"transformers.DetrImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to self.do_normalize) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.DetrImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to self.image_mean) &#x2014;
Mean to use when normalizing the image.`,name:"image_mean"},{anchor:"transformers.DetrImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to self.image_std) &#x2014;
Standard deviation to use when normalizing the image.`,name:"image_std"},{anchor:"transformers.DetrImageProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to self.do_pad) &#x2014;
Whether to pad the image.`,name:"do_pad"},{anchor:"transformers.DetrImageProcessor.preprocess.format",description:`<strong>format</strong> (<code>str</code> or <code>AnnotionFormat</code>, <em>optional</em>, defaults to self.format) &#x2014;
Format of the annotations.`,name:"format"},{anchor:"transformers.DetrImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>, defaults to self.return_tensors) &#x2014;
Type of tensors to return. If <code>None</code>, will return the list of images.`,name:"return_tensors"},{anchor:"transformers.DetrImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>str</code> or <code>ChannelDimension</code>, <em>optional</em>, defaults to self.data_format) &#x2014;
The channel dimension format of the image. If not provided, it will be the same as the input image.`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L1011"}}),po=new k({props:{name:"post_process_object_detection",anchor:"transformers.DetrImageProcessor.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.DetrImageProcessor.post_process_object_detection.outputs",description:`<strong>outputs</strong> (<code>DetrObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.DetrImageProcessor.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.DetrImageProcessor.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>) &#x2014;
Tensor of shape <code>(batch_size, 2)</code> or list of tuples (<code>Tuple[int, int]</code>) containing the target size
<code>(height, width)</code> of each image in the batch. If unset, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L1495",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>
`}}),go=new k({props:{name:"post_process_semantic_segmentation",anchor:"transformers.DetrImageProcessor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": typing.List[typing.Tuple[int, int]] = None"}],parametersDescription:[{anchor:"transformers.DetrImageProcessor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.DetrImageProcessor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple[int, int]]</code>, <em>optional</em>) &#x2014;
A list of tuples (<code>Tuple[int, int]</code>) containing the target size (height, width) of each image in the
batch. If unset, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L1548",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>
`}}),_o=new k({props:{name:"post_process_instance_segmentation",anchor:"transformers.DetrImageProcessor.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.DetrImageProcessor.post_process_instance_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.DetrImageProcessor.post_process_instance_segmentation.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The probability score threshold to keep predicted instance masks.`,name:"threshold"},{anchor:"transformers.DetrImageProcessor.post_process_instance_segmentation.mask_threshold",description:`<strong>mask_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Threshold to use when turning the predicted masks into binary values.`,name:"mask_threshold"},{anchor:"transformers.DetrImageProcessor.post_process_instance_segmentation.overlap_mask_area_threshold",description:`<strong>overlap_mask_area_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
The overlap mask area threshold to merge or discard small disconnected parts within each binary
instance mask.`,name:"overlap_mask_area_threshold"},{anchor:"transformers.DetrImageProcessor.post_process_instance_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds to the requested
final size (height, width) of each prediction. If unset, predictions will not be resized.`,name:"target_sizes"},{anchor:"transformers.DetrImageProcessor.post_process_instance_segmentation.return_coco_annotation",description:`<strong>return_coco_annotation</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Defaults to <code>False</code>. If set to <code>True</code>, segmentation maps are returned in COCO run-length encoding (RLE)
format.`,name:"return_coco_annotation"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L1596",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>
`}}),vo=new k({props:{name:"post_process_panoptic_segmentation",anchor:"transformers.DetrImageProcessor.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.DetrImageProcessor.post_process_panoptic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>) &#x2014;
The outputs from <a href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>.`,name:"outputs"},{anchor:"transformers.DetrImageProcessor.post_process_panoptic_segmentation.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The probability score threshold to keep predicted instance masks.`,name:"threshold"},{anchor:"transformers.DetrImageProcessor.post_process_panoptic_segmentation.mask_threshold",description:`<strong>mask_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Threshold to use when turning the predicted masks into binary values.`,name:"mask_threshold"},{anchor:"transformers.DetrImageProcessor.post_process_panoptic_segmentation.overlap_mask_area_threshold",description:`<strong>overlap_mask_area_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
The overlap mask area threshold to merge or discard small disconnected parts within each binary
instance mask.`,name:"overlap_mask_area_threshold"},{anchor:"transformers.DetrImageProcessor.post_process_panoptic_segmentation.label_ids_to_fuse",description:`<strong>label_ids_to_fuse</strong> (<code>Set[int]</code>, <em>optional</em>) &#x2014;
The labels in this state will have all their instances be fused together. For instance we could say
there can only be one sky in an image, but several persons, so the label ID for sky would be in that
set, but not the one for person.`,name:"label_ids_to_fuse"},{anchor:"transformers.DetrImageProcessor.post_process_panoptic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds to the requested
final size (height, width) of each prediction in batch. If unset, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L1680",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>
`}}),yo=new Re({}),wo=new k({props:{name:"class transformers.DetrImageProcessor",anchor:"transformers.DetrImageProcessor",parameters:[{name:"format",val:": typing.Union[str, transformers.models.detr.image_processing_detr.AnnotionFormat] = <AnnotionFormat.COCO_DETECTION: 'coco_detection'>"},{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float]] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float]] = None"},{name:"do_pad",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DetrImageProcessor.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.DetrImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Controls whether to resize the image&#x2019;s <code>(height, width)</code> dimensions to the specified <code>size</code>. Can be
overridden by the <code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.DetrImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 800, &quot;longest_edge&quot;: 1333}</code>):
Size of the image&#x2019;s <code>(height, width)</code> dimensions after resizing. Can be overridden by the <code>size</code> parameter
in the <code>preprocess</code> method.`,name:"size"},{anchor:"transformers.DetrImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image.`,name:"resample"},{anchor:"transformers.DetrImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Controls whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the
<code>do_rescale</code> parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.DetrImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by the <code>rescale_factor</code> parameter in the
<code>preprocess</code> method.
do_normalize &#x2014;
Controls whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the
<code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.DetrImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_DEFAULT_MEAN</code>) &#x2014;
Mean values to use when normalizing the image. Can be a single value or a list of values, one for each
channel. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.DetrImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_DEFAULT_STD</code>) &#x2014;
Standard deviation values to use when normalizing the image. Can be a single value or a list of values, one
for each channel. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"},{anchor:"transformers.DetrImageProcessor.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Controls whether to pad the image to the largest image in a batch and create a pixel mask. Can be
overridden by the <code>do_pad</code> parameter in the <code>preprocess</code> method.`,name:"do_pad"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L718"}}),To=new k({props:{name:"__call__",anchor:"transformers.DetrImageProcessor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/image_processing_utils.py#L435"}}),xo=new k({props:{name:"pad_and_create_pixel_mask",anchor:"transformers.DetrImageProcessor.pad_and_create_pixel_mask",parameters:[{name:"pixel_values_list",val:": typing.List[typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]]"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = None"}],parametersDescription:[{anchor:"transformers.DetrImageProcessor.pad_and_create_pixel_mask.images",description:`<strong>images</strong> (<code>List[np.ndarray]</code>) &#x2014;
Batch of images to pad.`,name:"images"},{anchor:"transformers.DetrImageProcessor.pad_and_create_pixel_mask.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.DetrImageProcessor.pad_and_create_pixel_mask.data_format",description:`<strong>data_format</strong> (<code>str</code> or <code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format of the image. If not provided, it will be the same as the input image.`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L917"}}),Eo=new k({props:{name:"post_process_object_detection",anchor:"transformers.DetrImageProcessor.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.DetrImageProcessor.post_process_object_detection.outputs",description:`<strong>outputs</strong> (<code>DetrObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.DetrImageProcessor.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.DetrImageProcessor.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>) &#x2014;
Tensor of shape <code>(batch_size, 2)</code> or list of tuples (<code>Tuple[int, int]</code>) containing the target size
<code>(height, width)</code> of each image in the batch. If unset, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L1495",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>
`}}),ko=new k({props:{name:"post_process_semantic_segmentation",anchor:"transformers.DetrImageProcessor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": typing.List[typing.Tuple[int, int]] = None"}],parametersDescription:[{anchor:"transformers.DetrImageProcessor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.DetrImageProcessor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple[int, int]]</code>, <em>optional</em>) &#x2014;
A list of tuples (<code>Tuple[int, int]</code>) containing the target size (height, width) of each image in the
batch. If unset, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L1548",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>
`}}),Oo=new k({props:{name:"post_process_instance_segmentation",anchor:"transformers.DetrImageProcessor.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.DetrImageProcessor.post_process_instance_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.DetrImageProcessor.post_process_instance_segmentation.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The probability score threshold to keep predicted instance masks.`,name:"threshold"},{anchor:"transformers.DetrImageProcessor.post_process_instance_segmentation.mask_threshold",description:`<strong>mask_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Threshold to use when turning the predicted masks into binary values.`,name:"mask_threshold"},{anchor:"transformers.DetrImageProcessor.post_process_instance_segmentation.overlap_mask_area_threshold",description:`<strong>overlap_mask_area_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
The overlap mask area threshold to merge or discard small disconnected parts within each binary
instance mask.`,name:"overlap_mask_area_threshold"},{anchor:"transformers.DetrImageProcessor.post_process_instance_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds to the requested
final size (height, width) of each prediction. If unset, predictions will not be resized.`,name:"target_sizes"},{anchor:"transformers.DetrImageProcessor.post_process_instance_segmentation.return_coco_annotation",description:`<strong>return_coco_annotation</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Defaults to <code>False</code>. If set to <code>True</code>, segmentation maps are returned in COCO run-length encoding (RLE)
format.`,name:"return_coco_annotation"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L1596",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>
`}}),Po=new k({props:{name:"post_process_panoptic_segmentation",anchor:"transformers.DetrImageProcessor.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.DetrImageProcessor.post_process_panoptic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>) &#x2014;
The outputs from <a href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation">DetrForSegmentation</a>.`,name:"outputs"},{anchor:"transformers.DetrImageProcessor.post_process_panoptic_segmentation.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The probability score threshold to keep predicted instance masks.`,name:"threshold"},{anchor:"transformers.DetrImageProcessor.post_process_panoptic_segmentation.mask_threshold",description:`<strong>mask_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Threshold to use when turning the predicted masks into binary values.`,name:"mask_threshold"},{anchor:"transformers.DetrImageProcessor.post_process_panoptic_segmentation.overlap_mask_area_threshold",description:`<strong>overlap_mask_area_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
The overlap mask area threshold to merge or discard small disconnected parts within each binary
instance mask.`,name:"overlap_mask_area_threshold"},{anchor:"transformers.DetrImageProcessor.post_process_panoptic_segmentation.label_ids_to_fuse",description:`<strong>label_ids_to_fuse</strong> (<code>Set[int]</code>, <em>optional</em>) &#x2014;
The labels in this state will have all their instances be fused together. For instance we could say
there can only be one sky in an image, but several persons, so the label ID for sky would be in that
set, but not the one for person.`,name:"label_ids_to_fuse"},{anchor:"transformers.DetrImageProcessor.post_process_panoptic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code>, <em>optional</em>) &#x2014;
List of length (batch_size), where each list item (<code>Tuple[int, int]]</code>) corresponds to the requested
final size (height, width) of each prediction in batch. If unset, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/image_processing_detr.py#L1680",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>
`}}),Co=new Re({}),Io=new k({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/v4.25.1/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/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/modeling_detr.py#L1189"}}),Ao=new k({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/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor">DetrImageProcessor</a>. See <a href="/docs/transformers/v4.25.1/en/model_doc/deit#transformers.DeiTImageProcessor.__call__">DetrImageProcessor.<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/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/modeling_detr.py#L1225",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/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/v4.25.1/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/v4.25.1/en/model_doc/detr#transformers.models.detr.modeling_detr.DetrModelOutput"
>transformers.models.detr.modeling_detr.DetrModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ct=new og({props:{$$slots:{default:[Eb]},$$scope:{ctx:q}}}),lt=new Mi({props:{anchor:"transformers.DetrModel.forward.example",$$slots:{default:[$b]},$$scope:{ctx:q}}}),Lo=new Re({}),Ro=new k({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/v4.25.1/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/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/modeling_detr.py#L1359"}}),Go=new k({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/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor">DetrImageProcessor</a>. See <a href="/docs/transformers/v4.25.1/en/model_doc/deit#transformers.DeiTImageProcessor.__call__">DetrImageProcessor.<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/v4.25.1/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/v4.25.1/src/transformers/models/detr/modeling_detr.py#L1385",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/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/v4.25.1/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/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.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/v4.25.1/en/model_doc/detr#transformers.models.detr.modeling_detr.DetrObjectDetectionOutput"
>transformers.models.detr.modeling_detr.DetrObjectDetectionOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),mt=new og({props:{$$slots:{default:[kb]},$$scope:{ctx:q}}}),pt=new Mi({props:{anchor:"transformers.DetrForObjectDetection.forward.example",$$slots:{default:[jb]},$$scope:{ctx:q}}}),Wo=new Re({}),Vo=new k({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/v4.25.1/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/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/detr/modeling_detr.py#L1533"}}),Jo=new k({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/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor">DetrImageProcessor</a>. See <a href="/docs/transformers/v4.25.1/en/model_doc/deit#transformers.DeiTImageProcessor.__call__">DetrImageProcessor.<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/v4.25.1/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/v4.25.1/src/transformers/models/detr/modeling_detr.py#L1555",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.25.1/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/v4.25.1/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/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.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/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.post_process_semantic_segmentation"
>post_process_semantic_segmentation()</a> or
<a
  href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.post_process_instance_segmentation"
>post_process_instance_segmentation()</a>
<a
  href="/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.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/v4.25.1/en/model_doc/detr#transformers.models.detr.modeling_detr.DetrSegmentationOutput"
>transformers.models.detr.modeling_detr.DetrSegmentationOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),gt=new og({props:{$$slots:{default:[Ob]},$$scope:{ctx:q}}}),ut=new Mi({props:{anchor:"transformers.DetrForSegmentation.forward.example",$$slots:{default:[zb]},$$scope:{ctx:q}}}),{c(){f=s("meta"),E=d(),_=s("h1"),g=s("a"),x=s("span"),b(m.$$.fragment),u=d(),G=s("span"),Hi=n("DETR"),ha=d(),ye=s("h2"),Me=s("a"),or=s("span"),b(Nt.$$.fragment),Gi=d(),nr=s("span"),Wi=n("Overview"),ma=d(),Ue=s("p"),Vi=n("The DETR model was proposed in "),St=s("a"),Bi=n("End-to-End Object Detection with Transformers"),Yi=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.`),pa=d(),en=s("p"),Qi=n("The abstract from the paper is the following:"),fa=d(),tn=s("p"),rr=s("em"),Ji=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.`),ga=d(),ue=s("p"),Ki=n("This model was contributed by "),At=s("a"),Xi=n("nielsr"),Zi=n(". The original code can be found "),Lt=s("a"),ed=n("here"),td=n("."),ua=d(),He=s("p"),od=n("The quickest way to get started with DETR is by checking the "),Rt=s("a"),nd=n("example notebooks"),rd=n(` (which showcase both inference and
fine-tuning on custom data).`),_a=d(),Ge=s("p"),sd=n("Here\u2019s a TLDR explaining how "),on=s("a"),ad=n("DetrForObjectDetection"),id=n(" works:"),ba=d(),j=s("p"),dd=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 `),sr=s("code"),cd=n("(batch_size, 3, height, width)"),ld=n(`, assuming the image has 3 color channels (RGB). The CNN backbone
outputs a new lower-resolution feature map, typically of shape `),ar=s("code"),hd=n("(batch_size, 2048, height/32, width/32)"),md=n(`. This is
then projected to match the hidden dimension of the Transformer of DETR, which is `),ir=s("code"),pd=n("256"),fd=n(` by default, using a
`),dr=s("code"),gd=n("nn.Conv2D"),ud=n(" layer. So now, we have a tensor of shape "),cr=s("code"),_d=n("(batch_size, 256, height/32, width/32)."),bd=n(` Next, the
feature map is flattened and transposed to obtain a tensor of shape `),lr=s("code"),vd=n("(batch_size, seq_len, d_model)"),Dd=n(` =
`),hr=s("code"),yd=n("(batch_size, width/32*height/32, 256)"),wd=n(`. So a difference with NLP models is that the sequence length is actually
longer than usual, but with a smaller `),mr=s("code"),Td=n("d_model"),xd=n(" (which in NLP is typically 768 or higher)."),va=d(),C=s("p"),Ed=n("Next, this is sent through the encoder, outputting "),pr=s("code"),$d=n("encoder_hidden_states"),kd=n(` of the same shape (you can consider
these as image features). Next, so-called `),fr=s("strong"),jd=n("object queries"),Od=n(` are sent through the decoder. This is a tensor of shape
`),gr=s("code"),zd=n("(batch_size, num_queries, d_model)"),Pd=n(", with "),ur=s("code"),Fd=n("num_queries"),Cd=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 `),_r=s("code"),Id=n("decoder_hidden_states"),qd=n(" of the same shape: "),br=s("code"),Nd=n("(batch_size, num_queries, d_model)"),Sd=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.`),Da=d(),J=s("p"),Ad=n("The model is trained using a "),vr=s("strong"),Ld=n("bipartite matching loss"),Rd=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 `),Mt=s("a"),Md=n("Hungarian matching algorithm"),Ud=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 `),Ut=s("a"),Hd=n("generalized IoU loss"),Gd=n(` (for the
bounding boxes) are used to optimize the parameters of the model.`),ya=d(),K=s("p"),Wd=n(`DETR can be naturally extended to perform panoptic segmentation (which unifies semantic segmentation and instance
segmentation). `),nn=s("a"),Vd=n("DetrForSegmentation"),Bd=n(` adds a segmentation mask head on top of
`),rn=s("a"),Yd=n("DetrForObjectDetection"),Qd=n(`. The mask head can be trained either jointly, or in a two steps process,
where one first trains a `),sn=s("a"),Jd=n("DetrForObjectDetection"),Kd=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.`),wa=d(),an=s("p"),Xd=n("Tips:"),Ta=d(),z=s("ul"),ne=s("li"),Zd=n("DETR uses so-called "),Dr=s("strong"),ec=n("object queries"),tc=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
`),yr=s("code"),oc=n("num_queries"),nc=n(" of "),dn=s("a"),rc=n("DetrConfig"),sc=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).`),ac=d(),wr=s("li"),ic=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.`),dc=d(),re=s("li"),cc=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 `),Tr=s("code"),lc=n("position_embedding_type"),hc=n(` of
`),cn=s("a"),mc=n("DetrConfig"),pc=n(" is set to "),xr=s("code"),fc=n('"sine"'),gc=n("."),uc=d(),se=s("li"),_c=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"),bc=n("auxiliary_loss"),vc=n(` of
`),ln=s("a"),Dc=n("DetrConfig"),yc=n(" to "),$r=s("code"),wc=n("True"),Tc=n(`, then prediction feedforward neural networks and Hungarian losses
are added after each decoder layer (with the FFNs sharing parameters).`),xc=d(),B=s("li"),Ec=n(`If you want to train the model in a distributed environment across multiple nodes, then one should update the
`),kr=s("em"),$c=n("num_boxes"),kc=n(" variable in the "),jr=s("em"),jc=n("DetrLoss"),Oc=n(" class of "),Or=s("em"),zc=n("modeling_detr.py"),Pc=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 `),Ht=s("a"),Fc=n("here"),Cc=n("."),Ic=d(),N=s("li"),hn=s("a"),qc=n("DetrForObjectDetection"),Nc=n(" and "),mn=s("a"),Sc=n("DetrForSegmentation"),Ac=n(` can be initialized with
any convolutional backbone available in the `),Gt=s("a"),Lc=n("timm library"),Rc=n(`.
Initializing with a MobileNet backbone for example can be done by setting the `),zr=s("code"),Mc=n("backbone"),Uc=n(` attribute of
`),pn=s("a"),Hc=n("DetrConfig"),Gc=n(" to "),Pr=s("code"),Wc=n('"tf_mobilenetv3_small_075"'),Vc=n(`, and then initializing the model with that
config.`),Bc=d(),ae=s("li"),Yc=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
`),fn=s("a"),Qc=n("DetrImageProcessor"),Jc=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 `),Fr=s("code"),Kc=n("collate_fn"),Xc=n(` in order to batch images together, using
`),gn=s("a"),Zc=n("pad_and_create_pixel_mask()"),el=n("."),tl=d(),we=s("li"),ol=n("The size of the images will determine the amount of memory being used, and will thus determine the "),Cr=s("code"),nl=n("batch_size"),rl=n(`.
It is advised to use a batch size of 2 per GPU. See `),Wt=s("a"),sl=n("this Github thread"),al=n(" for more info."),xa=d(),un=s("p"),il=n("There are three ways to instantiate a DETR model (depending on what you prefer):"),Ea=d(),_n=s("p"),dl=n("Option 1: Instantiate DETR with pre-trained weights for entire model"),$a=d(),b(Vt.$$.fragment),ka=d(),bn=s("p"),cl=n("Option 2: Instantiate DETR with randomly initialized weights for Transformer, but pre-trained weights for backbone"),ja=d(),b(Bt.$$.fragment),Oa=d(),vn=s("p"),ll=n("Option 3: Instantiate DETR with randomly initialized weights for backbone + Transformer"),za=d(),b(Yt.$$.fragment),Pa=d(),Dn=s("p"),hl=n("As a summary, consider the following table:"),Fa=d(),We=s("table"),Ir=s("thead"),ie=s("tr"),qr=s("th"),ml=n("Task"),pl=d(),Nr=s("th"),fl=n("Object detection"),gl=d(),Sr=s("th"),ul=n("Instance segmentation"),_l=d(),Ar=s("th"),bl=n("Panoptic segmentation"),vl=d(),L=s("tbody"),de=s("tr"),Lr=s("td"),Rr=s("strong"),Dl=n("Description"),yl=d(),Mr=s("td"),wl=n("Predicting bounding boxes and class labels around objects in an image"),Tl=d(),Ur=s("td"),xl=n("Predicting masks around objects (i.e. instances) in an image"),El=d(),Hr=s("td"),$l=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"),kl=d(),ce=s("tr"),Gr=s("td"),Wr=s("strong"),jl=n("Model"),Ol=d(),Vr=s("td"),yn=s("a"),zl=n("DetrForObjectDetection"),Pl=d(),Br=s("td"),wn=s("a"),Fl=n("DetrForSegmentation"),Cl=d(),Yr=s("td"),Tn=s("a"),Il=n("DetrForSegmentation"),ql=d(),le=s("tr"),Qr=s("td"),Jr=s("strong"),Nl=n("Example dataset"),Sl=d(),Kr=s("td"),Al=n("COCO detection"),Ll=d(),Xr=s("td"),Rl=n("COCO detection, COCO panoptic"),Ml=d(),Zr=s("td"),Ul=n("COCO panoptic"),Hl=d(),he=s("tr"),Qt=s("td"),es=s("strong"),Gl=n("Format of annotations to provide to"),Wl=d(),xn=s("a"),Vl=n("DetrImageProcessor"),Bl=d(),Te=s("td"),Yl=n("{\u2018image_id\u2019: "),ts=s("code"),Ql=n("int"),Jl=n(", \u2018annotations\u2019: "),os=s("code"),Kl=n("List[Dict]"),Xl=n("} each Dict being a COCO object annotation"),Zl=d(),R=s("td"),eh=n("{\u2018image_id\u2019: "),ns=s("code"),th=n("int"),oh=n(", \u2018annotations\u2019: "),rs=s("code"),nh=n("List[Dict]"),rh=n("}  (in case of COCO detection) or {\u2018file_name\u2019: "),ss=s("code"),sh=n("str"),ah=n(", \u2018image_id\u2019: "),as=s("code"),ih=n("int"),dh=n(", \u2018segments_info\u2019: "),is=s("code"),ch=n("List[Dict]"),lh=n("} (in case of COCO panoptic)"),hh=d(),me=s("td"),mh=n("{\u2018file_name\u2019: "),ds=s("code"),ph=n("str"),fh=n(", \u2018image_id\u2019: "),cs=s("code"),gh=n("int"),uh=n(", \u2018segments_info\u2019: "),ls=s("code"),_h=n("List[Dict]"),bh=n("} and masks_path (path to directory containing PNG files of the masks)"),vh=d(),pe=s("tr"),En=s("td"),hs=s("strong"),Dh=n("Postprocessing"),yh=n(" (i.e. converting the output of the model to COCO API)"),wh=d(),ms=s("td"),ps=s("code"),Th=n("post_process()"),xh=d(),fs=s("td"),gs=s("code"),Eh=n("post_process_segmentation()"),$h=d(),Jt=s("td"),us=s("code"),kh=n("post_process_segmentation()"),jh=n(", "),_s=s("code"),Oh=n("post_process_panoptic()"),zh=d(),fe=s("tr"),bs=s("td"),vs=s("strong"),Ph=n("evaluators"),Fh=d(),Kt=s("td"),Ds=s("code"),Ch=n("CocoEvaluator"),Ih=n(" with "),ys=s("code"),qh=n('iou_types="bbox"'),Nh=d(),xe=s("td"),ws=s("code"),Sh=n("CocoEvaluator"),Ah=n(" with "),Ts=s("code"),Lh=n('iou_types="bbox"'),Rh=n(" or "),xs=s("code"),Mh=n('"segm"'),Uh=d(),ge=s("td"),Es=s("code"),Hh=n("CocoEvaluator"),Gh=n(" with "),$s=s("code"),Wh=n('iou_tupes="bbox"'),Vh=n(" or "),ks=s("code"),Bh=n('"segm"'),Yh=n(", "),js=s("code"),Qh=n("PanopticEvaluator"),Ca=d(),$=s("p"),Jh=n(`In short, one should prepare the data either in COCO detection or COCO panoptic format, then use
`),$n=s("a"),Kh=n("DetrImageProcessor"),Xh=n(" to create "),Os=s("code"),Zh=n("pixel_values"),em=n(", "),zs=s("code"),tm=n("pixel_mask"),om=n(` and optional
`),Ps=s("code"),nm=n("labels"),rm=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 `),kn=s("a"),sm=n("DetrImageProcessor"),am=n(`. These can
be be provided to either `),Fs=s("code"),im=n("CocoEvaluator"),dm=n(" or "),Cs=s("code"),cm=n("PanopticEvaluator"),lm=n(`, which allow you to calculate metrics like
mean Average Precision (mAP) and Panoptic Quality (PQ). The latter objects are implemented in the `),Xt=s("a"),hm=n("original repository"),mm=n(". See the "),Zt=s("a"),pm=n("example notebooks"),fm=n(" for more info regarding evaluation."),Ia=d(),Ee=s("h2"),Ve=s("a"),Is=s("span"),b(eo.$$.fragment),gm=d(),qs=s("span"),um=n("DETR specific outputs"),qa=d(),$e=s("div"),b(to.$$.fragment),_m=d(),Ns=s("p"),bm=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.`),Na=d(),ke=s("div"),b(oo.$$.fragment),vm=d(),no=s("p"),Dm=n("Output type of "),jn=s("a"),ym=n("DetrForObjectDetection"),wm=n("."),Sa=d(),je=s("div"),b(ro.$$.fragment),Tm=d(),so=s("p"),xm=n("Output type of "),On=s("a"),Em=n("DetrForSegmentation"),$m=n("."),Aa=d(),Oe=s("h2"),Be=s("a"),Ss=s("span"),b(ao.$$.fragment),km=d(),As=s("span"),jm=n("DetrConfig"),La=d(),Y=s("div"),b(io.$$.fragment),Om=d(),ze=s("p"),zm=n("This is the configuration class to store the configuration of a "),zn=s("a"),Pm=n("DetrModel"),Fm=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
`),co=s("a"),Cm=n("facebook/detr-resnet-50"),Im=n(" architecture."),qm=d(),Pe=s("p"),Nm=n("Configuration objects inherit from "),Pn=s("a"),Sm=n("PretrainedConfig"),Am=n(` and can be used to control the model outputs. Read the
documentation from `),Fn=s("a"),Lm=n("PretrainedConfig"),Rm=n(" for more information."),Mm=d(),b(Ye.$$.fragment),Ra=d(),Fe=s("h2"),Qe=s("a"),Ls=s("span"),b(lo.$$.fragment),Um=d(),Rs=s("span"),Hm=n("DetrImageProcessor"),Ma=d(),F=s("div"),b(ho.$$.fragment),Gm=d(),Ms=s("p"),Wm=n("Constructs a Detr image processor."),Vm=d(),Je=s("div"),b(mo.$$.fragment),Bm=d(),Us=s("p"),Ym=n("Preprocess an image or a batch of images so that it can be used by the model."),Qm=d(),Ke=s("div"),b(po.$$.fragment),Jm=d(),fo=s("p"),Km=n("Converts the output of "),Cn=s("a"),Xm=n("DetrForObjectDetection"),Zm=n(` into the format expected by the COCO api. Only supports
PyTorch.`),ep=d(),Xe=s("div"),b(go.$$.fragment),tp=d(),uo=s("p"),op=n("Converts the output of "),In=s("a"),np=n("DetrForSegmentation"),rp=n(" into semantic segmentation maps. Only supports PyTorch."),sp=d(),Ze=s("div"),b(_o.$$.fragment),ap=d(),bo=s("p"),ip=n("Converts the output of "),qn=s("a"),dp=n("DetrForSegmentation"),cp=n(" into instance segmentation predictions. Only supports PyTorch."),lp=d(),et=s("div"),b(vo.$$.fragment),hp=d(),Do=s("p"),mp=n("Converts the output of "),Nn=s("a"),pp=n("DetrForSegmentation"),fp=n(` into image panoptic segmentation predictions. Only supports
PyTorch.`),Ua=d(),Ce=s("h2"),tt=s("a"),Hs=s("span"),b(yo.$$.fragment),gp=d(),Gs=s("span"),up=n("DetrFeatureExtractor"),Ha=d(),O=s("div"),b(wo.$$.fragment),_p=d(),Ws=s("p"),bp=n("Constructs a Detr image processor."),vp=d(),ot=s("div"),b(To.$$.fragment),Dp=d(),Vs=s("p"),yp=n("Preprocess an image or a batch of images."),wp=d(),nt=s("div"),b(xo.$$.fragment),Tp=d(),Bs=s("p"),xp=n(`Pads a batch of images with zeros to the size of largest height and width in the batch and returns their
corresponding pixel mask.`),Ep=d(),rt=s("div"),b(Eo.$$.fragment),$p=d(),$o=s("p"),kp=n("Converts the output of "),Sn=s("a"),jp=n("DetrForObjectDetection"),Op=n(` into the format expected by the COCO api. Only supports
PyTorch.`),zp=d(),st=s("div"),b(ko.$$.fragment),Pp=d(),jo=s("p"),Fp=n("Converts the output of "),An=s("a"),Cp=n("DetrForSegmentation"),Ip=n(" into semantic segmentation maps. Only supports PyTorch."),qp=d(),at=s("div"),b(Oo.$$.fragment),Np=d(),zo=s("p"),Sp=n("Converts the output of "),Ln=s("a"),Ap=n("DetrForSegmentation"),Lp=n(" into instance segmentation predictions. Only supports PyTorch."),Rp=d(),it=s("div"),b(Po.$$.fragment),Mp=d(),Fo=s("p"),Up=n("Converts the output of "),Rn=s("a"),Hp=n("DetrForSegmentation"),Gp=n(` into image panoptic segmentation predictions. Only supports
PyTorch.`),Ga=d(),Ie=s("h2"),dt=s("a"),Ys=s("span"),b(Co.$$.fragment),Wp=d(),Qs=s("span"),Vp=n("DetrModel"),Wa=d(),M=s("div"),b(Io.$$.fragment),Bp=d(),Js=s("p"),Yp=n(`The bare DETR Model (consisting of a backbone and encoder-decoder Transformer) outputting raw hidden-states without
any specific head on top.`),Qp=d(),qo=s("p"),Jp=n("This model inherits from "),Mn=s("a"),Kp=n("PreTrainedModel"),Xp=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.)`),Zp=d(),No=s("p"),ef=n("This model is also a PyTorch "),So=s("a"),tf=n("torch.nn.Module"),of=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),nf=d(),X=s("div"),b(Ao.$$.fragment),rf=d(),qe=s("p"),sf=n("The "),Un=s("a"),af=n("DetrModel"),df=n(" forward method, overrides the "),Ks=s("code"),cf=n("__call__"),lf=n(" special method."),hf=d(),b(ct.$$.fragment),mf=d(),b(lt.$$.fragment),Va=d(),Ne=s("h2"),ht=s("a"),Xs=s("span"),b(Lo.$$.fragment),pf=d(),Zs=s("span"),ff=n("DetrForObjectDetection"),Ba=d(),U=s("div"),b(Ro.$$.fragment),gf=d(),ea=s("p"),uf=n(`DETR Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on top, for tasks
such as COCO detection.`),_f=d(),Mo=s("p"),bf=n("This model inherits from "),Hn=s("a"),vf=n("PreTrainedModel"),Df=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.)`),yf=d(),Uo=s("p"),wf=n("This model is also a PyTorch "),Ho=s("a"),Tf=n("torch.nn.Module"),xf=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ef=d(),Z=s("div"),b(Go.$$.fragment),$f=d(),Se=s("p"),kf=n("The "),Gn=s("a"),jf=n("DetrForObjectDetection"),Of=n(" forward method, overrides the "),ta=s("code"),zf=n("__call__"),Pf=n(" special method."),Ff=d(),b(mt.$$.fragment),Cf=d(),b(pt.$$.fragment),Ya=d(),Ae=s("h2"),ft=s("a"),oa=s("span"),b(Wo.$$.fragment),If=d(),na=s("span"),qf=n("DetrForSegmentation"),Qa=d(),H=s("div"),b(Vo.$$.fragment),Nf=d(),ra=s("p"),Sf=n(`DETR Model (consisting of a backbone and encoder-decoder Transformer) with a segmentation head on top, for tasks
such as COCO panoptic.`),Af=d(),Bo=s("p"),Lf=n("This model inherits from "),Wn=s("a"),Rf=n("PreTrainedModel"),Mf=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.)`),Uf=d(),Yo=s("p"),Hf=n("This model is also a PyTorch "),Qo=s("a"),Gf=n("torch.nn.Module"),Wf=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Vf=d(),ee=s("div"),b(Jo.$$.fragment),Bf=d(),Le=s("p"),Yf=n("The "),Vn=s("a"),Qf=n("DetrForSegmentation"),Jf=n(" forward method, overrides the "),sa=s("code"),Kf=n("__call__"),Xf=n(" special method."),Zf=d(),b(gt.$$.fragment),eg=d(),b(ut.$$.fragment),this.h()},l(o){const h=wb('[data-svelte="svelte-1phssyn"]',document.head);f=a(h,"META",{name:!0,content:!0}),h.forEach(t),E=c(o),_=a(o,"H1",{class:!0});var Ko=i(_);g=a(Ko,"A",{id:!0,class:!0,href:!0});var aa=i(g);x=a(aa,"SPAN",{});var ia=i(x);v(m.$$.fragment,ia),ia.forEach(t),aa.forEach(t),u=c(Ko),G=a(Ko,"SPAN",{});var da=i(G);Hi=r(da,"DETR"),da.forEach(t),Ko.forEach(t),ha=c(o),ye=a(o,"H2",{class:!0});var Xo=i(ye);Me=a(Xo,"A",{id:!0,class:!0,href:!0});var ca=i(Me);or=a(ca,"SPAN",{});var la=i(or);v(Nt.$$.fragment,la),la.forEach(t),ca.forEach(t),Gi=c(Xo),nr=a(Xo,"SPAN",{});var ng=i(nr);Wi=r(ng,"Overview"),ng.forEach(t),Xo.forEach(t),ma=c(o),Ue=a(o,"P",{});var Ka=i(Ue);Vi=r(Ka,"The DETR model was proposed in "),St=a(Ka,"A",{href:!0,rel:!0});var rg=i(St);Bi=r(rg,"End-to-End Object Detection with Transformers"),rg.forEach(t),Yi=r(Ka,` 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.`),Ka.forEach(t),pa=c(o),en=a(o,"P",{});var sg=i(en);Qi=r(sg,"The abstract from the paper is the following:"),sg.forEach(t),fa=c(o),tn=a(o,"P",{});var ag=i(tn);rr=a(ag,"EM",{});var ig=i(rr);Ji=r(ig,`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.`),ig.forEach(t),ag.forEach(t),ga=c(o),ue=a(o,"P",{});var Bn=i(ue);Ki=r(Bn,"This model was contributed by "),At=a(Bn,"A",{href:!0,rel:!0});var dg=i(At);Xi=r(dg,"nielsr"),dg.forEach(t),Zi=r(Bn,". The original code can be found "),Lt=a(Bn,"A",{href:!0,rel:!0});var cg=i(Lt);ed=r(cg,"here"),cg.forEach(t),td=r(Bn,"."),Bn.forEach(t),ua=c(o),He=a(o,"P",{});var Xa=i(He);od=r(Xa,"The quickest way to get started with DETR is by checking the "),Rt=a(Xa,"A",{href:!0,rel:!0});var lg=i(Rt);nd=r(lg,"example notebooks"),lg.forEach(t),rd=r(Xa,` (which showcase both inference and
fine-tuning on custom data).`),Xa.forEach(t),_a=c(o),Ge=a(o,"P",{});var Za=i(Ge);sd=r(Za,"Here\u2019s a TLDR explaining how "),on=a(Za,"A",{href:!0});var hg=i(on);ad=r(hg,"DetrForObjectDetection"),hg.forEach(t),id=r(Za," works:"),Za.forEach(t),ba=c(o),j=a(o,"P",{});var I=i(j);dd=r(I,`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 `),sr=a(I,"CODE",{});var mg=i(sr);cd=r(mg,"(batch_size, 3, height, width)"),mg.forEach(t),ld=r(I,`, assuming the image has 3 color channels (RGB). The CNN backbone
outputs a new lower-resolution feature map, typically of shape `),ar=a(I,"CODE",{});var pg=i(ar);hd=r(pg,"(batch_size, 2048, height/32, width/32)"),pg.forEach(t),md=r(I,`. This is
then projected to match the hidden dimension of the Transformer of DETR, which is `),ir=a(I,"CODE",{});var fg=i(ir);pd=r(fg,"256"),fg.forEach(t),fd=r(I,` by default, using a
`),dr=a(I,"CODE",{});var gg=i(dr);gd=r(gg,"nn.Conv2D"),gg.forEach(t),ud=r(I," layer. So now, we have a tensor of shape "),cr=a(I,"CODE",{});var ug=i(cr);_d=r(ug,"(batch_size, 256, height/32, width/32)."),ug.forEach(t),bd=r(I,` Next, the
feature map is flattened and transposed to obtain a tensor of shape `),lr=a(I,"CODE",{});var _g=i(lr);vd=r(_g,"(batch_size, seq_len, d_model)"),_g.forEach(t),Dd=r(I,` =
`),hr=a(I,"CODE",{});var bg=i(hr);yd=r(bg,"(batch_size, width/32*height/32, 256)"),bg.forEach(t),wd=r(I,`. So a difference with NLP models is that the sequence length is actually
longer than usual, but with a smaller `),mr=a(I,"CODE",{});var vg=i(mr);Td=r(vg,"d_model"),vg.forEach(t),xd=r(I," (which in NLP is typically 768 or higher)."),I.forEach(t),va=c(o),C=a(o,"P",{});var W=i(C);Ed=r(W,"Next, this is sent through the encoder, outputting "),pr=a(W,"CODE",{});var Dg=i(pr);$d=r(Dg,"encoder_hidden_states"),Dg.forEach(t),kd=r(W,` of the same shape (you can consider
these as image features). Next, so-called `),fr=a(W,"STRONG",{});var yg=i(fr);jd=r(yg,"object queries"),yg.forEach(t),Od=r(W,` are sent through the decoder. This is a tensor of shape
`),gr=a(W,"CODE",{});var wg=i(gr);zd=r(wg,"(batch_size, num_queries, d_model)"),wg.forEach(t),Pd=r(W,", with "),ur=a(W,"CODE",{});var Tg=i(ur);Fd=r(Tg,"num_queries"),Tg.forEach(t),Cd=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 `),_r=a(W,"CODE",{});var xg=i(_r);Id=r(xg,"decoder_hidden_states"),xg.forEach(t),qd=r(W," of the same shape: "),br=a(W,"CODE",{});var Eg=i(br);Nd=r(Eg,"(batch_size, num_queries, d_model)"),Eg.forEach(t),Sd=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),Da=c(o),J=a(o,"P",{});var _t=i(J);Ad=r(_t,"The model is trained using a "),vr=a(_t,"STRONG",{});var $g=i(vr);Ld=r($g,"bipartite matching loss"),$g.forEach(t),Rd=r(_t,`: 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 `),Mt=a(_t,"A",{href:!0,rel:!0});var kg=i(Mt);Md=r(kg,"Hungarian matching algorithm"),kg.forEach(t),Ud=r(_t,` 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 `),Ut=a(_t,"A",{href:!0,rel:!0});var jg=i(Ut);Hd=r(jg,"generalized IoU loss"),jg.forEach(t),Gd=r(_t,` (for the
bounding boxes) are used to optimize the parameters of the model.`),_t.forEach(t),ya=c(o),K=a(o,"P",{});var bt=i(K);Wd=r(bt,`DETR can be naturally extended to perform panoptic segmentation (which unifies semantic segmentation and instance
segmentation). `),nn=a(bt,"A",{href:!0});var Og=i(nn);Vd=r(Og,"DetrForSegmentation"),Og.forEach(t),Bd=r(bt,` adds a segmentation mask head on top of
`),rn=a(bt,"A",{href:!0});var zg=i(rn);Yd=r(zg,"DetrForObjectDetection"),zg.forEach(t),Qd=r(bt,`. The mask head can be trained either jointly, or in a two steps process,
where one first trains a `),sn=a(bt,"A",{href:!0});var Pg=i(sn);Jd=r(Pg,"DetrForObjectDetection"),Pg.forEach(t),Kd=r(bt,` 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.`),bt.forEach(t),wa=c(o),an=a(o,"P",{});var Fg=i(an);Xd=r(Fg,"Tips:"),Fg.forEach(t),Ta=c(o),z=a(o,"UL",{});var S=i(z);ne=a(S,"LI",{});var vt=i(ne);Zd=r(vt,"DETR uses so-called "),Dr=a(vt,"STRONG",{});var Cg=i(Dr);ec=r(Cg,"object queries"),Cg.forEach(t),tc=r(vt,` 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
`),yr=a(vt,"CODE",{});var Ig=i(yr);oc=r(Ig,"num_queries"),Ig.forEach(t),nc=r(vt," of "),dn=a(vt,"A",{href:!0});var qg=i(dn);rc=r(qg,"DetrConfig"),qg.forEach(t),sc=r(vt,`). 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).`),vt.forEach(t),ac=c(S),wr=a(S,"LI",{});var Ng=i(wr);ic=r(Ng,`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.`),Ng.forEach(t),dc=c(S),re=a(S,"LI",{});var Dt=i(re);cc=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 `),Tr=a(Dt,"CODE",{});var Sg=i(Tr);lc=r(Sg,"position_embedding_type"),Sg.forEach(t),hc=r(Dt,` of
`),cn=a(Dt,"A",{href:!0});var Ag=i(cn);mc=r(Ag,"DetrConfig"),Ag.forEach(t),pc=r(Dt," is set to "),xr=a(Dt,"CODE",{});var Lg=i(xr);fc=r(Lg,'"sine"'),Lg.forEach(t),gc=r(Dt,"."),Dt.forEach(t),uc=c(S),se=a(S,"LI",{});var yt=i(se);_c=r(yt,`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(yt,"CODE",{});var Rg=i(Er);bc=r(Rg,"auxiliary_loss"),Rg.forEach(t),vc=r(yt,` of
`),ln=a(yt,"A",{href:!0});var Mg=i(ln);Dc=r(Mg,"DetrConfig"),Mg.forEach(t),yc=r(yt," to "),$r=a(yt,"CODE",{});var Ug=i($r);wc=r(Ug,"True"),Ug.forEach(t),Tc=r(yt,`, then prediction feedforward neural networks and Hungarian losses
are added after each decoder layer (with the FFNs sharing parameters).`),yt.forEach(t),xc=c(S),B=a(S,"LI",{});var _e=i(B);Ec=r(_e,`If you want to train the model in a distributed environment across multiple nodes, then one should update the
`),kr=a(_e,"EM",{});var Hg=i(kr);$c=r(Hg,"num_boxes"),Hg.forEach(t),kc=r(_e," variable in the "),jr=a(_e,"EM",{});var Gg=i(jr);jc=r(Gg,"DetrLoss"),Gg.forEach(t),Oc=r(_e," class of "),Or=a(_e,"EM",{});var Wg=i(Or);zc=r(Wg,"modeling_detr.py"),Wg.forEach(t),Pc=r(_e,`. 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 `),Ht=a(_e,"A",{href:!0,rel:!0});var Vg=i(Ht);Fc=r(Vg,"here"),Vg.forEach(t),Cc=r(_e,"."),_e.forEach(t),Ic=c(S),N=a(S,"LI",{});var Q=i(N);hn=a(Q,"A",{href:!0});var Bg=i(hn);qc=r(Bg,"DetrForObjectDetection"),Bg.forEach(t),Nc=r(Q," and "),mn=a(Q,"A",{href:!0});var Yg=i(mn);Sc=r(Yg,"DetrForSegmentation"),Yg.forEach(t),Ac=r(Q,` can be initialized with
any convolutional backbone available in the `),Gt=a(Q,"A",{href:!0,rel:!0});var Qg=i(Gt);Lc=r(Qg,"timm library"),Qg.forEach(t),Rc=r(Q,`.
Initializing with a MobileNet backbone for example can be done by setting the `),zr=a(Q,"CODE",{});var Jg=i(zr);Mc=r(Jg,"backbone"),Jg.forEach(t),Uc=r(Q,` attribute of
`),pn=a(Q,"A",{href:!0});var Kg=i(pn);Hc=r(Kg,"DetrConfig"),Kg.forEach(t),Gc=r(Q," to "),Pr=a(Q,"CODE",{});var Xg=i(Pr);Wc=r(Xg,'"tf_mobilenetv3_small_075"'),Xg.forEach(t),Vc=r(Q,`, and then initializing the model with that
config.`),Q.forEach(t),Bc=c(S),ae=a(S,"LI",{});var wt=i(ae);Yc=r(wt,`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
`),fn=a(wt,"A",{href:!0});var Zg=i(fn);Qc=r(Zg,"DetrImageProcessor"),Zg.forEach(t),Jc=r(wt,` 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 `),Fr=a(wt,"CODE",{});var eu=i(Fr);Kc=r(eu,"collate_fn"),eu.forEach(t),Xc=r(wt,` in order to batch images together, using
`),gn=a(wt,"A",{href:!0});var tu=i(gn);Zc=r(tu,"pad_and_create_pixel_mask()"),tu.forEach(t),el=r(wt,"."),wt.forEach(t),tl=c(S),we=a(S,"LI",{});var Yn=i(we);ol=r(Yn,"The size of the images will determine the amount of memory being used, and will thus determine the "),Cr=a(Yn,"CODE",{});var ou=i(Cr);nl=r(ou,"batch_size"),ou.forEach(t),rl=r(Yn,`.
It is advised to use a batch size of 2 per GPU. See `),Wt=a(Yn,"A",{href:!0,rel:!0});var nu=i(Wt);sl=r(nu,"this Github thread"),nu.forEach(t),al=r(Yn," for more info."),Yn.forEach(t),S.forEach(t),xa=c(o),un=a(o,"P",{});var ru=i(un);il=r(ru,"There are three ways to instantiate a DETR model (depending on what you prefer):"),ru.forEach(t),Ea=c(o),_n=a(o,"P",{});var su=i(_n);dl=r(su,"Option 1: Instantiate DETR with pre-trained weights for entire model"),su.forEach(t),$a=c(o),v(Vt.$$.fragment,o),ka=c(o),bn=a(o,"P",{});var au=i(bn);cl=r(au,"Option 2: Instantiate DETR with randomly initialized weights for Transformer, but pre-trained weights for backbone"),au.forEach(t),ja=c(o),v(Bt.$$.fragment,o),Oa=c(o),vn=a(o,"P",{});var iu=i(vn);ll=r(iu,"Option 3: Instantiate DETR with randomly initialized weights for backbone + Transformer"),iu.forEach(t),za=c(o),v(Yt.$$.fragment,o),Pa=c(o),Dn=a(o,"P",{});var du=i(Dn);hl=r(du,"As a summary, consider the following table:"),du.forEach(t),Fa=c(o),We=a(o,"TABLE",{});var ei=i(We);Ir=a(ei,"THEAD",{});var cu=i(Ir);ie=a(cu,"TR",{});var Tt=i(ie);qr=a(Tt,"TH",{});var lu=i(qr);ml=r(lu,"Task"),lu.forEach(t),pl=c(Tt),Nr=a(Tt,"TH",{});var hu=i(Nr);fl=r(hu,"Object detection"),hu.forEach(t),gl=c(Tt),Sr=a(Tt,"TH",{});var mu=i(Sr);ul=r(mu,"Instance segmentation"),mu.forEach(t),_l=c(Tt),Ar=a(Tt,"TH",{});var pu=i(Ar);bl=r(pu,"Panoptic segmentation"),pu.forEach(t),Tt.forEach(t),cu.forEach(t),vl=c(ei),L=a(ei,"TBODY",{});var te=i(L);de=a(te,"TR",{});var xt=i(de);Lr=a(xt,"TD",{});var fu=i(Lr);Rr=a(fu,"STRONG",{});var gu=i(Rr);Dl=r(gu,"Description"),gu.forEach(t),fu.forEach(t),yl=c(xt),Mr=a(xt,"TD",{});var uu=i(Mr);wl=r(uu,"Predicting bounding boxes and class labels around objects in an image"),uu.forEach(t),Tl=c(xt),Ur=a(xt,"TD",{});var _u=i(Ur);xl=r(_u,"Predicting masks around objects (i.e. instances) in an image"),_u.forEach(t),El=c(xt),Hr=a(xt,"TD",{});var bu=i(Hr);$l=r(bu,"Predicting masks around both objects (i.e. instances) as well as \u201Cstuff\u201D (i.e. background things like trees and roads) in an image"),bu.forEach(t),xt.forEach(t),kl=c(te),ce=a(te,"TR",{});var Et=i(ce);Gr=a(Et,"TD",{});var vu=i(Gr);Wr=a(vu,"STRONG",{});var Du=i(Wr);jl=r(Du,"Model"),Du.forEach(t),vu.forEach(t),Ol=c(Et),Vr=a(Et,"TD",{});var yu=i(Vr);yn=a(yu,"A",{href:!0});var wu=i(yn);zl=r(wu,"DetrForObjectDetection"),wu.forEach(t),yu.forEach(t),Pl=c(Et),Br=a(Et,"TD",{});var Tu=i(Br);wn=a(Tu,"A",{href:!0});var xu=i(wn);Fl=r(xu,"DetrForSegmentation"),xu.forEach(t),Tu.forEach(t),Cl=c(Et),Yr=a(Et,"TD",{});var Eu=i(Yr);Tn=a(Eu,"A",{href:!0});var $u=i(Tn);Il=r($u,"DetrForSegmentation"),$u.forEach(t),Eu.forEach(t),Et.forEach(t),ql=c(te),le=a(te,"TR",{});var $t=i(le);Qr=a($t,"TD",{});var ku=i(Qr);Jr=a(ku,"STRONG",{});var ju=i(Jr);Nl=r(ju,"Example dataset"),ju.forEach(t),ku.forEach(t),Sl=c($t),Kr=a($t,"TD",{});var Ou=i(Kr);Al=r(Ou,"COCO detection"),Ou.forEach(t),Ll=c($t),Xr=a($t,"TD",{});var zu=i(Xr);Rl=r(zu,"COCO detection, COCO panoptic"),zu.forEach(t),Ml=c($t),Zr=a($t,"TD",{});var Pu=i(Zr);Ul=r(Pu,"COCO panoptic"),Pu.forEach(t),$t.forEach(t),Hl=c(te),he=a(te,"TR",{});var kt=i(he);Qt=a(kt,"TD",{});var ti=i(Qt);es=a(ti,"STRONG",{});var Fu=i(es);Gl=r(Fu,"Format of annotations to provide to"),Fu.forEach(t),Wl=c(ti),xn=a(ti,"A",{href:!0});var Cu=i(xn);Vl=r(Cu,"DetrImageProcessor"),Cu.forEach(t),ti.forEach(t),Bl=c(kt),Te=a(kt,"TD",{});var Qn=i(Te);Yl=r(Qn,"{\u2018image_id\u2019: "),ts=a(Qn,"CODE",{});var Iu=i(ts);Ql=r(Iu,"int"),Iu.forEach(t),Jl=r(Qn,", \u2018annotations\u2019: "),os=a(Qn,"CODE",{});var qu=i(os);Kl=r(qu,"List[Dict]"),qu.forEach(t),Xl=r(Qn,"} each Dict being a COCO object annotation"),Qn.forEach(t),Zl=c(kt),R=a(kt,"TD",{});var oe=i(R);eh=r(oe,"{\u2018image_id\u2019: "),ns=a(oe,"CODE",{});var Nu=i(ns);th=r(Nu,"int"),Nu.forEach(t),oh=r(oe,", \u2018annotations\u2019: "),rs=a(oe,"CODE",{});var Su=i(rs);nh=r(Su,"List[Dict]"),Su.forEach(t),rh=r(oe,"}  (in case of COCO detection) or {\u2018file_name\u2019: "),ss=a(oe,"CODE",{});var Au=i(ss);sh=r(Au,"str"),Au.forEach(t),ah=r(oe,", \u2018image_id\u2019: "),as=a(oe,"CODE",{});var Lu=i(as);ih=r(Lu,"int"),Lu.forEach(t),dh=r(oe,", \u2018segments_info\u2019: "),is=a(oe,"CODE",{});var Ru=i(is);ch=r(Ru,"List[Dict]"),Ru.forEach(t),lh=r(oe,"} (in case of COCO panoptic)"),oe.forEach(t),hh=c(kt),me=a(kt,"TD",{});var jt=i(me);mh=r(jt,"{\u2018file_name\u2019: "),ds=a(jt,"CODE",{});var Mu=i(ds);ph=r(Mu,"str"),Mu.forEach(t),fh=r(jt,", \u2018image_id\u2019: "),cs=a(jt,"CODE",{});var Uu=i(cs);gh=r(Uu,"int"),Uu.forEach(t),uh=r(jt,", \u2018segments_info\u2019: "),ls=a(jt,"CODE",{});var Hu=i(ls);_h=r(Hu,"List[Dict]"),Hu.forEach(t),bh=r(jt,"} and masks_path (path to directory containing PNG files of the masks)"),jt.forEach(t),kt.forEach(t),vh=c(te),pe=a(te,"TR",{});var Ot=i(pe);En=a(Ot,"TD",{});var tg=i(En);hs=a(tg,"STRONG",{});var Gu=i(hs);Dh=r(Gu,"Postprocessing"),Gu.forEach(t),yh=r(tg," (i.e. converting the output of the model to COCO API)"),tg.forEach(t),wh=c(Ot),ms=a(Ot,"TD",{});var Wu=i(ms);ps=a(Wu,"CODE",{});var Vu=i(ps);Th=r(Vu,"post_process()"),Vu.forEach(t),Wu.forEach(t),xh=c(Ot),fs=a(Ot,"TD",{});var Bu=i(fs);gs=a(Bu,"CODE",{});var Yu=i(gs);Eh=r(Yu,"post_process_segmentation()"),Yu.forEach(t),Bu.forEach(t),$h=c(Ot),Jt=a(Ot,"TD",{});var oi=i(Jt);us=a(oi,"CODE",{});var Qu=i(us);kh=r(Qu,"post_process_segmentation()"),Qu.forEach(t),jh=r(oi,", "),_s=a(oi,"CODE",{});var Ju=i(_s);Oh=r(Ju,"post_process_panoptic()"),Ju.forEach(t),oi.forEach(t),Ot.forEach(t),zh=c(te),fe=a(te,"TR",{});var zt=i(fe);bs=a(zt,"TD",{});var Ku=i(bs);vs=a(Ku,"STRONG",{});var Xu=i(vs);Ph=r(Xu,"evaluators"),Xu.forEach(t),Ku.forEach(t),Fh=c(zt),Kt=a(zt,"TD",{});var ni=i(Kt);Ds=a(ni,"CODE",{});var Zu=i(Ds);Ch=r(Zu,"CocoEvaluator"),Zu.forEach(t),Ih=r(ni," with "),ys=a(ni,"CODE",{});var e_=i(ys);qh=r(e_,'iou_types="bbox"'),e_.forEach(t),ni.forEach(t),Nh=c(zt),xe=a(zt,"TD",{});var Jn=i(xe);ws=a(Jn,"CODE",{});var t_=i(ws);Sh=r(t_,"CocoEvaluator"),t_.forEach(t),Ah=r(Jn," with "),Ts=a(Jn,"CODE",{});var o_=i(Ts);Lh=r(o_,'iou_types="bbox"'),o_.forEach(t),Rh=r(Jn," or "),xs=a(Jn,"CODE",{});var n_=i(xs);Mh=r(n_,'"segm"'),n_.forEach(t),Jn.forEach(t),Uh=c(zt),ge=a(zt,"TD",{});var Pt=i(ge);Es=a(Pt,"CODE",{});var r_=i(Es);Hh=r(r_,"CocoEvaluator"),r_.forEach(t),Gh=r(Pt," with "),$s=a(Pt,"CODE",{});var s_=i($s);Wh=r(s_,'iou_tupes="bbox"'),s_.forEach(t),Vh=r(Pt," or "),ks=a(Pt,"CODE",{});var a_=i(ks);Bh=r(a_,'"segm"'),a_.forEach(t),Yh=r(Pt,", "),js=a(Pt,"CODE",{});var i_=i(js);Qh=r(i_,"PanopticEvaluator"),i_.forEach(t),Pt.forEach(t),zt.forEach(t),te.forEach(t),ei.forEach(t),Ca=c(o),$=a(o,"P",{});var P=i($);Jh=r(P,`In short, one should prepare the data either in COCO detection or COCO panoptic format, then use
`),$n=a(P,"A",{href:!0});var d_=i($n);Kh=r(d_,"DetrImageProcessor"),d_.forEach(t),Xh=r(P," to create "),Os=a(P,"CODE",{});var c_=i(Os);Zh=r(c_,"pixel_values"),c_.forEach(t),em=r(P,", "),zs=a(P,"CODE",{});var l_=i(zs);tm=r(l_,"pixel_mask"),l_.forEach(t),om=r(P,` and optional
`),Ps=a(P,"CODE",{});var h_=i(Ps);nm=r(h_,"labels"),h_.forEach(t),rm=r(P,`, 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 `),kn=a(P,"A",{href:!0});var m_=i(kn);sm=r(m_,"DetrImageProcessor"),m_.forEach(t),am=r(P,`. These can
be be provided to either `),Fs=a(P,"CODE",{});var p_=i(Fs);im=r(p_,"CocoEvaluator"),p_.forEach(t),dm=r(P," or "),Cs=a(P,"CODE",{});var f_=i(Cs);cm=r(f_,"PanopticEvaluator"),f_.forEach(t),lm=r(P,`, which allow you to calculate metrics like
mean Average Precision (mAP) and Panoptic Quality (PQ). The latter objects are implemented in the `),Xt=a(P,"A",{href:!0,rel:!0});var g_=i(Xt);hm=r(g_,"original repository"),g_.forEach(t),mm=r(P,". See the "),Zt=a(P,"A",{href:!0,rel:!0});var u_=i(Zt);pm=r(u_,"example notebooks"),u_.forEach(t),fm=r(P," for more info regarding evaluation."),P.forEach(t),Ia=c(o),Ee=a(o,"H2",{class:!0});var ri=i(Ee);Ve=a(ri,"A",{id:!0,class:!0,href:!0});var __=i(Ve);Is=a(__,"SPAN",{});var b_=i(Is);v(eo.$$.fragment,b_),b_.forEach(t),__.forEach(t),gm=c(ri),qs=a(ri,"SPAN",{});var v_=i(qs);um=r(v_,"DETR specific outputs"),v_.forEach(t),ri.forEach(t),qa=c(o),$e=a(o,"DIV",{class:!0});var si=i($e);v(to.$$.fragment,si),_m=c(si),Ns=a(si,"P",{});var D_=i(Ns);bm=r(D_,`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.`),D_.forEach(t),si.forEach(t),Na=c(o),ke=a(o,"DIV",{class:!0});var ai=i(ke);v(oo.$$.fragment,ai),vm=c(ai),no=a(ai,"P",{});var ii=i(no);Dm=r(ii,"Output type of "),jn=a(ii,"A",{href:!0});var y_=i(jn);ym=r(y_,"DetrForObjectDetection"),y_.forEach(t),wm=r(ii,"."),ii.forEach(t),ai.forEach(t),Sa=c(o),je=a(o,"DIV",{class:!0});var di=i(je);v(ro.$$.fragment,di),Tm=c(di),so=a(di,"P",{});var ci=i(so);xm=r(ci,"Output type of "),On=a(ci,"A",{href:!0});var w_=i(On);Em=r(w_,"DetrForSegmentation"),w_.forEach(t),$m=r(ci,"."),ci.forEach(t),di.forEach(t),Aa=c(o),Oe=a(o,"H2",{class:!0});var li=i(Oe);Be=a(li,"A",{id:!0,class:!0,href:!0});var T_=i(Be);Ss=a(T_,"SPAN",{});var x_=i(Ss);v(ao.$$.fragment,x_),x_.forEach(t),T_.forEach(t),km=c(li),As=a(li,"SPAN",{});var E_=i(As);jm=r(E_,"DetrConfig"),E_.forEach(t),li.forEach(t),La=c(o),Y=a(o,"DIV",{class:!0});var Ft=i(Y);v(io.$$.fragment,Ft),Om=c(Ft),ze=a(Ft,"P",{});var Kn=i(ze);zm=r(Kn,"This is the configuration class to store the configuration of a "),zn=a(Kn,"A",{href:!0});var $_=i(zn);Pm=r($_,"DetrModel"),$_.forEach(t),Fm=r(Kn,`. 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
`),co=a(Kn,"A",{href:!0,rel:!0});var k_=i(co);Cm=r(k_,"facebook/detr-resnet-50"),k_.forEach(t),Im=r(Kn," architecture."),Kn.forEach(t),qm=c(Ft),Pe=a(Ft,"P",{});var Xn=i(Pe);Nm=r(Xn,"Configuration objects inherit from "),Pn=a(Xn,"A",{href:!0});var j_=i(Pn);Sm=r(j_,"PretrainedConfig"),j_.forEach(t),Am=r(Xn,` and can be used to control the model outputs. Read the
documentation from `),Fn=a(Xn,"A",{href:!0});var O_=i(Fn);Lm=r(O_,"PretrainedConfig"),O_.forEach(t),Rm=r(Xn," for more information."),Xn.forEach(t),Mm=c(Ft),v(Ye.$$.fragment,Ft),Ft.forEach(t),Ra=c(o),Fe=a(o,"H2",{class:!0});var hi=i(Fe);Qe=a(hi,"A",{id:!0,class:!0,href:!0});var z_=i(Qe);Ls=a(z_,"SPAN",{});var P_=i(Ls);v(lo.$$.fragment,P_),P_.forEach(t),z_.forEach(t),Um=c(hi),Rs=a(hi,"SPAN",{});var F_=i(Rs);Hm=r(F_,"DetrImageProcessor"),F_.forEach(t),hi.forEach(t),Ma=c(o),F=a(o,"DIV",{class:!0});var V=i(F);v(ho.$$.fragment,V),Gm=c(V),Ms=a(V,"P",{});var C_=i(Ms);Wm=r(C_,"Constructs a Detr image processor."),C_.forEach(t),Vm=c(V),Je=a(V,"DIV",{class:!0});var mi=i(Je);v(mo.$$.fragment,mi),Bm=c(mi),Us=a(mi,"P",{});var I_=i(Us);Ym=r(I_,"Preprocess an image or a batch of images so that it can be used by the model."),I_.forEach(t),mi.forEach(t),Qm=c(V),Ke=a(V,"DIV",{class:!0});var pi=i(Ke);v(po.$$.fragment,pi),Jm=c(pi),fo=a(pi,"P",{});var fi=i(fo);Km=r(fi,"Converts the output of "),Cn=a(fi,"A",{href:!0});var q_=i(Cn);Xm=r(q_,"DetrForObjectDetection"),q_.forEach(t),Zm=r(fi,` into the format expected by the COCO api. Only supports
PyTorch.`),fi.forEach(t),pi.forEach(t),ep=c(V),Xe=a(V,"DIV",{class:!0});var gi=i(Xe);v(go.$$.fragment,gi),tp=c(gi),uo=a(gi,"P",{});var ui=i(uo);op=r(ui,"Converts the output of "),In=a(ui,"A",{href:!0});var N_=i(In);np=r(N_,"DetrForSegmentation"),N_.forEach(t),rp=r(ui," into semantic segmentation maps. Only supports PyTorch."),ui.forEach(t),gi.forEach(t),sp=c(V),Ze=a(V,"DIV",{class:!0});var _i=i(Ze);v(_o.$$.fragment,_i),ap=c(_i),bo=a(_i,"P",{});var bi=i(bo);ip=r(bi,"Converts the output of "),qn=a(bi,"A",{href:!0});var S_=i(qn);dp=r(S_,"DetrForSegmentation"),S_.forEach(t),cp=r(bi," into instance segmentation predictions. Only supports PyTorch."),bi.forEach(t),_i.forEach(t),lp=c(V),et=a(V,"DIV",{class:!0});var vi=i(et);v(vo.$$.fragment,vi),hp=c(vi),Do=a(vi,"P",{});var Di=i(Do);mp=r(Di,"Converts the output of "),Nn=a(Di,"A",{href:!0});var A_=i(Nn);pp=r(A_,"DetrForSegmentation"),A_.forEach(t),fp=r(Di,` into image panoptic segmentation predictions. Only supports
PyTorch.`),Di.forEach(t),vi.forEach(t),V.forEach(t),Ua=c(o),Ce=a(o,"H2",{class:!0});var yi=i(Ce);tt=a(yi,"A",{id:!0,class:!0,href:!0});var L_=i(tt);Hs=a(L_,"SPAN",{});var R_=i(Hs);v(yo.$$.fragment,R_),R_.forEach(t),L_.forEach(t),gp=c(yi),Gs=a(yi,"SPAN",{});var M_=i(Gs);up=r(M_,"DetrFeatureExtractor"),M_.forEach(t),yi.forEach(t),Ha=c(o),O=a(o,"DIV",{class:!0});var A=i(O);v(wo.$$.fragment,A),_p=c(A),Ws=a(A,"P",{});var U_=i(Ws);bp=r(U_,"Constructs a Detr image processor."),U_.forEach(t),vp=c(A),ot=a(A,"DIV",{class:!0});var wi=i(ot);v(To.$$.fragment,wi),Dp=c(wi),Vs=a(wi,"P",{});var H_=i(Vs);yp=r(H_,"Preprocess an image or a batch of images."),H_.forEach(t),wi.forEach(t),wp=c(A),nt=a(A,"DIV",{class:!0});var Ti=i(nt);v(xo.$$.fragment,Ti),Tp=c(Ti),Bs=a(Ti,"P",{});var G_=i(Bs);xp=r(G_,`Pads a batch of images with zeros to the size of largest height and width in the batch and returns their
corresponding pixel mask.`),G_.forEach(t),Ti.forEach(t),Ep=c(A),rt=a(A,"DIV",{class:!0});var xi=i(rt);v(Eo.$$.fragment,xi),$p=c(xi),$o=a(xi,"P",{});var Ei=i($o);kp=r(Ei,"Converts the output of "),Sn=a(Ei,"A",{href:!0});var W_=i(Sn);jp=r(W_,"DetrForObjectDetection"),W_.forEach(t),Op=r(Ei,` into the format expected by the COCO api. Only supports
PyTorch.`),Ei.forEach(t),xi.forEach(t),zp=c(A),st=a(A,"DIV",{class:!0});var $i=i(st);v(ko.$$.fragment,$i),Pp=c($i),jo=a($i,"P",{});var ki=i(jo);Fp=r(ki,"Converts the output of "),An=a(ki,"A",{href:!0});var V_=i(An);Cp=r(V_,"DetrForSegmentation"),V_.forEach(t),Ip=r(ki," into semantic segmentation maps. Only supports PyTorch."),ki.forEach(t),$i.forEach(t),qp=c(A),at=a(A,"DIV",{class:!0});var ji=i(at);v(Oo.$$.fragment,ji),Np=c(ji),zo=a(ji,"P",{});var Oi=i(zo);Sp=r(Oi,"Converts the output of "),Ln=a(Oi,"A",{href:!0});var B_=i(Ln);Ap=r(B_,"DetrForSegmentation"),B_.forEach(t),Lp=r(Oi," into instance segmentation predictions. Only supports PyTorch."),Oi.forEach(t),ji.forEach(t),Rp=c(A),it=a(A,"DIV",{class:!0});var zi=i(it);v(Po.$$.fragment,zi),Mp=c(zi),Fo=a(zi,"P",{});var Pi=i(Fo);Up=r(Pi,"Converts the output of "),Rn=a(Pi,"A",{href:!0});var Y_=i(Rn);Hp=r(Y_,"DetrForSegmentation"),Y_.forEach(t),Gp=r(Pi,` into image panoptic segmentation predictions. Only supports
PyTorch.`),Pi.forEach(t),zi.forEach(t),A.forEach(t),Ga=c(o),Ie=a(o,"H2",{class:!0});var Fi=i(Ie);dt=a(Fi,"A",{id:!0,class:!0,href:!0});var Q_=i(dt);Ys=a(Q_,"SPAN",{});var J_=i(Ys);v(Co.$$.fragment,J_),J_.forEach(t),Q_.forEach(t),Wp=c(Fi),Qs=a(Fi,"SPAN",{});var K_=i(Qs);Vp=r(K_,"DetrModel"),K_.forEach(t),Fi.forEach(t),Wa=c(o),M=a(o,"DIV",{class:!0});var be=i(M);v(Io.$$.fragment,be),Bp=c(be),Js=a(be,"P",{});var X_=i(Js);Yp=r(X_,`The bare DETR Model (consisting of a backbone and encoder-decoder Transformer) outputting raw hidden-states without
any specific head on top.`),X_.forEach(t),Qp=c(be),qo=a(be,"P",{});var Ci=i(qo);Jp=r(Ci,"This model inherits from "),Mn=a(Ci,"A",{href:!0});var Z_=i(Mn);Kp=r(Z_,"PreTrainedModel"),Z_.forEach(t),Xp=r(Ci,`. 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.)`),Ci.forEach(t),Zp=c(be),No=a(be,"P",{});var Ii=i(No);ef=r(Ii,"This model is also a PyTorch "),So=a(Ii,"A",{href:!0,rel:!0});var eb=i(So);tf=r(eb,"torch.nn.Module"),eb.forEach(t),of=r(Ii,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ii.forEach(t),nf=c(be),X=a(be,"DIV",{class:!0});var Ct=i(X);v(Ao.$$.fragment,Ct),rf=c(Ct),qe=a(Ct,"P",{});var Zn=i(qe);sf=r(Zn,"The "),Un=a(Zn,"A",{href:!0});var tb=i(Un);af=r(tb,"DetrModel"),tb.forEach(t),df=r(Zn," forward method, overrides the "),Ks=a(Zn,"CODE",{});var ob=i(Ks);cf=r(ob,"__call__"),ob.forEach(t),lf=r(Zn," special method."),Zn.forEach(t),hf=c(Ct),v(ct.$$.fragment,Ct),mf=c(Ct),v(lt.$$.fragment,Ct),Ct.forEach(t),be.forEach(t),Va=c(o),Ne=a(o,"H2",{class:!0});var qi=i(Ne);ht=a(qi,"A",{id:!0,class:!0,href:!0});var nb=i(ht);Xs=a(nb,"SPAN",{});var rb=i(Xs);v(Lo.$$.fragment,rb),rb.forEach(t),nb.forEach(t),pf=c(qi),Zs=a(qi,"SPAN",{});var sb=i(Zs);ff=r(sb,"DetrForObjectDetection"),sb.forEach(t),qi.forEach(t),Ba=c(o),U=a(o,"DIV",{class:!0});var ve=i(U);v(Ro.$$.fragment,ve),gf=c(ve),ea=a(ve,"P",{});var ab=i(ea);uf=r(ab,`DETR Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on top, for tasks
such as COCO detection.`),ab.forEach(t),_f=c(ve),Mo=a(ve,"P",{});var Ni=i(Mo);bf=r(Ni,"This model inherits from "),Hn=a(Ni,"A",{href:!0});var ib=i(Hn);vf=r(ib,"PreTrainedModel"),ib.forEach(t),Df=r(Ni,`. 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.)`),Ni.forEach(t),yf=c(ve),Uo=a(ve,"P",{});var Si=i(Uo);wf=r(Si,"This model is also a PyTorch "),Ho=a(Si,"A",{href:!0,rel:!0});var db=i(Ho);Tf=r(db,"torch.nn.Module"),db.forEach(t),xf=r(Si,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Si.forEach(t),Ef=c(ve),Z=a(ve,"DIV",{class:!0});var It=i(Z);v(Go.$$.fragment,It),$f=c(It),Se=a(It,"P",{});var er=i(Se);kf=r(er,"The "),Gn=a(er,"A",{href:!0});var cb=i(Gn);jf=r(cb,"DetrForObjectDetection"),cb.forEach(t),Of=r(er," forward method, overrides the "),ta=a(er,"CODE",{});var lb=i(ta);zf=r(lb,"__call__"),lb.forEach(t),Pf=r(er," special method."),er.forEach(t),Ff=c(It),v(mt.$$.fragment,It),Cf=c(It),v(pt.$$.fragment,It),It.forEach(t),ve.forEach(t),Ya=c(o),Ae=a(o,"H2",{class:!0});var Ai=i(Ae);ft=a(Ai,"A",{id:!0,class:!0,href:!0});var hb=i(ft);oa=a(hb,"SPAN",{});var mb=i(oa);v(Wo.$$.fragment,mb),mb.forEach(t),hb.forEach(t),If=c(Ai),na=a(Ai,"SPAN",{});var pb=i(na);qf=r(pb,"DetrForSegmentation"),pb.forEach(t),Ai.forEach(t),Qa=c(o),H=a(o,"DIV",{class:!0});var De=i(H);v(Vo.$$.fragment,De),Nf=c(De),ra=a(De,"P",{});var fb=i(ra);Sf=r(fb,`DETR Model (consisting of a backbone and encoder-decoder Transformer) with a segmentation head on top, for tasks
such as COCO panoptic.`),fb.forEach(t),Af=c(De),Bo=a(De,"P",{});var Li=i(Bo);Lf=r(Li,"This model inherits from "),Wn=a(Li,"A",{href:!0});var gb=i(Wn);Rf=r(gb,"PreTrainedModel"),gb.forEach(t),Mf=r(Li,`. 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.)`),Li.forEach(t),Uf=c(De),Yo=a(De,"P",{});var Ri=i(Yo);Hf=r(Ri,"This model is also a PyTorch "),Qo=a(Ri,"A",{href:!0,rel:!0});var ub=i(Qo);Gf=r(ub,"torch.nn.Module"),ub.forEach(t),Wf=r(Ri,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ri.forEach(t),Vf=c(De),ee=a(De,"DIV",{class:!0});var qt=i(ee);v(Jo.$$.fragment,qt),Bf=c(qt),Le=a(qt,"P",{});var tr=i(Le);Yf=r(tr,"The "),Vn=a(tr,"A",{href:!0});var _b=i(Vn);Qf=r(_b,"DetrForSegmentation"),_b.forEach(t),Jf=r(tr," forward method, overrides the "),sa=a(tr,"CODE",{});var bb=i(sa);Kf=r(bb,"__call__"),bb.forEach(t),Xf=r(tr," special method."),tr.forEach(t),Zf=c(qt),v(gt.$$.fragment,qt),eg=c(qt),v(ut.$$.fragment,qt),qt.forEach(t),De.forEach(t),this.h()},h(){l(f,"name","hf:doc:metadata"),l(f,"content",JSON.stringify(Fb)),l(g,"id","detr"),l(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(g,"href","#detr"),l(_,"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(ye,"class","relative group"),l(St,"href","https://arxiv.org/abs/2005.12872"),l(St,"rel","nofollow"),l(At,"href","https://huggingface.co/nielsr"),l(At,"rel","nofollow"),l(Lt,"href","https://github.com/facebookresearch/detr"),l(Lt,"rel","nofollow"),l(Rt,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/DETR"),l(Rt,"rel","nofollow"),l(on,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForObjectDetection"),l(Mt,"href","https://en.wikipedia.org/wiki/Hungarian_algorithm"),l(Mt,"rel","nofollow"),l(Ut,"href","https://giou.stanford.edu/"),l(Ut,"rel","nofollow"),l(nn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),l(rn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForObjectDetection"),l(sn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForObjectDetection"),l(dn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrConfig"),l(cn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrConfig"),l(ln,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrConfig"),l(Ht,"href","https://github.com/facebookresearch/detr/blob/a54b77800eb8e64e3ad0d8237789fcbf2f8350c5/models/detr.py#L227-L232"),l(Ht,"rel","nofollow"),l(hn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForObjectDetection"),l(mn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),l(Gt,"href","https://github.com/rwightman/pytorch-image-models"),l(Gt,"rel","nofollow"),l(pn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrConfig"),l(fn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor"),l(gn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor.pad_and_create_pixel_mask"),l(Wt,"href","https://github.com/facebookresearch/detr/issues/150"),l(Wt,"rel","nofollow"),l(yn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForObjectDetection"),l(wn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),l(Tn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),l(xn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor"),l($n,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor"),l(kn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrImageProcessor"),l(Xt,"href","https://github.com/facebookresearch/detr"),l(Xt,"rel","nofollow"),l(Zt,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/DETR"),l(Zt,"rel","nofollow"),l(Ve,"id","transformers.models.detr.modeling_detr.DetrModelOutput"),l(Ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Ve,"href","#transformers.models.detr.modeling_detr.DetrModelOutput"),l(Ee,"class","relative group"),l($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(jn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForObjectDetection"),l(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(On,"href","/docs/transformers/v4.25.1/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(Be,"id","transformers.DetrConfig"),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.DetrConfig"),l(Oe,"class","relative group"),l(zn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrModel"),l(co,"href","https://huggingface.co/facebook/detr-resnet-50"),l(co,"rel","nofollow"),l(Pn,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),l(Fn,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),l(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Qe,"id","transformers.DetrImageProcessor"),l(Qe,"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(Qe,"href","#transformers.DetrImageProcessor"),l(Fe,"class","relative group"),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(Cn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForObjectDetection"),l(Ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(In,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),l(Xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(qn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),l(Ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Nn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),l(et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(tt,"id","transformers.DetrImageProcessor"),l(tt,"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(tt,"href","#transformers.DetrImageProcessor"),l(Ce,"class","relative group"),l(ot,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(nt,"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/v4.25.1/en/model_doc/detr#transformers.DetrForObjectDetection"),l(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(An,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),l(st,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ln,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),l(at,"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/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),l(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(dt,"id","transformers.DetrModel"),l(dt,"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(dt,"href","#transformers.DetrModel"),l(Ie,"class","relative group"),l(Mn,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel"),l(So,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(So,"rel","nofollow"),l(Un,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrModel"),l(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ht,"id","transformers.DetrForObjectDetection"),l(ht,"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(ht,"href","#transformers.DetrForObjectDetection"),l(Ne,"class","relative group"),l(Hn,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel"),l(Ho,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Ho,"rel","nofollow"),l(Gn,"href","/docs/transformers/v4.25.1/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(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ft,"id","transformers.DetrForSegmentation"),l(ft,"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(ft,"href","#transformers.DetrForSegmentation"),l(Ae,"class","relative group"),l(Wn,"href","/docs/transformers/v4.25.1/en/main_classes/model#transformers.PreTrainedModel"),l(Qo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Qo,"rel","nofollow"),l(Vn,"href","/docs/transformers/v4.25.1/en/model_doc/detr#transformers.DetrForSegmentation"),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(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),p(o,E,h),p(o,_,h),e(_,g),e(g,x),D(m,x,null),e(_,u),e(_,G),e(G,Hi),p(o,ha,h),p(o,ye,h),e(ye,Me),e(Me,or),D(Nt,or,null),e(ye,Gi),e(ye,nr),e(nr,Wi),p(o,ma,h),p(o,Ue,h),e(Ue,Vi),e(Ue,St),e(St,Bi),e(Ue,Yi),p(o,pa,h),p(o,en,h),e(en,Qi),p(o,fa,h),p(o,tn,h),e(tn,rr),e(rr,Ji),p(o,ga,h),p(o,ue,h),e(ue,Ki),e(ue,At),e(At,Xi),e(ue,Zi),e(ue,Lt),e(Lt,ed),e(ue,td),p(o,ua,h),p(o,He,h),e(He,od),e(He,Rt),e(Rt,nd),e(He,rd),p(o,_a,h),p(o,Ge,h),e(Ge,sd),e(Ge,on),e(on,ad),e(Ge,id),p(o,ba,h),p(o,j,h),e(j,dd),e(j,sr),e(sr,cd),e(j,ld),e(j,ar),e(ar,hd),e(j,md),e(j,ir),e(ir,pd),e(j,fd),e(j,dr),e(dr,gd),e(j,ud),e(j,cr),e(cr,_d),e(j,bd),e(j,lr),e(lr,vd),e(j,Dd),e(j,hr),e(hr,yd),e(j,wd),e(j,mr),e(mr,Td),e(j,xd),p(o,va,h),p(o,C,h),e(C,Ed),e(C,pr),e(pr,$d),e(C,kd),e(C,fr),e(fr,jd),e(C,Od),e(C,gr),e(gr,zd),e(C,Pd),e(C,ur),e(ur,Fd),e(C,Cd),e(C,_r),e(_r,Id),e(C,qd),e(C,br),e(br,Nd),e(C,Sd),p(o,Da,h),p(o,J,h),e(J,Ad),e(J,vr),e(vr,Ld),e(J,Rd),e(J,Mt),e(Mt,Md),e(J,Ud),e(J,Ut),e(Ut,Hd),e(J,Gd),p(o,ya,h),p(o,K,h),e(K,Wd),e(K,nn),e(nn,Vd),e(K,Bd),e(K,rn),e(rn,Yd),e(K,Qd),e(K,sn),e(sn,Jd),e(K,Kd),p(o,wa,h),p(o,an,h),e(an,Xd),p(o,Ta,h),p(o,z,h),e(z,ne),e(ne,Zd),e(ne,Dr),e(Dr,ec),e(ne,tc),e(ne,yr),e(yr,oc),e(ne,nc),e(ne,dn),e(dn,rc),e(ne,sc),e(z,ac),e(z,wr),e(wr,ic),e(z,dc),e(z,re),e(re,cc),e(re,Tr),e(Tr,lc),e(re,hc),e(re,cn),e(cn,mc),e(re,pc),e(re,xr),e(xr,fc),e(re,gc),e(z,uc),e(z,se),e(se,_c),e(se,Er),e(Er,bc),e(se,vc),e(se,ln),e(ln,Dc),e(se,yc),e(se,$r),e($r,wc),e(se,Tc),e(z,xc),e(z,B),e(B,Ec),e(B,kr),e(kr,$c),e(B,kc),e(B,jr),e(jr,jc),e(B,Oc),e(B,Or),e(Or,zc),e(B,Pc),e(B,Ht),e(Ht,Fc),e(B,Cc),e(z,Ic),e(z,N),e(N,hn),e(hn,qc),e(N,Nc),e(N,mn),e(mn,Sc),e(N,Ac),e(N,Gt),e(Gt,Lc),e(N,Rc),e(N,zr),e(zr,Mc),e(N,Uc),e(N,pn),e(pn,Hc),e(N,Gc),e(N,Pr),e(Pr,Wc),e(N,Vc),e(z,Bc),e(z,ae),e(ae,Yc),e(ae,fn),e(fn,Qc),e(ae,Jc),e(ae,Fr),e(Fr,Kc),e(ae,Xc),e(ae,gn),e(gn,Zc),e(ae,el),e(z,tl),e(z,we),e(we,ol),e(we,Cr),e(Cr,nl),e(we,rl),e(we,Wt),e(Wt,sl),e(we,al),p(o,xa,h),p(o,un,h),e(un,il),p(o,Ea,h),p(o,_n,h),e(_n,dl),p(o,$a,h),D(Vt,o,h),p(o,ka,h),p(o,bn,h),e(bn,cl),p(o,ja,h),D(Bt,o,h),p(o,Oa,h),p(o,vn,h),e(vn,ll),p(o,za,h),D(Yt,o,h),p(o,Pa,h),p(o,Dn,h),e(Dn,hl),p(o,Fa,h),p(o,We,h),e(We,Ir),e(Ir,ie),e(ie,qr),e(qr,ml),e(ie,pl),e(ie,Nr),e(Nr,fl),e(ie,gl),e(ie,Sr),e(Sr,ul),e(ie,_l),e(ie,Ar),e(Ar,bl),e(We,vl),e(We,L),e(L,de),e(de,Lr),e(Lr,Rr),e(Rr,Dl),e(de,yl),e(de,Mr),e(Mr,wl),e(de,Tl),e(de,Ur),e(Ur,xl),e(de,El),e(de,Hr),e(Hr,$l),e(L,kl),e(L,ce),e(ce,Gr),e(Gr,Wr),e(Wr,jl),e(ce,Ol),e(ce,Vr),e(Vr,yn),e(yn,zl),e(ce,Pl),e(ce,Br),e(Br,wn),e(wn,Fl),e(ce,Cl),e(ce,Yr),e(Yr,Tn),e(Tn,Il),e(L,ql),e(L,le),e(le,Qr),e(Qr,Jr),e(Jr,Nl),e(le,Sl),e(le,Kr),e(Kr,Al),e(le,Ll),e(le,Xr),e(Xr,Rl),e(le,Ml),e(le,Zr),e(Zr,Ul),e(L,Hl),e(L,he),e(he,Qt),e(Qt,es),e(es,Gl),e(Qt,Wl),e(Qt,xn),e(xn,Vl),e(he,Bl),e(he,Te),e(Te,Yl),e(Te,ts),e(ts,Ql),e(Te,Jl),e(Te,os),e(os,Kl),e(Te,Xl),e(he,Zl),e(he,R),e(R,eh),e(R,ns),e(ns,th),e(R,oh),e(R,rs),e(rs,nh),e(R,rh),e(R,ss),e(ss,sh),e(R,ah),e(R,as),e(as,ih),e(R,dh),e(R,is),e(is,ch),e(R,lh),e(he,hh),e(he,me),e(me,mh),e(me,ds),e(ds,ph),e(me,fh),e(me,cs),e(cs,gh),e(me,uh),e(me,ls),e(ls,_h),e(me,bh),e(L,vh),e(L,pe),e(pe,En),e(En,hs),e(hs,Dh),e(En,yh),e(pe,wh),e(pe,ms),e(ms,ps),e(ps,Th),e(pe,xh),e(pe,fs),e(fs,gs),e(gs,Eh),e(pe,$h),e(pe,Jt),e(Jt,us),e(us,kh),e(Jt,jh),e(Jt,_s),e(_s,Oh),e(L,zh),e(L,fe),e(fe,bs),e(bs,vs),e(vs,Ph),e(fe,Fh),e(fe,Kt),e(Kt,Ds),e(Ds,Ch),e(Kt,Ih),e(Kt,ys),e(ys,qh),e(fe,Nh),e(fe,xe),e(xe,ws),e(ws,Sh),e(xe,Ah),e(xe,Ts),e(Ts,Lh),e(xe,Rh),e(xe,xs),e(xs,Mh),e(fe,Uh),e(fe,ge),e(ge,Es),e(Es,Hh),e(ge,Gh),e(ge,$s),e($s,Wh),e(ge,Vh),e(ge,ks),e(ks,Bh),e(ge,Yh),e(ge,js),e(js,Qh),p(o,Ca,h),p(o,$,h),e($,Jh),e($,$n),e($n,Kh),e($,Xh),e($,Os),e(Os,Zh),e($,em),e($,zs),e(zs,tm),e($,om),e($,Ps),e(Ps,nm),e($,rm),e($,kn),e(kn,sm),e($,am),e($,Fs),e(Fs,im),e($,dm),e($,Cs),e(Cs,cm),e($,lm),e($,Xt),e(Xt,hm),e($,mm),e($,Zt),e(Zt,pm),e($,fm),p(o,Ia,h),p(o,Ee,h),e(Ee,Ve),e(Ve,Is),D(eo,Is,null),e(Ee,gm),e(Ee,qs),e(qs,um),p(o,qa,h),p(o,$e,h),D(to,$e,null),e($e,_m),e($e,Ns),e(Ns,bm),p(o,Na,h),p(o,ke,h),D(oo,ke,null),e(ke,vm),e(ke,no),e(no,Dm),e(no,jn),e(jn,ym),e(no,wm),p(o,Sa,h),p(o,je,h),D(ro,je,null),e(je,Tm),e(je,so),e(so,xm),e(so,On),e(On,Em),e(so,$m),p(o,Aa,h),p(o,Oe,h),e(Oe,Be),e(Be,Ss),D(ao,Ss,null),e(Oe,km),e(Oe,As),e(As,jm),p(o,La,h),p(o,Y,h),D(io,Y,null),e(Y,Om),e(Y,ze),e(ze,zm),e(ze,zn),e(zn,Pm),e(ze,Fm),e(ze,co),e(co,Cm),e(ze,Im),e(Y,qm),e(Y,Pe),e(Pe,Nm),e(Pe,Pn),e(Pn,Sm),e(Pe,Am),e(Pe,Fn),e(Fn,Lm),e(Pe,Rm),e(Y,Mm),D(Ye,Y,null),p(o,Ra,h),p(o,Fe,h),e(Fe,Qe),e(Qe,Ls),D(lo,Ls,null),e(Fe,Um),e(Fe,Rs),e(Rs,Hm),p(o,Ma,h),p(o,F,h),D(ho,F,null),e(F,Gm),e(F,Ms),e(Ms,Wm),e(F,Vm),e(F,Je),D(mo,Je,null),e(Je,Bm),e(Je,Us),e(Us,Ym),e(F,Qm),e(F,Ke),D(po,Ke,null),e(Ke,Jm),e(Ke,fo),e(fo,Km),e(fo,Cn),e(Cn,Xm),e(fo,Zm),e(F,ep),e(F,Xe),D(go,Xe,null),e(Xe,tp),e(Xe,uo),e(uo,op),e(uo,In),e(In,np),e(uo,rp),e(F,sp),e(F,Ze),D(_o,Ze,null),e(Ze,ap),e(Ze,bo),e(bo,ip),e(bo,qn),e(qn,dp),e(bo,cp),e(F,lp),e(F,et),D(vo,et,null),e(et,hp),e(et,Do),e(Do,mp),e(Do,Nn),e(Nn,pp),e(Do,fp),p(o,Ua,h),p(o,Ce,h),e(Ce,tt),e(tt,Hs),D(yo,Hs,null),e(Ce,gp),e(Ce,Gs),e(Gs,up),p(o,Ha,h),p(o,O,h),D(wo,O,null),e(O,_p),e(O,Ws),e(Ws,bp),e(O,vp),e(O,ot),D(To,ot,null),e(ot,Dp),e(ot,Vs),e(Vs,yp),e(O,wp),e(O,nt),D(xo,nt,null),e(nt,Tp),e(nt,Bs),e(Bs,xp),e(O,Ep),e(O,rt),D(Eo,rt,null),e(rt,$p),e(rt,$o),e($o,kp),e($o,Sn),e(Sn,jp),e($o,Op),e(O,zp),e(O,st),D(ko,st,null),e(st,Pp),e(st,jo),e(jo,Fp),e(jo,An),e(An,Cp),e(jo,Ip),e(O,qp),e(O,at),D(Oo,at,null),e(at,Np),e(at,zo),e(zo,Sp),e(zo,Ln),e(Ln,Ap),e(zo,Lp),e(O,Rp),e(O,it),D(Po,it,null),e(it,Mp),e(it,Fo),e(Fo,Up),e(Fo,Rn),e(Rn,Hp),e(Fo,Gp),p(o,Ga,h),p(o,Ie,h),e(Ie,dt),e(dt,Ys),D(Co,Ys,null),e(Ie,Wp),e(Ie,Qs),e(Qs,Vp),p(o,Wa,h),p(o,M,h),D(Io,M,null),e(M,Bp),e(M,Js),e(Js,Yp),e(M,Qp),e(M,qo),e(qo,Jp),e(qo,Mn),e(Mn,Kp),e(qo,Xp),e(M,Zp),e(M,No),e(No,ef),e(No,So),e(So,tf),e(No,of),e(M,nf),e(M,X),D(Ao,X,null),e(X,rf),e(X,qe),e(qe,sf),e(qe,Un),e(Un,af),e(qe,df),e(qe,Ks),e(Ks,cf),e(qe,lf),e(X,hf),D(ct,X,null),e(X,mf),D(lt,X,null),p(o,Va,h),p(o,Ne,h),e(Ne,ht),e(ht,Xs),D(Lo,Xs,null),e(Ne,pf),e(Ne,Zs),e(Zs,ff),p(o,Ba,h),p(o,U,h),D(Ro,U,null),e(U,gf),e(U,ea),e(ea,uf),e(U,_f),e(U,Mo),e(Mo,bf),e(Mo,Hn),e(Hn,vf),e(Mo,Df),e(U,yf),e(U,Uo),e(Uo,wf),e(Uo,Ho),e(Ho,Tf),e(Uo,xf),e(U,Ef),e(U,Z),D(Go,Z,null),e(Z,$f),e(Z,Se),e(Se,kf),e(Se,Gn),e(Gn,jf),e(Se,Of),e(Se,ta),e(ta,zf),e(Se,Pf),e(Z,Ff),D(mt,Z,null),e(Z,Cf),D(pt,Z,null),p(o,Ya,h),p(o,Ae,h),e(Ae,ft),e(ft,oa),D(Wo,oa,null),e(Ae,If),e(Ae,na),e(na,qf),p(o,Qa,h),p(o,H,h),D(Vo,H,null),e(H,Nf),e(H,ra),e(ra,Sf),e(H,Af),e(H,Bo),e(Bo,Lf),e(Bo,Wn),e(Wn,Rf),e(Bo,Mf),e(H,Uf),e(H,Yo),e(Yo,Hf),e(Yo,Qo),e(Qo,Gf),e(Yo,Wf),e(H,Vf),e(H,ee),D(Jo,ee,null),e(ee,Bf),e(ee,Le),e(Le,Yf),e(Le,Vn),e(Vn,Qf),e(Le,Jf),e(Le,sa),e(sa,Kf),e(Le,Xf),e(ee,Zf),D(gt,ee,null),e(ee,eg),D(ut,ee,null),Ja=!0},p(o,[h]){const Ko={};h&2&&(Ko.$$scope={dirty:h,ctx:o}),Ye.$set(Ko);const aa={};h&2&&(aa.$$scope={dirty:h,ctx:o}),ct.$set(aa);const ia={};h&2&&(ia.$$scope={dirty:h,ctx:o}),lt.$set(ia);const da={};h&2&&(da.$$scope={dirty:h,ctx:o}),mt.$set(da);const Xo={};h&2&&(Xo.$$scope={dirty:h,ctx:o}),pt.$set(Xo);const ca={};h&2&&(ca.$$scope={dirty:h,ctx:o}),gt.$set(ca);const la={};h&2&&(la.$$scope={dirty:h,ctx:o}),ut.$set(la)},i(o){Ja||(y(m.$$.fragment,o),y(Nt.$$.fragment,o),y(Vt.$$.fragment,o),y(Bt.$$.fragment,o),y(Yt.$$.fragment,o),y(eo.$$.fragment,o),y(to.$$.fragment,o),y(oo.$$.fragment,o),y(ro.$$.fragment,o),y(ao.$$.fragment,o),y(io.$$.fragment,o),y(Ye.$$.fragment,o),y(lo.$$.fragment,o),y(ho.$$.fragment,o),y(mo.$$.fragment,o),y(po.$$.fragment,o),y(go.$$.fragment,o),y(_o.$$.fragment,o),y(vo.$$.fragment,o),y(yo.$$.fragment,o),y(wo.$$.fragment,o),y(To.$$.fragment,o),y(xo.$$.fragment,o),y(Eo.$$.fragment,o),y(ko.$$.fragment,o),y(Oo.$$.fragment,o),y(Po.$$.fragment,o),y(Co.$$.fragment,o),y(Io.$$.fragment,o),y(Ao.$$.fragment,o),y(ct.$$.fragment,o),y(lt.$$.fragment,o),y(Lo.$$.fragment,o),y(Ro.$$.fragment,o),y(Go.$$.fragment,o),y(mt.$$.fragment,o),y(pt.$$.fragment,o),y(Wo.$$.fragment,o),y(Vo.$$.fragment,o),y(Jo.$$.fragment,o),y(gt.$$.fragment,o),y(ut.$$.fragment,o),Ja=!0)},o(o){w(m.$$.fragment,o),w(Nt.$$.fragment,o),w(Vt.$$.fragment,o),w(Bt.$$.fragment,o),w(Yt.$$.fragment,o),w(eo.$$.fragment,o),w(to.$$.fragment,o),w(oo.$$.fragment,o),w(ro.$$.fragment,o),w(ao.$$.fragment,o),w(io.$$.fragment,o),w(Ye.$$.fragment,o),w(lo.$$.fragment,o),w(ho.$$.fragment,o),w(mo.$$.fragment,o),w(po.$$.fragment,o),w(go.$$.fragment,o),w(_o.$$.fragment,o),w(vo.$$.fragment,o),w(yo.$$.fragment,o),w(wo.$$.fragment,o),w(To.$$.fragment,o),w(xo.$$.fragment,o),w(Eo.$$.fragment,o),w(ko.$$.fragment,o),w(Oo.$$.fragment,o),w(Po.$$.fragment,o),w(Co.$$.fragment,o),w(Io.$$.fragment,o),w(Ao.$$.fragment,o),w(ct.$$.fragment,o),w(lt.$$.fragment,o),w(Lo.$$.fragment,o),w(Ro.$$.fragment,o),w(Go.$$.fragment,o),w(mt.$$.fragment,o),w(pt.$$.fragment,o),w(Wo.$$.fragment,o),w(Vo.$$.fragment,o),w(Jo.$$.fragment,o),w(gt.$$.fragment,o),w(ut.$$.fragment,o),Ja=!1},d(o){t(f),o&&t(E),o&&t(_),T(m),o&&t(ha),o&&t(ye),T(Nt),o&&t(ma),o&&t(Ue),o&&t(pa),o&&t(en),o&&t(fa),o&&t(tn),o&&t(ga),o&&t(ue),o&&t(ua),o&&t(He),o&&t(_a),o&&t(Ge),o&&t(ba),o&&t(j),o&&t(va),o&&t(C),o&&t(Da),o&&t(J),o&&t(ya),o&&t(K),o&&t(wa),o&&t(an),o&&t(Ta),o&&t(z),o&&t(xa),o&&t(un),o&&t(Ea),o&&t(_n),o&&t($a),T(Vt,o),o&&t(ka),o&&t(bn),o&&t(ja),T(Bt,o),o&&t(Oa),o&&t(vn),o&&t(za),T(Yt,o),o&&t(Pa),o&&t(Dn),o&&t(Fa),o&&t(We),o&&t(Ca),o&&t($),o&&t(Ia),o&&t(Ee),T(eo),o&&t(qa),o&&t($e),T(to),o&&t(Na),o&&t(ke),T(oo),o&&t(Sa),o&&t(je),T(ro),o&&t(Aa),o&&t(Oe),T(ao),o&&t(La),o&&t(Y),T(io),T(Ye),o&&t(Ra),o&&t(Fe),T(lo),o&&t(Ma),o&&t(F),T(ho),T(mo),T(po),T(go),T(_o),T(vo),o&&t(Ua),o&&t(Ce),T(yo),o&&t(Ha),o&&t(O),T(wo),T(To),T(xo),T(Eo),T(ko),T(Oo),T(Po),o&&t(Ga),o&&t(Ie),T(Co),o&&t(Wa),o&&t(M),T(Io),T(Ao),T(ct),T(lt),o&&t(Va),o&&t(Ne),T(Lo),o&&t(Ba),o&&t(U),T(Ro),T(Go),T(mt),T(pt),o&&t(Ya),o&&t(Ae),T(Wo),o&&t(Qa),o&&t(H),T(Vo),T(Jo),T(gt),T(ut)}}}const Fb={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.DetrImageProcessor",title:"DetrImageProcessor"},{local:"transformers.DetrImageProcessor",title:"DetrFeatureExtractor"},{local:"transformers.DetrModel",title:"DetrModel"},{local:"transformers.DetrForObjectDetection",title:"DetrForObjectDetection"},{local:"transformers.DetrForSegmentation",title:"DetrForSegmentation"}],title:"DETR"};function Cb(q){return Tb(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Rb extends vb{constructor(f){super();Db(this,f,Cb,Pb,yb,{})}}export{Rb as default,Fb as metadata};
