import{S as Us,i as Hs,s as Ws,e as n,k as l,w,t as r,M as Vs,c as s,d as o,m,a,x as y,h as i,b as c,G as e,g as u,y as D,q as T,o as x,B as $,v as Bs,L as Gn}from"../../chunks/vendor-hf-doc-builder.js";import{T as Rs}from"../../chunks/Tip-hf-doc-builder.js";import{D as G}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Xn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as dt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Zn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Js(E){let h,v,_,f,b;return f=new Xn({props:{code:`from transformers import DetaConfig, DetaModel

# Initializing a DETA SenseTime/deformable-detr style configuration
configuration = DetaConfig()

# Initializing a model (with random weights) from the SenseTime/deformable-detr style configuration
model = DetaModel(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> DetaConfig, DetaModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a DETA SenseTime/deformable-detr style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = DetaConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the SenseTime/deformable-detr style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DetaModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){h=n("p"),v=r("Examples:"),_=l(),w(f.$$.fragment)},l(d){h=s(d,"P",{});var g=a(h);v=i(g,"Examples:"),g.forEach(o),_=m(d),y(f.$$.fragment,d)},m(d,g){u(d,h,g),e(h,v),u(d,_,g),D(f,d,g),b=!0},p:Gn,i(d){b||(T(f.$$.fragment,d),b=!0)},o(d){x(f.$$.fragment,d),b=!1},d(d){d&&o(h),d&&o(_),$(f,d)}}}function Zs(E){let h,v,_,f,b;return{c(){h=n("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),f=r("Module"),b=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(d){h=s(d,"P",{});var g=a(h);v=i(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(g,"CODE",{});var q=a(_);f=i(q,"Module"),q.forEach(o),b=i(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(o)},m(d,g){u(d,h,g),e(h,v),e(h,_),e(_,f),e(h,b)},d(d){d&&o(h)}}}function Gs(E){let h,v,_,f,b;return f=new Xn({props:{code:`from transformers import AutoImageProcessor, DetaModel
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 = AutoImageProcessor.from_pretrained("jozhang97/deta-swin-large-o365")
model = DetaModel.from_pretrained("jozhang97/deta-swin-large-o365", two_stage=False)

inputs = image_processor(images=image, return_tensors="pt")

outputs = model(**inputs)

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> AutoImageProcessor, DetaModel
<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 = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;jozhang97/deta-swin-large-o365&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DetaModel.from_pretrained(<span class="hljs-string">&quot;jozhang97/deta-swin-large-o365&quot;</span>, two_stage=<span class="hljs-literal">False</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>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">900</span>, <span class="hljs-number">256</span>]`}}),{c(){h=n("p"),v=r("Examples:"),_=l(),w(f.$$.fragment)},l(d){h=s(d,"P",{});var g=a(h);v=i(g,"Examples:"),g.forEach(o),_=m(d),y(f.$$.fragment,d)},m(d,g){u(d,h,g),e(h,v),u(d,_,g),D(f,d,g),b=!0},p:Gn,i(d){b||(T(f.$$.fragment,d),b=!0)},o(d){x(f.$$.fragment,d),b=!1},d(d){d&&o(h),d&&o(_),$(f,d)}}}function Xs(E){let h,v,_,f,b;return{c(){h=n("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),f=r("Module"),b=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(d){h=s(d,"P",{});var g=a(h);v=i(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s(g,"CODE",{});var q=a(_);f=i(q,"Module"),q.forEach(o),b=i(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(o)},m(d,g){u(d,h,g),e(h,v),e(h,_),e(_,f),e(h,b)},d(d){d&&o(h)}}}function Ks(E){let h,v,_,f,b;return f=new Xn({props:{code:`from transformers import AutoImageProcessor, DetaForObjectDetection
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 = AutoImageProcessor.from_pretrained("jozhang97/deta-swin-large")
model = DetaForObjectDetection.from_pretrained("jozhang97/deta-swin-large")

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.5, 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> AutoImageProcessor, DetaForObjectDetection
<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 = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;jozhang97/deta-swin-large&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DetaForObjectDetection.from_pretrained(<span class="hljs-string">&quot;jozhang97/deta-swin-large&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.5</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 cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.683</span> at location [<span class="hljs-number">345.85</span>, <span class="hljs-number">23.68</span>, <span class="hljs-number">639.86</span>, <span class="hljs-number">372.83</span>]
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.683</span> at location [<span class="hljs-number">8.8</span>, <span class="hljs-number">52.49</span>, <span class="hljs-number">316.93</span>, <span class="hljs-number">473.45</span>]
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.568</span> at location [<span class="hljs-number">40.02</span>, <span class="hljs-number">73.75</span>, <span class="hljs-number">175.96</span>, <span class="hljs-number">117.33</span>]
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.546</span> at location [<span class="hljs-number">333.68</span>, <span class="hljs-number">77.13</span>, <span class="hljs-number">370.12</span>, <span class="hljs-number">187.51</span>]`}}),{c(){h=n("p"),v=r("Examples:"),_=l(),w(f.$$.fragment)},l(d){h=s(d,"P",{});var g=a(h);v=i(g,"Examples:"),g.forEach(o),_=m(d),y(f.$$.fragment,d)},m(d,g){u(d,h,g),e(h,v),u(d,_,g),D(f,d,g),b=!0},p:Gn,i(d){b||(T(f.$$.fragment,d),b=!0)},o(d){x(f.$$.fragment,d),b=!1},d(d){d&&o(h),d&&o(_),$(f,d)}}}function Ys(E){let h,v,_,f,b,d,g,q,ao,Et,L,X,ct,he,ro,lt,io,Ct,A,co,pe,lo,mo,Se,ho,po,It,Re,fo,qt,Ue,mt,uo,At,He,go,Ft,We,fe,_o,Ve,bo,vo,Ot,F,wo,ue,yo,Do,ge,To,xo,Mt,S,K,ht,_e,$o,pt,jo,Nt,j,be,Po,R,zo,Be,ko,Eo,ve,Co,Io,qo,U,Ao,Je,Fo,Oo,Ze,Mo,No,Lo,Y,So,Q,we,Ro,H,Uo,Ge,Ho,Wo,ft,Vo,Bo,Lt,W,ee,ut,ye,Jo,gt,Zo,St,k,De,Go,_t,Xo,Ko,te,Te,Yo,bt,Qo,en,oe,xe,tn,$e,on,Xe,nn,sn,Rt,V,ne,vt,je,an,wt,rn,Ut,P,Pe,dn,yt,cn,ln,ze,mn,Ke,hn,pn,fn,ke,un,Ee,gn,_n,bn,C,Ce,vn,B,wn,Ye,yn,Dn,Dt,Tn,xn,$n,se,jn,ae,Ht,J,re,Tt,Ie,Pn,xt,zn,Wt,z,qe,kn,$t,En,Cn,Ae,In,Qe,qn,An,Fn,Fe,On,Oe,Mn,Nn,Ln,I,Me,Sn,Z,Rn,et,Un,Hn,jt,Wn,Vn,Bn,ie,Jn,de,Vt;return d=new dt({}),he=new dt({}),_e=new dt({}),be=new G({props:{name:"class transformers.DetaConfig",anchor:"transformers.DetaConfig",parameters:[{name:"backbone_config",val:" = None"},{name:"num_queries",val:" = 900"},{name:"max_position_embeddings",val:" = 2048"},{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:" = 1024"},{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:"return_intermediate",val:" = True"},{name:"auxiliary_loss",val:" = False"},{name:"position_embedding_type",val:" = 'sine'"},{name:"num_feature_levels",val:" = 5"},{name:"encoder_n_points",val:" = 4"},{name:"decoder_n_points",val:" = 4"},{name:"two_stage",val:" = True"},{name:"two_stage_num_proposals",val:" = 300"},{name:"with_box_refine",val:" = True"},{name:"assign_first_stage",val:" = True"},{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:"focal_alpha",val:" = 0.25"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DetaConfig.backbone_config",description:`<strong>backbone_config</strong> (<code>PretrainedConfig</code> or <code>dict</code>, <em>optional</em>, defaults to <code>ResNetConfig()</code>) &#x2014;
The configuration of the backbone model.`,name:"backbone_config"},{anchor:"transformers.DetaConfig.num_queries",description:`<strong>num_queries</strong> (<code>int</code>, <em>optional</em>, defaults to 900) &#x2014;
Number of object queries, i.e. detection slots. This is the maximal number of objects <a href="/docs/transformers/main/en/model_doc/deta#transformers.DetaModel">DetaModel</a> can
detect in a single image. In case <code>two_stage</code> is set to <code>True</code>, we use <code>two_stage_num_proposals</code> instead.`,name:"num_queries"},{anchor:"transformers.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.
encoder_layerdrop &#x2014; (<code>float</code>, <em>optional</em>, defaults to 0.0):
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.
decoder_layerdrop &#x2014; (<code>float</code>, <em>optional</em>, defaults to 0.0):
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:"init_xavier_std"},{anchor:"transformers.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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.DetaConfig.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"},{anchor:"transformers.DetaConfig.num_feature_levels",description:`<strong>num_feature_levels</strong> (<code>int</code>, <em>optional</em>, defaults to 5) &#x2014;
The number of input feature levels.`,name:"num_feature_levels"},{anchor:"transformers.DetaConfig.encoder_n_points",description:`<strong>encoder_n_points</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of sampled keys in each feature level for each attention head in the encoder.`,name:"encoder_n_points"},{anchor:"transformers.DetaConfig.decoder_n_points",description:`<strong>decoder_n_points</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of sampled keys in each feature level for each attention head in the decoder.`,name:"decoder_n_points"},{anchor:"transformers.DetaConfig.two_stage",description:`<strong>two_stage</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to apply a two-stage deformable DETR, where the region proposals are also generated by a variant of
DETA, which are further fed into the decoder for iterative bounding box refinement.`,name:"two_stage"},{anchor:"transformers.DetaConfig.two_stage_num_proposals",description:`<strong>two_stage_num_proposals</strong> (<code>int</code>, <em>optional</em>, defaults to 300) &#x2014;
The number of region proposals to be generated, in case <code>two_stage</code> is set to <code>True</code>.`,name:"two_stage_num_proposals"},{anchor:"transformers.DetaConfig.with_box_refine",description:`<strong>with_box_refine</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to apply iterative bounding box refinement, where each decoder layer refines the bounding boxes
based on the predictions from the previous layer.`,name:"with_box_refine"},{anchor:"transformers.DetaConfig.focal_alpha",description:`<strong>focal_alpha</strong> (<code>float</code>, <em>optional</em>, defaults to 0.25) &#x2014;
Alpha parameter in the focal loss.`,name:"focal_alpha"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deta/configuration_deta.py#L31"}}),Y=new Zn({props:{anchor:"transformers.DetaConfig.example",$$slots:{default:[Js]},$$scope:{ctx:E}}}),we=new G({props:{name:"to_dict",anchor:"transformers.DetaConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deta/configuration_deta.py#L239"}}),ye=new dt({}),De=new G({props:{name:"class transformers.DetaImageProcessor",anchor:"transformers.DetaImageProcessor",parameters:[{name:"format",val:": typing.Union[str, transformers.models.deta.image_processing_deta.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.DetaImageProcessor.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.DetaImageProcessor.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 (height, width) 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.DetaImageProcessor.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 (height, width) dimensions after resizing. Can be overridden by the <code>size</code> parameter in
the <code>preprocess</code> method.`,name:"size"},{anchor:"transformers.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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/main/src/transformers/models/deta/image_processing_deta.py#L445"}}),Te=new G({props:{name:"preprocess",anchor:"transformers.DetaImageProcessor.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.deta.image_processing_deta.AnnotionFormat, NoneType] = None"},{name:"return_tensors",val:": typing.Union[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DetaImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image or batch of images to preprocess.`,name:"images"},{anchor:"transformers.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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.DetaImageProcessor.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/main/src/transformers/models/deta/image_processing_deta.py#L731"}}),xe=new G({props:{name:"post_process_object_detection",anchor:"transformers.DetaImageProcessor.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"},{name:"nms_threshold",val:": float = 0.7"}],parametersDescription:[{anchor:"transformers.DetaImageProcessor.post_process_object_detection.outputs",description:`<strong>outputs</strong> (<code>DetrObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.DetaImageProcessor.post_process_object_detection.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Score threshold to keep object detection predictions.`,name:"threshold"},{anchor:"transformers.DetaImageProcessor.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
(height, width) of each image in the batch. If left to None, predictions will not be resized.`,name:"target_sizes"},{anchor:"transformers.DetaImageProcessor.post_process_object_detection.nms_threshold",description:`<strong>nms_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.7) &#x2014;
NMS threshold.`,name:"nms_threshold"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deta/image_processing_deta.py#L929",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>
`}}),je=new dt({}),Pe=new G({props:{name:"class transformers.DetaModel",anchor:"transformers.DetaModel",parameters:[{name:"config",val:": DetaConfig"}],parametersDescription:[{anchor:"transformers.DetaModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/deta#transformers.DetaConfig">DetaConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deta/modeling_deta.py#L1363"}}),Ce=new G({props:{name:"forward",anchor:"transformers.DetaModel.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.DetaModel.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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <code>AutoImageProcessor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.DetaModel.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.DetaModel.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.DetaModel.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.DetaModel.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.DetaModel.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.DetaModel.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.DetaModel.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.DetaModel.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deta/modeling_deta.py#L1528",returnDescription:`
<p>A <code>transformers.models.deta.modeling_deta.DetaModelOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/deta#transformers.DetaConfig"
>DetaConfig</a>) and inputs.</p>
<ul>
<li><strong>init_reference_points</strong> (<code>torch.FloatTensor</code> of shape  <code>(batch_size, num_queries, 4)</code>) \u2014 Initial reference points sent through the Transformer decoder.</li>
<li><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the decoder of the model.</li>
<li><strong>intermediate_hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.decoder_layers, num_queries, hidden_size)</code>) \u2014 Stacked intermediate hidden states (output of each layer of the decoder).</li>
<li><strong>intermediate_reference_points</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.decoder_layers, num_queries, 4)</code>) \u2014 Stacked intermediate reference points (reference points of each layer of the decoder).</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, num_queries, 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, num_queries, num_queries)</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_queries, num_heads, 4, 4)</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_queries, num_heads, 4, 4)</code>.
Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</li>
<li><strong>enc_outputs_class</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>, <em>optional</em>, returned when <code>config.with_box_refine=True</code> and <code>config.two_stage=True</code>) \u2014 Predicted bounding boxes scores where the top <code>config.two_stage_num_proposals</code> scoring bounding boxes are
picked as region proposals in the first stage. Output of bounding box binary classification (i.e.
foreground and background).</li>
<li><strong>enc_outputs_coord_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>, returned when <code>config.with_box_refine=True</code> and <code>config.two_stage=True</code>) \u2014 Logits of predicted bounding boxes coordinates in the first stage.</li>
</ul>
`,returnType:`
<p><code>transformers.models.deta.modeling_deta.DetaModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),se=new Rs({props:{$$slots:{default:[Zs]},$$scope:{ctx:E}}}),ae=new Zn({props:{anchor:"transformers.DetaModel.forward.example",$$slots:{default:[Gs]},$$scope:{ctx:E}}}),Ie=new dt({}),qe=new G({props:{name:"class transformers.DetaForObjectDetection",anchor:"transformers.DetaForObjectDetection",parameters:[{name:"config",val:": DetaConfig"}],parametersDescription:[{anchor:"transformers.DetaForObjectDetection.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/deta#transformers.DetaConfig">DetaConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deta/modeling_deta.py#L1780"}}),Me=new G({props:{name:"forward",anchor:"transformers.DetaForObjectDetection.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.DetaForObjectDetection.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/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <code>AutoImageProcessor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.DetaForObjectDetection.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.DetaForObjectDetection.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.DetaForObjectDetection.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.DetaForObjectDetection.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.DetaForObjectDetection.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.DetaForObjectDetection.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.DetaForObjectDetection.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.DetaForObjectDetection.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DetaForObjectDetection.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/main/src/transformers/models/deta/modeling_deta.py#L1833",returnDescription:`
<p>A <code>transformers.models.deta.modeling_deta.DetaObjectDetectionOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/deta#transformers.DetaConfig"
>DetaConfig</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 <code>~DetaProcessor.post_process_object_detection</code> 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, num_queries, 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, num_queries, 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, num_queries, num_queries)</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_queries, num_heads, 4, 4)</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, sequence_length, num_heads, 4, 4)</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>(batch_size, config.decoder_layers, num_queries, hidden_size)</code>) \u2014 Stacked intermediate hidden states (output of each layer of the decoder).</li>
<li><strong>intermediate_reference_points</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.decoder_layers, num_queries, 4)</code>) \u2014 Stacked intermediate reference points (reference points of each layer of the decoder).</li>
<li><strong>init_reference_points</strong> (<code>torch.FloatTensor</code> of shape  <code>(batch_size, num_queries, 4)</code>) \u2014 Initial reference points sent through the Transformer decoder.</li>
<li><strong>enc_outputs_class</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>, <em>optional</em>, returned when <code>config.with_box_refine=True</code> and <code>config.two_stage=True</code>) \u2014 Predicted bounding boxes scores where the top <code>config.two_stage_num_proposals</code> scoring bounding boxes are
picked as region proposals in the first stage. Output of bounding box binary classification (i.e.
foreground and background).</li>
<li><strong>enc_outputs_coord_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>, returned when <code>config.with_box_refine=True</code> and <code>config.two_stage=True</code>) \u2014 Logits of predicted bounding boxes coordinates in the first stage.</li>
</ul>
`,returnType:`
<p><code>transformers.models.deta.modeling_deta.DetaObjectDetectionOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ie=new Rs({props:{$$slots:{default:[Xs]},$$scope:{ctx:E}}}),de=new Zn({props:{anchor:"transformers.DetaForObjectDetection.forward.example",$$slots:{default:[Ks]},$$scope:{ctx:E}}}),{c(){h=n("meta"),v=l(),_=n("h1"),f=n("a"),b=n("span"),w(d.$$.fragment),g=l(),q=n("span"),ao=r("DETA"),Et=l(),L=n("h2"),X=n("a"),ct=n("span"),w(he.$$.fragment),ro=l(),lt=n("span"),io=r("Overview"),Ct=l(),A=n("p"),co=r("The DETA model was proposed in "),pe=n("a"),lo=r("NMS Strikes Back"),mo=r(` by Jeffrey Ouyang-Zhang, Jang Hyun Cho, Xingyi Zhou, Philipp Kr\xE4henb\xFChl.
DETA (short for Detection Transformers with Assignment) improves `),Se=n("a"),ho=r("Deformable DETR"),po=r(` by replacing the one-to-one bipartite Hungarian matching loss
with one-to-many label assignments used in traditional detectors with non-maximum suppression (NMS). This leads to significant gains of up to 2.5 mAP.`),It=l(),Re=n("p"),fo=r("The abstract from the paper is the following:"),qt=l(),Ue=n("p"),mt=n("em"),uo=r("Detection Transformer (DETR) directly transforms queries to unique objects by using one-to-one bipartite matching during training and enables end-to-end object detection. Recently, these models have surpassed traditional detectors on COCO with undeniable elegance. However, they differ from traditional detectors in multiple designs, including model architecture and training schedules, and thus the effectiveness of one-to-one matching is not fully understood. In this work, we conduct a strict comparison between the one-to-one Hungarian matching in DETRs and the one-to-many label assignments in traditional detectors with non-maximum supervision (NMS). Surprisingly, we observe one-to-many assignments with NMS consistently outperform standard one-to-one matching under the same setting, with a significant gain of up to 2.5 mAP. Our detector that trains Deformable-DETR with traditional IoU-based label assignment achieved 50.2 COCO mAP within 12 epochs (1x schedule) with ResNet50 backbone, outperforming all existing traditional or transformer-based detectors in this setting. On multiple datasets, schedules, and architectures, we consistently show bipartite matching is unnecessary for performant detection transformers. Furthermore, we attribute the success of detection transformers to their expressive transformer architecture."),At=l(),He=n("p"),go=r("Tips:"),Ft=l(),We=n("ul"),fe=n("li"),_o=r("One can use "),Ve=n("a"),bo=r("DetaImageProcessor"),vo=r(" to prepare images and optional targets for the model."),Ot=l(),F=n("p"),wo=r("This model was contributed by "),ue=n("a"),yo=r("nielsr"),Do=r(`.
The original code can be found `),ge=n("a"),To=r("here"),xo=r("."),Mt=l(),S=n("h2"),K=n("a"),ht=n("span"),w(_e.$$.fragment),$o=l(),pt=n("span"),jo=r("DetaConfig"),Nt=l(),j=n("div"),w(be.$$.fragment),Po=l(),R=n("p"),zo=r("This is the configuration class to store the configuration of a "),Be=n("a"),ko=r("DetaModel"),Eo=r(`. It is used to instantiate a DETA
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 DETA
`),ve=n("a"),Co=r("SenseTime/deformable-detr"),Io=r(" architecture."),qo=l(),U=n("p"),Ao=r("Configuration objects inherit from "),Je=n("a"),Fo=r("PretrainedConfig"),Oo=r(` and can be used to control the model outputs. Read the
documentation from `),Ze=n("a"),Mo=r("PretrainedConfig"),No=r(" for more information."),Lo=l(),w(Y.$$.fragment),So=l(),Q=n("div"),w(we.$$.fragment),Ro=l(),H=n("p"),Uo=r("Serializes this instance to a Python dictionary. Override the default "),Ge=n("a"),Ho=r("to_dict()"),Wo=r(`. Returns:
`),ft=n("code"),Vo=r("Dict[str, any]"),Bo=r(": Dictionary of all the attributes that make up this configuration instance,"),Lt=l(),W=n("h2"),ee=n("a"),ut=n("span"),w(ye.$$.fragment),Jo=l(),gt=n("span"),Zo=r("DetaImageProcessor"),St=l(),k=n("div"),w(De.$$.fragment),Go=l(),_t=n("p"),Xo=r("Constructs a Deformable DETR image processor."),Ko=l(),te=n("div"),w(Te.$$.fragment),Yo=l(),bt=n("p"),Qo=r("Preprocess an image or a batch of images so that it can be used by the model."),en=l(),oe=n("div"),w(xe.$$.fragment),tn=l(),$e=n("p"),on=r("Converts the output of "),Xe=n("a"),nn=r("DetaForObjectDetection"),sn=r(` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format. Only supports PyTorch.`),Rt=l(),V=n("h2"),ne=n("a"),vt=n("span"),w(je.$$.fragment),an=l(),wt=n("span"),rn=r("DetaModel"),Ut=l(),P=n("div"),w(Pe.$$.fragment),dn=l(),yt=n("p"),cn=r(`The bare DETA Model (consisting of a backbone and encoder-decoder Transformer) outputting raw hidden-states without
any specific head on top.`),ln=l(),ze=n("p"),mn=r("This model inherits from "),Ke=n("a"),hn=r("PreTrainedModel"),pn=r(`. 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.)`),fn=l(),ke=n("p"),un=r("This model is also a PyTorch "),Ee=n("a"),gn=r("torch.nn.Module"),_n=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),bn=l(),C=n("div"),w(Ce.$$.fragment),vn=l(),B=n("p"),wn=r("The "),Ye=n("a"),yn=r("DetaModel"),Dn=r(" forward method, overrides the "),Dt=n("code"),Tn=r("__call__"),xn=r(" special method."),$n=l(),w(se.$$.fragment),jn=l(),w(ae.$$.fragment),Ht=l(),J=n("h2"),re=n("a"),Tt=n("span"),w(Ie.$$.fragment),Pn=l(),xt=n("span"),zn=r("DetaForObjectDetection"),Wt=l(),z=n("div"),w(qe.$$.fragment),kn=l(),$t=n("p"),En=r(`DETA Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on top, for tasks
such as COCO detection.`),Cn=l(),Ae=n("p"),In=r("This model inherits from "),Qe=n("a"),qn=r("PreTrainedModel"),An=r(`. 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.)`),Fn=l(),Fe=n("p"),On=r("This model is also a PyTorch "),Oe=n("a"),Mn=r("torch.nn.Module"),Nn=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ln=l(),I=n("div"),w(Me.$$.fragment),Sn=l(),Z=n("p"),Rn=r("The "),et=n("a"),Un=r("DetaForObjectDetection"),Hn=r(" forward method, overrides the "),jt=n("code"),Wn=r("__call__"),Vn=r(" special method."),Bn=l(),w(ie.$$.fragment),Jn=l(),w(de.$$.fragment),this.h()},l(t){const p=Vs('[data-svelte="svelte-1phssyn"]',document.head);h=s(p,"META",{name:!0,content:!0}),p.forEach(o),v=m(t),_=s(t,"H1",{class:!0});var Ne=a(_);f=s(Ne,"A",{id:!0,class:!0,href:!0});var Pt=a(f);b=s(Pt,"SPAN",{});var zt=a(b);y(d.$$.fragment,zt),zt.forEach(o),Pt.forEach(o),g=m(Ne),q=s(Ne,"SPAN",{});var kt=a(q);ao=i(kt,"DETA"),kt.forEach(o),Ne.forEach(o),Et=m(t),L=s(t,"H2",{class:!0});var Le=a(L);X=s(Le,"A",{id:!0,class:!0,href:!0});var Kn=a(X);ct=s(Kn,"SPAN",{});var Yn=a(ct);y(he.$$.fragment,Yn),Yn.forEach(o),Kn.forEach(o),ro=m(Le),lt=s(Le,"SPAN",{});var Qn=a(lt);io=i(Qn,"Overview"),Qn.forEach(o),Le.forEach(o),Ct=m(t),A=s(t,"P",{});var tt=a(A);co=i(tt,"The DETA model was proposed in "),pe=s(tt,"A",{href:!0,rel:!0});var es=a(pe);lo=i(es,"NMS Strikes Back"),es.forEach(o),mo=i(tt,` by Jeffrey Ouyang-Zhang, Jang Hyun Cho, Xingyi Zhou, Philipp Kr\xE4henb\xFChl.
DETA (short for Detection Transformers with Assignment) improves `),Se=s(tt,"A",{href:!0});var ts=a(Se);ho=i(ts,"Deformable DETR"),ts.forEach(o),po=i(tt,` by replacing the one-to-one bipartite Hungarian matching loss
with one-to-many label assignments used in traditional detectors with non-maximum suppression (NMS). This leads to significant gains of up to 2.5 mAP.`),tt.forEach(o),It=m(t),Re=s(t,"P",{});var os=a(Re);fo=i(os,"The abstract from the paper is the following:"),os.forEach(o),qt=m(t),Ue=s(t,"P",{});var ns=a(Ue);mt=s(ns,"EM",{});var ss=a(mt);uo=i(ss,"Detection Transformer (DETR) directly transforms queries to unique objects by using one-to-one bipartite matching during training and enables end-to-end object detection. Recently, these models have surpassed traditional detectors on COCO with undeniable elegance. However, they differ from traditional detectors in multiple designs, including model architecture and training schedules, and thus the effectiveness of one-to-one matching is not fully understood. In this work, we conduct a strict comparison between the one-to-one Hungarian matching in DETRs and the one-to-many label assignments in traditional detectors with non-maximum supervision (NMS). Surprisingly, we observe one-to-many assignments with NMS consistently outperform standard one-to-one matching under the same setting, with a significant gain of up to 2.5 mAP. Our detector that trains Deformable-DETR with traditional IoU-based label assignment achieved 50.2 COCO mAP within 12 epochs (1x schedule) with ResNet50 backbone, outperforming all existing traditional or transformer-based detectors in this setting. On multiple datasets, schedules, and architectures, we consistently show bipartite matching is unnecessary for performant detection transformers. Furthermore, we attribute the success of detection transformers to their expressive transformer architecture."),ss.forEach(o),ns.forEach(o),At=m(t),He=s(t,"P",{});var as=a(He);go=i(as,"Tips:"),as.forEach(o),Ft=m(t),We=s(t,"UL",{});var rs=a(We);fe=s(rs,"LI",{});var Bt=a(fe);_o=i(Bt,"One can use "),Ve=s(Bt,"A",{href:!0});var is=a(Ve);bo=i(is,"DetaImageProcessor"),is.forEach(o),vo=i(Bt," to prepare images and optional targets for the model."),Bt.forEach(o),rs.forEach(o),Ot=m(t),F=s(t,"P",{});var ot=a(F);wo=i(ot,"This model was contributed by "),ue=s(ot,"A",{href:!0,rel:!0});var ds=a(ue);yo=i(ds,"nielsr"),ds.forEach(o),Do=i(ot,`.
The original code can be found `),ge=s(ot,"A",{href:!0,rel:!0});var cs=a(ge);To=i(cs,"here"),cs.forEach(o),xo=i(ot,"."),ot.forEach(o),Mt=m(t),S=s(t,"H2",{class:!0});var Jt=a(S);K=s(Jt,"A",{id:!0,class:!0,href:!0});var ls=a(K);ht=s(ls,"SPAN",{});var ms=a(ht);y(_e.$$.fragment,ms),ms.forEach(o),ls.forEach(o),$o=m(Jt),pt=s(Jt,"SPAN",{});var hs=a(pt);jo=i(hs,"DetaConfig"),hs.forEach(o),Jt.forEach(o),Nt=m(t),j=s(t,"DIV",{class:!0});var O=a(j);y(be.$$.fragment,O),Po=m(O),R=s(O,"P",{});var nt=a(R);zo=i(nt,"This is the configuration class to store the configuration of a "),Be=s(nt,"A",{href:!0});var ps=a(Be);ko=i(ps,"DetaModel"),ps.forEach(o),Eo=i(nt,`. It is used to instantiate a DETA
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 DETA
`),ve=s(nt,"A",{href:!0,rel:!0});var fs=a(ve);Co=i(fs,"SenseTime/deformable-detr"),fs.forEach(o),Io=i(nt," architecture."),nt.forEach(o),qo=m(O),U=s(O,"P",{});var st=a(U);Ao=i(st,"Configuration objects inherit from "),Je=s(st,"A",{href:!0});var us=a(Je);Fo=i(us,"PretrainedConfig"),us.forEach(o),Oo=i(st,` and can be used to control the model outputs. Read the
documentation from `),Ze=s(st,"A",{href:!0});var gs=a(Ze);Mo=i(gs,"PretrainedConfig"),gs.forEach(o),No=i(st," for more information."),st.forEach(o),Lo=m(O),y(Y.$$.fragment,O),So=m(O),Q=s(O,"DIV",{class:!0});var Zt=a(Q);y(we.$$.fragment,Zt),Ro=m(Zt),H=s(Zt,"P",{});var at=a(H);Uo=i(at,"Serializes this instance to a Python dictionary. Override the default "),Ge=s(at,"A",{href:!0});var _s=a(Ge);Ho=i(_s,"to_dict()"),_s.forEach(o),Wo=i(at,`. Returns:
`),ft=s(at,"CODE",{});var bs=a(ft);Vo=i(bs,"Dict[str, any]"),bs.forEach(o),Bo=i(at,": Dictionary of all the attributes that make up this configuration instance,"),at.forEach(o),Zt.forEach(o),O.forEach(o),Lt=m(t),W=s(t,"H2",{class:!0});var Gt=a(W);ee=s(Gt,"A",{id:!0,class:!0,href:!0});var vs=a(ee);ut=s(vs,"SPAN",{});var ws=a(ut);y(ye.$$.fragment,ws),ws.forEach(o),vs.forEach(o),Jo=m(Gt),gt=s(Gt,"SPAN",{});var ys=a(gt);Zo=i(ys,"DetaImageProcessor"),ys.forEach(o),Gt.forEach(o),St=m(t),k=s(t,"DIV",{class:!0});var ce=a(k);y(De.$$.fragment,ce),Go=m(ce),_t=s(ce,"P",{});var Ds=a(_t);Xo=i(Ds,"Constructs a Deformable DETR image processor."),Ds.forEach(o),Ko=m(ce),te=s(ce,"DIV",{class:!0});var Xt=a(te);y(Te.$$.fragment,Xt),Yo=m(Xt),bt=s(Xt,"P",{});var Ts=a(bt);Qo=i(Ts,"Preprocess an image or a batch of images so that it can be used by the model."),Ts.forEach(o),Xt.forEach(o),en=m(ce),oe=s(ce,"DIV",{class:!0});var Kt=a(oe);y(xe.$$.fragment,Kt),tn=m(Kt),$e=s(Kt,"P",{});var Yt=a($e);on=i(Yt,"Converts the output of "),Xe=s(Yt,"A",{href:!0});var xs=a(Xe);nn=i(xs,"DetaForObjectDetection"),xs.forEach(o),sn=i(Yt,` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format. Only supports PyTorch.`),Yt.forEach(o),Kt.forEach(o),ce.forEach(o),Rt=m(t),V=s(t,"H2",{class:!0});var Qt=a(V);ne=s(Qt,"A",{id:!0,class:!0,href:!0});var $s=a(ne);vt=s($s,"SPAN",{});var js=a(vt);y(je.$$.fragment,js),js.forEach(o),$s.forEach(o),an=m(Qt),wt=s(Qt,"SPAN",{});var Ps=a(wt);rn=i(Ps,"DetaModel"),Ps.forEach(o),Qt.forEach(o),Ut=m(t),P=s(t,"DIV",{class:!0});var M=a(P);y(Pe.$$.fragment,M),dn=m(M),yt=s(M,"P",{});var zs=a(yt);cn=i(zs,`The bare DETA Model (consisting of a backbone and encoder-decoder Transformer) outputting raw hidden-states without
any specific head on top.`),zs.forEach(o),ln=m(M),ze=s(M,"P",{});var eo=a(ze);mn=i(eo,"This model inherits from "),Ke=s(eo,"A",{href:!0});var ks=a(Ke);hn=i(ks,"PreTrainedModel"),ks.forEach(o),pn=i(eo,`. 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.)`),eo.forEach(o),fn=m(M),ke=s(M,"P",{});var to=a(ke);un=i(to,"This model is also a PyTorch "),Ee=s(to,"A",{href:!0,rel:!0});var Es=a(Ee);gn=i(Es,"torch.nn.Module"),Es.forEach(o),_n=i(to,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),to.forEach(o),bn=m(M),C=s(M,"DIV",{class:!0});var le=a(C);y(Ce.$$.fragment,le),vn=m(le),B=s(le,"P",{});var rt=a(B);wn=i(rt,"The "),Ye=s(rt,"A",{href:!0});var Cs=a(Ye);yn=i(Cs,"DetaModel"),Cs.forEach(o),Dn=i(rt," forward method, overrides the "),Dt=s(rt,"CODE",{});var Is=a(Dt);Tn=i(Is,"__call__"),Is.forEach(o),xn=i(rt," special method."),rt.forEach(o),$n=m(le),y(se.$$.fragment,le),jn=m(le),y(ae.$$.fragment,le),le.forEach(o),M.forEach(o),Ht=m(t),J=s(t,"H2",{class:!0});var oo=a(J);re=s(oo,"A",{id:!0,class:!0,href:!0});var qs=a(re);Tt=s(qs,"SPAN",{});var As=a(Tt);y(Ie.$$.fragment,As),As.forEach(o),qs.forEach(o),Pn=m(oo),xt=s(oo,"SPAN",{});var Fs=a(xt);zn=i(Fs,"DetaForObjectDetection"),Fs.forEach(o),oo.forEach(o),Wt=m(t),z=s(t,"DIV",{class:!0});var N=a(z);y(qe.$$.fragment,N),kn=m(N),$t=s(N,"P",{});var Os=a($t);En=i(Os,`DETA Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on top, for tasks
such as COCO detection.`),Os.forEach(o),Cn=m(N),Ae=s(N,"P",{});var no=a(Ae);In=i(no,"This model inherits from "),Qe=s(no,"A",{href:!0});var Ms=a(Qe);qn=i(Ms,"PreTrainedModel"),Ms.forEach(o),An=i(no,`. 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.)`),no.forEach(o),Fn=m(N),Fe=s(N,"P",{});var so=a(Fe);On=i(so,"This model is also a PyTorch "),Oe=s(so,"A",{href:!0,rel:!0});var Ns=a(Oe);Mn=i(Ns,"torch.nn.Module"),Ns.forEach(o),Nn=i(so,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),so.forEach(o),Ln=m(N),I=s(N,"DIV",{class:!0});var me=a(I);y(Me.$$.fragment,me),Sn=m(me),Z=s(me,"P",{});var it=a(Z);Rn=i(it,"The "),et=s(it,"A",{href:!0});var Ls=a(et);Un=i(Ls,"DetaForObjectDetection"),Ls.forEach(o),Hn=i(it," forward method, overrides the "),jt=s(it,"CODE",{});var Ss=a(jt);Wn=i(Ss,"__call__"),Ss.forEach(o),Vn=i(it," special method."),it.forEach(o),Bn=m(me),y(ie.$$.fragment,me),Jn=m(me),y(de.$$.fragment,me),me.forEach(o),N.forEach(o),this.h()},h(){c(h,"name","hf:doc:metadata"),c(h,"content",JSON.stringify(Qs)),c(f,"id","deta"),c(f,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(f,"href","#deta"),c(_,"class","relative group"),c(X,"id","overview"),c(X,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(X,"href","#overview"),c(L,"class","relative group"),c(pe,"href","https://arxiv.org/abs/2212.06137"),c(pe,"rel","nofollow"),c(Se,"href","deformable_detr"),c(Ve,"href","/docs/transformers/main/en/model_doc/deta#transformers.DetaImageProcessor"),c(ue,"href","https://huggingface.co/nielsr"),c(ue,"rel","nofollow"),c(ge,"href","https://github.com/jozhang97/DETA"),c(ge,"rel","nofollow"),c(K,"id","transformers.DetaConfig"),c(K,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(K,"href","#transformers.DetaConfig"),c(S,"class","relative group"),c(Be,"href","/docs/transformers/main/en/model_doc/deta#transformers.DetaModel"),c(ve,"href","https://huggingface.co/SenseTime/deformable-detr"),c(ve,"rel","nofollow"),c(Je,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(Ze,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(Ge,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig.to_dict"),c(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ee,"id","transformers.DetaImageProcessor"),c(ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ee,"href","#transformers.DetaImageProcessor"),c(W,"class","relative group"),c(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Xe,"href","/docs/transformers/main/en/model_doc/deta#transformers.DetaForObjectDetection"),c(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ne,"id","transformers.DetaModel"),c(ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ne,"href","#transformers.DetaModel"),c(V,"class","relative group"),c(Ke,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(Ee,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ee,"rel","nofollow"),c(Ye,"href","/docs/transformers/main/en/model_doc/deta#transformers.DetaModel"),c(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(re,"id","transformers.DetaForObjectDetection"),c(re,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(re,"href","#transformers.DetaForObjectDetection"),c(J,"class","relative group"),c(Qe,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(Oe,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Oe,"rel","nofollow"),c(et,"href","/docs/transformers/main/en/model_doc/deta#transformers.DetaForObjectDetection"),c(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,h),u(t,v,p),u(t,_,p),e(_,f),e(f,b),D(d,b,null),e(_,g),e(_,q),e(q,ao),u(t,Et,p),u(t,L,p),e(L,X),e(X,ct),D(he,ct,null),e(L,ro),e(L,lt),e(lt,io),u(t,Ct,p),u(t,A,p),e(A,co),e(A,pe),e(pe,lo),e(A,mo),e(A,Se),e(Se,ho),e(A,po),u(t,It,p),u(t,Re,p),e(Re,fo),u(t,qt,p),u(t,Ue,p),e(Ue,mt),e(mt,uo),u(t,At,p),u(t,He,p),e(He,go),u(t,Ft,p),u(t,We,p),e(We,fe),e(fe,_o),e(fe,Ve),e(Ve,bo),e(fe,vo),u(t,Ot,p),u(t,F,p),e(F,wo),e(F,ue),e(ue,yo),e(F,Do),e(F,ge),e(ge,To),e(F,xo),u(t,Mt,p),u(t,S,p),e(S,K),e(K,ht),D(_e,ht,null),e(S,$o),e(S,pt),e(pt,jo),u(t,Nt,p),u(t,j,p),D(be,j,null),e(j,Po),e(j,R),e(R,zo),e(R,Be),e(Be,ko),e(R,Eo),e(R,ve),e(ve,Co),e(R,Io),e(j,qo),e(j,U),e(U,Ao),e(U,Je),e(Je,Fo),e(U,Oo),e(U,Ze),e(Ze,Mo),e(U,No),e(j,Lo),D(Y,j,null),e(j,So),e(j,Q),D(we,Q,null),e(Q,Ro),e(Q,H),e(H,Uo),e(H,Ge),e(Ge,Ho),e(H,Wo),e(H,ft),e(ft,Vo),e(H,Bo),u(t,Lt,p),u(t,W,p),e(W,ee),e(ee,ut),D(ye,ut,null),e(W,Jo),e(W,gt),e(gt,Zo),u(t,St,p),u(t,k,p),D(De,k,null),e(k,Go),e(k,_t),e(_t,Xo),e(k,Ko),e(k,te),D(Te,te,null),e(te,Yo),e(te,bt),e(bt,Qo),e(k,en),e(k,oe),D(xe,oe,null),e(oe,tn),e(oe,$e),e($e,on),e($e,Xe),e(Xe,nn),e($e,sn),u(t,Rt,p),u(t,V,p),e(V,ne),e(ne,vt),D(je,vt,null),e(V,an),e(V,wt),e(wt,rn),u(t,Ut,p),u(t,P,p),D(Pe,P,null),e(P,dn),e(P,yt),e(yt,cn),e(P,ln),e(P,ze),e(ze,mn),e(ze,Ke),e(Ke,hn),e(ze,pn),e(P,fn),e(P,ke),e(ke,un),e(ke,Ee),e(Ee,gn),e(ke,_n),e(P,bn),e(P,C),D(Ce,C,null),e(C,vn),e(C,B),e(B,wn),e(B,Ye),e(Ye,yn),e(B,Dn),e(B,Dt),e(Dt,Tn),e(B,xn),e(C,$n),D(se,C,null),e(C,jn),D(ae,C,null),u(t,Ht,p),u(t,J,p),e(J,re),e(re,Tt),D(Ie,Tt,null),e(J,Pn),e(J,xt),e(xt,zn),u(t,Wt,p),u(t,z,p),D(qe,z,null),e(z,kn),e(z,$t),e($t,En),e(z,Cn),e(z,Ae),e(Ae,In),e(Ae,Qe),e(Qe,qn),e(Ae,An),e(z,Fn),e(z,Fe),e(Fe,On),e(Fe,Oe),e(Oe,Mn),e(Fe,Nn),e(z,Ln),e(z,I),D(Me,I,null),e(I,Sn),e(I,Z),e(Z,Rn),e(Z,et),e(et,Un),e(Z,Hn),e(Z,jt),e(jt,Wn),e(Z,Vn),e(I,Bn),D(ie,I,null),e(I,Jn),D(de,I,null),Vt=!0},p(t,[p]){const Ne={};p&2&&(Ne.$$scope={dirty:p,ctx:t}),Y.$set(Ne);const Pt={};p&2&&(Pt.$$scope={dirty:p,ctx:t}),se.$set(Pt);const zt={};p&2&&(zt.$$scope={dirty:p,ctx:t}),ae.$set(zt);const kt={};p&2&&(kt.$$scope={dirty:p,ctx:t}),ie.$set(kt);const Le={};p&2&&(Le.$$scope={dirty:p,ctx:t}),de.$set(Le)},i(t){Vt||(T(d.$$.fragment,t),T(he.$$.fragment,t),T(_e.$$.fragment,t),T(be.$$.fragment,t),T(Y.$$.fragment,t),T(we.$$.fragment,t),T(ye.$$.fragment,t),T(De.$$.fragment,t),T(Te.$$.fragment,t),T(xe.$$.fragment,t),T(je.$$.fragment,t),T(Pe.$$.fragment,t),T(Ce.$$.fragment,t),T(se.$$.fragment,t),T(ae.$$.fragment,t),T(Ie.$$.fragment,t),T(qe.$$.fragment,t),T(Me.$$.fragment,t),T(ie.$$.fragment,t),T(de.$$.fragment,t),Vt=!0)},o(t){x(d.$$.fragment,t),x(he.$$.fragment,t),x(_e.$$.fragment,t),x(be.$$.fragment,t),x(Y.$$.fragment,t),x(we.$$.fragment,t),x(ye.$$.fragment,t),x(De.$$.fragment,t),x(Te.$$.fragment,t),x(xe.$$.fragment,t),x(je.$$.fragment,t),x(Pe.$$.fragment,t),x(Ce.$$.fragment,t),x(se.$$.fragment,t),x(ae.$$.fragment,t),x(Ie.$$.fragment,t),x(qe.$$.fragment,t),x(Me.$$.fragment,t),x(ie.$$.fragment,t),x(de.$$.fragment,t),Vt=!1},d(t){o(h),t&&o(v),t&&o(_),$(d),t&&o(Et),t&&o(L),$(he),t&&o(Ct),t&&o(A),t&&o(It),t&&o(Re),t&&o(qt),t&&o(Ue),t&&o(At),t&&o(He),t&&o(Ft),t&&o(We),t&&o(Ot),t&&o(F),t&&o(Mt),t&&o(S),$(_e),t&&o(Nt),t&&o(j),$(be),$(Y),$(we),t&&o(Lt),t&&o(W),$(ye),t&&o(St),t&&o(k),$(De),$(Te),$(xe),t&&o(Rt),t&&o(V),$(je),t&&o(Ut),t&&o(P),$(Pe),$(Ce),$(se),$(ae),t&&o(Ht),t&&o(J),$(Ie),t&&o(Wt),t&&o(z),$(qe),$(Me),$(ie),$(de)}}}const Qs={local:"deta",sections:[{local:"overview",title:"Overview"},{local:"transformers.DetaConfig",title:"DetaConfig"},{local:"transformers.DetaImageProcessor",title:"DetaImageProcessor"},{local:"transformers.DetaModel",title:"DetaModel"},{local:"transformers.DetaForObjectDetection",title:"DetaForObjectDetection"}],title:"DETA"};function ea(E){return Bs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ia extends Us{constructor(h){super();Hs(this,h,ea,Ys,Ws,{})}}export{ia as default,Qs as metadata};
