import{S as ra,i as aa,s as ia,e as s,k as m,w as b,t as a,M as la,c as n,d as t,m as p,a as r,x as v,h as i,b as l,N as ca,G as o,g as h,y,q as w,o as $,B as x,v as da,L as Kn}from"../../chunks/vendor-hf-doc-builder.js";import{T as na}from"../../chunks/Tip-hf-doc-builder.js";import{D as k}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Zn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ye}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Xn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as ma}from"../../chunks/PipelineTag-hf-doc-builder.js";function pa(I){let f,T,_,g,Y;return g=new Zn({props:{code:`from transformers import YolosConfig, YolosModel

# Initializing a YOLOS hustvl/yolos-base style configuration
configuration = YolosConfig()

# Initializing a model (with random weights) from the hustvl/yolos-base style configuration
model = YolosModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> YolosConfig, YolosModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a YOLOS hustvl/yolos-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = YolosConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the hustvl/yolos-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = YolosModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){f=s("p"),T=a("Example:"),_=m(),b(g.$$.fragment)},l(c){f=n(c,"P",{});var u=r(f);T=i(u,"Example:"),u.forEach(t),_=p(c),v(g.$$.fragment,c)},m(c,u){h(c,f,u),o(f,T),h(c,_,u),y(g,c,u),Y=!0},p:Kn,i(c){Y||(w(g.$$.fragment,c),Y=!0)},o(c){$(g.$$.fragment,c),Y=!1},d(c){c&&t(f),c&&t(_),x(g,c)}}}function ha(I){let f,T,_,g,Y;return{c(){f=s("p"),T=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s("code"),g=a("Module"),Y=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){f=n(c,"P",{});var u=r(f);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(u,"CODE",{});var C=r(_);g=i(C,"Module"),C.forEach(t),Y=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(c,u){h(c,f,u),o(f,T),o(f,_),o(_,g),o(f,Y)},d(c){c&&t(f)}}}function fa(I){let f,T,_,g,Y;return g=new Zn({props:{code:`from transformers import AutoImageProcessor, YolosModel
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("hustvl/yolos-small")
model = YolosModel.from_pretrained("hustvl/yolos-small")

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

with torch.no_grad():
    outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, YolosModel
<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> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;hustvl/yolos-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = YolosModel.from_pretrained(<span class="hljs-string">&quot;hustvl/yolos-small&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, 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>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">3401</span>, <span class="hljs-number">384</span>]`}}),{c(){f=s("p"),T=a("Example:"),_=m(),b(g.$$.fragment)},l(c){f=n(c,"P",{});var u=r(f);T=i(u,"Example:"),u.forEach(t),_=p(c),v(g.$$.fragment,c)},m(c,u){h(c,f,u),o(f,T),h(c,_,u),y(g,c,u),Y=!0},p:Kn,i(c){Y||(w(g.$$.fragment,c),Y=!0)},o(c){$(g.$$.fragment,c),Y=!1},d(c){c&&t(f),c&&t(_),x(g,c)}}}function ga(I){let f,T,_,g,Y;return{c(){f=s("p"),T=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s("code"),g=a("Module"),Y=a(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){f=n(c,"P",{});var u=r(f);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(u,"CODE",{});var C=r(_);g=i(C,"Module"),C.forEach(t),Y=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(c,u){h(c,f,u),o(f,T),o(f,_),o(_,g),o(f,Y)},d(c){c&&t(f)}}}function ua(I){let f,T,_,g,Y;return g=new Zn({props:{code:`from transformers import AutoImageProcessor, AutoModelForObjectDetection
import torch
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

image_processor = AutoImageProcessor.from_pretrained("hustvl/yolos-tiny")
model = AutoModelForObjectDetection.from_pretrained("hustvl/yolos-tiny")

inputs = image_processor(images=image, return_tensors="pt")
outputs = model(**inputs)

# convert outputs (bounding boxes and class logits) to COCO API
target_sizes = torch.tensor([image.size[::-1]])
results = image_processor.post_process_object_detection(outputs, threshold=0.9, target_sizes=target_sizes)[
    0
]

for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
    box = [round(i, 2) for i in box.tolist()]
    print(
        f"Detected {model.config.id2label[label.item()]} with confidence "
        f"{round(score.item(), 3)} at location {box}"
    )`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, AutoModelForObjectDetection
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;hustvl/yolos-tiny&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForObjectDetection.from_pretrained(<span class="hljs-string">&quot;hustvl/yolos-tiny&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># convert outputs (bounding boxes and class logits) to COCO API</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_sizes = torch.tensor([image.size[::-<span class="hljs-number">1</span>]])
<span class="hljs-meta">&gt;&gt;&gt; </span>results = image_processor.post_process_object_detection(outputs, threshold=<span class="hljs-number">0.9</span>, target_sizes=target_sizes)[
<span class="hljs-meta">... </span>    <span class="hljs-number">0</span>
<span class="hljs-meta">... </span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> score, label, box <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(results[<span class="hljs-string">&quot;scores&quot;</span>], results[<span class="hljs-string">&quot;labels&quot;</span>], results[<span class="hljs-string">&quot;boxes&quot;</span>]):
<span class="hljs-meta">... </span>    box = [<span class="hljs-built_in">round</span>(i, <span class="hljs-number">2</span>) <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> box.tolist()]
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(
<span class="hljs-meta">... </span>        <span class="hljs-string">f&quot;Detected <span class="hljs-subst">{model.config.id2label[label.item()]}</span> with confidence &quot;</span>
<span class="hljs-meta">... </span>        <span class="hljs-string">f&quot;<span class="hljs-subst">{<span class="hljs-built_in">round</span>(score.item(), <span class="hljs-number">3</span>)}</span> at location <span class="hljs-subst">{box}</span>&quot;</span>
<span class="hljs-meta">... </span>    )
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.994</span> at location [<span class="hljs-number">46.96</span>, <span class="hljs-number">72.61</span>, <span class="hljs-number">181.02</span>, <span class="hljs-number">119.73</span>]
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.975</span> at location [<span class="hljs-number">340.66</span>, <span class="hljs-number">79.19</span>, <span class="hljs-number">372.59</span>, <span class="hljs-number">192.65</span>]
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.984</span> at location [<span class="hljs-number">12.27</span>, <span class="hljs-number">54.25</span>, <span class="hljs-number">319.42</span>, <span class="hljs-number">470.99</span>]
Detected remote <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.922</span> at location [<span class="hljs-number">41.66</span>, <span class="hljs-number">71.96</span>, <span class="hljs-number">178.7</span>, <span class="hljs-number">120.33</span>]
Detected cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.914</span> at location [<span class="hljs-number">342.34</span>, <span class="hljs-number">21.48</span>, <span class="hljs-number">638.64</span>, <span class="hljs-number">372.46</span>]`}}),{c(){f=s("p"),T=a("Examples:"),_=m(),b(g.$$.fragment)},l(c){f=n(c,"P",{});var u=r(f);T=i(u,"Examples:"),u.forEach(t),_=p(c),v(g.$$.fragment,c)},m(c,u){h(c,f,u),o(f,T),h(c,_,u),y(g,c,u),Y=!0},p:Kn,i(c){Y||(w(g.$$.fragment,c),Y=!0)},o(c){$(g.$$.fragment,c),Y=!1},d(c){c&&t(f),c&&t(_),x(g,c)}}}function _a(I){let f,T,_,g,Y,c,u,C,Jt,at,N,K,Do,Te,Gt,Co,Qt,it,A,Xt,je,Kt,Zt,ro,es,os,lt,ao,ts,ct,io,Lo,ss,dt,lo,ns,mt,co,L,rs,mo,as,is,po,ls,cs,Fo,ds,ms,pt,Z,er,ht,ee,ps,ho,hs,fs,ft,q,gs,Oe,us,_s,Pe,bs,vs,gt,S,oe,Ao,Ee,ys,qo,ws,ut,fo,$s,_t,ke,bt,go,R,xs,uo,Ys,Ts,Ie,js,Os,vt,_o,Ps,yt,U,te,Mo,ze,Es,No,ks,wt,O,De,Is,W,zs,bo,Ds,Cs,Ce,Ls,Fs,As,V,qs,vo,Ms,Ns,yo,Ss,Rs,Us,se,$t,B,ne,So,Le,Ws,Ro,Vs,xt,j,Fe,Bs,Uo,Hs,Js,re,Ae,Gs,Wo,Qs,Xs,ae,qe,Ks,Vo,Zs,en,ie,Me,on,Ne,tn,wo,sn,nn,Yt,H,le,Bo,Se,rn,Ho,an,Tt,P,Re,ln,ce,Ue,cn,Jo,dn,mn,de,We,pn,Go,hn,fn,me,Ve,gn,Be,un,$o,_n,bn,jt,J,pe,Qo,He,vn,Xo,yn,Ot,F,Je,wn,Ge,$n,Qe,xn,Yn,Tn,z,Xe,jn,G,On,xo,Pn,En,Ko,kn,In,zn,he,Dn,fe,Pt,Q,ge,Zo,Ke,Cn,et,Ln,Et,E,Ze,Fn,ot,An,qn,eo,Mn,oo,Nn,Sn,Rn,D,to,Un,X,Wn,Yo,Vn,Bn,tt,Hn,Jn,Gn,ue,Qn,_e,kt;return c=new Ye({}),Te=new Ye({}),Ee=new Ye({}),ke=new ma({props:{pipeline:"object-detection"}}),ze=new Ye({}),De=new k({props:{name:"class transformers.YolosConfig",anchor:"transformers.YolosConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"image_size",val:" = [512, 864]"},{name:"patch_size",val:" = 16"},{name:"num_channels",val:" = 3"},{name:"qkv_bias",val:" = True"},{name:"num_detection_tokens",val:" = 100"},{name:"use_mid_position_embeddings",val:" = True"},{name:"auxiliary_loss",val:" = False"},{name:"class_cost",val:" = 1"},{name:"bbox_cost",val:" = 5"},{name:"giou_cost",val:" = 2"},{name:"bbox_loss_coefficient",val:" = 5"},{name:"giou_loss_coefficient",val:" = 2"},{name:"eos_coefficient",val:" = 0.1"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.YolosConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.YolosConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.YolosConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.YolosConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.YolosConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&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;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.YolosConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.YolosConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.YolosConfig.initializer_range",description:`<strong>initializer_range</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:"initializer_range"},{anchor:"transformers.YolosConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.YolosConfig.image_size",description:`<strong>image_size</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[512, 864]</code>) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.YolosConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>16</code>) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.YolosConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>3</code>) &#x2014;
The number of input channels.`,name:"num_channels"},{anchor:"transformers.YolosConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a bias to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.YolosConfig.num_detection_tokens",description:`<strong>num_detection_tokens</strong> (<code>int</code>, <em>optional</em>, defaults to <code>100</code>) &#x2014;
The number of detection tokens.`,name:"num_detection_tokens"},{anchor:"transformers.YolosConfig.use_mid_position_embeddings",description:`<strong>use_mid_position_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use the mid-layer position encodings.`,name:"use_mid_position_embeddings"},{anchor:"transformers.YolosConfig.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.YolosConfig.class_cost",description:`<strong>class_cost</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
Relative weight of the classification error in the Hungarian matching cost.`,name:"class_cost"},{anchor:"transformers.YolosConfig.bbox_cost",description:`<strong>bbox_cost</strong> (<code>float</code>, <em>optional</em>, defaults to 5) &#x2014;
Relative weight of the L1 error of the bounding box coordinates in the Hungarian matching cost.`,name:"bbox_cost"},{anchor:"transformers.YolosConfig.giou_cost",description:`<strong>giou_cost</strong> (<code>float</code>, <em>optional</em>, defaults to 2) &#x2014;
Relative weight of the generalized IoU loss of the bounding box in the Hungarian matching cost.`,name:"giou_cost"},{anchor:"transformers.YolosConfig.bbox_loss_coefficient",description:`<strong>bbox_loss_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 5) &#x2014;
Relative weight of the L1 bounding box loss in the object detection loss.`,name:"bbox_loss_coefficient"},{anchor:"transformers.YolosConfig.giou_loss_coefficient",description:`<strong>giou_loss_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 2) &#x2014;
Relative weight of the generalized IoU loss in the object detection loss.`,name:"giou_loss_coefficient"},{anchor:"transformers.YolosConfig.eos_coefficient",description:`<strong>eos_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Relative classification weight of the &#x2018;no-object&#x2019; class in the object detection loss.`,name:"eos_coefficient"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/yolos/configuration_yolos.py#L35"}}),se=new Xn({props:{anchor:"transformers.YolosConfig.example",$$slots:{default:[pa]},$$scope:{ctx:I}}}),Le=new Ye({}),Fe=new k({props:{name:"class transformers.YolosImageProcessor",anchor:"transformers.YolosImageProcessor",parameters:[{name:"format",val:": typing.Union[str, transformers.models.yolos.image_processing_yolos.AnnotionFormat] = <AnnotionFormat.COCO_DETECTION: 'coco_detection'>"},{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float]] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float]] = None"},{name:"do_pad",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.YolosImageProcessor.format",description:`<strong>format</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;coco_detection&quot;</code>) &#x2014;
Data format of the annotations. One of &#x201C;coco_detection&#x201D; or &#x201C;coco_panoptic&#x201D;.`,name:"format"},{anchor:"transformers.YolosImageProcessor.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.YolosImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 800, &quot;longest_edge&quot;: 1333}</code>):
Size of the image&#x2019;s (height, width) dimensions after resizing. Can be overridden by the <code>size</code> parameter in
the <code>preprocess</code> method.`,name:"size"},{anchor:"transformers.YolosImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image.`,name:"resample"},{anchor:"transformers.YolosImageProcessor.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.YolosImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by the <code>rescale_factor</code> parameter in the
<code>preprocess</code> method.
do_normalize &#x2014;
Controls whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the
<code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.YolosImageProcessor.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.YolosImageProcessor.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.YolosImageProcessor.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Controls whether to pad the image to the largest image in a batch and create a pixel mask. Can be
overridden by the <code>do_pad</code> parameter in the <code>preprocess</code> method.`,name:"do_pad"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/yolos/image_processing_yolos.py#L652"}}),Ae=new k({props:{name:"preprocess",anchor:"transformers.YolosImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"annotations",val:": typing.Union[typing.Dict[str, typing.Union[int, str, typing.List[typing.Dict]]], typing.List[typing.Dict[str, typing.Union[int, str, typing.List[typing.Dict]]]], NoneType] = None"},{name:"return_segmentation_masks",val:": bool = None"},{name:"masks_path",val:": typing.Union[str, pathlib.Path, NoneType] = None"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"resample",val:" = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Union[int, float, NoneType] = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"do_pad",val:": typing.Optional[bool] = None"},{name:"format",val:": typing.Union[str, transformers.models.yolos.image_processing_yolos.AnnotionFormat, NoneType] = None"},{name:"return_tensors",val:": typing.Union[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.YolosImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image or batch of images to preprocess.`,name:"images"},{anchor:"transformers.YolosImageProcessor.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 annotionation is for object
detection, the annotations should be a dictionary with the following keys:<ul>
<li>&#x201C;image_id&#x201D; (<code>int</code>): The image id.</li>
<li>&#x201C;annotations&#x201D; (<code>List[Dict]</code>): List of annotations for an image. Each annotation should be a
dictionary. An image can have no annotations, in which case the list should be empty.
If annotionation is for segmentation, the annotations should be a dictionary with the following keys:</li>
<li>&#x201C;image_id&#x201D; (<code>int</code>): The image id.</li>
<li>&#x201C;segments_info&#x201D; (<code>List[Dict]</code>): List of segments for an image. Each segment should be a dictionary.
An image can have no segments, in which case the list should be empty.</li>
<li>&#x201C;file_name&#x201D; (<code>str</code>): The file name of the image.</li>
</ul>`,name:"annotations"},{anchor:"transformers.YolosImageProcessor.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.YolosImageProcessor.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.YolosImageProcessor.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.YolosImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to self.size) &#x2014;
Size of the image after resizing.`,name:"size"},{anchor:"transformers.YolosImageProcessor.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.YolosImageProcessor.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.YolosImageProcessor.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.YolosImageProcessor.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.YolosImageProcessor.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.YolosImageProcessor.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.YolosImageProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to self.do_pad) &#x2014;
Whether to pad the image.`,name:"do_pad"},{anchor:"transformers.YolosImageProcessor.preprocess.format",description:`<strong>format</strong> (<code>str</code> or <code>AnnotionFormat</code>, <em>optional</em>, defaults to self.format) &#x2014;
Format of the annotations.`,name:"format"},{anchor:"transformers.YolosImageProcessor.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.YolosImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>str</code> or <code>ChannelDimension</code>, <em>optional</em>, defaults to self.data_format) &#x2014;
The channel dimension format of the image. If not provided, it will be the same as the input image.`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/yolos/image_processing_yolos.py#L940"}}),qe=new k({props:{name:"pad",anchor:"transformers.YolosImageProcessor.pad",parameters:[{name:"images",val:": typing.List[numpy.ndarray]"},{name:"return_pixel_mask",val:": bool = False"},{name:"return_tensors",val:": typing.Union[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = None"}],parametersDescription:[{anchor:"transformers.YolosImageProcessor.pad.image",description:`<strong>image</strong> (<code>np.ndarray</code>) &#x2014;
Image to pad.`,name:"image"},{anchor:"transformers.YolosImageProcessor.pad.return_pixel_mask",description:`<strong>return_pixel_mask</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return a pixel mask.`,name:"return_pixel_mask"},{anchor:"transformers.YolosImageProcessor.pad.input_channel_dimension",description:`<strong>input_channel_dimension</strong> (<code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format of the image. If not provided, it will be inferred from the input image.`,name:"input_channel_dimension"},{anchor:"transformers.YolosImageProcessor.pad.data_format",description:`<strong>data_format</strong> (<code>str</code> or <code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format of the image. If not provided, it will be the same as the input image.`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/yolos/image_processing_yolos.py#L908"}}),Me=new k({props:{name:"post_process_object_detection",anchor:"transformers.YolosImageProcessor.post_process_object_detection",parameters:[{name:"outputs",val:""},{name:"threshold",val:": float = 0.5"},{name:"target_sizes",val:": typing.Union[transformers.utils.generic.TensorType, typing.List[typing.Tuple]] = None"}],parametersDescription:[{anchor:"transformers.YolosImageProcessor.post_process_object_detection.outputs",description:`<strong>outputs</strong> (<code>YolosObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.YolosImageProcessor.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.YolosImageProcessor.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/yolos/image_processing_yolos.py#L1191",returnDescription:`
<p>A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
in the batch as predicted by the model.</p>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),Se=new Ye({}),Re=new k({props:{name:"class transformers.YolosFeatureExtractor",anchor:"transformers.YolosFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/yolos/feature_extraction_yolos.py#L26"}}),Ue=new k({props:{name:"__call__",anchor:"transformers.YolosFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_processing_utils.py#L448"}}),We=new k({props:{name:"pad",anchor:"transformers.YolosFeatureExtractor.pad",parameters:[{name:"images",val:": typing.List[numpy.ndarray]"},{name:"return_pixel_mask",val:": bool = False"},{name:"return_tensors",val:": typing.Union[transformers.utils.generic.TensorType, str, NoneType] = None"},{name:"data_format",val:": typing.Optional[transformers.image_utils.ChannelDimension] = None"}],parametersDescription:[{anchor:"transformers.YolosFeatureExtractor.pad.image",description:`<strong>image</strong> (<code>np.ndarray</code>) &#x2014;
Image to pad.`,name:"image"},{anchor:"transformers.YolosFeatureExtractor.pad.return_pixel_mask",description:`<strong>return_pixel_mask</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return a pixel mask.`,name:"return_pixel_mask"},{anchor:"transformers.YolosFeatureExtractor.pad.input_channel_dimension",description:`<strong>input_channel_dimension</strong> (<code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format of the image. If not provided, it will be inferred from the input image.`,name:"input_channel_dimension"},{anchor:"transformers.YolosFeatureExtractor.pad.data_format",description:`<strong>data_format</strong> (<code>str</code> or <code>ChannelDimension</code>, <em>optional</em>) &#x2014;
The channel dimension format of the image. If not provided, it will be the same as the input image.`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/yolos/image_processing_yolos.py#L908"}}),Ve=new k({props:{name:"post_process_object_detection",anchor:"transformers.YolosFeatureExtractor.post_process_object_detection",parameters:[{name:"outputs",val:""},{name:"threshold",val:": float = 0.5"},{name:"target_sizes",val:": typing.Union[transformers.utils.generic.TensorType, typing.List[typing.Tuple]] = None"}],parametersDescription:[{anchor:"transformers.YolosFeatureExtractor.post_process_object_detection.outputs",description:`<strong>outputs</strong> (<code>YolosObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.YolosFeatureExtractor.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.YolosFeatureExtractor.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/yolos/image_processing_yolos.py#L1191",returnDescription:`
<p>A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
in the batch as predicted by the model.</p>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),He=new Ye({}),Je=new k({props:{name:"class transformers.YolosModel",anchor:"transformers.YolosModel",parameters:[{name:"config",val:": YolosConfig"},{name:"add_pooling_layer",val:": bool = True"}],parametersDescription:[{anchor:"transformers.YolosModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/yolos#transformers.YolosConfig">YolosConfig</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/yolos/modeling_yolos.py#L599"}}),Xe=new k({props:{name:"forward",anchor:"transformers.YolosModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = 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.YolosModel.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. 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/poolformer#transformers.PoolFormerFeatureExtractor.__call__">YolosImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.YolosModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.YolosModel.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.YolosModel.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.YolosModel.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/yolos/modeling_yolos.py#L627",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/yolos#transformers.YolosConfig"
>YolosConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),he=new na({props:{$$slots:{default:[ha]},$$scope:{ctx:I}}}),fe=new Xn({props:{anchor:"transformers.YolosModel.forward.example",$$slots:{default:[fa]},$$scope:{ctx:I}}}),Ke=new Ye({}),Ze=new k({props:{name:"class transformers.YolosForObjectDetection",anchor:"transformers.YolosForObjectDetection",parameters:[{name:"config",val:": YolosConfig"}],parametersDescription:[{anchor:"transformers.YolosForObjectDetection.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/yolos#transformers.YolosConfig">YolosConfig</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/yolos/modeling_yolos.py#L707"}}),to=new k({props:{name:"forward",anchor:"transformers.YolosForObjectDetection.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"labels",val:": typing.Optional[typing.List[typing.Dict]] = 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.YolosForObjectDetection.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. 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/poolformer#transformers.PoolFormerFeatureExtractor.__call__">YolosImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.YolosForObjectDetection.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.YolosForObjectDetection.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.YolosForObjectDetection.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.YolosForObjectDetection.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.YolosForObjectDetection.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: <code>&apos;class_labels&apos;</code> and <code>&apos;boxes&apos;</code> (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/yolos/modeling_yolos.py#L734",returnDescription:`
<p>A <code>transformers.models.yolos.modeling_yolos.YolosObjectDetectionOutput</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/yolos#transformers.YolosConfig"
>YolosConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> are provided)) \u2014 Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a
bounding box loss. The latter is defined as a linear combination of the L1 loss and the generalized
scale-invariant IoU loss.</li>
<li><strong>loss_dict</strong> (<code>Dict</code>, <em>optional</em>) \u2014 A dictionary containing the individual losses. Useful for logging.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, num_classes + 1)</code>) \u2014 Classification logits (including no-object) for all queries.</li>
<li><strong>pred_boxes</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_queries, 4)</code>) \u2014 Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding
possible padding). You can use <code>post_process()</code> to retrieve the unnormalized bounding
boxes.</li>
<li><strong>auxiliary_outputs</strong> (<code>list[Dict]</code>, <em>optional</em>) \u2014 Optional, only returned when auxilary losses are activated (i.e. <code>config.auxiliary_loss</code> is set to <code>True</code>)
and labels are provided. It is a list of dictionaries containing the two above keys (<code>logits</code> and
<code>pred_boxes</code>) for each decoder layer.</li>
<li><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the decoder of the model.</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
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 optional initial embedding outputs.</li>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`
<p><code>transformers.models.yolos.modeling_yolos.YolosObjectDetectionOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ue=new na({props:{$$slots:{default:[ga]},$$scope:{ctx:I}}}),_e=new Xn({props:{anchor:"transformers.YolosForObjectDetection.forward.example",$$slots:{default:[ua]},$$scope:{ctx:I}}}),{c(){f=s("meta"),T=m(),_=s("h1"),g=s("a"),Y=s("span"),b(c.$$.fragment),u=m(),C=s("span"),Jt=a("YOLOS"),at=m(),N=s("h2"),K=s("a"),Do=s("span"),b(Te.$$.fragment),Gt=m(),Co=s("span"),Qt=a("Overview"),it=m(),A=s("p"),Xt=a("The YOLOS model was proposed in "),je=s("a"),Kt=a("You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection"),Zt=a(` by Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, Wenyu Liu.
YOLOS proposes to just leverage the plain `),ro=s("a"),es=a("Vision Transformer (ViT)"),os=a(" for object detection, inspired by DETR. It turns out that a base-sized encoder-only Transformer can also achieve 42 AP on COCO, similar to DETR and much more complex frameworks such as Faster R-CNN."),lt=m(),ao=s("p"),ts=a("The abstract from the paper is the following:"),ct=m(),io=s("p"),Lo=s("em"),ss=a("Can Transformer perform 2D object- and region-level recognition from a pure sequence-to-sequence perspective with minimal knowledge about the 2D spatial structure? To answer this question, we present You Only Look at One Sequence (YOLOS), a series of object detection models based on the vanilla Vision Transformer with the fewest possible modifications, region priors, as well as inductive biases of the target task. We find that YOLOS pre-trained on the mid-sized ImageNet-1k dataset only can already achieve quite competitive performance on the challenging COCO object detection benchmark, e.g., YOLOS-Base directly adopted from BERT-Base architecture can obtain 42.0 box AP on COCO val. We also discuss the impacts as well as limitations of current pre-train schemes and model scaling strategies for Transformer in vision through YOLOS."),dt=m(),lo=s("p"),ns=a("Tips:"),mt=m(),co=s("ul"),L=s("li"),rs=a("One can use "),mo=s("a"),as=a("YolosImageProcessor"),is=a(" for preparing images (and optional targets) for the model. Contrary to "),po=s("a"),ls=a("DETR"),cs=a(", YOLOS doesn\u2019t require a "),Fo=s("code"),ds=a("pixel_mask"),ms=a(" to be created."),pt=m(),Z=s("img"),ht=m(),ee=s("small"),ps=a("YOLOS architecture. Taken from the "),ho=s("a"),hs=a("original paper"),fs=a("."),ft=m(),q=s("p"),gs=a("This model was contributed by "),Oe=s("a"),us=a("nielsr"),_s=a(". The original code can be found "),Pe=s("a"),bs=a("here"),vs=a("."),gt=m(),S=s("h2"),oe=s("a"),Ao=s("span"),b(Ee.$$.fragment),ys=m(),qo=s("span"),ws=a("Resources"),ut=m(),fo=s("p"),$s=a("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with YOLOS."),_t=m(),b(ke.$$.fragment),bt=m(),go=s("ul"),R=s("li"),xs=a("All example notebooks illustrating inference + fine-tuning "),uo=s("a"),Ys=a("YolosForObjectDetection"),Ts=a(" on a custom dataset can be found "),Ie=s("a"),js=a("here"),Os=a("."),vt=m(),_o=s("p"),Ps=a("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),yt=m(),U=s("h2"),te=s("a"),Mo=s("span"),b(ze.$$.fragment),Es=m(),No=s("span"),ks=a("YolosConfig"),wt=m(),O=s("div"),b(De.$$.fragment),Is=m(),W=s("p"),zs=a("This is the configuration class to store the configuration of a "),bo=s("a"),Ds=a("YolosModel"),Cs=a(`. It is used to instantiate a YOLOS
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 YOLOS
`),Ce=s("a"),Ls=a("hustvl/yolos-base"),Fs=a(" architecture."),As=m(),V=s("p"),qs=a("Configuration objects inherit from "),vo=s("a"),Ms=a("PretrainedConfig"),Ns=a(` and can be used to control the model outputs. Read the
documentation from `),yo=s("a"),Ss=a("PretrainedConfig"),Rs=a(" for more information."),Us=m(),b(se.$$.fragment),$t=m(),B=s("h2"),ne=s("a"),So=s("span"),b(Le.$$.fragment),Ws=m(),Ro=s("span"),Vs=a("YolosImageProcessor"),xt=m(),j=s("div"),b(Fe.$$.fragment),Bs=m(),Uo=s("p"),Hs=a("Constructs a Detr image processor."),Js=m(),re=s("div"),b(Ae.$$.fragment),Gs=m(),Wo=s("p"),Qs=a("Preprocess an image or a batch of images so that it can be used by the model."),Xs=m(),ae=s("div"),b(qe.$$.fragment),Ks=m(),Vo=s("p"),Zs=a(`Pads a batch of images to the bottom and right of the image with zeros to the size of largest height and width
in the batch and optionally returns their corresponding pixel mask.`),en=m(),ie=s("div"),b(Me.$$.fragment),on=m(),Ne=s("p"),tn=a("Converts the raw output of "),wo=s("a"),sn=a("YolosForObjectDetection"),nn=a(` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format. Only supports PyTorch.`),Yt=m(),H=s("h2"),le=s("a"),Bo=s("span"),b(Se.$$.fragment),rn=m(),Ho=s("span"),an=a("YolosFeatureExtractor"),Tt=m(),P=s("div"),b(Re.$$.fragment),ln=m(),ce=s("div"),b(Ue.$$.fragment),cn=m(),Jo=s("p"),dn=a("Preprocess an image or a batch of images."),mn=m(),de=s("div"),b(We.$$.fragment),pn=m(),Go=s("p"),hn=a(`Pads a batch of images to the bottom and right of the image with zeros to the size of largest height and width
in the batch and optionally returns their corresponding pixel mask.`),fn=m(),me=s("div"),b(Ve.$$.fragment),gn=m(),Be=s("p"),un=a("Converts the raw output of "),$o=s("a"),_n=a("YolosForObjectDetection"),bn=a(` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format. Only supports PyTorch.`),jt=m(),J=s("h2"),pe=s("a"),Qo=s("span"),b(He.$$.fragment),vn=m(),Xo=s("span"),yn=a("YolosModel"),Ot=m(),F=s("div"),b(Je.$$.fragment),wn=m(),Ge=s("p"),$n=a(`The bare YOLOS Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Qe=s("a"),xn=a("torch.nn.Module"),Yn=a(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Tn=m(),z=s("div"),b(Xe.$$.fragment),jn=m(),G=s("p"),On=a("The "),xo=s("a"),Pn=a("YolosModel"),En=a(" forward method, overrides the "),Ko=s("code"),kn=a("__call__"),In=a(" special method."),zn=m(),b(he.$$.fragment),Dn=m(),b(fe.$$.fragment),Pt=m(),Q=s("h2"),ge=s("a"),Zo=s("span"),b(Ke.$$.fragment),Cn=m(),et=s("span"),Ln=a("YolosForObjectDetection"),Et=m(),E=s("div"),b(Ze.$$.fragment),Fn=m(),ot=s("p"),An=a("YOLOS Model (consisting of a ViT encoder) with object detection heads on top, for tasks such as COCO detection."),qn=m(),eo=s("p"),Mn=a("This model is a PyTorch "),oo=s("a"),Nn=a("torch.nn.Module"),Sn=a(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Rn=m(),D=s("div"),b(to.$$.fragment),Un=m(),X=s("p"),Wn=a("The "),Yo=s("a"),Vn=a("YolosForObjectDetection"),Bn=a(" forward method, overrides the "),tt=s("code"),Hn=a("__call__"),Jn=a(" special method."),Gn=m(),b(ue.$$.fragment),Qn=m(),b(_e.$$.fragment),this.h()},l(e){const d=la('[data-svelte="svelte-1phssyn"]',document.head);f=n(d,"META",{name:!0,content:!0}),d.forEach(t),T=p(e),_=n(e,"H1",{class:!0});var so=r(_);g=n(so,"A",{id:!0,class:!0,href:!0});var st=r(g);Y=n(st,"SPAN",{});var nt=r(Y);v(c.$$.fragment,nt),nt.forEach(t),st.forEach(t),u=p(so),C=n(so,"SPAN",{});var rt=r(C);Jt=i(rt,"YOLOS"),rt.forEach(t),so.forEach(t),at=p(e),N=n(e,"H2",{class:!0});var no=r(N);K=n(no,"A",{id:!0,class:!0,href:!0});var or=r(K);Do=n(or,"SPAN",{});var tr=r(Do);v(Te.$$.fragment,tr),tr.forEach(t),or.forEach(t),Gt=p(no),Co=n(no,"SPAN",{});var sr=r(Co);Qt=i(sr,"Overview"),sr.forEach(t),no.forEach(t),it=p(e),A=n(e,"P",{});var To=r(A);Xt=i(To,"The YOLOS model was proposed in "),je=n(To,"A",{href:!0,rel:!0});var nr=r(je);Kt=i(nr,"You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection"),nr.forEach(t),Zt=i(To,` by Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, Wenyu Liu.
YOLOS proposes to just leverage the plain `),ro=n(To,"A",{href:!0});var rr=r(ro);es=i(rr,"Vision Transformer (ViT)"),rr.forEach(t),os=i(To," for object detection, inspired by DETR. It turns out that a base-sized encoder-only Transformer can also achieve 42 AP on COCO, similar to DETR and much more complex frameworks such as Faster R-CNN."),To.forEach(t),lt=p(e),ao=n(e,"P",{});var ar=r(ao);ts=i(ar,"The abstract from the paper is the following:"),ar.forEach(t),ct=p(e),io=n(e,"P",{});var ir=r(io);Lo=n(ir,"EM",{});var lr=r(Lo);ss=i(lr,"Can Transformer perform 2D object- and region-level recognition from a pure sequence-to-sequence perspective with minimal knowledge about the 2D spatial structure? To answer this question, we present You Only Look at One Sequence (YOLOS), a series of object detection models based on the vanilla Vision Transformer with the fewest possible modifications, region priors, as well as inductive biases of the target task. We find that YOLOS pre-trained on the mid-sized ImageNet-1k dataset only can already achieve quite competitive performance on the challenging COCO object detection benchmark, e.g., YOLOS-Base directly adopted from BERT-Base architecture can obtain 42.0 box AP on COCO val. We also discuss the impacts as well as limitations of current pre-train schemes and model scaling strategies for Transformer in vision through YOLOS."),lr.forEach(t),ir.forEach(t),dt=p(e),lo=n(e,"P",{});var cr=r(lo);ns=i(cr,"Tips:"),cr.forEach(t),mt=p(e),co=n(e,"UL",{});var dr=r(co);L=n(dr,"LI",{});var be=r(L);rs=i(be,"One can use "),mo=n(be,"A",{href:!0});var mr=r(mo);as=i(mr,"YolosImageProcessor"),mr.forEach(t),is=i(be," for preparing images (and optional targets) for the model. Contrary to "),po=n(be,"A",{href:!0});var pr=r(po);ls=i(pr,"DETR"),pr.forEach(t),cs=i(be,", YOLOS doesn\u2019t require a "),Fo=n(be,"CODE",{});var hr=r(Fo);ds=i(hr,"pixel_mask"),hr.forEach(t),ms=i(be," to be created."),be.forEach(t),dr.forEach(t),pt=p(e),Z=n(e,"IMG",{src:!0,alt:!0,width:!0}),ht=p(e),ee=n(e,"SMALL",{});var It=r(ee);ps=i(It,"YOLOS architecture. Taken from the "),ho=n(It,"A",{href:!0});var fr=r(ho);hs=i(fr,"original paper"),fr.forEach(t),fs=i(It,"."),It.forEach(t),ft=p(e),q=n(e,"P",{});var jo=r(q);gs=i(jo,"This model was contributed by "),Oe=n(jo,"A",{href:!0,rel:!0});var gr=r(Oe);us=i(gr,"nielsr"),gr.forEach(t),_s=i(jo,". The original code can be found "),Pe=n(jo,"A",{href:!0,rel:!0});var ur=r(Pe);bs=i(ur,"here"),ur.forEach(t),vs=i(jo,"."),jo.forEach(t),gt=p(e),S=n(e,"H2",{class:!0});var zt=r(S);oe=n(zt,"A",{id:!0,class:!0,href:!0});var _r=r(oe);Ao=n(_r,"SPAN",{});var br=r(Ao);v(Ee.$$.fragment,br),br.forEach(t),_r.forEach(t),ys=p(zt),qo=n(zt,"SPAN",{});var vr=r(qo);ws=i(vr,"Resources"),vr.forEach(t),zt.forEach(t),ut=p(e),fo=n(e,"P",{});var yr=r(fo);$s=i(yr,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with YOLOS."),yr.forEach(t),_t=p(e),v(ke.$$.fragment,e),bt=p(e),go=n(e,"UL",{});var wr=r(go);R=n(wr,"LI",{});var Oo=r(R);xs=i(Oo,"All example notebooks illustrating inference + fine-tuning "),uo=n(Oo,"A",{href:!0});var $r=r(uo);Ys=i($r,"YolosForObjectDetection"),$r.forEach(t),Ts=i(Oo," on a custom dataset can be found "),Ie=n(Oo,"A",{href:!0,rel:!0});var xr=r(Ie);js=i(xr,"here"),xr.forEach(t),Os=i(Oo,"."),Oo.forEach(t),wr.forEach(t),vt=p(e),_o=n(e,"P",{});var Yr=r(_o);Ps=i(Yr,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Yr.forEach(t),yt=p(e),U=n(e,"H2",{class:!0});var Dt=r(U);te=n(Dt,"A",{id:!0,class:!0,href:!0});var Tr=r(te);Mo=n(Tr,"SPAN",{});var jr=r(Mo);v(ze.$$.fragment,jr),jr.forEach(t),Tr.forEach(t),Es=p(Dt),No=n(Dt,"SPAN",{});var Or=r(No);ks=i(Or,"YolosConfig"),Or.forEach(t),Dt.forEach(t),wt=p(e),O=n(e,"DIV",{class:!0});var ve=r(O);v(De.$$.fragment,ve),Is=p(ve),W=n(ve,"P",{});var Po=r(W);zs=i(Po,"This is the configuration class to store the configuration of a "),bo=n(Po,"A",{href:!0});var Pr=r(bo);Ds=i(Pr,"YolosModel"),Pr.forEach(t),Cs=i(Po,`. It is used to instantiate a YOLOS
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 YOLOS
`),Ce=n(Po,"A",{href:!0,rel:!0});var Er=r(Ce);Ls=i(Er,"hustvl/yolos-base"),Er.forEach(t),Fs=i(Po," architecture."),Po.forEach(t),As=p(ve),V=n(ve,"P",{});var Eo=r(V);qs=i(Eo,"Configuration objects inherit from "),vo=n(Eo,"A",{href:!0});var kr=r(vo);Ms=i(kr,"PretrainedConfig"),kr.forEach(t),Ns=i(Eo,` and can be used to control the model outputs. Read the
documentation from `),yo=n(Eo,"A",{href:!0});var Ir=r(yo);Ss=i(Ir,"PretrainedConfig"),Ir.forEach(t),Rs=i(Eo," for more information."),Eo.forEach(t),Us=p(ve),v(se.$$.fragment,ve),ve.forEach(t),$t=p(e),B=n(e,"H2",{class:!0});var Ct=r(B);ne=n(Ct,"A",{id:!0,class:!0,href:!0});var zr=r(ne);So=n(zr,"SPAN",{});var Dr=r(So);v(Le.$$.fragment,Dr),Dr.forEach(t),zr.forEach(t),Ws=p(Ct),Ro=n(Ct,"SPAN",{});var Cr=r(Ro);Vs=i(Cr,"YolosImageProcessor"),Cr.forEach(t),Ct.forEach(t),xt=p(e),j=n(e,"DIV",{class:!0});var M=r(j);v(Fe.$$.fragment,M),Bs=p(M),Uo=n(M,"P",{});var Lr=r(Uo);Hs=i(Lr,"Constructs a Detr image processor."),Lr.forEach(t),Js=p(M),re=n(M,"DIV",{class:!0});var Lt=r(re);v(Ae.$$.fragment,Lt),Gs=p(Lt),Wo=n(Lt,"P",{});var Fr=r(Wo);Qs=i(Fr,"Preprocess an image or a batch of images so that it can be used by the model."),Fr.forEach(t),Lt.forEach(t),Xs=p(M),ae=n(M,"DIV",{class:!0});var Ft=r(ae);v(qe.$$.fragment,Ft),Ks=p(Ft),Vo=n(Ft,"P",{});var Ar=r(Vo);Zs=i(Ar,`Pads a batch of images to the bottom and right of the image with zeros to the size of largest height and width
in the batch and optionally returns their corresponding pixel mask.`),Ar.forEach(t),Ft.forEach(t),en=p(M),ie=n(M,"DIV",{class:!0});var At=r(ie);v(Me.$$.fragment,At),on=p(At),Ne=n(At,"P",{});var qt=r(Ne);tn=i(qt,"Converts the raw output of "),wo=n(qt,"A",{href:!0});var qr=r(wo);sn=i(qr,"YolosForObjectDetection"),qr.forEach(t),nn=i(qt,` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format. Only supports PyTorch.`),qt.forEach(t),At.forEach(t),M.forEach(t),Yt=p(e),H=n(e,"H2",{class:!0});var Mt=r(H);le=n(Mt,"A",{id:!0,class:!0,href:!0});var Mr=r(le);Bo=n(Mr,"SPAN",{});var Nr=r(Bo);v(Se.$$.fragment,Nr),Nr.forEach(t),Mr.forEach(t),rn=p(Mt),Ho=n(Mt,"SPAN",{});var Sr=r(Ho);an=i(Sr,"YolosFeatureExtractor"),Sr.forEach(t),Mt.forEach(t),Tt=p(e),P=n(e,"DIV",{class:!0});var ye=r(P);v(Re.$$.fragment,ye),ln=p(ye),ce=n(ye,"DIV",{class:!0});var Nt=r(ce);v(Ue.$$.fragment,Nt),cn=p(Nt),Jo=n(Nt,"P",{});var Rr=r(Jo);dn=i(Rr,"Preprocess an image or a batch of images."),Rr.forEach(t),Nt.forEach(t),mn=p(ye),de=n(ye,"DIV",{class:!0});var St=r(de);v(We.$$.fragment,St),pn=p(St),Go=n(St,"P",{});var Ur=r(Go);hn=i(Ur,`Pads a batch of images to the bottom and right of the image with zeros to the size of largest height and width
in the batch and optionally returns their corresponding pixel mask.`),Ur.forEach(t),St.forEach(t),fn=p(ye),me=n(ye,"DIV",{class:!0});var Rt=r(me);v(Ve.$$.fragment,Rt),gn=p(Rt),Be=n(Rt,"P",{});var Ut=r(Be);un=i(Ut,"Converts the raw output of "),$o=n(Ut,"A",{href:!0});var Wr=r($o);_n=i(Wr,"YolosForObjectDetection"),Wr.forEach(t),bn=i(Ut,` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format. Only supports PyTorch.`),Ut.forEach(t),Rt.forEach(t),ye.forEach(t),jt=p(e),J=n(e,"H2",{class:!0});var Wt=r(J);pe=n(Wt,"A",{id:!0,class:!0,href:!0});var Vr=r(pe);Qo=n(Vr,"SPAN",{});var Br=r(Qo);v(He.$$.fragment,Br),Br.forEach(t),Vr.forEach(t),vn=p(Wt),Xo=n(Wt,"SPAN",{});var Hr=r(Xo);yn=i(Hr,"YolosModel"),Hr.forEach(t),Wt.forEach(t),Ot=p(e),F=n(e,"DIV",{class:!0});var ko=r(F);v(Je.$$.fragment,ko),wn=p(ko),Ge=n(ko,"P",{});var Vt=r(Ge);$n=i(Vt,`The bare YOLOS Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Qe=n(Vt,"A",{href:!0,rel:!0});var Jr=r(Qe);xn=i(Jr,"torch.nn.Module"),Jr.forEach(t),Yn=i(Vt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Vt.forEach(t),Tn=p(ko),z=n(ko,"DIV",{class:!0});var we=r(z);v(Xe.$$.fragment,we),jn=p(we),G=n(we,"P",{});var Io=r(G);On=i(Io,"The "),xo=n(Io,"A",{href:!0});var Gr=r(xo);Pn=i(Gr,"YolosModel"),Gr.forEach(t),En=i(Io," forward method, overrides the "),Ko=n(Io,"CODE",{});var Qr=r(Ko);kn=i(Qr,"__call__"),Qr.forEach(t),In=i(Io," special method."),Io.forEach(t),zn=p(we),v(he.$$.fragment,we),Dn=p(we),v(fe.$$.fragment,we),we.forEach(t),ko.forEach(t),Pt=p(e),Q=n(e,"H2",{class:!0});var Bt=r(Q);ge=n(Bt,"A",{id:!0,class:!0,href:!0});var Xr=r(ge);Zo=n(Xr,"SPAN",{});var Kr=r(Zo);v(Ke.$$.fragment,Kr),Kr.forEach(t),Xr.forEach(t),Cn=p(Bt),et=n(Bt,"SPAN",{});var Zr=r(et);Ln=i(Zr,"YolosForObjectDetection"),Zr.forEach(t),Bt.forEach(t),Et=p(e),E=n(e,"DIV",{class:!0});var $e=r(E);v(Ze.$$.fragment,$e),Fn=p($e),ot=n($e,"P",{});var ea=r(ot);An=i(ea,"YOLOS Model (consisting of a ViT encoder) with object detection heads on top, for tasks such as COCO detection."),ea.forEach(t),qn=p($e),eo=n($e,"P",{});var Ht=r(eo);Mn=i(Ht,"This model is a PyTorch "),oo=n(Ht,"A",{href:!0,rel:!0});var oa=r(oo);Nn=i(oa,"torch.nn.Module"),oa.forEach(t),Sn=i(Ht,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ht.forEach(t),Rn=p($e),D=n($e,"DIV",{class:!0});var xe=r(D);v(to.$$.fragment,xe),Un=p(xe),X=n(xe,"P",{});var zo=r(X);Wn=i(zo,"The "),Yo=n(zo,"A",{href:!0});var ta=r(Yo);Vn=i(ta,"YolosForObjectDetection"),ta.forEach(t),Bn=i(zo," forward method, overrides the "),tt=n(zo,"CODE",{});var sa=r(tt);Hn=i(sa,"__call__"),sa.forEach(t),Jn=i(zo," special method."),zo.forEach(t),Gn=p(xe),v(ue.$$.fragment,xe),Qn=p(xe),v(_e.$$.fragment,xe),xe.forEach(t),$e.forEach(t),this.h()},h(){l(f,"name","hf:doc:metadata"),l(f,"content",JSON.stringify(ba)),l(g,"id","yolos"),l(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(g,"href","#yolos"),l(_,"class","relative group"),l(K,"id","overview"),l(K,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(K,"href","#overview"),l(N,"class","relative group"),l(je,"href","https://arxiv.org/abs/2106.00666"),l(je,"rel","nofollow"),l(ro,"href","vit"),l(mo,"href","/docs/transformers/main/en/model_doc/yolos#transformers.YolosImageProcessor"),l(po,"href","detr"),ca(Z.src,er="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/yolos_architecture.png")||l(Z,"src",er),l(Z,"alt","drawing"),l(Z,"width","600"),l(ho,"href","https://arxiv.org/abs/2106.00666"),l(Oe,"href","https://huggingface.co/nielsr"),l(Oe,"rel","nofollow"),l(Pe,"href","https://github.com/hustvl/YOLOS"),l(Pe,"rel","nofollow"),l(oe,"id","resources"),l(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(oe,"href","#resources"),l(S,"class","relative group"),l(uo,"href","/docs/transformers/main/en/model_doc/yolos#transformers.YolosForObjectDetection"),l(Ie,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/YOLOS"),l(Ie,"rel","nofollow"),l(te,"id","transformers.YolosConfig"),l(te,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(te,"href","#transformers.YolosConfig"),l(U,"class","relative group"),l(bo,"href","/docs/transformers/main/en/model_doc/yolos#transformers.YolosModel"),l(Ce,"href","https://huggingface.co/hustvl/yolos-base"),l(Ce,"rel","nofollow"),l(vo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(yo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ne,"id","transformers.YolosImageProcessor"),l(ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(ne,"href","#transformers.YolosImageProcessor"),l(B,"class","relative group"),l(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(wo,"href","/docs/transformers/main/en/model_doc/yolos#transformers.YolosForObjectDetection"),l(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(le,"id","transformers.YolosFeatureExtractor"),l(le,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(le,"href","#transformers.YolosFeatureExtractor"),l(H,"class","relative group"),l(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l($o,"href","/docs/transformers/main/en/model_doc/yolos#transformers.YolosForObjectDetection"),l(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(pe,"id","transformers.YolosModel"),l(pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(pe,"href","#transformers.YolosModel"),l(J,"class","relative group"),l(Qe,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Qe,"rel","nofollow"),l(xo,"href","/docs/transformers/main/en/model_doc/yolos#transformers.YolosModel"),l(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ge,"id","transformers.YolosForObjectDetection"),l(ge,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(ge,"href","#transformers.YolosForObjectDetection"),l(Q,"class","relative group"),l(oo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(oo,"rel","nofollow"),l(Yo,"href","/docs/transformers/main/en/model_doc/yolos#transformers.YolosForObjectDetection"),l(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,d){o(document.head,f),h(e,T,d),h(e,_,d),o(_,g),o(g,Y),y(c,Y,null),o(_,u),o(_,C),o(C,Jt),h(e,at,d),h(e,N,d),o(N,K),o(K,Do),y(Te,Do,null),o(N,Gt),o(N,Co),o(Co,Qt),h(e,it,d),h(e,A,d),o(A,Xt),o(A,je),o(je,Kt),o(A,Zt),o(A,ro),o(ro,es),o(A,os),h(e,lt,d),h(e,ao,d),o(ao,ts),h(e,ct,d),h(e,io,d),o(io,Lo),o(Lo,ss),h(e,dt,d),h(e,lo,d),o(lo,ns),h(e,mt,d),h(e,co,d),o(co,L),o(L,rs),o(L,mo),o(mo,as),o(L,is),o(L,po),o(po,ls),o(L,cs),o(L,Fo),o(Fo,ds),o(L,ms),h(e,pt,d),h(e,Z,d),h(e,ht,d),h(e,ee,d),o(ee,ps),o(ee,ho),o(ho,hs),o(ee,fs),h(e,ft,d),h(e,q,d),o(q,gs),o(q,Oe),o(Oe,us),o(q,_s),o(q,Pe),o(Pe,bs),o(q,vs),h(e,gt,d),h(e,S,d),o(S,oe),o(oe,Ao),y(Ee,Ao,null),o(S,ys),o(S,qo),o(qo,ws),h(e,ut,d),h(e,fo,d),o(fo,$s),h(e,_t,d),y(ke,e,d),h(e,bt,d),h(e,go,d),o(go,R),o(R,xs),o(R,uo),o(uo,Ys),o(R,Ts),o(R,Ie),o(Ie,js),o(R,Os),h(e,vt,d),h(e,_o,d),o(_o,Ps),h(e,yt,d),h(e,U,d),o(U,te),o(te,Mo),y(ze,Mo,null),o(U,Es),o(U,No),o(No,ks),h(e,wt,d),h(e,O,d),y(De,O,null),o(O,Is),o(O,W),o(W,zs),o(W,bo),o(bo,Ds),o(W,Cs),o(W,Ce),o(Ce,Ls),o(W,Fs),o(O,As),o(O,V),o(V,qs),o(V,vo),o(vo,Ms),o(V,Ns),o(V,yo),o(yo,Ss),o(V,Rs),o(O,Us),y(se,O,null),h(e,$t,d),h(e,B,d),o(B,ne),o(ne,So),y(Le,So,null),o(B,Ws),o(B,Ro),o(Ro,Vs),h(e,xt,d),h(e,j,d),y(Fe,j,null),o(j,Bs),o(j,Uo),o(Uo,Hs),o(j,Js),o(j,re),y(Ae,re,null),o(re,Gs),o(re,Wo),o(Wo,Qs),o(j,Xs),o(j,ae),y(qe,ae,null),o(ae,Ks),o(ae,Vo),o(Vo,Zs),o(j,en),o(j,ie),y(Me,ie,null),o(ie,on),o(ie,Ne),o(Ne,tn),o(Ne,wo),o(wo,sn),o(Ne,nn),h(e,Yt,d),h(e,H,d),o(H,le),o(le,Bo),y(Se,Bo,null),o(H,rn),o(H,Ho),o(Ho,an),h(e,Tt,d),h(e,P,d),y(Re,P,null),o(P,ln),o(P,ce),y(Ue,ce,null),o(ce,cn),o(ce,Jo),o(Jo,dn),o(P,mn),o(P,de),y(We,de,null),o(de,pn),o(de,Go),o(Go,hn),o(P,fn),o(P,me),y(Ve,me,null),o(me,gn),o(me,Be),o(Be,un),o(Be,$o),o($o,_n),o(Be,bn),h(e,jt,d),h(e,J,d),o(J,pe),o(pe,Qo),y(He,Qo,null),o(J,vn),o(J,Xo),o(Xo,yn),h(e,Ot,d),h(e,F,d),y(Je,F,null),o(F,wn),o(F,Ge),o(Ge,$n),o(Ge,Qe),o(Qe,xn),o(Ge,Yn),o(F,Tn),o(F,z),y(Xe,z,null),o(z,jn),o(z,G),o(G,On),o(G,xo),o(xo,Pn),o(G,En),o(G,Ko),o(Ko,kn),o(G,In),o(z,zn),y(he,z,null),o(z,Dn),y(fe,z,null),h(e,Pt,d),h(e,Q,d),o(Q,ge),o(ge,Zo),y(Ke,Zo,null),o(Q,Cn),o(Q,et),o(et,Ln),h(e,Et,d),h(e,E,d),y(Ze,E,null),o(E,Fn),o(E,ot),o(ot,An),o(E,qn),o(E,eo),o(eo,Mn),o(eo,oo),o(oo,Nn),o(eo,Sn),o(E,Rn),o(E,D),y(to,D,null),o(D,Un),o(D,X),o(X,Wn),o(X,Yo),o(Yo,Vn),o(X,Bn),o(X,tt),o(tt,Hn),o(X,Jn),o(D,Gn),y(ue,D,null),o(D,Qn),y(_e,D,null),kt=!0},p(e,[d]){const so={};d&2&&(so.$$scope={dirty:d,ctx:e}),se.$set(so);const st={};d&2&&(st.$$scope={dirty:d,ctx:e}),he.$set(st);const nt={};d&2&&(nt.$$scope={dirty:d,ctx:e}),fe.$set(nt);const rt={};d&2&&(rt.$$scope={dirty:d,ctx:e}),ue.$set(rt);const no={};d&2&&(no.$$scope={dirty:d,ctx:e}),_e.$set(no)},i(e){kt||(w(c.$$.fragment,e),w(Te.$$.fragment,e),w(Ee.$$.fragment,e),w(ke.$$.fragment,e),w(ze.$$.fragment,e),w(De.$$.fragment,e),w(se.$$.fragment,e),w(Le.$$.fragment,e),w(Fe.$$.fragment,e),w(Ae.$$.fragment,e),w(qe.$$.fragment,e),w(Me.$$.fragment,e),w(Se.$$.fragment,e),w(Re.$$.fragment,e),w(Ue.$$.fragment,e),w(We.$$.fragment,e),w(Ve.$$.fragment,e),w(He.$$.fragment,e),w(Je.$$.fragment,e),w(Xe.$$.fragment,e),w(he.$$.fragment,e),w(fe.$$.fragment,e),w(Ke.$$.fragment,e),w(Ze.$$.fragment,e),w(to.$$.fragment,e),w(ue.$$.fragment,e),w(_e.$$.fragment,e),kt=!0)},o(e){$(c.$$.fragment,e),$(Te.$$.fragment,e),$(Ee.$$.fragment,e),$(ke.$$.fragment,e),$(ze.$$.fragment,e),$(De.$$.fragment,e),$(se.$$.fragment,e),$(Le.$$.fragment,e),$(Fe.$$.fragment,e),$(Ae.$$.fragment,e),$(qe.$$.fragment,e),$(Me.$$.fragment,e),$(Se.$$.fragment,e),$(Re.$$.fragment,e),$(Ue.$$.fragment,e),$(We.$$.fragment,e),$(Ve.$$.fragment,e),$(He.$$.fragment,e),$(Je.$$.fragment,e),$(Xe.$$.fragment,e),$(he.$$.fragment,e),$(fe.$$.fragment,e),$(Ke.$$.fragment,e),$(Ze.$$.fragment,e),$(to.$$.fragment,e),$(ue.$$.fragment,e),$(_e.$$.fragment,e),kt=!1},d(e){t(f),e&&t(T),e&&t(_),x(c),e&&t(at),e&&t(N),x(Te),e&&t(it),e&&t(A),e&&t(lt),e&&t(ao),e&&t(ct),e&&t(io),e&&t(dt),e&&t(lo),e&&t(mt),e&&t(co),e&&t(pt),e&&t(Z),e&&t(ht),e&&t(ee),e&&t(ft),e&&t(q),e&&t(gt),e&&t(S),x(Ee),e&&t(ut),e&&t(fo),e&&t(_t),x(ke,e),e&&t(bt),e&&t(go),e&&t(vt),e&&t(_o),e&&t(yt),e&&t(U),x(ze),e&&t(wt),e&&t(O),x(De),x(se),e&&t($t),e&&t(B),x(Le),e&&t(xt),e&&t(j),x(Fe),x(Ae),x(qe),x(Me),e&&t(Yt),e&&t(H),x(Se),e&&t(Tt),e&&t(P),x(Re),x(Ue),x(We),x(Ve),e&&t(jt),e&&t(J),x(He),e&&t(Ot),e&&t(F),x(Je),x(Xe),x(he),x(fe),e&&t(Pt),e&&t(Q),x(Ke),e&&t(Et),e&&t(E),x(Ze),x(to),x(ue),x(_e)}}}const ba={local:"yolos",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.YolosConfig",title:"YolosConfig"},{local:"transformers.YolosImageProcessor",title:"YolosImageProcessor"},{local:"transformers.YolosFeatureExtractor",title:"YolosFeatureExtractor"},{local:"transformers.YolosModel",title:"YolosModel"},{local:"transformers.YolosForObjectDetection",title:"YolosForObjectDetection"}],title:"YOLOS"};function va(I){return da(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Oa extends ra{constructor(f){super();aa(this,f,va,_a,ia,{})}}export{Oa as default,ba as metadata};
