import{s as Jn,f as In,o as Un,n as Ae}from"../chunks/scheduler.25b97de1.js";import{S as qn,i as Nn,g as c,s as t,r as u,A as Rn,h as l,f as n,c as s,j as $,u as h,x as p,k as x,y as d,a as r,v as f,d as _,t as b,w as y}from"../chunks/index.d9030fc9.js";import{T as $n}from"../chunks/Tip.baa67368.js";import{D as R}from"../chunks/Docstring.ffac8efa.js";import{C as Go}from"../chunks/CodeBlock.e6cd0d95.js";import{E as en}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as F,E as Fn}from"../chunks/EditOnGithub.91d95064.js";function Pn(k){let a,w="Examples:",m,g,T;return g=new Go({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdyb3VuZGluZ0Rpbm9Db25maWclMkMlMjBHcm91bmRpbmdEaW5vTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwR3JvdW5kaW5nJTIwRElOTyUyMElERUEtUmVzZWFyY2glMkZncm91bmRpbmctZGluby10aW55JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMEdyb3VuZGluZ0Rpbm9Db25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwSURFQS1SZXNlYXJjaCUyRmdyb3VuZGluZy1kaW5vLXRpbnklMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMEdyb3VuZGluZ0Rpbm9Nb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GroundingDinoConfig, GroundingDinoModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Grounding DINO IDEA-Research/grounding-dino-tiny style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = GroundingDinoConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the IDEA-Research/grounding-dino-tiny style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GroundingDinoModel(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`,wrap:!1}}),{c(){a=c("p"),a.textContent=w,m=t(),u(g.$$.fragment)},l(i){a=l(i,"P",{"data-svelte-h":!0}),p(a)!=="svelte-kvfsh7"&&(a.textContent=w),m=s(i),h(g.$$.fragment,i)},m(i,v){r(i,a,v),r(i,m,v),f(g,i,v),T=!0},p:Ae,i(i){T||(_(g.$$.fragment,i),T=!0)},o(i){b(g.$$.fragment,i),T=!1},d(i){i&&(n(a),n(m)),y(g,i)}}}function Zn(k){let a,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){a=c("p"),a.innerHTML=w},l(m){a=l(m,"P",{"data-svelte-h":!0}),p(a)!=="svelte-fincs2"&&(a.innerHTML=w)},m(m,g){r(m,a,g)},p:Ae,d(m){m&&n(a)}}}function En(k){let a,w="Examples:",m,g,T;return g=new Go({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBBdXRvTW9kZWwlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEF0ZXh0JTIwJTNEJTIwJTIyYSUyMGNhdC4lMjIlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJJREVBLVJlc2VhcmNoJTJGZ3JvdW5kaW5nLWRpbm8tdGlueSUyMiklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIySURFQS1SZXNlYXJjaCUyRmdyb3VuZGluZy1kaW5vLXRpbnklMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwdGV4dCUzRHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBbGlzdChsYXN0X2hpZGRlbl9zdGF0ZXMuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AutoModel
<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>text = <span class="hljs-string">&quot;a cat.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;IDEA-Research/grounding-dino-tiny&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModel.from_pretrained(<span class="hljs-string">&quot;IDEA-Research/grounding-dino-tiny&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">900</span>, <span class="hljs-number">256</span>]`,wrap:!1}}),{c(){a=c("p"),a.textContent=w,m=t(),u(g.$$.fragment)},l(i){a=l(i,"P",{"data-svelte-h":!0}),p(a)!=="svelte-kvfsh7"&&(a.textContent=w),m=s(i),h(g.$$.fragment,i)},m(i,v){r(i,a,v),r(i,m,v),f(g,i,v),T=!0},p:Ae,i(i){T||(_(g.$$.fragment,i),T=!0)},o(i){b(g.$$.fragment,i),T=!1},d(i){i&&(n(a),n(m)),y(g,i)}}}function Wn(k){let a,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){a=c("p"),a.innerHTML=w},l(m){a=l(m,"P",{"data-svelte-h":!0}),p(a)!=="svelte-fincs2"&&(a.innerHTML=w)},m(m,g){r(m,a,g)},p:Ae,d(m){m&&n(a)}}}function Ln(k){let a,w="Examples:",m,g,T;return g=new Go({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBHcm91bmRpbmdEaW5vRm9yT2JqZWN0RGV0ZWN0aW9uJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBdGV4dCUyMCUzRCUyMCUyMmElMjBjYXQuJTIyJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIySURFQS1SZXNlYXJjaCUyRmdyb3VuZGluZy1kaW5vLXRpbnklMjIpJTBBbW9kZWwlMjAlM0QlMjBHcm91bmRpbmdEaW5vRm9yT2JqZWN0RGV0ZWN0aW9uLmZyb21fcHJldHJhaW5lZCglMjJJREVBLVJlc2VhcmNoJTJGZ3JvdW5kaW5nLWRpbm8tdGlueSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjB0ZXh0JTNEdGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQSUyMyUyMGNvbnZlcnQlMjBvdXRwdXRzJTIwKGJvdW5kaW5nJTIwYm94ZXMlMjBhbmQlMjBjbGFzcyUyMGxvZ2l0cyklMjB0byUyMENPQ08lMjBBUEklMEF0YXJnZXRfc2l6ZXMlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCaW1hZ2Uuc2l6ZSU1QiUzQSUzQS0xJTVEJTVEKSUwQXJlc3VsdHMlMjAlM0QlMjBwcm9jZXNzb3IuaW1hZ2VfcHJvY2Vzc29yLnBvc3RfcHJvY2Vzc19vYmplY3RfZGV0ZWN0aW9uKCUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMkMlMjB0aHJlc2hvbGQlM0QwLjM1JTJDJTIwdGFyZ2V0X3NpemVzJTNEdGFyZ2V0X3NpemVzJTBBKSU1QjAlNUQlMEFmb3IlMjBzY29yZSUyQyUyMGxhYmVsJTJDJTIwYm94JTIwaW4lMjB6aXAocmVzdWx0cyU1QiUyMnNjb3JlcyUyMiU1RCUyQyUyMHJlc3VsdHMlNUIlMjJsYWJlbHMlMjIlNUQlMkMlMjByZXN1bHRzJTVCJTIyYm94ZXMlMjIlNUQpJTNBJTBBJTIwJTIwJTIwJTIwYm94JTIwJTNEJTIwJTVCcm91bmQoaSUyQyUyMDEpJTIwZm9yJTIwaSUyMGluJTIwYm94LnRvbGlzdCgpJTVEJTBBJTIwJTIwJTIwJTIwcHJpbnQoZiUyMkRldGVjdGVkJTIwJTdCbGFiZWwuaXRlbSgpJTdEJTIwd2l0aCUyMGNvbmZpZGVuY2UlMjAlMjIlMjBmJTIyJTdCcm91bmQoc2NvcmUuaXRlbSgpJTJDJTIwMiklN0QlMjBhdCUyMGxvY2F0aW9uJTIwJTdCYm94JTdEJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, GroundingDinoForObjectDetection
<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>text = <span class="hljs-string">&quot;a cat.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;IDEA-Research/grounding-dino-tiny&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GroundingDinoForObjectDetection.from_pretrained(<span class="hljs-string">&quot;IDEA-Research/grounding-dino-tiny&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=text, 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 = processor.image_processor.post_process_object_detection(
<span class="hljs-meta">... </span>    outputs, threshold=<span class="hljs-number">0.35</span>, target_sizes=target_sizes
<span class="hljs-meta">... </span>)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> score, label, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(results[<span class="hljs-string">&quot;scores&quot;</span>], results[<span class="hljs-string">&quot;labels&quot;</span>], results[<span class="hljs-string">&quot;boxes&quot;</span>]):
<span class="hljs-meta">... </span>    box = [<span class="hljs-built_in">round</span>(i, <span class="hljs-number">1</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-string">f&quot;Detected <span class="hljs-subst">{label.item()}</span> with confidence &quot;</span> <span class="hljs-string">f&quot;<span class="hljs-subst">{<span class="hljs-built_in">round</span>(score.item(), <span class="hljs-number">2</span>)}</span> at location <span class="hljs-subst">{box}</span>&quot;</span>)
Detected <span class="hljs-number">1</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.45</span> at location [<span class="hljs-number">344.8</span>, <span class="hljs-number">23.2</span>, <span class="hljs-number">637.4</span>, <span class="hljs-number">373.8</span>]
Detected <span class="hljs-number">1</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.41</span> at location [<span class="hljs-number">11.9</span>, <span class="hljs-number">51.6</span>, <span class="hljs-number">316.6</span>, <span class="hljs-number">472.9</span>]`,wrap:!1}}),{c(){a=c("p"),a.textContent=w,m=t(),u(g.$$.fragment)},l(i){a=l(i,"P",{"data-svelte-h":!0}),p(a)!=="svelte-kvfsh7"&&(a.textContent=w),m=s(i),h(g.$$.fragment,i)},m(i,v){r(i,a,v),r(i,m,v),f(g,i,v),T=!0},p:Ae,i(i){T||(_(g.$$.fragment,i),T=!0)},o(i){b(g.$$.fragment,i),T=!1},d(i){i&&(n(a),n(m)),y(g,i)}}}function Bn(k){let a,w,m,g,T,i,v,Xe,Y,on='The Grounding DINO model was proposed in <a href="https://arxiv.org/abs/2303.05499" rel="nofollow">Grounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detection</a> by Shilong Liu, Zhaoyang Zeng, Tianhe Ren, Feng Li, Hao Zhang, Jie Yang, Chunyuan Li, Jianwei Yang, Hang Su, Jun Zhu, Lei Zhang. Grounding DINO extends a closed-set object detection model with a text encoder, enabling open-set object detection. The model achieves remarkable results, such as 52.5 AP on COCO zero-shot.',Qe,K,nn="The abstract from the paper is the following:",Ye,ee,tn="<em>In this paper, we present an open-set object detector, called Grounding DINO, by marrying Transformer-based detector DINO with grounded pre-training, which can detect arbitrary objects with human inputs such as category names or referring expressions. The key solution of open-set object detection is introducing language to a closed-set detector for open-set concept generalization. To effectively fuse language and vision modalities, we conceptually divide a closed-set detector into three phases and propose a tight fusion solution, which includes a feature enhancer, a language-guided query selection, and a cross-modality decoder for cross-modality fusion. While previous works mainly evaluate open-set object detection on novel categories, we propose to also perform evaluations on referring expression comprehension for objects specified with attributes. Grounding DINO performs remarkably well on all three settings, including benchmarks on COCO, LVIS, ODinW, and RefCOCO/+/g. Grounding DINO achieves a 52.5 AP on the COCO detection zero-shot transfer benchmark, i.e., without any training data from COCO. It sets a new record on the ODinW zero-shot benchmark with a mean 26.1 AP.</em>",Ke,P,sn,eo,oe,rn='Grounding DINO overview. Taken from the <a href="https://arxiv.org/abs/2303.05499">original paper</a>.',oo,ne,an=`This model was contributed by <a href="https://huggingface.co/EduardoPacheco" rel="nofollow">EduardoPacheco</a> and <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>.
The original code can be found <a href="https://github.com/IDEA-Research/GroundingDINO" rel="nofollow">here</a>.`,no,te,to,se,dn='<li>One can use <a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoProcessor">GroundingDinoProcessor</a> to prepare image-text pairs for the model.</li> <li>To separate classes in the text use a period e.g. “a cat. a dog.”</li> <li>When using multiple classes (e.g. <code>&quot;a cat. a dog.&quot;</code>), use <code>post_process_grounded_object_detection</code> from <a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoProcessor">GroundingDinoProcessor</a> to post process outputs. Since, the labels returned from <code>post_process_object_detection</code> represent the indices from the model dimension where prob &gt; threshold.</li>',so,re,cn="Here’s how to use the model for zero-shot object detection:",ro,ae,ao,ie,io,de,ln='One can combine Grounding DINO with the <a href="sam">Segment Anything</a> model for text-based mask generation as introduced in <a href="https://arxiv.org/abs/2401.14159" rel="nofollow">Grounded SAM: Assembling Open-World Models for Diverse Visual Tasks</a>. You can refer to this <a href="https://github.com/NielsRogge/Transformers-Tutorials/blob/master/Grounding%20DINO/GroundingDINO_with_Segment_Anything.ipynb" rel="nofollow">demo notebook</a> 🌍 for details.',co,Z,mn,lo,ce,gn='Grounded SAM overview. Taken from the <a href="https://github.com/IDEA-Research/Grounded-Segment-Anything">original repository</a>.',mo,le,go,me,pn="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with Grounding DINO. If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",po,ge,un='<li>Demo notebooks regarding inference with Grounding DINO as well as combining it with <a href="sam">SAM</a> can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Grounding%20DINO" rel="nofollow">here</a>. 🌎</li>',uo,pe,ho,j,ue,Co,$e,hn="Constructs a Grounding DINO image processor.",ko,E,he,zo,Je,fn="Preprocess an image or a batch of images so that it can be used by the model.",Io,W,fe,$o,Ue,_n=`Converts the raw output of <a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoForObjectDetection">GroundingDinoForObjectDetection</a> into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format.`,fo,_e,_o,G,be,Jo,qe,bn=`Constructs a Grounding DINO processor which wraps a Deformable DETR image processor and a BERT tokenizer into a
single processor.`,Uo,Ne,yn=`<a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoProcessor">GroundingDinoProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoImageProcessor">GroundingDinoImageProcessor</a> and
<a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See the docstring of <code>__call__()</code> and <code>decode()</code>
for more information.`,qo,L,ye,No,Re,Tn=`Converts the raw output of <a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoForObjectDetection">GroundingDinoForObjectDetection</a> into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format and get the associated text label.`,bo,Te,yo,C,we,Ro,Fe,wn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoModel">GroundingDinoModel</a>. It is used to instantiate a
Grounding DINO 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 Grounding DINO
<a href="https://huggingface.co/IDEA-Research/grounding-dino-tiny" rel="nofollow">IDEA-Research/grounding-dino-tiny</a> architecture.`,Fo,Pe,vn=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Po,B,To,ve,wo,M,xe,Zo,Ze,xn=`The bare Grounding DINO Model (consisting of a backbone and encoder-decoder Transformer) outputting raw
hidden-states without any specific head on top.`,Eo,Ee,Mn=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,Wo,We,Dn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Lo,z,Me,Bo,Le,jn='The <a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoModel">GroundingDinoModel</a> forward method, overrides the <code>__call__</code> special method.',Oo,O,So,S,vo,De,xo,D,je,Ho,Be,Gn=`Grounding DINO Model (consisting of a backbone and encoder-decoder Transformer) with object detection heads on top,
for tasks such as COCO detection.`,Vo,Oe,Cn=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,Ao,Se,kn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Xo,I,Ge,Qo,He,zn='The <a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoForObjectDetection">GroundingDinoForObjectDetection</a> forward method, overrides the <code>__call__</code> special method.',Yo,H,Ko,V,Mo,Ce,Do,Ve,jo;return T=new F({props:{title:"Grounding DINO",local:"grounding-dino",headingTag:"h1"}}),v=new F({props:{title:"Overview",local:"overview",headingTag:"h2"}}),te=new F({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),ae=new Go({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEElMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwQXV0b01vZGVsRm9yWmVyb1Nob3RPYmplY3REZXRlY3Rpb24lMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMklERUEtUmVzZWFyY2glMkZncm91bmRpbmctZGluby10aW55JTIyJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUwQSUwQXByb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yWmVyb1Nob3RPYmplY3REZXRlY3Rpb24uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKS50byhkZXZpY2UpJTBBJTBBaW1hZ2VfdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQoaW1hZ2VfdXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUyMyUyMENoZWNrJTIwZm9yJTIwY2F0cyUyMGFuZCUyMHJlbW90ZSUyMGNvbnRyb2xzJTBBdGV4dCUyMCUzRCUyMCUyMmElMjBjYXQuJTIwYSUyMHJlbW90ZSUyMGNvbnRyb2wuJTIyJTBBJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwdGV4dCUzRHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS50byhkZXZpY2UpJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFyZXN1bHRzJTIwJTNEJTIwcHJvY2Vzc29yLnBvc3RfcHJvY2Vzc19ncm91bmRlZF9vYmplY3RfZGV0ZWN0aW9uKCUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMkMlMEElMjAlMjAlMjAlMjBpbnB1dHMuaW5wdXRfaWRzJTJDJTBBJTIwJTIwJTIwJTIwYm94X3RocmVzaG9sZCUzRDAuNCUyQyUwQSUyMCUyMCUyMCUyMHRleHRfdGhyZXNob2xkJTNEMC4zJTJDJTBBJTIwJTIwJTIwJTIwdGFyZ2V0X3NpemVzJTNEJTVCaW1hZ2Uuc2l6ZSU1QiUzQSUzQS0xJTVEJTVEJTBBKSUwQXByaW50KHJlc3VsdHMp",highlighted:`<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">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">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, AutoModelForZeroShotObjectDetection

<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = <span class="hljs-string">&quot;IDEA-Research/grounding-dino-tiny&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(model_id)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForZeroShotObjectDetection.from_pretrained(model_id).to(device)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_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(image_url, stream=<span class="hljs-literal">True</span>).raw)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Check for cats and remote controls</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;a cat. a remote control.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, text=text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>results = processor.post_process_grounded_object_detection(
<span class="hljs-meta">... </span>    outputs,
<span class="hljs-meta">... </span>    inputs.input_ids,
<span class="hljs-meta">... </span>    box_threshold=<span class="hljs-number">0.4</span>,
<span class="hljs-meta">... </span>    text_threshold=<span class="hljs-number">0.3</span>,
<span class="hljs-meta">... </span>    target_sizes=[image.size[::-<span class="hljs-number">1</span>]]
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(results)
[{<span class="hljs-string">&#x27;boxes&#x27;</span>: tensor([[<span class="hljs-number">344.6959</span>,  <span class="hljs-number">23.1090</span>, <span class="hljs-number">637.1833</span>, <span class="hljs-number">374.2751</span>],
        [ <span class="hljs-number">12.2666</span>,  <span class="hljs-number">51.9145</span>, <span class="hljs-number">316.8582</span>, <span class="hljs-number">472.4392</span>],
        [ <span class="hljs-number">38.5742</span>,  <span class="hljs-number">70.0015</span>, <span class="hljs-number">176.7838</span>, <span class="hljs-number">118.1806</span>]], device=<span class="hljs-string">&#x27;cuda:0&#x27;</span>),
  <span class="hljs-string">&#x27;labels&#x27;</span>: [<span class="hljs-string">&#x27;a cat&#x27;</span>, <span class="hljs-string">&#x27;a cat&#x27;</span>, <span class="hljs-string">&#x27;a remote control&#x27;</span>],
  <span class="hljs-string">&#x27;scores&#x27;</span>: tensor([<span class="hljs-number">0.4785</span>, <span class="hljs-number">0.4381</span>, <span class="hljs-number">0.4776</span>], device=<span class="hljs-string">&#x27;cuda:0&#x27;</span>)}]`,wrap:!1}}),ie=new F({props:{title:"Grounded SAM",local:"grounded-sam",headingTag:"h2"}}),le=new F({props:{title:"Resources",local:"resources",headingTag:"h2"}}),pe=new F({props:{title:"GroundingDinoImageProcessor",local:"transformers.GroundingDinoImageProcessor",headingTag:"h2"}}),ue=new R({props:{name:"class transformers.GroundingDinoImageProcessor",anchor:"transformers.GroundingDinoImageProcessor",parameters:[{name:"format",val:": typing.Union[str, transformers.models.grounding_dino.image_processing_grounding_dino.AnnotationFormat] = <AnnotationFormat.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_convert_annotations",val:": typing.Optional[bool] = None"},{name:"do_pad",val:": bool = True"},{name:"pad_size",val:": typing.Optional[typing.Dict[str, int]] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GroundingDinoImageProcessor.format",description:`<strong>format</strong> (<code>str</code>, <em>optional</em>, defaults to <code>AnnotationFormat.COCO_DETECTION</code>) &#x2014;
Data format of the annotations. One of &#x201C;coco_detection&#x201D; or &#x201C;coco_panoptic&#x201D;.`,name:"format"},{anchor:"transformers.GroundingDinoImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Controls whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be
overridden by the <code>do_resize</code> parameter in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.GroundingDinoImageProcessor.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. Available options are:<ul>
<li><code>{&quot;height&quot;: int, &quot;width&quot;: int}</code>: The image will be resized to the exact size <code>(height, width)</code>.
Do NOT keep the aspect ratio.</li>
<li><code>{&quot;shortest_edge&quot;: int, &quot;longest_edge&quot;: int}</code>: The image will be resized to a maximum size respecting
the aspect ratio and keeping the shortest edge less or equal to <code>shortest_edge</code> and the longest edge
less or equal to <code>longest_edge</code>.</li>
<li><code>{&quot;max_height&quot;: int, &quot;max_width&quot;: int}</code>: The image will be resized to the maximum size respecting the
aspect ratio and keeping the height less or equal to <code>max_height</code> and the width less or equal to
<code>max_width</code>.</li>
</ul>`,name:"size"},{anchor:"transformers.GroundingDinoImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image.`,name:"resample"},{anchor:"transformers.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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. 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.GroundingDinoImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"do_normalize"},{anchor:"transformers.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.do_convert_annotations",description:`<strong>do_convert_annotations</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Controls whether to convert the annotations to the format expected by the DETR model. Converts the
bounding boxes to the format <code>(center_x, center_y, width, height)</code> and in the range <code>[0, 1]</code>.
Can be overridden by the <code>do_convert_annotations</code> parameter in the <code>preprocess</code> method.`,name:"do_convert_annotations"},{anchor:"transformers.GroundingDinoImageProcessor.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. Can be overridden by the <code>do_pad</code> parameter in the <code>preprocess</code>
method. If <code>True</code>, padding will be applied to the bottom and right of the image with zeros.
If <code>pad_size</code> is provided, the image will be padded to the specified dimensions.
Otherwise, the image will be padded to the maximum height and width of the batch.`,name:"do_pad"},{anchor:"transformers.GroundingDinoImageProcessor.pad_size",description:`<strong>pad_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>) &#x2014;
The size <code>{&quot;height&quot;: int, &quot;width&quot; int}</code> to pad the images to. Must be larger than any image size
provided for preprocessing. If <code>pad_size</code> is not provided, images will be padded to the largest
height and width in the batch.`,name:"pad_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/grounding_dino/image_processing_grounding_dino.py#L809"}}),he=new R({props:{name:"preprocess",anchor:"transformers.GroundingDinoImageProcessor.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.Optional[typing.Dict[str, int]] = 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:"do_convert_annotations",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.grounding_dino.image_processing_grounding_dino.AnnotationFormat, 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:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"pad_size",val:": typing.Optional[typing.Dict[str, int]] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GroundingDinoImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image or batch of images to preprocess. Expects a single or batch of images with pixel values ranging
from 0 to 255. If passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to self.size) &#x2014;
Size of the image&#x2019;s <code>(height, width)</code> dimensions after resizing. Available options are:<ul>
<li><code>{&quot;height&quot;: int, &quot;width&quot;: int}</code>: The image will be resized to the exact size <code>(height, width)</code>.
Do NOT keep the aspect ratio.</li>
<li><code>{&quot;shortest_edge&quot;: int, &quot;longest_edge&quot;: int}</code>: The image will be resized to a maximum size respecting
the aspect ratio and keeping the shortest edge less or equal to <code>shortest_edge</code> and the longest edge
less or equal to <code>longest_edge</code>.</li>
<li><code>{&quot;max_height&quot;: int, &quot;max_width&quot;: int}</code>: The image will be resized to the maximum size respecting the
aspect ratio and keeping the height less or equal to <code>max_height</code> and the width less or equal to
<code>max_width</code>.</li>
</ul>`,name:"size"},{anchor:"transformers.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.preprocess.do_convert_annotations",description:`<strong>do_convert_annotations</strong> (<code>bool</code>, <em>optional</em>, defaults to self.do_convert_annotations) &#x2014;
Whether to convert the annotations to the format expected by the model. Converts the bounding
boxes from the format <code>(top_left_x, top_left_y, width, height)</code> to <code>(center_x, center_y, width, height)</code>
and in relative coordinates.`,name:"do_convert_annotations"},{anchor:"transformers.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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. If <code>True</code>, padding will be applied to the bottom and right of
the image with zeros. If <code>pad_size</code> is provided, the image will be padded to the specified
dimensions. Otherwise, the image will be padded to the maximum height and width of the batch.`,name:"do_pad"},{anchor:"transformers.GroundingDinoImageProcessor.preprocess.format",description:`<strong>format</strong> (<code>str</code> or <code>AnnotationFormat</code>, <em>optional</em>, defaults to self.format) &#x2014;
Format of the annotations.`,name:"format"},{anchor:"transformers.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.GroundingDinoImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"},{anchor:"transformers.GroundingDinoImageProcessor.preprocess.pad_size",description:`<strong>pad_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>) &#x2014;
The size <code>{&quot;height&quot;: int, &quot;width&quot; int}</code> to pad the images to. Must be larger than any image size
provided for preprocessing. If <code>pad_size</code> is not provided, images will be padded to the largest
height and width in the batch.`,name:"pad_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/grounding_dino/image_processing_grounding_dino.py#L1269"}}),fe=new R({props:{name:"post_process_object_detection",anchor:"transformers.GroundingDinoImageProcessor.post_process_object_detection",parameters:[{name:"outputs",val:""},{name:"threshold",val:": float = 0.1"},{name:"target_sizes",val:": typing.Union[transformers.utils.generic.TensorType, typing.List[typing.Tuple]] = None"}],parametersDescription:[{anchor:"transformers.GroundingDinoImageProcessor.post_process_object_detection.outputs",description:`<strong>outputs</strong> (<code>GroundingDinoObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.GroundingDinoImageProcessor.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.GroundingDinoImageProcessor.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/main/src/transformers/models/grounding_dino/image_processing_grounding_dino.py#L1535",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[Dict]</code></p>
`}}),_e=new F({props:{title:"GroundingDinoProcessor",local:"transformers.GroundingDinoProcessor",headingTag:"h2"}}),be=new R({props:{name:"class transformers.GroundingDinoProcessor",anchor:"transformers.GroundingDinoProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.GroundingDinoProcessor.image_processor",description:`<strong>image_processor</strong> (<code>GroundingDinoImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoImageProcessor">GroundingDinoImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.GroundingDinoProcessor.tokenizer",description:"<strong>tokenizer</strong> (<code>AutoTokenizer</code>) &#x2014;\nAn instance of [&#x2018;PreTrainedTokenizer`]. The tokenizer is a required input.",name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/grounding_dino/processing_grounding_dino.py#L88"}}),ye=new R({props:{name:"post_process_grounded_object_detection",anchor:"transformers.GroundingDinoProcessor.post_process_grounded_object_detection",parameters:[{name:"outputs",val:""},{name:"input_ids",val:""},{name:"box_threshold",val:": float = 0.25"},{name:"text_threshold",val:": float = 0.25"},{name:"target_sizes",val:": typing.Union[transformers.utils.generic.TensorType, typing.List[typing.Tuple]] = None"}],parametersDescription:[{anchor:"transformers.GroundingDinoProcessor.post_process_grounded_object_detection.outputs",description:`<strong>outputs</strong> (<code>GroundingDinoObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.GroundingDinoProcessor.post_process_grounded_object_detection.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
The token ids of the input text.`,name:"input_ids"},{anchor:"transformers.GroundingDinoProcessor.post_process_grounded_object_detection.box_threshold",description:`<strong>box_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.25) &#x2014;
Score threshold to keep object detection predictions.`,name:"box_threshold"},{anchor:"transformers.GroundingDinoProcessor.post_process_grounded_object_detection.text_threshold",description:`<strong>text_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.25) &#x2014;
Score threshold to keep text detection predictions.`,name:"text_threshold"},{anchor:"transformers.GroundingDinoProcessor.post_process_grounded_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/main/src/transformers/models/grounding_dino/processing_grounding_dino.py#L175",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[Dict]</code></p>
`}}),Te=new F({props:{title:"GroundingDinoConfig",local:"transformers.GroundingDinoConfig",headingTag:"h2"}}),we=new R({props:{name:"class transformers.GroundingDinoConfig",anchor:"transformers.GroundingDinoConfig",parameters:[{name:"backbone_config",val:" = None"},{name:"backbone",val:" = None"},{name:"use_pretrained_backbone",val:" = False"},{name:"use_timm_backbone",val:" = False"},{name:"backbone_kwargs",val:" = None"},{name:"text_config",val:" = None"},{name:"num_queries",val:" = 900"},{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:"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:"auxiliary_loss",val:" = False"},{name:"position_embedding_type",val:" = 'sine'"},{name:"num_feature_levels",val:" = 4"},{name:"encoder_n_points",val:" = 4"},{name:"decoder_n_points",val:" = 4"},{name:"two_stage",val:" = True"},{name:"class_cost",val:" = 1.0"},{name:"bbox_cost",val:" = 5.0"},{name:"giou_cost",val:" = 2.0"},{name:"bbox_loss_coefficient",val:" = 5.0"},{name:"giou_loss_coefficient",val:" = 2.0"},{name:"focal_alpha",val:" = 0.25"},{name:"disable_custom_kernels",val:" = False"},{name:"max_text_len",val:" = 256"},{name:"text_enhancer_dropout",val:" = 0.0"},{name:"fusion_droppath",val:" = 0.1"},{name:"fusion_dropout",val:" = 0.0"},{name:"embedding_init_target",val:" = True"},{name:"query_dim",val:" = 4"},{name:"decoder_bbox_embed_share",val:" = True"},{name:"two_stage_bbox_embed_share",val:" = False"},{name:"positional_embedding_temperature",val:" = 20"},{name:"init_std",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GroundingDinoConfig.backbone_config",description:`<strong>backbone_config</strong> (<code>PretrainedConfig</code> or <code>dict</code>, <em>optional</em>, defaults to <code>ResNetConfig()</code>) &#x2014;
The configuration of the backbone model.`,name:"backbone_config"},{anchor:"transformers.GroundingDinoConfig.backbone",description:`<strong>backbone</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Name of backbone to use when <code>backbone_config</code> is <code>None</code>. If <code>use_pretrained_backbone</code> is <code>True</code>, this
will load the corresponding pretrained weights from the timm or transformers library. If <code>use_pretrained_backbone</code>
is <code>False</code>, this loads the backbone&#x2019;s config and uses that to initialize the backbone with random weights.`,name:"backbone"},{anchor:"transformers.GroundingDinoConfig.use_pretrained_backbone",description:`<strong>use_pretrained_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use pretrained weights for the backbone.`,name:"use_pretrained_backbone"},{anchor:"transformers.GroundingDinoConfig.use_timm_backbone",description:`<strong>use_timm_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to load <code>backbone</code> from the timm library. If <code>False</code>, the backbone is loaded from the transformers
library.`,name:"use_timm_backbone"},{anchor:"transformers.GroundingDinoConfig.backbone_kwargs",description:`<strong>backbone_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Keyword arguments to be passed to AutoBackbone when loading from a checkpoint
e.g. <code>{&apos;out_indices&apos;: (0, 1, 2, 3)}</code>. Cannot be specified if <code>backbone_config</code> is set.`,name:"backbone_kwargs"},{anchor:"transformers.GroundingDinoConfig.text_config",description:`<strong>text_config</strong> (<code>Union[AutoConfig, dict]</code>, <em>optional</em>, defaults to <code>BertConfig</code>) &#x2014;
The config object or dictionary of the text backbone.`,name:"text_config"},{anchor:"transformers.GroundingDinoConfig.num_queries",description:`<strong>num_queries</strong> (<code>int</code>, <em>optional</em>, defaults to 900) &#x2014;
Number of object queries, i.e. detection slots. This is the maximal number of objects
<a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoModel">GroundingDinoModel</a> can detect in a single image.`,name:"num_queries"},{anchor:"transformers.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.is_encoder_decoder",description:`<strong>is_encoder_decoder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the model is used as an encoder/decoder or not.`,name:"is_encoder_decoder"},{anchor:"transformers.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.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.GroundingDinoConfig.num_feature_levels",description:`<strong>num_feature_levels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of input feature levels.`,name:"num_feature_levels"},{anchor:"transformers.GroundingDinoConfig.encoder_n_points",description:`<strong>encoder_n_points</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of sampled keys in each feature level for each attention head in the encoder.`,name:"encoder_n_points"},{anchor:"transformers.GroundingDinoConfig.decoder_n_points",description:`<strong>decoder_n_points</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of sampled keys in each feature level for each attention head in the decoder.`,name:"decoder_n_points"},{anchor:"transformers.GroundingDinoConfig.two_stage",description:`<strong>two_stage</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to apply a two-stage deformable DETR, where the region proposals are also generated by a variant of
Grounding DINO, which are further fed into the decoder for iterative bounding box refinement.`,name:"two_stage"},{anchor:"transformers.GroundingDinoConfig.class_cost",description:`<strong>class_cost</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Relative weight of the classification error in the Hungarian matching cost.`,name:"class_cost"},{anchor:"transformers.GroundingDinoConfig.bbox_cost",description:`<strong>bbox_cost</strong> (<code>float</code>, <em>optional</em>, defaults to 5.0) &#x2014;
Relative weight of the L1 error of the bounding box coordinates in the Hungarian matching cost.`,name:"bbox_cost"},{anchor:"transformers.GroundingDinoConfig.giou_cost",description:`<strong>giou_cost</strong> (<code>float</code>, <em>optional</em>, defaults to 2.0) &#x2014;
Relative weight of the generalized IoU loss of the bounding box in the Hungarian matching cost.`,name:"giou_cost"},{anchor:"transformers.GroundingDinoConfig.bbox_loss_coefficient",description:`<strong>bbox_loss_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 5.0) &#x2014;
Relative weight of the L1 bounding box loss in the object detection loss.`,name:"bbox_loss_coefficient"},{anchor:"transformers.GroundingDinoConfig.giou_loss_coefficient",description:`<strong>giou_loss_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 2.0) &#x2014;
Relative weight of the generalized IoU loss in the object detection loss.`,name:"giou_loss_coefficient"},{anchor:"transformers.GroundingDinoConfig.focal_alpha",description:`<strong>focal_alpha</strong> (<code>float</code>, <em>optional</em>, defaults to 0.25) &#x2014;
Alpha parameter in the focal loss.`,name:"focal_alpha"},{anchor:"transformers.GroundingDinoConfig.disable_custom_kernels",description:`<strong>disable_custom_kernels</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Disable the use of custom CUDA and CPU kernels. This option is necessary for the ONNX export, as custom
kernels are not supported by PyTorch ONNX export.`,name:"disable_custom_kernels"},{anchor:"transformers.GroundingDinoConfig.max_text_len",description:`<strong>max_text_len</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
The maximum length of the text input.`,name:"max_text_len"},{anchor:"transformers.GroundingDinoConfig.text_enhancer_dropout",description:`<strong>text_enhancer_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the text enhancer.`,name:"text_enhancer_dropout"},{anchor:"transformers.GroundingDinoConfig.fusion_droppath",description:`<strong>fusion_droppath</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The droppath ratio for the fusion module.`,name:"fusion_droppath"},{anchor:"transformers.GroundingDinoConfig.fusion_dropout",description:`<strong>fusion_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the fusion module.`,name:"fusion_dropout"},{anchor:"transformers.GroundingDinoConfig.embedding_init_target",description:`<strong>embedding_init_target</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to initialize the target with Embedding weights.`,name:"embedding_init_target"},{anchor:"transformers.GroundingDinoConfig.query_dim",description:`<strong>query_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The dimension of the query vector.`,name:"query_dim"},{anchor:"transformers.GroundingDinoConfig.decoder_bbox_embed_share",description:`<strong>decoder_bbox_embed_share</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to share the bbox regression head for all decoder layers.`,name:"decoder_bbox_embed_share"},{anchor:"transformers.GroundingDinoConfig.two_stage_bbox_embed_share",description:`<strong>two_stage_bbox_embed_share</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to share the bbox embedding between the two-stage bbox generator and the region proposal
generation.`,name:"two_stage_bbox_embed_share"},{anchor:"transformers.GroundingDinoConfig.positional_embedding_temperature",description:`<strong>positional_embedding_temperature</strong> (<code>float</code>, <em>optional</em>, defaults to 20) &#x2014;
The temperature for Sine Positional Embedding that is used together with vision backbone.`,name:"positional_embedding_temperature"},{anchor:"transformers.GroundingDinoConfig.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.GroundingDinoConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/grounding_dino/configuration_grounding_dino.py#L26"}}),B=new en({props:{anchor:"transformers.GroundingDinoConfig.example",$$slots:{default:[Pn]},$$scope:{ctx:k}}}),ve=new F({props:{title:"GroundingDinoModel",local:"transformers.GroundingDinoModel",headingTag:"h2"}}),xe=new R({props:{name:"class transformers.GroundingDinoModel",anchor:"transformers.GroundingDinoModel",parameters:[{name:"config",val:": GroundingDinoConfig"}],parametersDescription:[{anchor:"transformers.GroundingDinoModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoConfig">GroundingDinoConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/grounding_dino/modeling_grounding_dino.py#L2059"}}),Me=new R({props:{name:"forward",anchor:"transformers.GroundingDinoModel.forward",parameters:[{name:"pixel_values",val:": Tensor"},{name:"input_ids",val:": Tensor"},{name:"token_type_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"pixel_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_outputs",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],parametersDescription:[{anchor:"transformers.GroundingDinoModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it.</p>
<p>Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">GroundingDinoImageProcessor.<strong>call</strong>()</a> for
details.`,name:"pixel_values"},{anchor:"transformers.GroundingDinoModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, text_sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">BertTokenizer.<strong>call</strong>()</a> for details.`,name:"input_ids"},{anchor:"transformers.GroundingDinoModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, text_sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>: 0 corresponds to a <code>sentence A</code> token, 1 corresponds to a <code>sentence B</code> token</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GroundingDinoModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, text_sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for tokens that are padding (i.e. <strong>masked</strong>).</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GroundingDinoModel.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.GroundingDinoModel.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_vision</code>, <em>optional</em>: <code>last_hidden_state_text</code>, <em>optional</em>:
<code>vision_hidden_states</code>, <em>optional</em>: <code>text_hidden_states</code>, <em>optional</em>: <code>attentions</code>)
<code>last_hidden_state_vision</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.GroundingDinoModel.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.GroundingDinoModel.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.GroundingDinoModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/grounding_dino/modeling_grounding_dino.py#L2216",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoModelOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoConfig"
>GroundingDinoConfig</a>) and inputs.</p>
<ul>
<li><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the decoder of the model.</li>
<li><strong>init_reference_points</strong> (<code>torch.FloatTensor</code> of shape  <code>(batch_size, num_queries, 4)</code>) — Initial reference points sent through the Transformer decoder.</li>
<li><strong>intermediate_hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.decoder_layers, num_queries, hidden_size)</code>) — Stacked intermediate hidden states (output of each layer of the decoder).</li>
<li><strong>intermediate_reference_points</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.decoder_layers, num_queries, 4)</code>) — Stacked intermediate reference points (reference points of each layer of the decoder).</li>
<li><strong>decoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, num_queries, hidden_size)</code>. Hidden-states of the decoder at the output of each layer
plus the initial embedding outputs.</li>
<li><strong>decoder_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of tuples of <code>torch.FloatTensor</code> (one for attention for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the
weighted average in the self-attention, cross-attention and multi-scale deformable attention heads.</li>
<li><strong>encoder_last_hidden_state_vision</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</li>
<li><strong>encoder_last_hidden_state_text</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</li>
<li><strong>encoder_vision_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>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the vision embeddings + one for the output of each
layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the vision encoder at the
output of each layer plus the initial embedding outputs.</li>
<li><strong>encoder_text_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>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the text embeddings + one for the output of each layer)
of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the text encoder at the output of
each layer plus the initial embedding outputs.</li>
<li><strong>encoder_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of tuples of <code>torch.FloatTensor</code> (one for attention for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the
weighted average in the text-vision attention, vision-text attention, text-enhancer (self-attention) and
multi-scale deformable attention heads. attention softmax, used to compute the weighted average in the
bi-attention heads.</li>
<li><strong>enc_outputs_class</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>, <em>optional</em>, returned when <code>config.two_stage=True</code>) — Predicted bounding boxes scores where the top <code>config.num_queries</code> scoring bounding boxes are picked as
region proposals in the first stage. Output of bounding box binary classification (i.e. foreground and
background).</li>
<li><strong>enc_outputs_coord_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>, returned when <code>config.two_stage=True</code>) — Logits of predicted bounding boxes coordinates in the first stage.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),O=new $n({props:{$$slots:{default:[Zn]},$$scope:{ctx:k}}}),S=new en({props:{anchor:"transformers.GroundingDinoModel.forward.example",$$slots:{default:[En]},$$scope:{ctx:k}}}),De=new F({props:{title:"GroundingDinoForObjectDetection",local:"transformers.GroundingDinoForObjectDetection",headingTag:"h2"}}),je=new R({props:{name:"class transformers.GroundingDinoForObjectDetection",anchor:"transformers.GroundingDinoForObjectDetection",parameters:[{name:"config",val:": GroundingDinoConfig"}],parametersDescription:[{anchor:"transformers.GroundingDinoForObjectDetection.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoConfig">GroundingDinoConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/grounding_dino/modeling_grounding_dino.py#L2478"}}),Ge=new R({props:{name:"forward",anchor:"transformers.GroundingDinoForObjectDetection.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"input_ids",val:": LongTensor"},{name:"token_type_ids",val:": LongTensor = None"},{name:"attention_mask",val:": LongTensor = None"},{name:"pixel_mask",val:": typing.Optional[torch.BoolTensor] = None"},{name:"encoder_outputs",val:": typing.Union[transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoEncoderOutput, typing.Tuple, NoneType] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.List[typing.Dict[str, typing.Union[torch.LongTensor, torch.FloatTensor]]] = None"}],parametersDescription:[{anchor:"transformers.GroundingDinoForObjectDetection.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Padding will be ignored by default should you provide it.</p>
<p>Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/imagegpt#transformers.ImageGPTFeatureExtractor.__call__">GroundingDinoImageProcessor.<strong>call</strong>()</a> for
details.`,name:"pixel_values"},{anchor:"transformers.GroundingDinoForObjectDetection.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, text_sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">BertTokenizer.<strong>call</strong>()</a> for details.`,name:"input_ids"},{anchor:"transformers.GroundingDinoForObjectDetection.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, text_sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>: 0 corresponds to a <code>sentence A</code> token, 1 corresponds to a <code>sentence B</code> token</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GroundingDinoForObjectDetection.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, text_sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are real (i.e. <strong>not masked</strong>),</li>
<li>0 for tokens that are padding (i.e. <strong>masked</strong>).</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GroundingDinoForObjectDetection.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.GroundingDinoForObjectDetection.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_vision</code>, <em>optional</em>: <code>last_hidden_state_text</code>, <em>optional</em>:
<code>vision_hidden_states</code>, <em>optional</em>: <code>text_hidden_states</code>, <em>optional</em>: <code>attentions</code>)
<code>last_hidden_state_vision</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.GroundingDinoForObjectDetection.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.GroundingDinoForObjectDetection.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.GroundingDinoForObjectDetection.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GroundingDinoForObjectDetection.forward.labels",description:`<strong>labels</strong> (<code>List[Dict]</code> of len <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the bipartite matching loss. List of dicts, each dictionary containing at least the
following 2 keys: &#x2018;class_labels&#x2019; and &#x2018;boxes&#x2019; (the class labels and bounding boxes of an image in the batch
respectively). The class labels themselves should be a <code>torch.LongTensor</code> of len <code>(number of bounding boxes in the image,)</code> and the boxes a <code>torch.FloatTensor</code> of shape <code>(number of bounding boxes in the image, 4)</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/grounding_dino/modeling_grounding_dino.py#L2524",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoObjectDetectionOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/grounding-dino#transformers.GroundingDinoConfig"
>GroundingDinoConfig</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)) — 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>) — 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>) — 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>) — Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding
possible padding). You can use <code>~GroundingDinoProcessor.post_process_object_detection</code> to retrieve the
unnormalized bounding boxes.</li>
<li><strong>auxiliary_outputs</strong> (<code>List[Dict]</code>, <em>optional</em>) — Optional, only returned when auxilary losses are activated (i.e. <code>config.auxiliary_loss</code> is set to <code>True</code>)
and labels are provided. It is a list of dictionaries containing the two above keys (<code>logits</code> and
<code>pred_boxes</code>) for each decoder layer.</li>
<li><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, hidden_size)</code>, <em>optional</em>) — 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>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, num_queries, hidden_size)</code>. Hidden-states of the decoder at the output of each layer
plus the initial embedding outputs.</li>
<li><strong>decoder_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of tuples of <code>torch.FloatTensor</code> (one for attention for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the
weighted average in the self-attention, cross-attention and multi-scale deformable attention heads.</li>
<li><strong>encoder_last_hidden_state_vision</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</li>
<li><strong>encoder_last_hidden_state_text</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — Sequence of hidden-states at the output of the last layer of the encoder of the model.</li>
<li><strong>encoder_vision_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>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the vision embeddings + one for the output of each
layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the vision encoder at the
output of each layer plus the initial embedding outputs.</li>
<li><strong>encoder_text_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>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the text embeddings + one for the output of each layer)
of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the text encoder at the output of
each layer plus the initial embedding outputs.</li>
<li><strong>encoder_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of tuples of <code>torch.FloatTensor</code> (one for attention for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the
weighted average in the text-vision attention, vision-text attention, text-enhancer (self-attention) and
multi-scale deformable attention heads.</li>
<li><strong>intermediate_hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.decoder_layers, num_queries, hidden_size)</code>) — Stacked intermediate hidden states (output of each layer of the decoder).</li>
<li><strong>intermediate_reference_points</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.decoder_layers, num_queries, 4)</code>) — Stacked intermediate reference points (reference points of each layer of the decoder).</li>
<li><strong>init_reference_points</strong> (<code>torch.FloatTensor</code> of shape  <code>(batch_size, num_queries, 4)</code>) — Initial reference points sent through the Transformer decoder.</li>
<li><strong>enc_outputs_class</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>, <em>optional</em>, returned when <code>config.two_stage=True</code>) — Predicted bounding boxes scores where the top <code>config.num_queries</code> scoring bounding boxes are picked as
region proposals in the first stage. Output of bounding box binary classification (i.e. foreground and
background).</li>
<li><strong>enc_outputs_coord_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, 4)</code>, <em>optional</em>, returned when <code>config.two_stage=True</code>) — Logits of predicted bounding boxes coordinates in the first stage.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.grounding_dino.modeling_grounding_dino.GroundingDinoObjectDetectionOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),H=new $n({props:{$$slots:{default:[Wn]},$$scope:{ctx:k}}}),V=new en({props:{anchor:"transformers.GroundingDinoForObjectDetection.forward.example",$$slots:{default:[Ln]},$$scope:{ctx:k}}}),Ce=new Fn({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/grounding-dino.md"}}),{c(){a=c("meta"),w=t(),m=c("p"),g=t(),u(T.$$.fragment),i=t(),u(v.$$.fragment),Xe=t(),Y=c("p"),Y.innerHTML=on,Qe=t(),K=c("p"),K.textContent=nn,Ye=t(),ee=c("p"),ee.innerHTML=tn,Ke=t(),P=c("img"),eo=t(),oe=c("small"),oe.innerHTML=rn,oo=t(),ne=c("p"),ne.innerHTML=an,no=t(),u(te.$$.fragment),to=t(),se=c("ul"),se.innerHTML=dn,so=t(),re=c("p"),re.textContent=cn,ro=t(),u(ae.$$.fragment),ao=t(),u(ie.$$.fragment),io=t(),de=c("p"),de.innerHTML=ln,co=t(),Z=c("img"),lo=t(),ce=c("small"),ce.innerHTML=gn,mo=t(),u(le.$$.fragment),go=t(),me=c("p"),me.textContent=pn,po=t(),ge=c("ul"),ge.innerHTML=un,uo=t(),u(pe.$$.fragment),ho=t(),j=c("div"),u(ue.$$.fragment),Co=t(),$e=c("p"),$e.textContent=hn,ko=t(),E=c("div"),u(he.$$.fragment),zo=t(),Je=c("p"),Je.textContent=fn,Io=t(),W=c("div"),u(fe.$$.fragment),$o=t(),Ue=c("p"),Ue.innerHTML=_n,fo=t(),u(_e.$$.fragment),_o=t(),G=c("div"),u(be.$$.fragment),Jo=t(),qe=c("p"),qe.textContent=bn,Uo=t(),Ne=c("p"),Ne.innerHTML=yn,qo=t(),L=c("div"),u(ye.$$.fragment),No=t(),Re=c("p"),Re.innerHTML=Tn,bo=t(),u(Te.$$.fragment),yo=t(),C=c("div"),u(we.$$.fragment),Ro=t(),Fe=c("p"),Fe.innerHTML=wn,Fo=t(),Pe=c("p"),Pe.innerHTML=vn,Po=t(),u(B.$$.fragment),To=t(),u(ve.$$.fragment),wo=t(),M=c("div"),u(xe.$$.fragment),Zo=t(),Ze=c("p"),Ze.textContent=xn,Eo=t(),Ee=c("p"),Ee.innerHTML=Mn,Wo=t(),We=c("p"),We.innerHTML=Dn,Lo=t(),z=c("div"),u(Me.$$.fragment),Bo=t(),Le=c("p"),Le.innerHTML=jn,Oo=t(),u(O.$$.fragment),So=t(),u(S.$$.fragment),vo=t(),u(De.$$.fragment),xo=t(),D=c("div"),u(je.$$.fragment),Ho=t(),Be=c("p"),Be.textContent=Gn,Vo=t(),Oe=c("p"),Oe.innerHTML=Cn,Ao=t(),Se=c("p"),Se.innerHTML=kn,Xo=t(),I=c("div"),u(Ge.$$.fragment),Qo=t(),He=c("p"),He.innerHTML=zn,Yo=t(),u(H.$$.fragment),Ko=t(),u(V.$$.fragment),Mo=t(),u(Ce.$$.fragment),Do=t(),Ve=c("p"),this.h()},l(e){const o=Rn("svelte-u9bgzb",document.head);a=l(o,"META",{name:!0,content:!0}),o.forEach(n),w=s(e),m=l(e,"P",{}),$(m).forEach(n),g=s(e),h(T.$$.fragment,e),i=s(e),h(v.$$.fragment,e),Xe=s(e),Y=l(e,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-1usvly6"&&(Y.innerHTML=on),Qe=s(e),K=l(e,"P",{"data-svelte-h":!0}),p(K)!=="svelte-vfdo9a"&&(K.textContent=nn),Ye=s(e),ee=l(e,"P",{"data-svelte-h":!0}),p(ee)!=="svelte-14ayby0"&&(ee.innerHTML=tn),Ke=s(e),P=l(e,"IMG",{src:!0,alt:!0,width:!0}),eo=s(e),oe=l(e,"SMALL",{"data-svelte-h":!0}),p(oe)!=="svelte-1o9330u"&&(oe.innerHTML=rn),oo=s(e),ne=l(e,"P",{"data-svelte-h":!0}),p(ne)!=="svelte-1p2elqj"&&(ne.innerHTML=an),no=s(e),h(te.$$.fragment,e),to=s(e),se=l(e,"UL",{"data-svelte-h":!0}),p(se)!=="svelte-1omd7fu"&&(se.innerHTML=dn),so=s(e),re=l(e,"P",{"data-svelte-h":!0}),p(re)!=="svelte-ffyfwo"&&(re.textContent=cn),ro=s(e),h(ae.$$.fragment,e),ao=s(e),h(ie.$$.fragment,e),io=s(e),de=l(e,"P",{"data-svelte-h":!0}),p(de)!=="svelte-1ewje5n"&&(de.innerHTML=ln),co=s(e),Z=l(e,"IMG",{src:!0,alt:!0,width:!0}),lo=s(e),ce=l(e,"SMALL",{"data-svelte-h":!0}),p(ce)!=="svelte-16zie7b"&&(ce.innerHTML=gn),mo=s(e),h(le.$$.fragment,e),go=s(e),me=l(e,"P",{"data-svelte-h":!0}),p(me)!=="svelte-h29b2y"&&(me.textContent=pn),po=s(e),ge=l(e,"UL",{"data-svelte-h":!0}),p(ge)!=="svelte-1afawla"&&(ge.innerHTML=un),uo=s(e),h(pe.$$.fragment,e),ho=s(e),j=l(e,"DIV",{class:!0});var J=$(j);h(ue.$$.fragment,J),Co=s(J),$e=l(J,"P",{"data-svelte-h":!0}),p($e)!=="svelte-1k24st3"&&($e.textContent=hn),ko=s(J),E=l(J,"DIV",{class:!0});var ke=$(E);h(he.$$.fragment,ke),zo=s(ke),Je=l(ke,"P",{"data-svelte-h":!0}),p(Je)!=="svelte-jgz2ra"&&(Je.textContent=fn),ke.forEach(n),Io=s(J),W=l(J,"DIV",{class:!0});var ze=$(W);h(fe.$$.fragment,ze),$o=s(ze),Ue=l(ze,"P",{"data-svelte-h":!0}),p(Ue)!=="svelte-ca0muk"&&(Ue.innerHTML=_n),ze.forEach(n),J.forEach(n),fo=s(e),h(_e.$$.fragment,e),_o=s(e),G=l(e,"DIV",{class:!0});var U=$(G);h(be.$$.fragment,U),Jo=s(U),qe=l(U,"P",{"data-svelte-h":!0}),p(qe)!=="svelte-6v5vrh"&&(qe.textContent=bn),Uo=s(U),Ne=l(U,"P",{"data-svelte-h":!0}),p(Ne)!=="svelte-1svcr55"&&(Ne.innerHTML=yn),qo=s(U),L=l(U,"DIV",{class:!0});var Ie=$(L);h(ye.$$.fragment,Ie),No=s(Ie),Re=l(Ie,"P",{"data-svelte-h":!0}),p(Re)!=="svelte-kxzevl"&&(Re.innerHTML=Tn),Ie.forEach(n),U.forEach(n),bo=s(e),h(Te.$$.fragment,e),yo=s(e),C=l(e,"DIV",{class:!0});var A=$(C);h(we.$$.fragment,A),Ro=s(A),Fe=l(A,"P",{"data-svelte-h":!0}),p(Fe)!=="svelte-14zgym3"&&(Fe.innerHTML=wn),Fo=s(A),Pe=l(A,"P",{"data-svelte-h":!0}),p(Pe)!=="svelte-o55m63"&&(Pe.innerHTML=vn),Po=s(A),h(B.$$.fragment,A),A.forEach(n),To=s(e),h(ve.$$.fragment,e),wo=s(e),M=l(e,"DIV",{class:!0});var q=$(M);h(xe.$$.fragment,q),Zo=s(q),Ze=l(q,"P",{"data-svelte-h":!0}),p(Ze)!=="svelte-7hyzcp"&&(Ze.textContent=xn),Eo=s(q),Ee=l(q,"P",{"data-svelte-h":!0}),p(Ee)!=="svelte-6pahdo"&&(Ee.innerHTML=Mn),Wo=s(q),We=l(q,"P",{"data-svelte-h":!0}),p(We)!=="svelte-hswkmf"&&(We.innerHTML=Dn),Lo=s(q),z=l(q,"DIV",{class:!0});var X=$(z);h(Me.$$.fragment,X),Bo=s(X),Le=l(X,"P",{"data-svelte-h":!0}),p(Le)!=="svelte-1rg4rqf"&&(Le.innerHTML=jn),Oo=s(X),h(O.$$.fragment,X),So=s(X),h(S.$$.fragment,X),X.forEach(n),q.forEach(n),vo=s(e),h(De.$$.fragment,e),xo=s(e),D=l(e,"DIV",{class:!0});var N=$(D);h(je.$$.fragment,N),Ho=s(N),Be=l(N,"P",{"data-svelte-h":!0}),p(Be)!=="svelte-hgz8xq"&&(Be.textContent=Gn),Vo=s(N),Oe=l(N,"P",{"data-svelte-h":!0}),p(Oe)!=="svelte-6pahdo"&&(Oe.innerHTML=Cn),Ao=s(N),Se=l(N,"P",{"data-svelte-h":!0}),p(Se)!=="svelte-hswkmf"&&(Se.innerHTML=kn),Xo=s(N),I=l(N,"DIV",{class:!0});var Q=$(I);h(Ge.$$.fragment,Q),Qo=s(Q),He=l(Q,"P",{"data-svelte-h":!0}),p(He)!=="svelte-z24s13"&&(He.innerHTML=zn),Yo=s(Q),h(H.$$.fragment,Q),Ko=s(Q),h(V.$$.fragment,Q),Q.forEach(n),N.forEach(n),Mo=s(e),h(Ce.$$.fragment,e),Do=s(e),Ve=l(e,"P",{}),$(Ve).forEach(n),this.h()},h(){x(a,"name","hf:doc:metadata"),x(a,"content",On),In(P.src,sn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/grouding_dino_architecture.png")||x(P,"src",sn),x(P,"alt","drawing"),x(P,"width","600"),In(Z.src,mn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/grounded_sam.png")||x(Z,"src",mn),x(Z,"alt","drawing"),x(Z,"width","900"),x(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,o){d(document.head,a),r(e,w,o),r(e,m,o),r(e,g,o),f(T,e,o),r(e,i,o),f(v,e,o),r(e,Xe,o),r(e,Y,o),r(e,Qe,o),r(e,K,o),r(e,Ye,o),r(e,ee,o),r(e,Ke,o),r(e,P,o),r(e,eo,o),r(e,oe,o),r(e,oo,o),r(e,ne,o),r(e,no,o),f(te,e,o),r(e,to,o),r(e,se,o),r(e,so,o),r(e,re,o),r(e,ro,o),f(ae,e,o),r(e,ao,o),f(ie,e,o),r(e,io,o),r(e,de,o),r(e,co,o),r(e,Z,o),r(e,lo,o),r(e,ce,o),r(e,mo,o),f(le,e,o),r(e,go,o),r(e,me,o),r(e,po,o),r(e,ge,o),r(e,uo,o),f(pe,e,o),r(e,ho,o),r(e,j,o),f(ue,j,null),d(j,Co),d(j,$e),d(j,ko),d(j,E),f(he,E,null),d(E,zo),d(E,Je),d(j,Io),d(j,W),f(fe,W,null),d(W,$o),d(W,Ue),r(e,fo,o),f(_e,e,o),r(e,_o,o),r(e,G,o),f(be,G,null),d(G,Jo),d(G,qe),d(G,Uo),d(G,Ne),d(G,qo),d(G,L),f(ye,L,null),d(L,No),d(L,Re),r(e,bo,o),f(Te,e,o),r(e,yo,o),r(e,C,o),f(we,C,null),d(C,Ro),d(C,Fe),d(C,Fo),d(C,Pe),d(C,Po),f(B,C,null),r(e,To,o),f(ve,e,o),r(e,wo,o),r(e,M,o),f(xe,M,null),d(M,Zo),d(M,Ze),d(M,Eo),d(M,Ee),d(M,Wo),d(M,We),d(M,Lo),d(M,z),f(Me,z,null),d(z,Bo),d(z,Le),d(z,Oo),f(O,z,null),d(z,So),f(S,z,null),r(e,vo,o),f(De,e,o),r(e,xo,o),r(e,D,o),f(je,D,null),d(D,Ho),d(D,Be),d(D,Vo),d(D,Oe),d(D,Ao),d(D,Se),d(D,Xo),d(D,I),f(Ge,I,null),d(I,Qo),d(I,He),d(I,Yo),f(H,I,null),d(I,Ko),f(V,I,null),r(e,Mo,o),f(Ce,e,o),r(e,Do,o),r(e,Ve,o),jo=!0},p(e,[o]){const J={};o&2&&(J.$$scope={dirty:o,ctx:e}),B.$set(J);const ke={};o&2&&(ke.$$scope={dirty:o,ctx:e}),O.$set(ke);const ze={};o&2&&(ze.$$scope={dirty:o,ctx:e}),S.$set(ze);const U={};o&2&&(U.$$scope={dirty:o,ctx:e}),H.$set(U);const Ie={};o&2&&(Ie.$$scope={dirty:o,ctx:e}),V.$set(Ie)},i(e){jo||(_(T.$$.fragment,e),_(v.$$.fragment,e),_(te.$$.fragment,e),_(ae.$$.fragment,e),_(ie.$$.fragment,e),_(le.$$.fragment,e),_(pe.$$.fragment,e),_(ue.$$.fragment,e),_(he.$$.fragment,e),_(fe.$$.fragment,e),_(_e.$$.fragment,e),_(be.$$.fragment,e),_(ye.$$.fragment,e),_(Te.$$.fragment,e),_(we.$$.fragment,e),_(B.$$.fragment,e),_(ve.$$.fragment,e),_(xe.$$.fragment,e),_(Me.$$.fragment,e),_(O.$$.fragment,e),_(S.$$.fragment,e),_(De.$$.fragment,e),_(je.$$.fragment,e),_(Ge.$$.fragment,e),_(H.$$.fragment,e),_(V.$$.fragment,e),_(Ce.$$.fragment,e),jo=!0)},o(e){b(T.$$.fragment,e),b(v.$$.fragment,e),b(te.$$.fragment,e),b(ae.$$.fragment,e),b(ie.$$.fragment,e),b(le.$$.fragment,e),b(pe.$$.fragment,e),b(ue.$$.fragment,e),b(he.$$.fragment,e),b(fe.$$.fragment,e),b(_e.$$.fragment,e),b(be.$$.fragment,e),b(ye.$$.fragment,e),b(Te.$$.fragment,e),b(we.$$.fragment,e),b(B.$$.fragment,e),b(ve.$$.fragment,e),b(xe.$$.fragment,e),b(Me.$$.fragment,e),b(O.$$.fragment,e),b(S.$$.fragment,e),b(De.$$.fragment,e),b(je.$$.fragment,e),b(Ge.$$.fragment,e),b(H.$$.fragment,e),b(V.$$.fragment,e),b(Ce.$$.fragment,e),jo=!1},d(e){e&&(n(w),n(m),n(g),n(i),n(Xe),n(Y),n(Qe),n(K),n(Ye),n(ee),n(Ke),n(P),n(eo),n(oe),n(oo),n(ne),n(no),n(to),n(se),n(so),n(re),n(ro),n(ao),n(io),n(de),n(co),n(Z),n(lo),n(ce),n(mo),n(go),n(me),n(po),n(ge),n(uo),n(ho),n(j),n(fo),n(_o),n(G),n(bo),n(yo),n(C),n(To),n(wo),n(M),n(vo),n(xo),n(D),n(Mo),n(Do),n(Ve)),n(a),y(T,e),y(v,e),y(te,e),y(ae,e),y(ie,e),y(le,e),y(pe,e),y(ue),y(he),y(fe),y(_e,e),y(be),y(ye),y(Te,e),y(we),y(B),y(ve,e),y(xe),y(Me),y(O),y(S),y(De,e),y(je),y(Ge),y(H),y(V),y(Ce,e)}}}const On='{"title":"Grounding DINO","local":"grounding-dino","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Grounded SAM","local":"grounded-sam","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"GroundingDinoImageProcessor","local":"transformers.GroundingDinoImageProcessor","sections":[],"depth":2},{"title":"GroundingDinoProcessor","local":"transformers.GroundingDinoProcessor","sections":[],"depth":2},{"title":"GroundingDinoConfig","local":"transformers.GroundingDinoConfig","sections":[],"depth":2},{"title":"GroundingDinoModel","local":"transformers.GroundingDinoModel","sections":[],"depth":2},{"title":"GroundingDinoForObjectDetection","local":"transformers.GroundingDinoForObjectDetection","sections":[],"depth":2}],"depth":1}';function Sn(k){return Un(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class et extends qn{constructor(a){super(),Nn(this,a,Sn,Bn,Jn,{})}}export{et as component};
