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