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