import{S as Lr,i as Ar,s as qr,e as s,k as d,w as v,t as a,M as Fr,c as n,d as t,m,a as r,x as y,h as i,b as l,N as Nr,G as e,g as f,y as w,q as $,o as x,B as Y,v as Mr,L as Ln}from"../../chunks/vendor-hf-doc-builder.js";import{T as Dr}from"../../chunks/Tip-hf-doc-builder.js";import{D as C}from"../../chunks/Docstring-hf-doc-builder.js";import{C as An}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as oo}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Dn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Sr(k){let h,T,_,g,b;return g=new An({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(){h=s("p"),T=a("Example:"),_=d(),v(g.$$.fragment)},l(c){h=n(c,"P",{});var u=r(h);T=i(u,"Example:"),u.forEach(t),_=m(c),y(g.$$.fragment,c)},m(c,u){f(c,h,u),e(h,T),f(c,_,u),w(g,c,u),b=!0},p:Ln,i(c){b||($(g.$$.fragment,c),b=!0)},o(c){x(g.$$.fragment,c),b=!1},d(c){c&&t(h),c&&t(_),Y(g,c)}}}function Rr(k){let h,T,_,g,b;return{c(){h=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"),b=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){h=n(c,"P",{});var u=r(h);T=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n(u,"CODE",{});var D=r(_);g=i(D,"Module"),D.forEach(t),b=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){f(c,h,u),e(h,T),e(h,_),e(_,g),e(h,b)},d(c){c&&t(h)}}}function Ur(k){let h,T,_,g,b;return g=new An({props:{code:`from transformers import YolosImageProcessor, YolosModel
import torch
from datasets import load_dataset

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

feature_extractor = YolosImageProcessor.from_pretrained("hustvl/yolos-small")
model = YolosModel.from_pretrained("hustvl/yolos-small")

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