import{S as pa,i as ha,s as fa,e as s,k as m,w as b,t as a,M as ga,c as n,d as t,m as p,a as r,x as v,h as i,b as l,N as ua,G as o,g as h,y,q as w,o as $,B as x,v as _a,L as rr}from"../../chunks/vendor-hf-doc-builder.js";import{T as ma}from"../../chunks/Tip-hf-doc-builder.js";import{D as k}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ar}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Te}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as nr}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as ba}from"../../chunks/PipelineTag-hf-doc-builder.js";function va(I){let f,T,_,g,Y;return g=new ar({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:rr,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 ya(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 wa(I){let f,T,_,g,Y;return g=new ar({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:rr,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;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 xa(I){let f,T,_,g,Y;return g=new ar({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:rr,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 Ya(I){let f,T,_,g,Y,c,u,C,Xt,lt,N,K,Lo,je,Kt,Fo,Zt,ct,A,es,Oe,os,ts,ao,ss,ns,dt,io,rs,mt,lo,Ao,as,pt,co,is,ht,mo,L,ls,po,cs,ds,ho,ms,ps,qo,hs,fs,ft,Z,ir,gt,ee,gs,fo,us,_s,ut,q,bs,Pe,vs,ys,Ee,ws,$s,_t,S,oe,Mo,ke,xs,No,Ys,bt,go,Ts,vt,Ie,yt,te,R,js,uo,Os,Ps,De,Es,ks,Is,_o,Ds,bo,zs,wt,vo,Cs,$t,U,se,So,ze,Ls,Ro,Fs,xt,O,Ce,As,W,qs,yo,Ms,Ns,Le,Ss,Rs,Us,V,Ws,wo,Vs,Bs,$o,Hs,Js,Gs,ne,Yt,B,re,Uo,Fe,Qs,Wo,Xs,Tt,j,Ae,Ks,Vo,Zs,en,ae,qe,on,Bo,tn,sn,ie,Me,nn,Ho,rn,an,le,Ne,ln,Se,cn,xo,dn,mn,jt,H,ce,Jo,Re,pn,Go,hn,Ot,P,Ue,fn,de,We,gn,Qo,un,_n,me,Ve,bn,Xo,vn,yn,pe,Be,wn,He,$n,Yo,xn,Yn,Pt,J,he,Ko,Je,Tn,Zo,jn,Et,F,Ge,On,Qe,Pn,Xe,En,kn,In,D,Ke,Dn,G,zn,To,Cn,Ln,et,Fn,An,qn,fe,Mn,ge,kt,Q,ue,ot,Ze,Nn,tt,Sn,It,E,eo,Rn,st,Un,Wn,oo,Vn,to,Bn,Hn,Jn,z,so,Gn,X,Qn,jo,Xn,Kn,nt,Zn,er,or,_e,tr,be,Dt;return c=new Te({}),je=new Te({}),ke=new Te({}),Ie=new ba({props:{pipeline:"object-detection"}}),ze=new Te({}),Ce=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/v4.29.0/src/transformers/models/yolos/configuration_yolos.py#L35"}}),ne=new nr({props:{anchor:"transformers.YolosConfig.example",$$slots:{default:[va]},$$scope:{ctx:I}}}),Fe=new Te({}),Ae=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/v4.29.0/src/transformers/models/yolos/image_processing_yolos.py#L654"}}),qe=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[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.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/v4.29.0/src/transformers/models/yolos/image_processing_yolos.py#L945"}}),Me=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[str, transformers.utils.generic.TensorType, 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/v4.29.0/src/transformers/models/yolos/image_processing_yolos.py#L913"}}),Ne=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/v4.29.0/src/transformers/models/yolos/image_processing_yolos.py#L1193",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>
`}}),Re=new Te({}),Ue=new k({props:{name:"class transformers.YolosFeatureExtractor",anchor:"transformers.YolosFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/yolos/feature_extraction_yolos.py#L26"}}),We=new k({props:{name:"__call__",anchor:"transformers.YolosFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/image_processing_utils.py#L462"}}),Ve=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[str, transformers.utils.generic.TensorType, 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/v4.29.0/src/transformers/models/yolos/image_processing_yolos.py#L913"}}),Be=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/v4.29.0/src/transformers/models/yolos/image_processing_yolos.py#L1193",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>
`}}),Je=new Te({}),Ge=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/yolos/modeling_yolos.py#L597"}}),Ke=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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/yolos/modeling_yolos.py#L625",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),fe=new ma({props:{$$slots:{default:[ya]},$$scope:{ctx:I}}}),ge=new nr({props:{anchor:"transformers.YolosModel.forward.example",$$slots:{default:[wa]},$$scope:{ctx:I}}}),Ze=new Te({}),eo=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/yolos/modeling_yolos.py#L705"}}),so=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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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/v4.29.0/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/v4.29.0/src/transformers/models/yolos/modeling_yolos.py#L732",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/v4.29.0/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>
`}}),_e=new ma({props:{$$slots:{default:[$a]},$$scope:{ctx:I}}}),be=new nr({props:{anchor:"transformers.YolosForObjectDetection.forward.example",$$slots:{default:[xa]},$$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"),Xt=a("YOLOS"),lt=m(),N=s("h2"),K=s("a"),Lo=s("span"),b(je.$$.fragment),Kt=m(),Fo=s("span"),Zt=a("Overview"),ct=m(),A=s("p"),es=a("The YOLOS model was proposed in "),Oe=s("a"),os=a("You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection"),ts=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 `),ao=s("a"),ss=a("Vision Transformer (ViT)"),ns=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."),dt=m(),io=s("p"),rs=a("The abstract from the paper is the following:"),mt=m(),lo=s("p"),Ao=s("em"),as=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."),pt=m(),co=s("p"),is=a("Tips:"),ht=m(),mo=s("ul"),L=s("li"),ls=a("One can use "),po=s("a"),cs=a("YolosImageProcessor"),ds=a(" for preparing images (and optional targets) for the model. Contrary to "),ho=s("a"),ms=a("DETR"),ps=a(", YOLOS doesn\u2019t require a "),qo=s("code"),hs=a("pixel_mask"),fs=a(" to be created."),ft=m(),Z=s("img"),gt=m(),ee=s("small"),gs=a("YOLOS architecture. Taken from the "),fo=s("a"),us=a("original paper"),_s=a("."),ut=m(),q=s("p"),bs=a("This model was contributed by "),Pe=s("a"),vs=a("nielsr"),ys=a(". The original code can be found "),Ee=s("a"),ws=a("here"),$s=a("."),_t=m(),S=s("h2"),oe=s("a"),Mo=s("span"),b(ke.$$.fragment),xs=m(),No=s("span"),Ys=a("Resources"),bt=m(),go=s("p"),Ts=a("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with YOLOS."),vt=m(),b(Ie.$$.fragment),yt=m(),te=s("ul"),R=s("li"),js=a("All example notebooks illustrating inference + fine-tuning "),uo=s("a"),Os=a("YolosForObjectDetection"),Ps=a(" on a custom dataset can be found "),De=s("a"),Es=a("here"),ks=a("."),Is=m(),_o=s("li"),Ds=a("See also: "),bo=s("a"),zs=a("Object detection task guide"),wt=m(),vo=s("p"),Cs=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."),$t=m(),U=s("h2"),se=s("a"),So=s("span"),b(ze.$$.fragment),Ls=m(),Ro=s("span"),Fs=a("YolosConfig"),xt=m(),O=s("div"),b(Ce.$$.fragment),As=m(),W=s("p"),qs=a("This is the configuration class to store the configuration of a "),yo=s("a"),Ms=a("YolosModel"),Ns=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
`),Le=s("a"),Ss=a("hustvl/yolos-base"),Rs=a(" architecture."),Us=m(),V=s("p"),Ws=a("Configuration objects inherit from "),wo=s("a"),Vs=a("PretrainedConfig"),Bs=a(` and can be used to control the model outputs. Read the
documentation from `),$o=s("a"),Hs=a("PretrainedConfig"),Js=a(" for more information."),Gs=m(),b(ne.$$.fragment),Yt=m(),B=s("h2"),re=s("a"),Uo=s("span"),b(Fe.$$.fragment),Qs=m(),Wo=s("span"),Xs=a("YolosImageProcessor"),Tt=m(),j=s("div"),b(Ae.$$.fragment),Ks=m(),Vo=s("p"),Zs=a("Constructs a Detr image processor."),en=m(),ae=s("div"),b(qe.$$.fragment),on=m(),Bo=s("p"),tn=a("Preprocess an image or a batch of images so that it can be used by the model."),sn=m(),ie=s("div"),b(Me.$$.fragment),nn=m(),Ho=s("p"),rn=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.`),an=m(),le=s("div"),b(Ne.$$.fragment),ln=m(),Se=s("p"),cn=a("Converts the raw output of "),xo=s("a"),dn=a("YolosForObjectDetection"),mn=a(` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format. Only supports PyTorch.`),jt=m(),H=s("h2"),ce=s("a"),Jo=s("span"),b(Re.$$.fragment),pn=m(),Go=s("span"),hn=a("YolosFeatureExtractor"),Ot=m(),P=s("div"),b(Ue.$$.fragment),fn=m(),de=s("div"),b(We.$$.fragment),gn=m(),Qo=s("p"),un=a("Preprocess an image or a batch of images."),_n=m(),me=s("div"),b(Ve.$$.fragment),bn=m(),Xo=s("p"),vn=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.`),yn=m(),pe=s("div"),b(Be.$$.fragment),wn=m(),He=s("p"),$n=a("Converts the raw output of "),Yo=s("a"),xn=a("YolosForObjectDetection"),Yn=a(` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format. Only supports PyTorch.`),Pt=m(),J=s("h2"),he=s("a"),Ko=s("span"),b(Je.$$.fragment),Tn=m(),Zo=s("span"),jn=a("YolosModel"),Et=m(),F=s("div"),b(Ge.$$.fragment),On=m(),Qe=s("p"),Pn=a(`The bare YOLOS Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Xe=s("a"),En=a("torch.nn.Module"),kn=a(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),In=m(),D=s("div"),b(Ke.$$.fragment),Dn=m(),G=s("p"),zn=a("The "),To=s("a"),Cn=a("YolosModel"),Ln=a(" forward method, overrides the "),et=s("code"),Fn=a("__call__"),An=a(" special method."),qn=m(),b(fe.$$.fragment),Mn=m(),b(ge.$$.fragment),kt=m(),Q=s("h2"),ue=s("a"),ot=s("span"),b(Ze.$$.fragment),Nn=m(),tt=s("span"),Sn=a("YolosForObjectDetection"),It=m(),E=s("div"),b(eo.$$.fragment),Rn=m(),st=s("p"),Un=a("YOLOS Model (consisting of a ViT encoder) with object detection heads on top, for tasks such as COCO detection."),Wn=m(),oo=s("p"),Vn=a("This model is a PyTorch "),to=s("a"),Bn=a("torch.nn.Module"),Hn=a(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Jn=m(),z=s("div"),b(so.$$.fragment),Gn=m(),X=s("p"),Qn=a("The "),jo=s("a"),Xn=a("YolosForObjectDetection"),Kn=a(" forward method, overrides the "),nt=s("code"),Zn=a("__call__"),er=a(" special method."),or=m(),b(_e.$$.fragment),tr=m(),b(be.$$.fragment),this.h()},l(e){const d=ga('[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 no=r(_);g=n(no,"A",{id:!0,class:!0,href:!0});var rt=r(g);Y=n(rt,"SPAN",{});var at=r(Y);v(c.$$.fragment,at),at.forEach(t),rt.forEach(t),u=p(no),C=n(no,"SPAN",{});var it=r(C);Xt=i(it,"YOLOS"),it.forEach(t),no.forEach(t),lt=p(e),N=n(e,"H2",{class:!0});var ro=r(N);K=n(ro,"A",{id:!0,class:!0,href:!0});var lr=r(K);Lo=n(lr,"SPAN",{});var cr=r(Lo);v(je.$$.fragment,cr),cr.forEach(t),lr.forEach(t),Kt=p(ro),Fo=n(ro,"SPAN",{});var dr=r(Fo);Zt=i(dr,"Overview"),dr.forEach(t),ro.forEach(t),ct=p(e),A=n(e,"P",{});var Oo=r(A);es=i(Oo,"The YOLOS model was proposed in "),Oe=n(Oo,"A",{href:!0,rel:!0});var mr=r(Oe);os=i(mr,"You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection"),mr.forEach(t),ts=i(Oo,` by Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, Wenyu Liu.
YOLOS proposes to just leverage the plain `),ao=n(Oo,"A",{href:!0});var pr=r(ao);ss=i(pr,"Vision Transformer (ViT)"),pr.forEach(t),ns=i(Oo," 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."),Oo.forEach(t),dt=p(e),io=n(e,"P",{});var hr=r(io);rs=i(hr,"The abstract from the paper is the following:"),hr.forEach(t),mt=p(e),lo=n(e,"P",{});var fr=r(lo);Ao=n(fr,"EM",{});var gr=r(Ao);as=i(gr,"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."),gr.forEach(t),fr.forEach(t),pt=p(e),co=n(e,"P",{});var ur=r(co);is=i(ur,"Tips:"),ur.forEach(t),ht=p(e),mo=n(e,"UL",{});var _r=r(mo);L=n(_r,"LI",{});var ve=r(L);ls=i(ve,"One can use "),po=n(ve,"A",{href:!0});var br=r(po);cs=i(br,"YolosImageProcessor"),br.forEach(t),ds=i(ve," for preparing images (and optional targets) for the model. Contrary to "),ho=n(ve,"A",{href:!0});var vr=r(ho);ms=i(vr,"DETR"),vr.forEach(t),ps=i(ve,", YOLOS doesn\u2019t require a "),qo=n(ve,"CODE",{});var yr=r(qo);hs=i(yr,"pixel_mask"),yr.forEach(t),fs=i(ve," to be created."),ve.forEach(t),_r.forEach(t),ft=p(e),Z=n(e,"IMG",{src:!0,alt:!0,width:!0}),gt=p(e),ee=n(e,"SMALL",{});var zt=r(ee);gs=i(zt,"YOLOS architecture. Taken from the "),fo=n(zt,"A",{href:!0});var wr=r(fo);us=i(wr,"original paper"),wr.forEach(t),_s=i(zt,"."),zt.forEach(t),ut=p(e),q=n(e,"P",{});var Po=r(q);bs=i(Po,"This model was contributed by "),Pe=n(Po,"A",{href:!0,rel:!0});var $r=r(Pe);vs=i($r,"nielsr"),$r.forEach(t),ys=i(Po,". The original code can be found "),Ee=n(Po,"A",{href:!0,rel:!0});var xr=r(Ee);ws=i(xr,"here"),xr.forEach(t),$s=i(Po,"."),Po.forEach(t),_t=p(e),S=n(e,"H2",{class:!0});var Ct=r(S);oe=n(Ct,"A",{id:!0,class:!0,href:!0});var Yr=r(oe);Mo=n(Yr,"SPAN",{});var Tr=r(Mo);v(ke.$$.fragment,Tr),Tr.forEach(t),Yr.forEach(t),xs=p(Ct),No=n(Ct,"SPAN",{});var jr=r(No);Ys=i(jr,"Resources"),jr.forEach(t),Ct.forEach(t),bt=p(e),go=n(e,"P",{});var Or=r(go);Ts=i(Or,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with YOLOS."),Or.forEach(t),vt=p(e),v(Ie.$$.fragment,e),yt=p(e),te=n(e,"UL",{});var Lt=r(te);R=n(Lt,"LI",{});var Eo=r(R);js=i(Eo,"All example notebooks illustrating inference + fine-tuning "),uo=n(Eo,"A",{href:!0});var Pr=r(uo);Os=i(Pr,"YolosForObjectDetection"),Pr.forEach(t),Ps=i(Eo," on a custom dataset can be found "),De=n(Eo,"A",{href:!0,rel:!0});var Er=r(De);Es=i(Er,"here"),Er.forEach(t),ks=i(Eo,"."),Eo.forEach(t),Is=p(Lt),_o=n(Lt,"LI",{});var sr=r(_o);Ds=i(sr,"See also: "),bo=n(sr,"A",{href:!0});var kr=r(bo);zs=i(kr,"Object detection task guide"),kr.forEach(t),sr.forEach(t),Lt.forEach(t),wt=p(e),vo=n(e,"P",{});var Ir=r(vo);Cs=i(Ir,"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."),Ir.forEach(t),$t=p(e),U=n(e,"H2",{class:!0});var Ft=r(U);se=n(Ft,"A",{id:!0,class:!0,href:!0});var Dr=r(se);So=n(Dr,"SPAN",{});var zr=r(So);v(ze.$$.fragment,zr),zr.forEach(t),Dr.forEach(t),Ls=p(Ft),Ro=n(Ft,"SPAN",{});var Cr=r(Ro);Fs=i(Cr,"YolosConfig"),Cr.forEach(t),Ft.forEach(t),xt=p(e),O=n(e,"DIV",{class:!0});var ye=r(O);v(Ce.$$.fragment,ye),As=p(ye),W=n(ye,"P",{});var ko=r(W);qs=i(ko,"This is the configuration class to store the configuration of a "),yo=n(ko,"A",{href:!0});var Lr=r(yo);Ms=i(Lr,"YolosModel"),Lr.forEach(t),Ns=i(ko,`. 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
`),Le=n(ko,"A",{href:!0,rel:!0});var Fr=r(Le);Ss=i(Fr,"hustvl/yolos-base"),Fr.forEach(t),Rs=i(ko," architecture."),ko.forEach(t),Us=p(ye),V=n(ye,"P",{});var Io=r(V);Ws=i(Io,"Configuration objects inherit from "),wo=n(Io,"A",{href:!0});var Ar=r(wo);Vs=i(Ar,"PretrainedConfig"),Ar.forEach(t),Bs=i(Io,` and can be used to control the model outputs. Read the
documentation from `),$o=n(Io,"A",{href:!0});var qr=r($o);Hs=i(qr,"PretrainedConfig"),qr.forEach(t),Js=i(Io," for more information."),Io.forEach(t),Gs=p(ye),v(ne.$$.fragment,ye),ye.forEach(t),Yt=p(e),B=n(e,"H2",{class:!0});var At=r(B);re=n(At,"A",{id:!0,class:!0,href:!0});var Mr=r(re);Uo=n(Mr,"SPAN",{});var Nr=r(Uo);v(Fe.$$.fragment,Nr),Nr.forEach(t),Mr.forEach(t),Qs=p(At),Wo=n(At,"SPAN",{});var Sr=r(Wo);Xs=i(Sr,"YolosImageProcessor"),Sr.forEach(t),At.forEach(t),Tt=p(e),j=n(e,"DIV",{class:!0});var M=r(j);v(Ae.$$.fragment,M),Ks=p(M),Vo=n(M,"P",{});var Rr=r(Vo);Zs=i(Rr,"Constructs a Detr image processor."),Rr.forEach(t),en=p(M),ae=n(M,"DIV",{class:!0});var qt=r(ae);v(qe.$$.fragment,qt),on=p(qt),Bo=n(qt,"P",{});var Ur=r(Bo);tn=i(Ur,"Preprocess an image or a batch of images so that it can be used by the model."),Ur.forEach(t),qt.forEach(t),sn=p(M),ie=n(M,"DIV",{class:!0});var Mt=r(ie);v(Me.$$.fragment,Mt),nn=p(Mt),Ho=n(Mt,"P",{});var Wr=r(Ho);rn=i(Wr,`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.`),Wr.forEach(t),Mt.forEach(t),an=p(M),le=n(M,"DIV",{class:!0});var Nt=r(le);v(Ne.$$.fragment,Nt),ln=p(Nt),Se=n(Nt,"P",{});var St=r(Se);cn=i(St,"Converts the raw output of "),xo=n(St,"A",{href:!0});var Vr=r(xo);dn=i(Vr,"YolosForObjectDetection"),Vr.forEach(t),mn=i(St,` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format. Only supports PyTorch.`),St.forEach(t),Nt.forEach(t),M.forEach(t),jt=p(e),H=n(e,"H2",{class:!0});var Rt=r(H);ce=n(Rt,"A",{id:!0,class:!0,href:!0});var Br=r(ce);Jo=n(Br,"SPAN",{});var Hr=r(Jo);v(Re.$$.fragment,Hr),Hr.forEach(t),Br.forEach(t),pn=p(Rt),Go=n(Rt,"SPAN",{});var Jr=r(Go);hn=i(Jr,"YolosFeatureExtractor"),Jr.forEach(t),Rt.forEach(t),Ot=p(e),P=n(e,"DIV",{class:!0});var we=r(P);v(Ue.$$.fragment,we),fn=p(we),de=n(we,"DIV",{class:!0});var Ut=r(de);v(We.$$.fragment,Ut),gn=p(Ut),Qo=n(Ut,"P",{});var Gr=r(Qo);un=i(Gr,"Preprocess an image or a batch of images."),Gr.forEach(t),Ut.forEach(t),_n=p(we),me=n(we,"DIV",{class:!0});var Wt=r(me);v(Ve.$$.fragment,Wt),bn=p(Wt),Xo=n(Wt,"P",{});var Qr=r(Xo);vn=i(Qr,`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.`),Qr.forEach(t),Wt.forEach(t),yn=p(we),pe=n(we,"DIV",{class:!0});var Vt=r(pe);v(Be.$$.fragment,Vt),wn=p(Vt),He=n(Vt,"P",{});var Bt=r(He);$n=i(Bt,"Converts the raw output of "),Yo=n(Bt,"A",{href:!0});var Xr=r(Yo);xn=i(Xr,"YolosForObjectDetection"),Xr.forEach(t),Yn=i(Bt,` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format. Only supports PyTorch.`),Bt.forEach(t),Vt.forEach(t),we.forEach(t),Pt=p(e),J=n(e,"H2",{class:!0});var Ht=r(J);he=n(Ht,"A",{id:!0,class:!0,href:!0});var Kr=r(he);Ko=n(Kr,"SPAN",{});var Zr=r(Ko);v(Je.$$.fragment,Zr),Zr.forEach(t),Kr.forEach(t),Tn=p(Ht),Zo=n(Ht,"SPAN",{});var ea=r(Zo);jn=i(ea,"YolosModel"),ea.forEach(t),Ht.forEach(t),Et=p(e),F=n(e,"DIV",{class:!0});var Do=r(F);v(Ge.$$.fragment,Do),On=p(Do),Qe=n(Do,"P",{});var Jt=r(Qe);Pn=i(Jt,`The bare YOLOS Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Xe=n(Jt,"A",{href:!0,rel:!0});var oa=r(Xe);En=i(oa,"torch.nn.Module"),oa.forEach(t),kn=i(Jt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Jt.forEach(t),In=p(Do),D=n(Do,"DIV",{class:!0});var $e=r(D);v(Ke.$$.fragment,$e),Dn=p($e),G=n($e,"P",{});var zo=r(G);zn=i(zo,"The "),To=n(zo,"A",{href:!0});var ta=r(To);Cn=i(ta,"YolosModel"),ta.forEach(t),Ln=i(zo," forward method, overrides the "),et=n(zo,"CODE",{});var sa=r(et);Fn=i(sa,"__call__"),sa.forEach(t),An=i(zo," special method."),zo.forEach(t),qn=p($e),v(fe.$$.fragment,$e),Mn=p($e),v(ge.$$.fragment,$e),$e.forEach(t),Do.forEach(t),kt=p(e),Q=n(e,"H2",{class:!0});var Gt=r(Q);ue=n(Gt,"A",{id:!0,class:!0,href:!0});var na=r(ue);ot=n(na,"SPAN",{});var ra=r(ot);v(Ze.$$.fragment,ra),ra.forEach(t),na.forEach(t),Nn=p(Gt),tt=n(Gt,"SPAN",{});var aa=r(tt);Sn=i(aa,"YolosForObjectDetection"),aa.forEach(t),Gt.forEach(t),It=p(e),E=n(e,"DIV",{class:!0});var xe=r(E);v(eo.$$.fragment,xe),Rn=p(xe),st=n(xe,"P",{});var ia=r(st);Un=i(ia,"YOLOS Model (consisting of a ViT encoder) with object detection heads on top, for tasks such as COCO detection."),ia.forEach(t),Wn=p(xe),oo=n(xe,"P",{});var Qt=r(oo);Vn=i(Qt,"This model is a PyTorch "),to=n(Qt,"A",{href:!0,rel:!0});var la=r(to);Bn=i(la,"torch.nn.Module"),la.forEach(t),Hn=i(Qt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Qt.forEach(t),Jn=p(xe),z=n(xe,"DIV",{class:!0});var Ye=r(z);v(so.$$.fragment,Ye),Gn=p(Ye),X=n(Ye,"P",{});var Co=r(X);Qn=i(Co,"The "),jo=n(Co,"A",{href:!0});var ca=r(jo);Xn=i(ca,"YolosForObjectDetection"),ca.forEach(t),Kn=i(Co," forward method, overrides the "),nt=n(Co,"CODE",{});var da=r(nt);Zn=i(da,"__call__"),da.forEach(t),er=i(Co," special method."),Co.forEach(t),or=p(Ye),v(_e.$$.fragment,Ye),tr=p(Ye),v(be.$$.fragment,Ye),Ye.forEach(t),xe.forEach(t),this.h()},h(){l(f,"name","hf:doc:metadata"),l(f,"content",JSON.stringify(Ta)),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(Oe,"href","https://arxiv.org/abs/2106.00666"),l(Oe,"rel","nofollow"),l(ao,"href","vit"),l(po,"href","/docs/transformers/v4.29.0/en/model_doc/yolos#transformers.YolosImageProcessor"),l(ho,"href","detr"),ua(Z.src,ir="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/yolos_architecture.png")||l(Z,"src",ir),l(Z,"alt","drawing"),l(Z,"width","600"),l(fo,"href","https://arxiv.org/abs/2106.00666"),l(Pe,"href","https://huggingface.co/nielsr"),l(Pe,"rel","nofollow"),l(Ee,"href","https://github.com/hustvl/YOLOS"),l(Ee,"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/v4.29.0/en/model_doc/yolos#transformers.YolosForObjectDetection"),l(De,"href","https://github.com/NielsRogge/Transformers-Tutorials/tree/master/YOLOS"),l(De,"rel","nofollow"),l(bo,"href","../tasks/object_detection"),l(se,"id","transformers.YolosConfig"),l(se,"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(se,"href","#transformers.YolosConfig"),l(U,"class","relative group"),l(yo,"href","/docs/transformers/v4.29.0/en/model_doc/yolos#transformers.YolosModel"),l(Le,"href","https://huggingface.co/hustvl/yolos-base"),l(Le,"rel","nofollow"),l(wo,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l($o,"href","/docs/transformers/v4.29.0/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(re,"id","transformers.YolosImageProcessor"),l(re,"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(re,"href","#transformers.YolosImageProcessor"),l(B,"class","relative group"),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(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(xo,"href","/docs/transformers/v4.29.0/en/model_doc/yolos#transformers.YolosForObjectDetection"),l(le,"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(ce,"id","transformers.YolosFeatureExtractor"),l(ce,"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(ce,"href","#transformers.YolosFeatureExtractor"),l(H,"class","relative group"),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(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(Yo,"href","/docs/transformers/v4.29.0/en/model_doc/yolos#transformers.YolosForObjectDetection"),l(pe,"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(he,"id","transformers.YolosModel"),l(he,"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(he,"href","#transformers.YolosModel"),l(J,"class","relative group"),l(Xe,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Xe,"rel","nofollow"),l(To,"href","/docs/transformers/v4.29.0/en/model_doc/yolos#transformers.YolosModel"),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(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(ue,"id","transformers.YolosForObjectDetection"),l(ue,"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(ue,"href","#transformers.YolosForObjectDetection"),l(Q,"class","relative group"),l(to,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(to,"rel","nofollow"),l(jo,"href","/docs/transformers/v4.29.0/en/model_doc/yolos#transformers.YolosForObjectDetection"),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(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,Xt),h(e,lt,d),h(e,N,d),o(N,K),o(K,Lo),y(je,Lo,null),o(N,Kt),o(N,Fo),o(Fo,Zt),h(e,ct,d),h(e,A,d),o(A,es),o(A,Oe),o(Oe,os),o(A,ts),o(A,ao),o(ao,ss),o(A,ns),h(e,dt,d),h(e,io,d),o(io,rs),h(e,mt,d),h(e,lo,d),o(lo,Ao),o(Ao,as),h(e,pt,d),h(e,co,d),o(co,is),h(e,ht,d),h(e,mo,d),o(mo,L),o(L,ls),o(L,po),o(po,cs),o(L,ds),o(L,ho),o(ho,ms),o(L,ps),o(L,qo),o(qo,hs),o(L,fs),h(e,ft,d),h(e,Z,d),h(e,gt,d),h(e,ee,d),o(ee,gs),o(ee,fo),o(fo,us),o(ee,_s),h(e,ut,d),h(e,q,d),o(q,bs),o(q,Pe),o(Pe,vs),o(q,ys),o(q,Ee),o(Ee,ws),o(q,$s),h(e,_t,d),h(e,S,d),o(S,oe),o(oe,Mo),y(ke,Mo,null),o(S,xs),o(S,No),o(No,Ys),h(e,bt,d),h(e,go,d),o(go,Ts),h(e,vt,d),y(Ie,e,d),h(e,yt,d),h(e,te,d),o(te,R),o(R,js),o(R,uo),o(uo,Os),o(R,Ps),o(R,De),o(De,Es),o(R,ks),o(te,Is),o(te,_o),o(_o,Ds),o(_o,bo),o(bo,zs),h(e,wt,d),h(e,vo,d),o(vo,Cs),h(e,$t,d),h(e,U,d),o(U,se),o(se,So),y(ze,So,null),o(U,Ls),o(U,Ro),o(Ro,Fs),h(e,xt,d),h(e,O,d),y(Ce,O,null),o(O,As),o(O,W),o(W,qs),o(W,yo),o(yo,Ms),o(W,Ns),o(W,Le),o(Le,Ss),o(W,Rs),o(O,Us),o(O,V),o(V,Ws),o(V,wo),o(wo,Vs),o(V,Bs),o(V,$o),o($o,Hs),o(V,Js),o(O,Gs),y(ne,O,null),h(e,Yt,d),h(e,B,d),o(B,re),o(re,Uo),y(Fe,Uo,null),o(B,Qs),o(B,Wo),o(Wo,Xs),h(e,Tt,d),h(e,j,d),y(Ae,j,null),o(j,Ks),o(j,Vo),o(Vo,Zs),o(j,en),o(j,ae),y(qe,ae,null),o(ae,on),o(ae,Bo),o(Bo,tn),o(j,sn),o(j,ie),y(Me,ie,null),o(ie,nn),o(ie,Ho),o(Ho,rn),o(j,an),o(j,le),y(Ne,le,null),o(le,ln),o(le,Se),o(Se,cn),o(Se,xo),o(xo,dn),o(Se,mn),h(e,jt,d),h(e,H,d),o(H,ce),o(ce,Jo),y(Re,Jo,null),o(H,pn),o(H,Go),o(Go,hn),h(e,Ot,d),h(e,P,d),y(Ue,P,null),o(P,fn),o(P,de),y(We,de,null),o(de,gn),o(de,Qo),o(Qo,un),o(P,_n),o(P,me),y(Ve,me,null),o(me,bn),o(me,Xo),o(Xo,vn),o(P,yn),o(P,pe),y(Be,pe,null),o(pe,wn),o(pe,He),o(He,$n),o(He,Yo),o(Yo,xn),o(He,Yn),h(e,Pt,d),h(e,J,d),o(J,he),o(he,Ko),y(Je,Ko,null),o(J,Tn),o(J,Zo),o(Zo,jn),h(e,Et,d),h(e,F,d),y(Ge,F,null),o(F,On),o(F,Qe),o(Qe,Pn),o(Qe,Xe),o(Xe,En),o(Qe,kn),o(F,In),o(F,D),y(Ke,D,null),o(D,Dn),o(D,G),o(G,zn),o(G,To),o(To,Cn),o(G,Ln),o(G,et),o(et,Fn),o(G,An),o(D,qn),y(fe,D,null),o(D,Mn),y(ge,D,null),h(e,kt,d),h(e,Q,d),o(Q,ue),o(ue,ot),y(Ze,ot,null),o(Q,Nn),o(Q,tt),o(tt,Sn),h(e,It,d),h(e,E,d),y(eo,E,null),o(E,Rn),o(E,st),o(st,Un),o(E,Wn),o(E,oo),o(oo,Vn),o(oo,to),o(to,Bn),o(oo,Hn),o(E,Jn),o(E,z),y(so,z,null),o(z,Gn),o(z,X),o(X,Qn),o(X,jo),o(jo,Xn),o(X,Kn),o(X,nt),o(nt,Zn),o(X,er),o(z,or),y(_e,z,null),o(z,tr),y(be,z,null),Dt=!0},p(e,[d]){const no={};d&2&&(no.$$scope={dirty:d,ctx:e}),ne.$set(no);const rt={};d&2&&(rt.$$scope={dirty:d,ctx:e}),fe.$set(rt);const at={};d&2&&(at.$$scope={dirty:d,ctx:e}),ge.$set(at);const it={};d&2&&(it.$$scope={dirty:d,ctx:e}),_e.$set(it);const ro={};d&2&&(ro.$$scope={dirty:d,ctx:e}),be.$set(ro)},i(e){Dt||(w(c.$$.fragment,e),w(je.$$.fragment,e),w(ke.$$.fragment,e),w(Ie.$$.fragment,e),w(ze.$$.fragment,e),w(Ce.$$.fragment,e),w(ne.$$.fragment,e),w(Fe.$$.fragment,e),w(Ae.$$.fragment,e),w(qe.$$.fragment,e),w(Me.$$.fragment,e),w(Ne.$$.fragment,e),w(Re.$$.fragment,e),w(Ue.$$.fragment,e),w(We.$$.fragment,e),w(Ve.$$.fragment,e),w(Be.$$.fragment,e),w(Je.$$.fragment,e),w(Ge.$$.fragment,e),w(Ke.$$.fragment,e),w(fe.$$.fragment,e),w(ge.$$.fragment,e),w(Ze.$$.fragment,e),w(eo.$$.fragment,e),w(so.$$.fragment,e),w(_e.$$.fragment,e),w(be.$$.fragment,e),Dt=!0)},o(e){$(c.$$.fragment,e),$(je.$$.fragment,e),$(ke.$$.fragment,e),$(Ie.$$.fragment,e),$(ze.$$.fragment,e),$(Ce.$$.fragment,e),$(ne.$$.fragment,e),$(Fe.$$.fragment,e),$(Ae.$$.fragment,e),$(qe.$$.fragment,e),$(Me.$$.fragment,e),$(Ne.$$.fragment,e),$(Re.$$.fragment,e),$(Ue.$$.fragment,e),$(We.$$.fragment,e),$(Ve.$$.fragment,e),$(Be.$$.fragment,e),$(Je.$$.fragment,e),$(Ge.$$.fragment,e),$(Ke.$$.fragment,e),$(fe.$$.fragment,e),$(ge.$$.fragment,e),$(Ze.$$.fragment,e),$(eo.$$.fragment,e),$(so.$$.fragment,e),$(_e.$$.fragment,e),$(be.$$.fragment,e),Dt=!1},d(e){t(f),e&&t(T),e&&t(_),x(c),e&&t(lt),e&&t(N),x(je),e&&t(ct),e&&t(A),e&&t(dt),e&&t(io),e&&t(mt),e&&t(lo),e&&t(pt),e&&t(co),e&&t(ht),e&&t(mo),e&&t(ft),e&&t(Z),e&&t(gt),e&&t(ee),e&&t(ut),e&&t(q),e&&t(_t),e&&t(S),x(ke),e&&t(bt),e&&t(go),e&&t(vt),x(Ie,e),e&&t(yt),e&&t(te),e&&t(wt),e&&t(vo),e&&t($t),e&&t(U),x(ze),e&&t(xt),e&&t(O),x(Ce),x(ne),e&&t(Yt),e&&t(B),x(Fe),e&&t(Tt),e&&t(j),x(Ae),x(qe),x(Me),x(Ne),e&&t(jt),e&&t(H),x(Re),e&&t(Ot),e&&t(P),x(Ue),x(We),x(Ve),x(Be),e&&t(Pt),e&&t(J),x(Je),e&&t(Et),e&&t(F),x(Ge),x(Ke),x(fe),x(ge),e&&t(kt),e&&t(Q),x(Ze),e&&t(It),e&&t(E),x(eo),x(so),x(_e),x(be)}}}const Ta={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 ja(I){return _a(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ca extends pa{constructor(f){super();ha(this,f,ja,Ya,fa,{})}}export{Ca as default,Ta as metadata};
