import{s as Ds,f as xs,o as Cs,n as cs}from"../chunks/scheduler.25b97de1.js";import{S as Os,i as Zs,g as c,s as a,r as p,A as zs,h as i,f as t,c as o,j as de,u,x as _,k as x,y as d,a as n,v as h,d as b,t as g,w as f}from"../chunks/index.d9030fc9.js";import{T as $s}from"../chunks/Tip.baa67368.js";import{D as ye}from"../chunks/Docstring.ffac8efa.js";import{C as Xe}from"../chunks/CodeBlock.e6cd0d95.js";import{E as ks}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as C,E as Vs}from"../chunks/EditOnGithub.91d95064.js";function Rs(O){let l,J="Examples:",T,m,j;return m=new Xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME9tRGV0VHVyYm9Db25maWclMkMlMjBPbURldFR1cmJvRm9yT2JqZWN0RGV0ZWN0aW9uJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyME9tRGV0LVR1cmJvJTIwb21sYWIlMkZvbWRldC10dXJiby1zd2luLXRpbnktaGYlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwT21EZXRUdXJib0NvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBvbWxhYiUyRm9tZGV0LXR1cmJvLXN3aW4tdGlueS1oZiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwT21EZXRUdXJib0Zvck9iamVjdERldGVjdGlvbihjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> OmDetTurboConfig, OmDetTurboForObjectDetection

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a OmDet-Turbo omlab/omdet-turbo-swin-tiny-hf style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = OmDetTurboConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the omlab/omdet-turbo-swin-tiny-hf style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OmDetTurboForObjectDetection(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(){l=c("p"),l.textContent=J,T=a(),p(m.$$.fragment)},l(r){l=i(r,"P",{"data-svelte-h":!0}),_(l)!=="svelte-kvfsh7"&&(l.textContent=J),T=o(r),u(m.$$.fragment,r)},m(r,y){n(r,l,y),n(r,T,y),h(m,r,y),j=!0},p:cs,i(r){j||(b(m.$$.fragment,r),j=!0)},o(r){g(m.$$.fragment,r),j=!1},d(r){r&&(t(l),t(T)),f(m,r)}}}function Gs(O){let l,J=`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(){l=c("p"),l.innerHTML=J},l(T){l=i(T,"P",{"data-svelte-h":!0}),_(l)!=="svelte-fincs2"&&(l.innerHTML=J)},m(T,m){n(T,l,m)},p:cs,d(T){T&&t(l)}}}function Bs(O){let l,J="Examples:",T,m,j;return m=new Xe({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyME9tRGV0VHVyYm9Gb3JPYmplY3REZXRlY3Rpb24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xhc3NlcyUzRGNsYXNzZXMlMkMlMEElMjAlMjAlMjAlMjB0YXJnZXRfc2l6ZXMlM0QlNUJpbWFnZS5zaXplJTVCJTNBJTNBLTElNUQlNUQlMkMlMEElMjAlMjAlMjAlMjBzY29yZV90aHJlc2hvbGQlM0QwLjMlMkMlMEElMjAlMjAlMjAlMjBubXNfdGhyZXNob2xkJTNEMC4zJTJDJTBBKSU1QjAlNUQlMEFmb3IlMjBzY29yZSUyQyUyMGNsYXNzX25hbWUlMkMlMjBib3glMjBpbiUyMHppcChyZXN1bHRzJTVCJTIyc2NvcmVzJTIyJTVEJTJDJTIwcmVzdWx0cyU1QiUyMmNsYXNzZXMlMjIlNUQlMkMlMjByZXN1bHRzJTVCJTIyYm94ZXMlMjIlNUQpJTNBJTBBJTIwJTIwJTIwJTIwYm94JTIwJTNEJTIwJTVCcm91bmQoaSUyQyUyMDEpJTIwZm9yJTIwaSUyMGluJTIwYm94LnRvbGlzdCgpJTVEJTBBJTIwJTIwJTIwJTIwcHJpbnQoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZiUyMkRldGVjdGVkJTIwJTdCY2xhc3NfbmFtZSU3RCUyMHdpdGglMjBjb25maWRlbmNlJTIwJTIyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZiUyMiU3QnJvdW5kKHNjb3JlLml0ZW0oKSUyQyUyMDIpJTdEJTIwYXQlMjBsb2NhdGlvbiUyMCU3QmJveCU3RCUyMiUwQSUyMCUyMCUyMCUyMCk=",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">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, OmDetTurboForObjectDetection

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;omlab/omdet-turbo-swin-tiny-hf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OmDetTurboForObjectDetection.from_pretrained(<span class="hljs-string">&quot;omlab/omdet-turbo-swin-tiny-hf&quot;</span>)

<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>classes = [<span class="hljs-string">&quot;cat&quot;</span>, <span class="hljs-string">&quot;remote&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>task = <span class="hljs-string">&quot;Detect {}.&quot;</span>.<span class="hljs-built_in">format</span>(<span class="hljs-string">&quot;, &quot;</span>.join(classes))
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(image, text=classes, task=task, 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)</span>
<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>    classes=classes,
<span class="hljs-meta">... </span>    target_sizes=[image.size[::-<span class="hljs-number">1</span>]],
<span class="hljs-meta">... </span>    score_threshold=<span class="hljs-number">0.3</span>,
<span class="hljs-meta">... </span>    nms_threshold=<span class="hljs-number">0.3</span>,
<span class="hljs-meta">&gt;&gt;&gt; </span>)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> score, class_name, 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;classes&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-meta">... </span>        <span class="hljs-string">f&quot;Detected <span class="hljs-subst">{class_name}</span> with confidence &quot;</span>
<span class="hljs-meta">... </span>        <span class="hljs-string">f&quot;<span class="hljs-subst">{<span class="hljs-built_in">round</span>(score.item(), <span class="hljs-number">2</span>)}</span> at location <span class="hljs-subst">{box}</span>&quot;</span>
<span class="hljs-meta">... </span>    )
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.76</span> at location [<span class="hljs-number">39.9</span>, <span class="hljs-number">71.3</span>, <span class="hljs-number">176.5</span>, <span class="hljs-number">117.9</span>]
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.72</span> at location [<span class="hljs-number">345.1</span>, <span class="hljs-number">22.5</span>, <span class="hljs-number">639.7</span>, <span class="hljs-number">371.9</span>]
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.65</span> at location [<span class="hljs-number">12.7</span>, <span class="hljs-number">53.8</span>, <span class="hljs-number">315.5</span>, <span class="hljs-number">475.3</span>]
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.57</span> at location [<span class="hljs-number">333.4</span>, <span class="hljs-number">75.6</span>, <span class="hljs-number">370.7</span>, <span class="hljs-number">187.0</span>]`,wrap:!1}}),{c(){l=c("p"),l.textContent=J,T=a(),p(m.$$.fragment)},l(r){l=i(r,"P",{"data-svelte-h":!0}),_(l)!=="svelte-kvfsh7"&&(l.textContent=J),T=o(r),u(m.$$.fragment,r)},m(r,y){n(r,l,y),n(r,T,y),h(m,r,y),j=!0},p:cs,i(r){j||(b(m.$$.fragment,r),j=!0)},o(r){g(m.$$.fragment,r),j=!1},d(r){r&&(t(l),t(T)),f(m,r)}}}function Ns(O){let l,J,T,m,j,r,y,we,B,is='The OmDet-Turbo model was proposed in <a href="https://arxiv.org/abs/2403.06892" rel="nofollow">Real-time Transformer-based Open-Vocabulary Detection with Efficient Fusion Head</a> by Tiancheng Zhao, Peng Liu, Xuan He, Lu Zhang, Kyusong Lee. OmDet-Turbo incorporates components from RT-DETR and introduces a swift multimodal fusion module to achieve real-time open-vocabulary object detection capabilities while maintaining high accuracy. The base model achieves performance of up to 100.2 FPS and 53.4 AP on COCO zero-shot.',Je,N,ds="The abstract from the paper is the following:",Me,F,ms="<em>End-to-end transformer-based detectors (DETRs) have shown exceptional performance in both closed-set and open-vocabulary object detection (OVD) tasks through the integration of language modalities. However, their demanding computational requirements have hindered their practical application in real-time object detection (OD) scenarios. In this paper, we scrutinize the limitations of two leading models in the OVDEval benchmark, OmDet and Grounding-DINO, and introduce OmDet-Turbo. This novel transformer-based real-time OVD model features an innovative Efficient Fusion Head (EFH) module designed to alleviate the bottlenecks observed in OmDet and Grounding-DINO. Notably, OmDet-Turbo-Base achieves a 100.2 frames per second (FPS) with TensorRT and language cache techniques applied. Notably, in zero-shot scenarios on COCO and LVIS datasets, OmDet-Turbo achieves performance levels nearly on par with current state-of-the-art supervised models. Furthermore, it establishes new state-of-the-art benchmarks on ODinW and OVDEval, boasting an AP of 30.1 and an NMS-AP of 26.86, respectively. The practicality of OmDet-Turbo in industrial applications is underscored by its exceptional performance on benchmark datasets and superior inference speed, positioning it as a compelling choice for real-time object detection tasks.</em>",ve,Z,ps,Ie,W,us='OmDet-Turbo architecture overview. Taken from the <a href="https://arxiv.org/abs/2403.06892">original paper</a>.',Ue,q,hs=`This model was contributed by <a href="https://huggingface.co/yonigozlan" rel="nofollow">yonigozlan</a>.
The original code can be found <a href="https://github.com/om-ai-lab/OmDet" rel="nofollow">here</a>.`,ke,E,De,Q,bs='One unique property of OmDet-Turbo compared to other zero-shot object detection models, such as <a href="grounding-dino">Grounding DINO</a>, is the decoupled classes and prompt embedding structure that allows caching of text embeddings. This means that the model needs both classes and task as inputs, where classes is a list of objects we want to detect and task is the grounded text used to guide open-vocabulary detection. This approach limits the scope of the open-vocabulary detection and makes the decoding process faster.',xe,H,gs='<a href="/docs/transformers/main/en/model_doc/omdet-turbo#transformers.OmDetTurboProcessor">OmDetTurboProcessor</a> is used to prepare the classes, task and image triplet. The task input is optional, and when not provided, it will default to <code>&quot;Detect [class1], [class2], [class3], ...&quot;</code>. To process the results from the model, one can use <code>post_process_grounded_object_detection</code> from <a href="/docs/transformers/main/en/model_doc/omdet-turbo#transformers.OmDetTurboProcessor">OmDetTurboProcessor</a>. Notably, this function takes in the input classes, as unlike other zero-shot object detection models, the decoupling of classes and task embeddings means that no decoding of the predicted class embeddings is needed in the post-processing step, and the predicted classes can be matched to the inputted ones directly.',Ce,X,Oe,Y,Ze,S,fs="Here’s how to load the model and prepare the inputs to perform zero-shot object detection on a single image:",ze,L,$e,A,Ve,P,Ts="OmDet-Turbo can perform batched multi-image inference, with support for different text prompts and classes in the same batch:",Re,K,Ge,ee,Be,M,se,Ye,me,_s=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/omdet-turbo#transformers.OmDetTurboForObjectDetection">OmDetTurboForObjectDetection</a>.
It is used to instantiate a OmDet-Turbo 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 OmDet-Turbo
<a href="https://huggingface.co/omlab/omdet-turbo-swin-tiny-hf" rel="nofollow">omlab/omdet-turbo-swin-tiny-hf</a> architecture.`,Se,pe,js=`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.`,Le,z,Ne,te,Fe,v,ne,Ae,ue,ys=`Constructs a OmDet-Turbo processor which wraps a Deformable DETR image processor and an AutoTokenizer into a
single processor.`,Pe,he,ws=`<a href="/docs/transformers/main/en/model_doc/omdet-turbo#transformers.OmDetTurboProcessor">OmDetTurboProcessor</a> offers all the functionalities of <a href="/docs/transformers/main/en/model_doc/detr#transformers.DetrImageProcessor">DetrImageProcessor</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.`,Ke,$,ae,es,be,Js=`Converts the raw output of <a href="/docs/transformers/main/en/model_doc/omdet-turbo#transformers.OmDetTurboForObjectDetection">OmDetTurboForObjectDetection</a> into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format and get the associated text class.`,We,oe,qe,w,re,ss,ge,Ms=`OmDetTurbo Model (consisting of a vision and a text backbone, and encoder-decoder architecture) outputting
bounding boxes and classes scores for tasks such as COCO detection.`,ts,fe,vs=`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.)`,ns,Te,Is=`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.`,as,I,le,os,_e,Us='The <a href="/docs/transformers/main/en/model_doc/omdet-turbo#transformers.OmDetTurboForObjectDetection">OmDetTurboForObjectDetection</a> forward method, overrides the <code>__call__</code> special method.',rs,V,ls,R,Ee,ce,Qe,je,He;return j=new C({props:{title:"OmDet-Turbo",local:"omdet-turbo",headingTag:"h1"}}),y=new C({props:{title:"Overview",local:"overview",headingTag:"h2"}}),E=new C({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),X=new C({props:{title:"Usage example",local:"usage-example",headingTag:"h2"}}),Y=new C({props:{title:"Single image inference",local:"single-image-inference",headingTag:"h3"}}),L=new Xe({props:{code:"aW1wb3J0JTIwdG9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<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, OmDetTurboForObjectDetection

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;omlab/omdet-turbo-swin-tiny-hf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OmDetTurboForObjectDetection.from_pretrained(<span class="hljs-string">&quot;omlab/omdet-turbo-swin-tiny-hf&quot;</span>)

<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_labels = [<span class="hljs-string">&quot;cat&quot;</span>, <span class="hljs-string">&quot;remote&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(image, text=text_labels, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<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><span class="hljs-comment"># convert outputs (bounding boxes and class logits)</span>
<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>    target_sizes=[(image.height, image.width)],
<span class="hljs-meta">... </span>    text_labels=text_labels,
<span class="hljs-meta">... </span>    threshold=<span class="hljs-number">0.3</span>,
<span class="hljs-meta">... </span>    nms_threshold=<span class="hljs-number">0.3</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>result = results[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes, scores, text_labels = result[<span class="hljs-string">&quot;boxes&quot;</span>], result[<span class="hljs-string">&quot;scores&quot;</span>], result[<span class="hljs-string">&quot;text_labels&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> box, score, text_label <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(boxes, scores, text_labels):
<span class="hljs-meta">... </span>    box = [<span class="hljs-built_in">round</span>(i, <span class="hljs-number">2</span>) <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> box.tolist()]
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Detected <span class="hljs-subst">{text_label}</span> with confidence <span class="hljs-subst">{<span class="hljs-built_in">round</span>(score.item(), <span class="hljs-number">3</span>)}</span> at location <span class="hljs-subst">{box}</span>&quot;</span>)
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.768</span> at location [<span class="hljs-number">39.89</span>, <span class="hljs-number">70.35</span>, <span class="hljs-number">176.74</span>, <span class="hljs-number">118.04</span>]
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.72</span> at location [<span class="hljs-number">11.6</span>, <span class="hljs-number">54.19</span>, <span class="hljs-number">314.8</span>, <span class="hljs-number">473.95</span>]
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.563</span> at location [<span class="hljs-number">333.38</span>, <span class="hljs-number">75.77</span>, <span class="hljs-number">370.7</span>, <span class="hljs-number">187.03</span>]
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.552</span> at location [<span class="hljs-number">345.15</span>, <span class="hljs-number">23.95</span>, <span class="hljs-number">639.75</span>, <span class="hljs-number">371.67</span>]`,wrap:!1}}),A=new C({props:{title:"Multi image inference",local:"multi-image-inference",headingTag:"h3"}}),K=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MjIlNUQlMEElMjAlMjAlMjAlMjApJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYm94JTIwJTNEJTIwJTVCcm91bmQoaSUyQyUyMDEpJTIwZm9yJTIwaSUyMGluJTIwYm94LnRvbGlzdCgpJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcHJpbnQoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZiUyMkRldGVjdGVkJTIwJTdCdGV4dF9sYWJlbCU3RCUyMHdpdGglMjBjb25maWRlbmNlJTIwJTIyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZiUyMiU3QnJvdW5kKHNjb3JlLml0ZW0oKSUyQyUyMDIpJTdEJTIwYXQlMjBsb2NhdGlvbiUyMCU3QmJveCU3RCUyMGluJTIwaW1hZ2UlMjAlN0JpJTdEJTIyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<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, OmDetTurboForObjectDetection

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;omlab/omdet-turbo-swin-tiny-hf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OmDetTurboForObjectDetection.from_pretrained(<span class="hljs-string">&quot;omlab/omdet-turbo-swin-tiny-hf&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url1 = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image1 = Image.<span class="hljs-built_in">open</span>(BytesIO(requests.get(url1).content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_labels1 = [<span class="hljs-string">&quot;cat&quot;</span>, <span class="hljs-string">&quot;remote&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>task1 = <span class="hljs-string">&quot;Detect {}.&quot;</span>.<span class="hljs-built_in">format</span>(<span class="hljs-string">&quot;, &quot;</span>.join(text_labels1))

<span class="hljs-meta">&gt;&gt;&gt; </span>url2 = <span class="hljs-string">&quot;http://images.cocodataset.org/train2017/000000257813.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image2 = Image.<span class="hljs-built_in">open</span>(BytesIO(requests.get(url2).content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_labels2 = [<span class="hljs-string">&quot;boat&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>task2 = <span class="hljs-string">&quot;Detect everything that looks like a boat.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>url3 = <span class="hljs-string">&quot;https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image3 = Image.<span class="hljs-built_in">open</span>(BytesIO(requests.get(url3).content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_labels3 = [<span class="hljs-string">&quot;statue&quot;</span>, <span class="hljs-string">&quot;trees&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>task3 = <span class="hljs-string">&quot;Focus on the foreground, detect statue and trees.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(
<span class="hljs-meta">... </span>    images=[image1, image2, image3],
<span class="hljs-meta">... </span>    text=[text_labels1, text_labels2, text_labels3],
<span class="hljs-meta">... </span>    task=[task1, task2, task3],
<span class="hljs-meta">... </span>    return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>)

<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><span class="hljs-comment"># convert outputs (bounding boxes and class logits)</span>
<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>    text_labels=[text_labels1, text_labels2, text_labels3],
<span class="hljs-meta">... </span>    target_sizes=[(image.height, image.width) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> [image1, image2, image3]],
<span class="hljs-meta">... </span>    threshold=<span class="hljs-number">0.2</span>,
<span class="hljs-meta">... </span>    nms_threshold=<span class="hljs-number">0.3</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> i, result <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(results):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> score, text_label, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(
<span class="hljs-meta">... </span>        result[<span class="hljs-string">&quot;scores&quot;</span>], result[<span class="hljs-string">&quot;text_labels&quot;</span>], result[<span class="hljs-string">&quot;boxes&quot;</span>]
<span class="hljs-meta">... </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-meta">... </span>            <span class="hljs-string">f&quot;Detected <span class="hljs-subst">{text_label}</span> with confidence &quot;</span>
<span class="hljs-meta">... </span>            <span class="hljs-string">f&quot;<span class="hljs-subst">{<span class="hljs-built_in">round</span>(score.item(), <span class="hljs-number">2</span>)}</span> at location <span class="hljs-subst">{box}</span> in image <span class="hljs-subst">{i}</span>&quot;</span>
<span class="hljs-meta">... </span>        )
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.77</span> at location [<span class="hljs-number">39.9</span>, <span class="hljs-number">70.4</span>, <span class="hljs-number">176.7</span>, <span class="hljs-number">118.0</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">0</span>
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.72</span> at location [<span class="hljs-number">11.6</span>, <span class="hljs-number">54.2</span>, <span class="hljs-number">314.8</span>, <span class="hljs-number">474.0</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">0</span>
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.56</span> at location [<span class="hljs-number">333.4</span>, <span class="hljs-number">75.8</span>, <span class="hljs-number">370.7</span>, <span class="hljs-number">187.0</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">0</span>
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.55</span> at location [<span class="hljs-number">345.2</span>, <span class="hljs-number">24.0</span>, <span class="hljs-number">639.8</span>, <span class="hljs-number">371.7</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">0</span>
Detected boat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.32</span> at location [<span class="hljs-number">146.9</span>, <span class="hljs-number">219.8</span>, <span class="hljs-number">209.6</span>, <span class="hljs-number">250.7</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">1</span>
Detected boat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.3</span> at location [<span class="hljs-number">319.1</span>, <span class="hljs-number">223.2</span>, <span class="hljs-number">403.2</span>, <span class="hljs-number">238.4</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">1</span>
Detected boat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.27</span> at location [<span class="hljs-number">37.7</span>, <span class="hljs-number">220.3</span>, <span class="hljs-number">84.0</span>, <span class="hljs-number">235.9</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">1</span>
Detected boat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.22</span> at location [<span class="hljs-number">407.9</span>, <span class="hljs-number">207.0</span>, <span class="hljs-number">441.7</span>, <span class="hljs-number">220.2</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">1</span>
Detected statue <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.73</span> at location [<span class="hljs-number">544.7</span>, <span class="hljs-number">210.2</span>, <span class="hljs-number">651.9</span>, <span class="hljs-number">502.8</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">2</span>
Detected trees <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.25</span> at location [<span class="hljs-number">3.9</span>, <span class="hljs-number">584.3</span>, <span class="hljs-number">391.4</span>, <span class="hljs-number">785.6</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">2</span>
Detected trees <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.25</span> at location [<span class="hljs-number">1.4</span>, <span class="hljs-number">621.2</span>, <span class="hljs-number">118.2</span>, <span class="hljs-number">787.8</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">2</span>
Detected statue <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.2</span> at location [<span class="hljs-number">428.1</span>, <span class="hljs-number">205.5</span>, <span class="hljs-number">767.3</span>, <span class="hljs-number">759.5</span>] <span class="hljs-keyword">in</span> image <span class="hljs-number">2</span>
`,wrap:!1}}),ee=new C({props:{title:"OmDetTurboConfig",local:"transformers.OmDetTurboConfig",headingTag:"h2"}}),se=new ye({props:{name:"class transformers.OmDetTurboConfig",anchor:"transformers.OmDetTurboConfig",parameters:[{name:"text_config",val:" = None"},{name:"backbone_config",val:" = None"},{name:"use_timm_backbone",val:" = True"},{name:"backbone",val:" = 'swin_tiny_patch4_window7_224'"},{name:"backbone_kwargs",val:" = None"},{name:"use_pretrained_backbone",val:" = False"},{name:"apply_layernorm_after_vision_backbone",val:" = True"},{name:"image_size",val:" = 640"},{name:"disable_custom_kernels",val:" = False"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"batch_norm_eps",val:" = 1e-05"},{name:"init_std",val:" = 0.02"},{name:"text_projection_in_dim",val:" = 512"},{name:"text_projection_out_dim",val:" = 512"},{name:"task_encoder_hidden_dim",val:" = 1024"},{name:"class_embed_dim",val:" = 512"},{name:"class_distance_type",val:" = 'cosine'"},{name:"num_queries",val:" = 900"},{name:"csp_activation",val:" = 'silu'"},{name:"conv_norm_activation",val:" = 'gelu'"},{name:"encoder_feedforward_activation",val:" = 'relu'"},{name:"encoder_feedforward_dropout",val:" = 0.0"},{name:"encoder_dropout",val:" = 0.0"},{name:"hidden_expansion",val:" = 1"},{name:"vision_features_channels",val:" = [256, 256, 256]"},{name:"encoder_hidden_dim",val:" = 256"},{name:"encoder_in_channels",val:" = [192, 384, 768]"},{name:"encoder_projection_indices",val:" = [2]"},{name:"encoder_attention_heads",val:" = 8"},{name:"encoder_dim_feedforward",val:" = 2048"},{name:"encoder_layers",val:" = 1"},{name:"positional_encoding_temperature",val:" = 10000"},{name:"num_feature_levels",val:" = 3"},{name:"decoder_hidden_dim",val:" = 256"},{name:"decoder_num_heads",val:" = 8"},{name:"decoder_num_layers",val:" = 6"},{name:"decoder_activation",val:" = 'relu'"},{name:"decoder_dim_feedforward",val:" = 2048"},{name:"decoder_num_points",val:" = 4"},{name:"decoder_dropout",val:" = 0.0"},{name:"eval_size",val:" = None"},{name:"learn_initial_query",val:" = False"},{name:"cache_size",val:" = 100"},{name:"is_encoder_decoder",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.OmDetTurboConfig.text_config",description:`<strong>text_config</strong> (<code>PretrainedConfig</code>, <em>optional</em>) &#x2014;
The configuration of the text backbone.`,name:"text_config"},{anchor:"transformers.OmDetTurboConfig.backbone_config",description:`<strong>backbone_config</strong> (<code>PretrainedConfig</code>, <em>optional</em>) &#x2014;
The configuration of the vision backbone.`,name:"backbone_config"},{anchor:"transformers.OmDetTurboConfig.use_timm_backbone",description:`<strong>use_timm_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use the timm for the vision backbone.`,name:"use_timm_backbone"},{anchor:"transformers.OmDetTurboConfig.backbone",description:`<strong>backbone</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;swin_tiny_patch4_window7_224&quot;</code>) &#x2014;
The name of the pretrained vision backbone to use. If <code>use_pretrained_backbone=False</code> a randomly initialized
backbone with the same architecture <code>backbone</code> is used.`,name:"backbone"},{anchor:"transformers.OmDetTurboConfig.backbone_kwargs",description:`<strong>backbone_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Additional kwargs for the vision backbone.`,name:"backbone_kwargs"},{anchor:"transformers.OmDetTurboConfig.use_pretrained_backbone",description:`<strong>use_pretrained_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use a pretrained vision backbone.`,name:"use_pretrained_backbone"},{anchor:"transformers.OmDetTurboConfig.apply_layernorm_after_vision_backbone",description:`<strong>apply_layernorm_after_vision_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to apply layer normalization on the feature maps of the vision backbone output.`,name:"apply_layernorm_after_vision_backbone"},{anchor:"transformers.OmDetTurboConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 640) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.OmDetTurboConfig.disable_custom_kernels",description:`<strong>disable_custom_kernels</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to disable custom kernels.`,name:"disable_custom_kernels"},{anchor:"transformers.OmDetTurboConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon value for layer normalization.`,name:"layer_norm_eps"},{anchor:"transformers.OmDetTurboConfig.batch_norm_eps",description:`<strong>batch_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon value for batch normalization.`,name:"batch_norm_eps"},{anchor:"transformers.OmDetTurboConfig.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.OmDetTurboConfig.text_projection_in_dim",description:`<strong>text_projection_in_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The input dimension for the text projection.`,name:"text_projection_in_dim"},{anchor:"transformers.OmDetTurboConfig.text_projection_out_dim",description:`<strong>text_projection_out_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The output dimension for the text projection.`,name:"text_projection_out_dim"},{anchor:"transformers.OmDetTurboConfig.task_encoder_hidden_dim",description:`<strong>task_encoder_hidden_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
The feedforward dimension for the task encoder.`,name:"task_encoder_hidden_dim"},{anchor:"transformers.OmDetTurboConfig.class_embed_dim",description:`<strong>class_embed_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The dimension of the classes embeddings.`,name:"class_embed_dim"},{anchor:"transformers.OmDetTurboConfig.class_distance_type",description:`<strong>class_distance_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;cosine&quot;</code>) &#x2014;
The type of of distance to compare predicted classes to projected classes embeddings.
Can be <code>&quot;cosine&quot;</code> or <code>&quot;dot&quot;</code>.`,name:"class_distance_type"},{anchor:"transformers.OmDetTurboConfig.num_queries",description:`<strong>num_queries</strong> (<code>int</code>, <em>optional</em>, defaults to 900) &#x2014;
The number of queries.`,name:"num_queries"},{anchor:"transformers.OmDetTurboConfig.csp_activation",description:`<strong>csp_activation</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The activation function of the Cross Stage Partial (CSP) networks of the encoder.`,name:"csp_activation"},{anchor:"transformers.OmDetTurboConfig.conv_norm_activation",description:`<strong>conv_norm_activation</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The activation function of the ConvNormLayer layers of the encoder.`,name:"conv_norm_activation"},{anchor:"transformers.OmDetTurboConfig.encoder_feedforward_activation",description:`<strong>encoder_feedforward_activation</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;relu&quot;</code>) &#x2014;
The activation function for the feedforward network of the encoder.`,name:"encoder_feedforward_activation"},{anchor:"transformers.OmDetTurboConfig.encoder_feedforward_dropout",description:`<strong>encoder_feedforward_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout rate following the activation of the encoder feedforward network.`,name:"encoder_feedforward_dropout"},{anchor:"transformers.OmDetTurboConfig.encoder_dropout",description:`<strong>encoder_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout rate of the encoder multi-head attention module.`,name:"encoder_dropout"},{anchor:"transformers.OmDetTurboConfig.hidden_expansion",description:`<strong>hidden_expansion</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The hidden expansion of the CSP networks in the encoder.`,name:"hidden_expansion"},{anchor:"transformers.OmDetTurboConfig.vision_features_channels",description:`<strong>vision_features_channels</strong> (<code>tuple(int)</code>, <em>optional</em>, defaults to <code>[256, 256, 256]</code>) &#x2014;
The projected vision features channels used as inputs for the decoder.`,name:"vision_features_channels"},{anchor:"transformers.OmDetTurboConfig.encoder_hidden_dim",description:`<strong>encoder_hidden_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
The hidden dimension of the encoder.`,name:"encoder_hidden_dim"},{anchor:"transformers.OmDetTurboConfig.encoder_in_channels",description:`<strong>encoder_in_channels</strong> (<code>List(int)</code>, <em>optional</em>, defaults to <code>[192, 384, 768]</code>) &#x2014;
The input channels for the encoder.`,name:"encoder_in_channels"},{anchor:"transformers.OmDetTurboConfig.encoder_projection_indices",description:`<strong>encoder_projection_indices</strong> (<code>List(int)</code>, <em>optional</em>, defaults to <code>[2]</code>) &#x2014;
The indices of the input features projected by each layers.`,name:"encoder_projection_indices"},{anchor:"transformers.OmDetTurboConfig.encoder_attention_heads",description:`<strong>encoder_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The number of attention heads for the encoder.`,name:"encoder_attention_heads"},{anchor:"transformers.OmDetTurboConfig.encoder_dim_feedforward",description:`<strong>encoder_dim_feedforward</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The feedforward dimension for the encoder.`,name:"encoder_dim_feedforward"},{anchor:"transformers.OmDetTurboConfig.encoder_layers",description:`<strong>encoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of layers in the encoder.`,name:"encoder_layers"},{anchor:"transformers.OmDetTurboConfig.positional_encoding_temperature",description:`<strong>positional_encoding_temperature</strong> (<code>int</code>, <em>optional</em>, defaults to 10000) &#x2014;
The positional encoding temperature in the encoder.`,name:"positional_encoding_temperature"},{anchor:"transformers.OmDetTurboConfig.num_feature_levels",description:`<strong>num_feature_levels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of feature levels for the multi-scale deformable attention module of the decoder.`,name:"num_feature_levels"},{anchor:"transformers.OmDetTurboConfig.decoder_hidden_dim",description:`<strong>decoder_hidden_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
The hidden dimension of the decoder.`,name:"decoder_hidden_dim"},{anchor:"transformers.OmDetTurboConfig.decoder_num_heads",description:`<strong>decoder_num_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The number of heads for the decoder.`,name:"decoder_num_heads"},{anchor:"transformers.OmDetTurboConfig.decoder_num_layers",description:`<strong>decoder_num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 6) &#x2014;
The number of layers for the decoder.`,name:"decoder_num_layers"},{anchor:"transformers.OmDetTurboConfig.decoder_activation",description:`<strong>decoder_activation</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;relu&quot;</code>) &#x2014;
The activation function for the decoder.`,name:"decoder_activation"},{anchor:"transformers.OmDetTurboConfig.decoder_dim_feedforward",description:`<strong>decoder_dim_feedforward</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The feedforward dimension for the decoder.`,name:"decoder_dim_feedforward"},{anchor:"transformers.OmDetTurboConfig.decoder_num_points",description:`<strong>decoder_num_points</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of points sampled in the decoder multi-scale deformable attention module.`,name:"decoder_num_points"},{anchor:"transformers.OmDetTurboConfig.decoder_dropout",description:`<strong>decoder_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout rate for the decoder.`,name:"decoder_dropout"},{anchor:"transformers.OmDetTurboConfig.eval_size",description:`<strong>eval_size</strong> (<code>Tuple[int, int]</code>, <em>optional</em>) &#x2014;
Height and width used to computes the effective height and width of the position embeddings after taking
into account the stride (see RTDetr).`,name:"eval_size"},{anchor:"transformers.OmDetTurboConfig.learn_initial_query",description:`<strong>learn_initial_query</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to learn the initial query.`,name:"learn_initial_query"},{anchor:"transformers.OmDetTurboConfig.cache_size",description:`<strong>cache_size</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The cache size for the classes and prompts caches.`,name:"cache_size"},{anchor:"transformers.OmDetTurboConfig.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 model or not.`,name:"is_encoder_decoder"},{anchor:"transformers.OmDetTurboConfig.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional parameters from the architecture. The values in kwargs will be saved as part of the configuration
and can be used to control the model outputs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/omdet_turbo/configuration_omdet_turbo.py#L26"}}),z=new ks({props:{anchor:"transformers.OmDetTurboConfig.example",$$slots:{default:[Rs]},$$scope:{ctx:O}}}),te=new C({props:{title:"OmDetTurboProcessor",local:"transformers.OmDetTurboProcessor",headingTag:"h2"}}),ne=new ye({props:{name:"class transformers.OmDetTurboProcessor",anchor:"transformers.OmDetTurboProcessor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.OmDetTurboProcessor.image_processor",description:`<strong>image_processor</strong> (<code>DetrImageProcessor</code>) &#x2014;
An instance of <a href="/docs/transformers/main/en/model_doc/detr#transformers.DetrImageProcessor">DetrImageProcessor</a>. The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.OmDetTurboProcessor.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/omdet_turbo/processing_omdet_turbo.py#L202"}}),ae=new ye({props:{name:"post_process_grounded_object_detection",anchor:"transformers.OmDetTurboProcessor.post_process_grounded_object_detection",parameters:[{name:"outputs",val:": OmDetTurboObjectDetectionOutput"},{name:"text_labels",val:": typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType] = None"},{name:"threshold",val:": float = 0.3"},{name:"nms_threshold",val:": float = 0.5"},{name:"target_sizes",val:": typing.Union[transformers.utils.generic.TensorType, typing.List[typing.Tuple], NoneType] = None"},{name:"max_num_det",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.OmDetTurboProcessor.post_process_grounded_object_detection.outputs",description:`<strong>outputs</strong> (<code>OmDetTurboObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.OmDetTurboProcessor.post_process_grounded_object_detection.text_labels",description:`<strong>text_labels</strong> (Union[List[str], List[List[str]]], <em>optional</em>) &#x2014;
The input classes names. If not provided, <code>text_labels</code> will be set to <code>None</code> in <code>outputs</code>.`,name:"text_labels"},{anchor:"transformers.OmDetTurboProcessor.post_process_grounded_object_detection.threshold",description:`<strong>threshold</strong> (float, defaults to 0.3) &#x2014;
Only return detections with a confidence score exceeding this threshold.`,name:"threshold"},{anchor:"transformers.OmDetTurboProcessor.post_process_grounded_object_detection.nms_threshold",description:`<strong>nms_threshold</strong> (float, defaults to 0.5) &#x2014;
The threshold to use for box non-maximum suppression. Value in [0, 1].`,name:"nms_threshold"},{anchor:"transformers.OmDetTurboProcessor.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"},{anchor:"transformers.OmDetTurboProcessor.post_process_grounded_object_detection.max_num_det",description:`<strong>max_num_det</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum number of detections to return.`,name:"max_num_det"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/omdet_turbo/processing_omdet_turbo.py#L320",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of dictionaries, each dictionary containing the scores, classes 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>
`}}),oe=new C({props:{title:"OmDetTurboForObjectDetection",local:"transformers.OmDetTurboForObjectDetection",headingTag:"h2"}}),re=new ye({props:{name:"class transformers.OmDetTurboForObjectDetection",anchor:"transformers.OmDetTurboForObjectDetection",parameters:[{name:"config",val:": OmDetTurboConfig"}],parametersDescription:[{anchor:"transformers.OmDetTurboForObjectDetection.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/omdet-turbo#transformers.OmDetTurboConfig">OmDetTurboConfig</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/omdet_turbo/modeling_omdet_turbo.py#L1634"}}),le=new ye({props:{name:"forward",anchor:"transformers.OmDetTurboForObjectDetection.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"classes_input_ids",val:": LongTensor"},{name:"classes_attention_mask",val:": LongTensor"},{name:"tasks_input_ids",val:": LongTensor"},{name:"tasks_attention_mask",val:": LongTensor"},{name:"classes_structure",val:": LongTensor"},{name:"labels",val:": typing.Optional[torch.LongTensor] = 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"}],parametersDescription:[{anchor:"transformers.OmDetTurboForObjectDetection.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/deit#transformers.DeiTFeatureExtractor.__call__">DetrImageProcessor.<strong>call</strong>()</a> for
details.`,name:"pixel_values"},{anchor:"transformers.OmDetTurboForObjectDetection.forward.classes_input_ids",description:`<strong>classes_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(total_classes (&gt;= batch_size), sequence_length)</code>) &#x2014;
Indices of input classes sequence tokens in the vocabulary of the language model.
Several classes can be provided for each tasks, thus the tokenized classes are flattened
and the structure of the classes is provided in the <code>classes_structure</code> argument.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/omdet-turbo#transformers.OmDetTurboProcessor">OmDetTurboProcessor</a>. See <code>OmDetTurboProcessor.__call__()</code> for
details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"classes_input_ids"},{anchor:"transformers.OmDetTurboForObjectDetection.forward.classes_attention_mask",description:`<strong>classes_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(total_classes (&gt;= batch_size), num_classes, sequence_length)</code>) &#x2014;
Attention mask for the classes. This is a binary mask that indicates which tokens should be attended to,
and which should not.`,name:"classes_attention_mask"},{anchor:"transformers.OmDetTurboForObjectDetection.forward.tasks_input_ids",description:`<strong>tasks_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input tasks sequence tokens in the vocabulary of the language model.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/omdet-turbo#transformers.OmDetTurboProcessor">OmDetTurboProcessor</a>. See <code>OmDetTurboProcessor.__call__()</code> for
details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"tasks_input_ids"},{anchor:"transformers.OmDetTurboForObjectDetection.forward.tasks_attention_mask",description:`<strong>tasks_attention_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Attention mask for the tasks. This is a binary mask that indicates which tokens should be attended to,
and which should not.`,name:"tasks_attention_mask"},{anchor:"transformers.OmDetTurboForObjectDetection.forward.classes_structure",description:`<strong>classes_structure</strong> (torch.LongTensor of shape <code>(batch_size)</code>) &#x2014;
Structure of the classes. This tensor indicates the number of classes for each task.`,name:"classes_structure"},{anchor:"transformers.OmDetTurboForObjectDetection.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.OmDetTurboForObjectDetection.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.OmDetTurboForObjectDetection.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/omdet_turbo/modeling_omdet_turbo.py#L1669",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboObjectDetectionOutput</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/omdet-turbo#transformers.OmDetTurboConfig"
>OmDetTurboConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code>) — The loss value.</li>
<li><strong>decoder_coord_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, 4)</code>) — The predicted coordinates logits of the objects.</li>
<li><strong>decoder_class_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, num_classes)</code>) — The predicted class of the objects.</li>
<li><strong>init_reference_points</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, 4)</code>) — The initial reference points.</li>
<li><strong>intermediate_reference_points</strong> (<code>Tuple[Tuple[torch.FloatTensor]]</code>) — The intermediate reference points.</li>
<li><strong>encoder_coord_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, 4)</code>) — The predicted coordinates of the objects from the encoder.</li>
<li><strong>encoder_class_logits</strong> (<code>Tuple[torch.FloatTensor]</code>) — The predicted class of the objects from the encoder.</li>
<li><strong>encoder_extracted_states</strong> (<code>torch.FloatTensor</code>) — The extracted states from the Feature Pyramid Network (FPN) and Path Aggregation Network (PAN) of the encoder.</li>
<li><strong>decoder_hidden_states</strong> (<code>Tuple[torch.FloatTensor]</code>, <em>optional</em>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the model 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>) — 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_hidden_states</strong> (<code>Tuple[torch.FloatTensor]</code>, <em>optional</em>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the model 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>) — 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>classes_structure</strong> (<code>torch.LongTensor</code>, <em>optional</em>) — The number of queried classes for each image.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboObjectDetectionOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),V=new $s({props:{$$slots:{default:[Gs]},$$scope:{ctx:O}}}),R=new ks({props:{anchor:"transformers.OmDetTurboForObjectDetection.forward.example",$$slots:{default:[Bs]},$$scope:{ctx:O}}}),ce=new Vs({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/omdet-turbo.md"}}),{c(){l=c("meta"),J=a(),T=c("p"),m=a(),p(j.$$.fragment),r=a(),p(y.$$.fragment),we=a(),B=c("p"),B.innerHTML=is,Je=a(),N=c("p"),N.textContent=ds,Me=a(),F=c("p"),F.innerHTML=ms,ve=a(),Z=c("img"),Ie=a(),W=c("small"),W.innerHTML=us,Ue=a(),q=c("p"),q.innerHTML=hs,ke=a(),p(E.$$.fragment),De=a(),Q=c("p"),Q.innerHTML=bs,xe=a(),H=c("p"),H.innerHTML=gs,Ce=a(),p(X.$$.fragment),Oe=a(),p(Y.$$.fragment),Ze=a(),S=c("p"),S.textContent=fs,ze=a(),p(L.$$.fragment),$e=a(),p(A.$$.fragment),Ve=a(),P=c("p"),P.textContent=Ts,Re=a(),p(K.$$.fragment),Ge=a(),p(ee.$$.fragment),Be=a(),M=c("div"),p(se.$$.fragment),Ye=a(),me=c("p"),me.innerHTML=_s,Se=a(),pe=c("p"),pe.innerHTML=js,Le=a(),p(z.$$.fragment),Ne=a(),p(te.$$.fragment),Fe=a(),v=c("div"),p(ne.$$.fragment),Ae=a(),ue=c("p"),ue.textContent=ys,Pe=a(),he=c("p"),he.innerHTML=ws,Ke=a(),$=c("div"),p(ae.$$.fragment),es=a(),be=c("p"),be.innerHTML=Js,We=a(),p(oe.$$.fragment),qe=a(),w=c("div"),p(re.$$.fragment),ss=a(),ge=c("p"),ge.textContent=Ms,ts=a(),fe=c("p"),fe.innerHTML=vs,ns=a(),Te=c("p"),Te.innerHTML=Is,as=a(),I=c("div"),p(le.$$.fragment),os=a(),_e=c("p"),_e.innerHTML=Us,rs=a(),p(V.$$.fragment),ls=a(),p(R.$$.fragment),Ee=a(),p(ce.$$.fragment),Qe=a(),je=c("p"),this.h()},l(e){const s=zs("svelte-u9bgzb",document.head);l=i(s,"META",{name:!0,content:!0}),s.forEach(t),J=o(e),T=i(e,"P",{}),de(T).forEach(t),m=o(e),u(j.$$.fragment,e),r=o(e),u(y.$$.fragment,e),we=o(e),B=i(e,"P",{"data-svelte-h":!0}),_(B)!=="svelte-o5s894"&&(B.innerHTML=is),Je=o(e),N=i(e,"P",{"data-svelte-h":!0}),_(N)!=="svelte-vfdo9a"&&(N.textContent=ds),Me=o(e),F=i(e,"P",{"data-svelte-h":!0}),_(F)!=="svelte-1plfyau"&&(F.innerHTML=ms),ve=o(e),Z=i(e,"IMG",{src:!0,alt:!0,width:!0}),Ie=o(e),W=i(e,"SMALL",{"data-svelte-h":!0}),_(W)!=="svelte-1lprvf"&&(W.innerHTML=us),Ue=o(e),q=i(e,"P",{"data-svelte-h":!0}),_(q)!=="svelte-1anbey3"&&(q.innerHTML=hs),ke=o(e),u(E.$$.fragment,e),De=o(e),Q=i(e,"P",{"data-svelte-h":!0}),_(Q)!=="svelte-6qxnhs"&&(Q.innerHTML=bs),xe=o(e),H=i(e,"P",{"data-svelte-h":!0}),_(H)!=="svelte-uxoj4w"&&(H.innerHTML=gs),Ce=o(e),u(X.$$.fragment,e),Oe=o(e),u(Y.$$.fragment,e),Ze=o(e),S=i(e,"P",{"data-svelte-h":!0}),_(S)!=="svelte-7rgq3f"&&(S.textContent=fs),ze=o(e),u(L.$$.fragment,e),$e=o(e),u(A.$$.fragment,e),Ve=o(e),P=i(e,"P",{"data-svelte-h":!0}),_(P)!=="svelte-s1nkyi"&&(P.textContent=Ts),Re=o(e),u(K.$$.fragment,e),Ge=o(e),u(ee.$$.fragment,e),Be=o(e),M=i(e,"DIV",{class:!0});var U=de(M);u(se.$$.fragment,U),Ye=o(U),me=i(U,"P",{"data-svelte-h":!0}),_(me)!=="svelte-1ud0jf5"&&(me.innerHTML=_s),Se=o(U),pe=i(U,"P",{"data-svelte-h":!0}),_(pe)!=="svelte-o55m63"&&(pe.innerHTML=js),Le=o(U),u(z.$$.fragment,U),U.forEach(t),Ne=o(e),u(te.$$.fragment,e),Fe=o(e),v=i(e,"DIV",{class:!0});var k=de(v);u(ne.$$.fragment,k),Ae=o(k),ue=i(k,"P",{"data-svelte-h":!0}),_(ue)!=="svelte-sqqjjc"&&(ue.textContent=ys),Pe=o(k),he=i(k,"P",{"data-svelte-h":!0}),_(he)!=="svelte-ci7234"&&(he.innerHTML=ws),Ke=o(k),$=i(k,"DIV",{class:!0});var ie=de($);u(ae.$$.fragment,ie),es=o(ie),be=i(ie,"P",{"data-svelte-h":!0}),_(be)!=="svelte-7iivmj"&&(be.innerHTML=Js),ie.forEach(t),k.forEach(t),We=o(e),u(oe.$$.fragment,e),qe=o(e),w=i(e,"DIV",{class:!0});var D=de(w);u(re.$$.fragment,D),ss=o(D),ge=i(D,"P",{"data-svelte-h":!0}),_(ge)!=="svelte-1cqamoa"&&(ge.textContent=Ms),ts=o(D),fe=i(D,"P",{"data-svelte-h":!0}),_(fe)!=="svelte-6pahdo"&&(fe.innerHTML=vs),ns=o(D),Te=i(D,"P",{"data-svelte-h":!0}),_(Te)!=="svelte-hswkmf"&&(Te.innerHTML=Is),as=o(D),I=i(D,"DIV",{class:!0});var G=de(I);u(le.$$.fragment,G),os=o(G),_e=i(G,"P",{"data-svelte-h":!0}),_(_e)!=="svelte-1o12qr"&&(_e.innerHTML=Us),rs=o(G),u(V.$$.fragment,G),ls=o(G),u(R.$$.fragment,G),G.forEach(t),D.forEach(t),Ee=o(e),u(ce.$$.fragment,e),Qe=o(e),je=i(e,"P",{}),de(je).forEach(t),this.h()},h(){x(l,"name","hf:doc:metadata"),x(l,"content",Fs),xs(Z.src,ps="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/omdet_turbo_architecture.jpeg")||x(Z,"src",ps),x(Z,"alt","drawing"),x(Z,"width","600"),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($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(v,"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(w,"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,s){d(document.head,l),n(e,J,s),n(e,T,s),n(e,m,s),h(j,e,s),n(e,r,s),h(y,e,s),n(e,we,s),n(e,B,s),n(e,Je,s),n(e,N,s),n(e,Me,s),n(e,F,s),n(e,ve,s),n(e,Z,s),n(e,Ie,s),n(e,W,s),n(e,Ue,s),n(e,q,s),n(e,ke,s),h(E,e,s),n(e,De,s),n(e,Q,s),n(e,xe,s),n(e,H,s),n(e,Ce,s),h(X,e,s),n(e,Oe,s),h(Y,e,s),n(e,Ze,s),n(e,S,s),n(e,ze,s),h(L,e,s),n(e,$e,s),h(A,e,s),n(e,Ve,s),n(e,P,s),n(e,Re,s),h(K,e,s),n(e,Ge,s),h(ee,e,s),n(e,Be,s),n(e,M,s),h(se,M,null),d(M,Ye),d(M,me),d(M,Se),d(M,pe),d(M,Le),h(z,M,null),n(e,Ne,s),h(te,e,s),n(e,Fe,s),n(e,v,s),h(ne,v,null),d(v,Ae),d(v,ue),d(v,Pe),d(v,he),d(v,Ke),d(v,$),h(ae,$,null),d($,es),d($,be),n(e,We,s),h(oe,e,s),n(e,qe,s),n(e,w,s),h(re,w,null),d(w,ss),d(w,ge),d(w,ts),d(w,fe),d(w,ns),d(w,Te),d(w,as),d(w,I),h(le,I,null),d(I,os),d(I,_e),d(I,rs),h(V,I,null),d(I,ls),h(R,I,null),n(e,Ee,s),h(ce,e,s),n(e,Qe,s),n(e,je,s),He=!0},p(e,[s]){const U={};s&2&&(U.$$scope={dirty:s,ctx:e}),z.$set(U);const k={};s&2&&(k.$$scope={dirty:s,ctx:e}),V.$set(k);const ie={};s&2&&(ie.$$scope={dirty:s,ctx:e}),R.$set(ie)},i(e){He||(b(j.$$.fragment,e),b(y.$$.fragment,e),b(E.$$.fragment,e),b(X.$$.fragment,e),b(Y.$$.fragment,e),b(L.$$.fragment,e),b(A.$$.fragment,e),b(K.$$.fragment,e),b(ee.$$.fragment,e),b(se.$$.fragment,e),b(z.$$.fragment,e),b(te.$$.fragment,e),b(ne.$$.fragment,e),b(ae.$$.fragment,e),b(oe.$$.fragment,e),b(re.$$.fragment,e),b(le.$$.fragment,e),b(V.$$.fragment,e),b(R.$$.fragment,e),b(ce.$$.fragment,e),He=!0)},o(e){g(j.$$.fragment,e),g(y.$$.fragment,e),g(E.$$.fragment,e),g(X.$$.fragment,e),g(Y.$$.fragment,e),g(L.$$.fragment,e),g(A.$$.fragment,e),g(K.$$.fragment,e),g(ee.$$.fragment,e),g(se.$$.fragment,e),g(z.$$.fragment,e),g(te.$$.fragment,e),g(ne.$$.fragment,e),g(ae.$$.fragment,e),g(oe.$$.fragment,e),g(re.$$.fragment,e),g(le.$$.fragment,e),g(V.$$.fragment,e),g(R.$$.fragment,e),g(ce.$$.fragment,e),He=!1},d(e){e&&(t(J),t(T),t(m),t(r),t(we),t(B),t(Je),t(N),t(Me),t(F),t(ve),t(Z),t(Ie),t(W),t(Ue),t(q),t(ke),t(De),t(Q),t(xe),t(H),t(Ce),t(Oe),t(Ze),t(S),t(ze),t($e),t(Ve),t(P),t(Re),t(Ge),t(Be),t(M),t(Ne),t(Fe),t(v),t(We),t(qe),t(w),t(Ee),t(Qe),t(je)),t(l),f(j,e),f(y,e),f(E,e),f(X,e),f(Y,e),f(L,e),f(A,e),f(K,e),f(ee,e),f(se),f(z),f(te,e),f(ne),f(ae),f(oe,e),f(re),f(le),f(V),f(R),f(ce,e)}}}const Fs='{"title":"OmDet-Turbo","local":"omdet-turbo","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Usage example","local":"usage-example","sections":[{"title":"Single image inference","local":"single-image-inference","sections":[],"depth":3},{"title":"Multi image inference","local":"multi-image-inference","sections":[],"depth":3}],"depth":2},{"title":"OmDetTurboConfig","local":"transformers.OmDetTurboConfig","sections":[],"depth":2},{"title":"OmDetTurboProcessor","local":"transformers.OmDetTurboProcessor","sections":[],"depth":2},{"title":"OmDetTurboForObjectDetection","local":"transformers.OmDetTurboForObjectDetection","sections":[],"depth":2}],"depth":1}';function Ws(O){return Cs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ls extends Os{constructor(l){super(),Zs(this,l,Ws,Ns,Ds,{})}}export{Ls as component};
