import{s as jo,f as To,o as Jo,n as z}from"../chunks/scheduler.9bc65507.js";import{S as Uo,i as xo,g as m,s as a,r as h,A as $o,h as p,f as n,c as r,j as J,u as g,x as v,k as T,y as i,a as d,v as u,d as f,t as _,w as b}from"../chunks/index.707bf1b6.js";import{T as Oe}from"../chunks/Tip.c2ecdbf4.js";import{D as U}from"../chunks/Docstring.17db21ae.js";import{C as A}from"../chunks/CodeBlock.54a9f38d.js";import{E as te}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{H as B}from"../chunks/Heading.342b1fa6.js";function zo(j){let t,w=`The architecture of OWLv2 is identical to <a href="owlvit">OWL-ViT</a>, however the object detection head now also includes an objectness classifier, which predicts the (query-agnostic) likelihood that a predicted box contains an object (as opposed to background). The objectness score can be used to rank or filter predictions independently of text queries.
Usage of OWLv2 is identical to <a href="owlvit">OWL-ViT</a> with a new, updated image processor (<a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ImageProcessor">Owlv2ImageProcessor</a>).`;return{c(){t=m("p"),t.innerHTML=w},l(l){t=p(l,"P",{"data-svelte-h":!0}),v(t)!=="svelte-ydk29n"&&(t.innerHTML=w)},m(l,c){d(l,t,c)},p:z,d(l){l&&n(t)}}}function Co(j){let t,w="Example:",l,c,M;return c=new A({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME93bHYyVGV4dENvbmZpZyUyQyUyME93bHYyVGV4dE1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyME93bHYyVGV4dE1vZGVsJTIwd2l0aCUyMGdvb2dsZSUyRm93bHYyLWJhc2UtcGF0Y2gxNiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBPd2x2MlRleHRDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBPd2x2MlRleHRDb25maWclMjBmcm9tJTIwdGhlJTIwZ29vZ2xlJTJGb3dsdjItYmFzZS1wYXRjaDE2JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBPd2x2MlRleHRNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Owlv2TextConfig, Owlv2TextModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Owlv2TextModel with google/owlv2-base-patch16 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Owlv2TextConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Owlv2TextConfig from the google/owlv2-base-patch16 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Owlv2TextModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){t=m("p"),t.textContent=w,l=a(),h(c.$$.fragment)},l(s){t=p(s,"P",{"data-svelte-h":!0}),v(t)!=="svelte-11lpom8"&&(t.textContent=w),l=r(s),g(c.$$.fragment,s)},m(s,y){d(s,t,y),d(s,l,y),u(c,s,y),M=!0},p:z,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(n(t),n(l)),b(c,s)}}}function Io(j){let t,w="Example:",l,c,M;return c=new A({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME93bHYyVmlzaW9uQ29uZmlnJTJDJTIwT3dsdjJWaXNpb25Nb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBPd2x2MlZpc2lvbk1vZGVsJTIwd2l0aCUyMGdvb2dsZSUyRm93bHYyLWJhc2UtcGF0Y2gxNiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBPd2x2MlZpc2lvbkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyME93bHYyVmlzaW9uTW9kZWwlMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBnb29nbGUlMkZvd2x2Mi1iYXNlLXBhdGNoMTYlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyME93bHYyVmlzaW9uTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Owlv2VisionConfig, Owlv2VisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Owlv2VisionModel with google/owlv2-base-patch16 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Owlv2VisionConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Owlv2VisionModel model from the google/owlv2-base-patch16 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Owlv2VisionModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){t=m("p"),t.textContent=w,l=a(),h(c.$$.fragment)},l(s){t=p(s,"P",{"data-svelte-h":!0}),v(t)!=="svelte-11lpom8"&&(t.textContent=w),l=r(s),g(c.$$.fragment,s)},m(s,y){d(s,t,y),d(s,l,y),u(c,s,y),M=!0},p:z,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(n(t),n(l)),b(c,s)}}}function Oo(j){let t,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=m("p"),t.innerHTML=w},l(l){t=p(l,"P",{"data-svelte-h":!0}),v(t)!=="svelte-fincs2"&&(t.innerHTML=w)},m(l,c){d(l,t,c)},p:z,d(l){l&&n(t)}}}function Wo(j){let t,w="Examples:",l,c,M;return c=new A({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyME93bHYyTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyME93bHYyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm93bHYyLWJhc2UtcGF0Y2gxNi1lbnNlbWJsZSUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2Mi1iYXNlLXBhdGNoMTYtZW5zZW1ibGUlMjIpJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEJTVCJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTVEJTJDJTIwaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsb2dpdHNfcGVyX2ltYWdlJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHNfcGVyX2ltYWdlJTIwJTIwJTIzJTIwdGhpcyUyMGlzJTIwdGhlJTIwaW1hZ2UtdGV4dCUyMHNpbWlsYXJpdHklMjBzY29yZSUwQXByb2JzJTIwJTNEJTIwbG9naXRzX3Blcl9pbWFnZS5zb2Z0bWF4KGRpbSUzRDEpJTIwJTIwJTIzJTIwd2UlMjBjYW4lMjB0YWtlJTIwdGhlJTIwc29mdG1heCUyMHRvJTIwZ2V0JTIwdGhlJTIwbGFiZWwlMjBwcm9iYWJpbGl0aWVz",highlighted:`<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><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Owlv2Model

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Owlv2Model.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=[[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>]], 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>logits_per_image = outputs.logits_per_image  <span class="hljs-comment"># this is the image-text similarity score</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>probs = logits_per_image.softmax(dim=<span class="hljs-number">1</span>)  <span class="hljs-comment"># we can take the softmax to get the label probabilities</span>`,wrap:!1}}),{c(){t=m("p"),t.textContent=w,l=a(),h(c.$$.fragment)},l(s){t=p(s,"P",{"data-svelte-h":!0}),v(t)!=="svelte-kvfsh7"&&(t.textContent=w),l=r(s),g(c.$$.fragment,s)},m(s,y){d(s,t,y),d(s,l,y),u(c,s,y),M=!0},p:z,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(n(t),n(l)),b(c,s)}}}function ko(j){let t,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=m("p"),t.innerHTML=w},l(l){t=p(l,"P",{"data-svelte-h":!0}),v(t)!=="svelte-fincs2"&&(t.innerHTML=w)},m(l,c){d(l,t,c)},p:z,d(l){l&&n(t)}}}function Zo(j){let t,w="Examples:",l,c,M;return c=new A({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBPd2x2Mk1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBPd2x2Mk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2Mi1iYXNlLXBhdGNoMTYtZW5zZW1ibGUlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdjItYmFzZS1wYXRjaDE2LWVuc2VtYmxlJTIyKSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvciglMEElMjAlMjAlMjAlMjB0ZXh0JTNEJTVCJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTJDJTIwJTVCJTIycGhvdG8lMjBvZiUyMGElMjBhc3RyYW5hdXQlMjIlNUQlNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKSUwQXRleHRfZmVhdHVyZXMlMjAlM0QlMjBtb2RlbC5nZXRfdGV4dF9mZWF0dXJlcygqKmlucHV0cyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Owlv2Model

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Owlv2Model.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(
<span class="hljs-meta">... </span>    text=[[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], [<span class="hljs-string">&quot;photo of a astranaut&quot;</span>]], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text_features = model.get_text_features(**inputs)`,wrap:!1}}),{c(){t=m("p"),t.textContent=w,l=a(),h(c.$$.fragment)},l(s){t=p(s,"P",{"data-svelte-h":!0}),v(t)!=="svelte-kvfsh7"&&(t.textContent=w),l=r(s),g(c.$$.fragment,s)},m(s,y){d(s,t,y),d(s,l,y),u(c,s,y),M=!0},p:z,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(n(t),n(l)),b(c,s)}}}function Vo(j){let t,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=m("p"),t.innerHTML=w},l(l){t=p(l,"P",{"data-svelte-h":!0}),v(t)!=="svelte-fincs2"&&(t.innerHTML=w)},m(l,c){d(l,t,c)},p:z,d(l){l&&n(t)}}}function Bo(j){let t,w="Examples:",l,c,M;return c=new A({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyME93bHYyTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyME93bHYyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm93bHYyLWJhc2UtcGF0Y2gxNi1lbnNlbWJsZSUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2Mi1iYXNlLXBhdGNoMTYtZW5zZW1ibGUlMjIpJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBaW1hZ2VfZmVhdHVyZXMlMjAlM0QlMjBtb2RlbC5nZXRfaW1hZ2VfZmVhdHVyZXMoKippbnB1dHMp",highlighted:`<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><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Owlv2Model

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Owlv2Model.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_features = model.get_image_features(**inputs)`,wrap:!1}}),{c(){t=m("p"),t.textContent=w,l=a(),h(c.$$.fragment)},l(s){t=p(s,"P",{"data-svelte-h":!0}),v(t)!=="svelte-kvfsh7"&&(t.textContent=w),l=r(s),g(c.$$.fragment,s)},m(s,y){d(s,t,y),d(s,l,y),u(c,s,y),M=!0},p:z,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(n(t),n(l)),b(c,s)}}}function No(j){let t,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=m("p"),t.innerHTML=w},l(l){t=p(l,"P",{"data-svelte-h":!0}),v(t)!=="svelte-fincs2"&&(t.innerHTML=w)},m(l,c){d(l,t,c)},p:z,d(l){l&&n(t)}}}function Ho(j){let t,w="Examples:",l,c,M;return c=new A({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBPd2x2MlRleHRNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwT3dsdjJUZXh0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm93bHYyLWJhc2UtcGF0Y2gxNiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2Mi1iYXNlLXBhdGNoMTYlMjIpJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKCUwQSUyMCUyMCUyMCUyMHRleHQlM0QlNUIlNUIlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjIlMkMlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBkb2clMjIlNUQlMkMlMjAlNUIlMjJwaG90byUyMG9mJTIwYSUyMGFzdHJhbmF1dCUyMiU1RCU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMEEpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxhc3RfaGlkZGVuX3N0YXRlJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQXBvb2xlZF9vdXRwdXQlMjAlM0QlMjBvdXRwdXRzLnBvb2xlcl9vdXRwdXQlMjAlMjAlMjMlMjBwb29sZWQlMjAoRU9TJTIwdG9rZW4pJTIwc3RhdGVz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Owlv2TextModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Owlv2TextModel.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(
<span class="hljs-meta">... </span>    text=[[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>], [<span class="hljs-string">&quot;photo of a astranaut&quot;</span>]], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_state = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output  <span class="hljs-comment"># pooled (EOS token) states</span>`,wrap:!1}}),{c(){t=m("p"),t.textContent=w,l=a(),h(c.$$.fragment)},l(s){t=p(s,"P",{"data-svelte-h":!0}),v(t)!=="svelte-kvfsh7"&&(t.textContent=w),l=r(s),g(c.$$.fragment,s)},m(s,y){d(s,t,y),d(s,l,y),u(c,s,y),M=!0},p:z,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(n(t),n(l)),b(c,s)}}}function Xo(j){let t,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=m("p"),t.innerHTML=w},l(l){t=p(l,"P",{"data-svelte-h":!0}),v(t)!=="svelte-fincs2"&&(t.innerHTML=w)},m(l,c){d(l,t,c)},p:z,d(l){l&&n(t)}}}function Fo(j){let t,w="Examples:",l,c,M;return c=new A({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyME93bHYyVmlzaW9uTW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyME93bHYyVmlzaW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm93bHYyLWJhc2UtcGF0Y2gxNiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2Mi1iYXNlLXBhdGNoMTYlMjIpJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxhc3RfaGlkZGVuX3N0YXRlJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQXBvb2xlZF9vdXRwdXQlMjAlM0QlMjBvdXRwdXRzLnBvb2xlcl9vdXRwdXQlMjAlMjAlMjMlMjBwb29sZWQlMjBDTFMlMjBzdGF0ZXM=",highlighted:`<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><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Owlv2VisionModel

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = 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>last_hidden_state = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output  <span class="hljs-comment"># pooled CLS states</span>`,wrap:!1}}),{c(){t=m("p"),t.textContent=w,l=a(),h(c.$$.fragment)},l(s){t=p(s,"P",{"data-svelte-h":!0}),v(t)!=="svelte-kvfsh7"&&(t.textContent=w),l=r(s),g(c.$$.fragment,s)},m(s,y){d(s,t,y),d(s,l,y),u(c,s,y),M=!0},p:z,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(n(t),n(l)),b(c,s)}}}function Go(j){let t,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=m("p"),t.innerHTML=w},l(l){t=p(l,"P",{"data-svelte-h":!0}),v(t)!=="svelte-fincs2"&&(t.innerHTML=w)},m(l,c){d(l,t,c)},p:z,d(l){l&&n(t)}}}function Ro(j){let t,w="Examples:",l,c,M;return c=new A({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwT3dsdjJGb3JPYmplY3REZXRlY3Rpb24lMEFmcm9tJTIwdHJhbnNmb3JtZXJzLnV0aWxzLmNvbnN0YW50cyUyMGltcG9ydCUyME9QRU5BSV9DTElQX01FQU4lMkMlMjBPUEVOQUlfQ0xJUF9TVEQlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2Mi1iYXNlLXBhdGNoMTYtZW5zZW1ibGUlMjIpJTBBbW9kZWwlMjAlM0QlMjBPd2x2MkZvck9iamVjdERldGVjdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdjItYmFzZS1wYXRjaDE2LWVuc2VtYmxlJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEF0ZXh0cyUyMCUzRCUyMCU1QiU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCU1RCUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3Nvcih0ZXh0JTNEdGV4dHMlMkMlMjBpbWFnZXMlM0RpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwZm9yd2FyZCUyMHBhc3MlMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQSUyMyUyME5vdGUlM0ElMjBib3hlcyUyMG5lZWQlMjB0byUyMGJlJTIwdmlzdWFsaXplZCUyMG9uJTIwdGhlJTIwcGFkZGVkJTJDJTIwdW5ub3JtYWxpemVkJTIwaW1hZ2UlMEElMjMlMjBoZW5jZSUyMHdlJ2xsJTIwc2V0JTIwdGhlJTIwdGFyZ2V0JTIwaW1hZ2UlMjBzaXplcyUyMChoZWlnaHQlMkMlMjB3aWR0aCklMjBiYXNlZCUyMG9uJTIwdGhhdCUwQSUwQWRlZiUyMGdldF9wcmVwcm9jZXNzZWRfaW1hZ2UocGl4ZWxfdmFsdWVzKSUzQSUwQSUyMCUyMCUyMCUyMHBpeGVsX3ZhbHVlcyUyMCUzRCUyMHBpeGVsX3ZhbHVlcy5zcXVlZXplKCkubnVtcHkoKSUwQSUyMCUyMCUyMCUyMHVubm9ybWFsaXplZF9pbWFnZSUyMCUzRCUyMChwaXhlbF92YWx1ZXMlMjAqJTIwbnAuYXJyYXkoT1BFTkFJX0NMSVBfU1REKSU1QiUzQSUyQyUyME5vbmUlMkMlMjBOb25lJTVEKSUyMCUyQiUyMG5wLmFycmF5KE9QRU5BSV9DTElQX01FQU4pJTVCJTNBJTJDJTIwTm9uZSUyQyUyME5vbmUlNUQlMEElMjAlMjAlMjAlMjB1bm5vcm1hbGl6ZWRfaW1hZ2UlMjAlM0QlMjAodW5ub3JtYWxpemVkX2ltYWdlJTIwKiUyMDI1NSkuYXN0eXBlKG5wLnVpbnQ4KSUwQSUyMCUyMCUyMCUyMHVubm9ybWFsaXplZF9pbWFnZSUyMCUzRCUyMG5wLm1vdmVheGlzKHVubm9ybWFsaXplZF9pbWFnZSUyQyUyMDAlMkMlMjAtMSklMEElMjAlMjAlMjAlMjB1bm5vcm1hbGl6ZWRfaW1hZ2UlMjAlM0QlMjBJbWFnZS5mcm9tYXJyYXkodW5ub3JtYWxpemVkX2ltYWdlKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMHVubm9ybWFsaXplZF9pbWFnZSUwQSUwQXVubm9ybWFsaXplZF9pbWFnZSUyMCUzRCUyMGdldF9wcmVwcm9jZXNzZWRfaW1hZ2UoaW5wdXRzLnBpeGVsX3ZhbHVlcyklMEElMEF0YXJnZXRfc2l6ZXMlMjAlM0QlMjB0b3JjaC5UZW5zb3IoJTVCdW5ub3JtYWxpemVkX2ltYWdlLnNpemUlNUIlM0ElM0EtMSU1RCU1RCklMEElMjMlMjBDb252ZXJ0JTIwb3V0cHV0cyUyMChib3VuZGluZyUyMGJveGVzJTIwYW5kJTIwY2xhc3MlMjBsb2dpdHMpJTIwdG8lMjBmaW5hbCUyMGJvdW5kaW5nJTIwYm94ZXMlMjBhbmQlMjBzY29yZXMlMEFyZXN1bHRzJTIwJTNEJTIwcHJvY2Vzc29yLnBvc3RfcHJvY2Vzc19vYmplY3RfZGV0ZWN0aW9uKCUwQSUyMCUyMCUyMCUyMG91dHB1dHMlM0RvdXRwdXRzJTJDJTIwdGhyZXNob2xkJTNEMC4yJTJDJTIwdGFyZ2V0X3NpemVzJTNEdGFyZ2V0X3NpemVzJTBBKSUwQSUwQWklMjAlM0QlMjAwJTIwJTIwJTIzJTIwUmV0cmlldmUlMjBwcmVkaWN0aW9ucyUyMGZvciUyMHRoZSUyMGZpcnN0JTIwaW1hZ2UlMjBmb3IlMjB0aGUlMjBjb3JyZXNwb25kaW5nJTIwdGV4dCUyMHF1ZXJpZXMlMEF0ZXh0JTIwJTNEJTIwdGV4dHMlNUJpJTVEJTBBYm94ZXMlMkMlMjBzY29yZXMlMkMlMjBsYWJlbHMlMjAlM0QlMjByZXN1bHRzJTVCaSU1RCU1QiUyMmJveGVzJTIyJTVEJTJDJTIwcmVzdWx0cyU1QmklNUQlNUIlMjJzY29yZXMlMjIlNUQlMkMlMjByZXN1bHRzJTVCaSU1RCU1QiUyMmxhYmVscyUyMiU1RCUwQSUwQWZvciUyMGJveCUyQyUyMHNjb3JlJTJDJTIwbGFiZWwlMjBpbiUyMHppcChib3hlcyUyQyUyMHNjb3JlcyUyQyUyMGxhYmVscyklM0ElMEElMjAlMjAlMjAlMjBib3glMjAlM0QlMjAlNUJyb3VuZChpJTJDJTIwMiklMjBmb3IlMjBpJTIwaW4lMjBib3gudG9saXN0KCklNUQlMEElMjAlMjAlMjAlMjBwcmludChmJTIyRGV0ZWN0ZWQlMjAlN0J0ZXh0JTVCbGFiZWwlNUQlN0QlMjB3aXRoJTIwY29uZmlkZW5jZSUyMCU3QnJvdW5kKHNjb3JlLml0ZW0oKSUyQyUyMDMpJTdEJTIwYXQlMjBsb2NhdGlvbiUyMCU3QmJveCU3RCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<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> transformers <span class="hljs-keyword">import</span> AutoProcessor, Owlv2ForObjectDetection
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.utils.constants <span class="hljs-keyword">import</span> OPENAI_CLIP_MEAN, OPENAI_CLIP_STD

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Owlv2ForObjectDetection.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
<span class="hljs-meta">&gt;&gt;&gt; </span>texts = [[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=texts, images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Note: boxes need to be visualized on the padded, unnormalized image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># hence we&#x27;ll set the target image sizes (height, width) based on that</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">get_preprocessed_image</span>(<span class="hljs-params">pixel_values</span>):
<span class="hljs-meta">... </span>    pixel_values = pixel_values.squeeze().numpy()
<span class="hljs-meta">... </span>    unnormalized_image = (pixel_values * np.array(OPENAI_CLIP_STD)[:, <span class="hljs-literal">None</span>, <span class="hljs-literal">None</span>]) + np.array(OPENAI_CLIP_MEAN)[:, <span class="hljs-literal">None</span>, <span class="hljs-literal">None</span>]
<span class="hljs-meta">... </span>    unnormalized_image = (unnormalized_image * <span class="hljs-number">255</span>).astype(np.uint8)
<span class="hljs-meta">... </span>    unnormalized_image = np.moveaxis(unnormalized_image, <span class="hljs-number">0</span>, -<span class="hljs-number">1</span>)
<span class="hljs-meta">... </span>    unnormalized_image = Image.fromarray(unnormalized_image)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> unnormalized_image

<span class="hljs-meta">&gt;&gt;&gt; </span>unnormalized_image = get_preprocessed_image(inputs.pixel_values)

<span class="hljs-meta">&gt;&gt;&gt; </span>target_sizes = torch.Tensor([unnormalized_image.size[::-<span class="hljs-number">1</span>]])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Convert outputs (bounding boxes and class logits) to final bounding boxes and scores</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>results = processor.post_process_object_detection(
<span class="hljs-meta">... </span>    outputs=outputs, threshold=<span class="hljs-number">0.2</span>, target_sizes=target_sizes
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>i = <span class="hljs-number">0</span>  <span class="hljs-comment"># Retrieve predictions for the first image for the corresponding text queries</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = texts[i]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes, scores, labels = results[i][<span class="hljs-string">&quot;boxes&quot;</span>], results[i][<span class="hljs-string">&quot;scores&quot;</span>], results[i][<span class="hljs-string">&quot;labels&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> box, score, label <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(boxes, scores, labels):
<span class="hljs-meta">... </span>    box = [<span class="hljs-built_in">round</span>(i, <span class="hljs-number">2</span>) <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> box.tolist()]
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Detected <span class="hljs-subst">{text[label]}</span> with confidence <span class="hljs-subst">{<span class="hljs-built_in">round</span>(score.item(), <span class="hljs-number">3</span>)}</span> at location <span class="hljs-subst">{box}</span>&quot;</span>)
Detected a photo of a cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.614</span> at location [<span class="hljs-number">512.5</span>, <span class="hljs-number">35.08</span>, <span class="hljs-number">963.48</span>, <span class="hljs-number">557.02</span>]
Detected a photo of a cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.665</span> at location [<span class="hljs-number">10.13</span>, <span class="hljs-number">77.94</span>, <span class="hljs-number">489.93</span>, <span class="hljs-number">709.69</span>]`,wrap:!1}}),{c(){t=m("p"),t.textContent=w,l=a(),h(c.$$.fragment)},l(s){t=p(s,"P",{"data-svelte-h":!0}),v(t)!=="svelte-kvfsh7"&&(t.textContent=w),l=r(s),g(c.$$.fragment,s)},m(s,y){d(s,t,y),d(s,l,y),u(c,s,y),M=!0},p:z,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(n(t),n(l)),b(c,s)}}}function Eo(j){let t,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=m("p"),t.innerHTML=w},l(l){t=p(l,"P",{"data-svelte-h":!0}),v(t)!=="svelte-fincs2"&&(t.innerHTML=w)},m(l,c){d(l,t,c)},p:z,d(l){l&&n(t)}}}function Po(j){let t,w="Examples:",l,c,M;return c=new A({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQWltcG9ydCUyMG51bXB5JTIwYXMlMjBucCUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwT3dsdjJGb3JPYmplY3REZXRlY3Rpb24lMEFmcm9tJTIwdHJhbnNmb3JtZXJzLnV0aWxzLmNvbnN0YW50cyUyMGltcG9ydCUyME9QRU5BSV9DTElQX01FQU4lMkMlMjBPUEVOQUlfQ0xJUF9TVEQlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2Mi1iYXNlLXBhdGNoMTYtZW5zZW1ibGUlMjIpJTBBbW9kZWwlMjAlM0QlMjBPd2x2MkZvck9iamVjdERldGVjdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdjItYmFzZS1wYXRjaDE2LWVuc2VtYmxlJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFxdWVyeV91cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMDE2NzUuanBnJTIyJTBBcXVlcnlfaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldChxdWVyeV91cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcXVlcnlfaW1hZ2VzJTNEcXVlcnlfaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMyUyMGZvcndhcmQlMjBwYXNzJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbC5pbWFnZV9ndWlkZWRfZGV0ZWN0aW9uKCoqaW5wdXRzKSUwQSUwQSUyMyUyME5vdGUlM0ElMjBib3hlcyUyMG5lZWQlMjB0byUyMGJlJTIwdmlzdWFsaXplZCUyMG9uJTIwdGhlJTIwcGFkZGVkJTJDJTIwdW5ub3JtYWxpemVkJTIwaW1hZ2UlMEElMjMlMjBoZW5jZSUyMHdlJ2xsJTIwc2V0JTIwdGhlJTIwdGFyZ2V0JTIwaW1hZ2UlMjBzaXplcyUyMChoZWlnaHQlMkMlMjB3aWR0aCklMjBiYXNlZCUyMG9uJTIwdGhhdCUwQSUwQWRlZiUyMGdldF9wcmVwcm9jZXNzZWRfaW1hZ2UocGl4ZWxfdmFsdWVzKSUzQSUwQSUyMCUyMCUyMCUyMHBpeGVsX3ZhbHVlcyUyMCUzRCUyMHBpeGVsX3ZhbHVlcy5zcXVlZXplKCkubnVtcHkoKSUwQSUyMCUyMCUyMCUyMHVubm9ybWFsaXplZF9pbWFnZSUyMCUzRCUyMChwaXhlbF92YWx1ZXMlMjAqJTIwbnAuYXJyYXkoT1BFTkFJX0NMSVBfU1REKSU1QiUzQSUyQyUyME5vbmUlMkMlMjBOb25lJTVEKSUyMCUyQiUyMG5wLmFycmF5KE9QRU5BSV9DTElQX01FQU4pJTVCJTNBJTJDJTIwTm9uZSUyQyUyME5vbmUlNUQlMEElMjAlMjAlMjAlMjB1bm5vcm1hbGl6ZWRfaW1hZ2UlMjAlM0QlMjAodW5ub3JtYWxpemVkX2ltYWdlJTIwKiUyMDI1NSkuYXN0eXBlKG5wLnVpbnQ4KSUwQSUyMCUyMCUyMCUyMHVubm9ybWFsaXplZF9pbWFnZSUyMCUzRCUyMG5wLm1vdmVheGlzKHVubm9ybWFsaXplZF9pbWFnZSUyQyUyMDAlMkMlMjAtMSklMEElMjAlMjAlMjAlMjB1bm5vcm1hbGl6ZWRfaW1hZ2UlMjAlM0QlMjBJbWFnZS5mcm9tYXJyYXkodW5ub3JtYWxpemVkX2ltYWdlKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMHVubm9ybWFsaXplZF9pbWFnZSUwQSUwQXVubm9ybWFsaXplZF9pbWFnZSUyMCUzRCUyMGdldF9wcmVwcm9jZXNzZWRfaW1hZ2UoaW5wdXRzLnBpeGVsX3ZhbHVlcyklMEElMEF0YXJnZXRfc2l6ZXMlMjAlM0QlMjB0b3JjaC5UZW5zb3IoJTVCdW5ub3JtYWxpemVkX2ltYWdlLnNpemUlNUIlM0ElM0EtMSU1RCU1RCklMEElMEElMjMlMjBDb252ZXJ0JTIwb3V0cHV0cyUyMChib3VuZGluZyUyMGJveGVzJTIwYW5kJTIwY2xhc3MlMjBsb2dpdHMpJTIwdG8lMjBQYXNjYWwlMjBWT0MlMjBmb3JtYXQlMjAoeG1pbiUyQyUyMHltaW4lMkMlMjB4bWF4JTJDJTIweW1heCklMEFyZXN1bHRzJTIwJTNEJTIwcHJvY2Vzc29yLnBvc3RfcHJvY2Vzc19pbWFnZV9ndWlkZWRfZGV0ZWN0aW9uKCUwQSUyMCUyMCUyMCUyMG91dHB1dHMlM0RvdXRwdXRzJTJDJTIwdGhyZXNob2xkJTNEMC45JTJDJTIwbm1zX3RocmVzaG9sZCUzRDAuMyUyQyUyMHRhcmdldF9zaXplcyUzRHRhcmdldF9zaXplcyUwQSklMEFpJTIwJTNEJTIwMCUyMCUyMCUyMyUyMFJldHJpZXZlJTIwcHJlZGljdGlvbnMlMjBmb3IlMjB0aGUlMjBmaXJzdCUyMGltYWdlJTBBYm94ZXMlMkMlMjBzY29yZXMlMjAlM0QlMjByZXN1bHRzJTVCaSU1RCU1QiUyMmJveGVzJTIyJTVEJTJDJTIwcmVzdWx0cyU1QmklNUQlNUIlMjJzY29yZXMlMjIlNUQlMEFmb3IlMjBib3glMkMlMjBzY29yZSUyMGluJTIwemlwKGJveGVzJTJDJTIwc2NvcmVzKSUzQSUwQSUyMCUyMCUyMCUyMGJveCUyMCUzRCUyMCU1QnJvdW5kKGklMkMlMjAyKSUyMGZvciUyMGklMjBpbiUyMGJveC50b2xpc3QoKSU1RCUwQSUyMCUyMCUyMCUyMHByaW50KGYlMjJEZXRlY3RlZCUyMHNpbWlsYXIlMjBvYmplY3QlMjB3aXRoJTIwY29uZmlkZW5jZSUyMCU3QnJvdW5kKHNjb3JlLml0ZW0oKSUyQyUyMDMpJTdEJTIwYXQlMjBsb2NhdGlvbiUyMCU3QmJveCU3RCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, Owlv2ForObjectDetection
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.utils.constants <span class="hljs-keyword">import</span> OPENAI_CLIP_MEAN, OPENAI_CLIP_STD

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Owlv2ForObjectDetection.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</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.image_guided_detection(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Note: boxes need to be visualized on the padded, unnormalized image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># hence we&#x27;ll set the target image sizes (height, width) based on that</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">get_preprocessed_image</span>(<span class="hljs-params">pixel_values</span>):
<span class="hljs-meta">... </span>    pixel_values = pixel_values.squeeze().numpy()
<span class="hljs-meta">... </span>    unnormalized_image = (pixel_values * np.array(OPENAI_CLIP_STD)[:, <span class="hljs-literal">None</span>, <span class="hljs-literal">None</span>]) + np.array(OPENAI_CLIP_MEAN)[:, <span class="hljs-literal">None</span>, <span class="hljs-literal">None</span>]
<span class="hljs-meta">... </span>    unnormalized_image = (unnormalized_image * <span class="hljs-number">255</span>).astype(np.uint8)
<span class="hljs-meta">... </span>    unnormalized_image = np.moveaxis(unnormalized_image, <span class="hljs-number">0</span>, -<span class="hljs-number">1</span>)
<span class="hljs-meta">... </span>    unnormalized_image = Image.fromarray(unnormalized_image)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> unnormalized_image

<span class="hljs-meta">&gt;&gt;&gt; </span>unnormalized_image = get_preprocessed_image(inputs.pixel_values)

<span class="hljs-meta">&gt;&gt;&gt; </span>target_sizes = torch.Tensor([unnormalized_image.size[::-<span class="hljs-number">1</span>]])

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Convert outputs (bounding boxes and class logits) to Pascal VOC format (xmin, ymin, xmax, ymax)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>results = processor.post_process_image_guided_detection(
<span class="hljs-meta">... </span>    outputs=outputs, threshold=<span class="hljs-number">0.9</span>, nms_threshold=<span class="hljs-number">0.3</span>, target_sizes=target_sizes
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>i = <span class="hljs-number">0</span>  <span class="hljs-comment"># Retrieve predictions for the first image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes, scores = results[i][<span class="hljs-string">&quot;boxes&quot;</span>], results[i][<span class="hljs-string">&quot;scores&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> box, score <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(boxes, scores):
<span class="hljs-meta">... </span>    box = [<span class="hljs-built_in">round</span>(i, <span class="hljs-number">2</span>) <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> box.tolist()]
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Detected similar object with confidence <span class="hljs-subst">{<span class="hljs-built_in">round</span>(score.item(), <span class="hljs-number">3</span>)}</span> at location <span class="hljs-subst">{box}</span>&quot;</span>)
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.938</span> at location [<span class="hljs-number">490.96</span>, <span class="hljs-number">109.89</span>, <span class="hljs-number">821.09</span>, <span class="hljs-number">536.11</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.959</span> at location [<span class="hljs-number">8.67</span>, <span class="hljs-number">721.29</span>, <span class="hljs-number">928.68</span>, <span class="hljs-number">732.78</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.902</span> at location [<span class="hljs-number">4.27</span>, <span class="hljs-number">720.02</span>, <span class="hljs-number">941.45</span>, <span class="hljs-number">761.59</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.985</span> at location [<span class="hljs-number">265.46</span>, -<span class="hljs-number">58.9</span>, <span class="hljs-number">1009.04</span>, <span class="hljs-number">365.66</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">1.0</span> at location [<span class="hljs-number">9.79</span>, <span class="hljs-number">28.69</span>, <span class="hljs-number">937.31</span>, <span class="hljs-number">941.64</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.998</span> at location [<span class="hljs-number">869.97</span>, <span class="hljs-number">58.28</span>, <span class="hljs-number">923.23</span>, <span class="hljs-number">978.1</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.985</span> at location [<span class="hljs-number">309.23</span>, <span class="hljs-number">21.07</span>, <span class="hljs-number">371.61</span>, <span class="hljs-number">932.02</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.947</span> at location [<span class="hljs-number">27.93</span>, <span class="hljs-number">859.45</span>, <span class="hljs-number">969.75</span>, <span class="hljs-number">915.44</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.996</span> at location [<span class="hljs-number">785.82</span>, <span class="hljs-number">41.38</span>, <span class="hljs-number">880.26</span>, <span class="hljs-number">966.37</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.998</span> at location [<span class="hljs-number">5.08</span>, <span class="hljs-number">721.17</span>, <span class="hljs-number">925.93</span>, <span class="hljs-number">998.41</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.969</span> at location [<span class="hljs-number">6.7</span>, <span class="hljs-number">898.1</span>, <span class="hljs-number">921.75</span>, <span class="hljs-number">949.51</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.966</span> at location [<span class="hljs-number">47.16</span>, <span class="hljs-number">927.29</span>, <span class="hljs-number">981.99</span>, <span class="hljs-number">942.14</span>]
Detected similar <span class="hljs-built_in">object</span> <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.924</span> at location [<span class="hljs-number">46.4</span>, <span class="hljs-number">936.13</span>, <span class="hljs-number">953.02</span>, <span class="hljs-number">950.78</span>]`,wrap:!1}}),{c(){t=m("p"),t.textContent=w,l=a(),h(c.$$.fragment)},l(s){t=p(s,"P",{"data-svelte-h":!0}),v(t)!=="svelte-kvfsh7"&&(t.textContent=w),l=r(s),g(c.$$.fragment,s)},m(s,y){d(s,t,y),d(s,l,y),u(c,s,y),M=!0},p:z,i(s){M||(f(c.$$.fragment,s),M=!0)},o(s){_(c.$$.fragment,s),M=!1},d(s){s&&(n(t),n(l)),b(c,s)}}}function Qo(j){let t,w,l,c,M,s,y,os,We,Gn='OWLv2 was proposed in <a href="https://arxiv.org/abs/2306.09683" rel="nofollow">Scaling Open-Vocabulary Object Detection</a> by Matthias Minderer, Alexey Gritsenko, Neil Houlsby. OWLv2 scales up <a href="owlvit">OWL-ViT</a> using self-training, which uses an existing detector to generate pseudo-box annotations on image-text pairs. This results in large gains over the previous state-of-the-art for zero-shot object detection.',as,ke,Rn="The abstract from the paper is the following:",rs,Ze,En="<em>Open-vocabulary object detection has benefited greatly from pretrained vision-language models, but is still limited by the amount of available detection training data. While detection training data can be expanded by using Web image-text pairs as weak supervision, this has not been done at scales comparable to image-level pretraining. Here, we scale up detection data with self-training, which uses an existing detector to generate pseudo-box annotations on image-text pairs. Major challenges in scaling self-training are the choice of label space, pseudo-annotation filtering, and training efficiency. We present the OWLv2 model and OWL-ST self-training recipe, which address these challenges. OWLv2 surpasses the performance of previous state-of-the-art open-vocabulary detectors already at comparable training scales (~10M examples). However, with OWL-ST, we can scale to over 1B examples, yielding further large improvement: With an L/14 architecture, OWL-ST improves AP on LVIS rare classes, for which the model has seen no human box annotations, from 31.2% to 44.6% (43% relative improvement). OWL-ST unlocks Web-scale training for open-world localization, similar to what has been seen for image classification and language modelling.</em>",ls,se,Pn,is,Ve,Qn='OWLv2 high-level overview. Taken from the <a href="https://arxiv.org/abs/2306.09683">original paper</a>.',cs,Be,Yn=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>.
The original code can be found <a href="https://github.com/google-research/scenic/tree/main/scenic/projects/owl_vit" rel="nofollow">here</a>.`,ds,Ne,ms,He,Ln='OWLv2 is, just like its predecessor <a href="owlvit">OWL-ViT</a>, a zero-shot text-conditioned object detection model. OWL-ViT uses <a href="clip">CLIP</a> as its multi-modal backbone, with a ViT-like Transformer to get visual features and a causal language model to get the text features. To use CLIP for detection, OWL-ViT removes the final token pooling layer of the vision model and attaches a lightweight classification and box head to each transformer output token. Open-vocabulary classification is enabled by replacing the fixed classification layer weights with the class-name embeddings obtained from the text model. The authors first train CLIP from scratch and fine-tune it end-to-end with the classification and box heads on standard detection datasets using a bipartite matching loss. One or multiple text queries per image can be used to perform zero-shot text-conditioned object detection.',ps,Xe,qn='<a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ImageProcessor">Owlv2ImageProcessor</a> can be used to resize (or rescale) and normalize images for the model and <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer">CLIPTokenizer</a> is used to encode the text. <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2Processor">Owlv2Processor</a> wraps <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ImageProcessor">Owlv2ImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer">CLIPTokenizer</a> into a single instance to both encode the text and prepare the images. The following example shows how to perform object detection using <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2Processor">Owlv2Processor</a> and <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ForObjectDetection">Owlv2ForObjectDetection</a>.',hs,Fe,gs,Ge,us,Re,Sn='<li>A demo notebook on using OWLv2 for zero- and one-shot (image-guided) object detection can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/tree/master/OWLv2" rel="nofollow">here</a>.</li> <li><a href="../tasks/zero_shot_object_detection">Zero-shot object detection task guide</a></li>',fs,ne,_s,Ee,bs,W,Pe,Hs,It,Dn=`<a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2Config">Owlv2Config</a> is the configuration class to store the configuration of an <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2Model">Owlv2Model</a>. It is used to
instantiate an OWLv2 model according to the specified arguments, defining the text model and vision model
configs. Instantiating a configuration with the defaults will yield a similar configuration to that of the OWLv2
<a href="https://huggingface.co/google/owlv2-base-patch16" rel="nofollow">google/owlv2-base-patch16</a> architecture.`,Xs,Ot,An=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Fs,oe,Qe,Gs,Wt,Kn=`Instantiate a <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2Config">Owlv2Config</a> (or a derived class) from owlv2 text model configuration and owlv2 vision
model configuration.`,ws,Ye,Ms,k,Le,Rs,kt,eo=`This is the configuration class to store the configuration of an <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2TextModel">Owlv2TextModel</a>. It is used to instantiate an
Owlv2 text encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the Owlv2
<a href="https://huggingface.co/google/owlv2-base-patch16" rel="nofollow">google/owlv2-base-patch16</a> architecture.`,Es,Zt,to=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ps,ae,vs,qe,ys,Z,Se,Qs,Vt,so=`This is the configuration class to store the configuration of an <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionModel">Owlv2VisionModel</a>. It is used to instantiate
an OWLv2 image encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the OWLv2
<a href="https://huggingface.co/google/owlv2-base-patch16" rel="nofollow">google/owlv2-base-patch16</a> architecture.`,Ys,Bt,no=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ls,re,js,De,Ts,C,Ae,qs,Nt,oo="Constructs an OWLv2 image processor.",Ss,le,Ke,Ds,Ht,ao="Preprocess an image or batch of images.",As,ie,et,Ks,Xt,ro=`Converts the raw output of <a href="/docs/transformers/main/en/model_doc/owlvit#transformers.OwlViTForObjectDetection">OwlViTForObjectDetection</a> into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format.`,en,ce,tt,tn,Ft,lo=`Converts the output of <a href="/docs/transformers/main/en/model_doc/owlvit#transformers.OwlViTForObjectDetection.image_guided_detection">OwlViTForObjectDetection.image_guided_detection()</a> into the format expected by the COCO
api.`,Js,st,Us,x,nt,sn,Gt,io=`Constructs an Owlv2 processor which wraps <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ImageProcessor">Owlv2ImageProcessor</a> and <a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer">CLIPTokenizer</a>/<a href="/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizerFast">CLIPTokenizerFast</a> into
a single processor that interits both the image processor and tokenizer functionalities. See the
<code>__call__()</code> and <a href="/docs/transformers/main/en/model_doc/owlvit#transformers.OwlViTProcessor.decode">decode()</a> for more information.`,nn,de,ot,on,Rt,co=`This method forwards all its arguments to CLIPTokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode">batch_decode()</a>. Please
refer to the docstring of this method for more information.`,an,me,at,rn,Et,mo=`This method forwards all its arguments to CLIPTokenizerFast’s <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode">decode()</a>. Please refer to
the docstring of this method for more information.`,ln,pe,rt,cn,Pt,po=`This method forwards all its arguments to <code>OwlViTImageProcessor.post_process_one_shot_object_detection</code>.
Please refer to the docstring of this method for more information.`,dn,he,lt,mn,Qt,ho=`This method forwards all its arguments to <a href="/docs/transformers/main/en/model_doc/owlvit#transformers.OwlViTImageProcessor.post_process_object_detection">OwlViTImageProcessor.post_process_object_detection()</a>. Please refer
to the docstring of this method for more information.`,xs,it,$s,$,ct,pn,Yt,go=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,hn,Lt,uo=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,gn,N,dt,un,qt,fo='The <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2Model">Owlv2Model</a> forward method, overrides the <code>__call__</code> special method.',fn,ge,_n,ue,bn,H,mt,wn,St,_o='The <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2Model">Owlv2Model</a> forward method, overrides the <code>__call__</code> special method.',Mn,fe,vn,_e,yn,X,pt,jn,Dt,bo='The <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2Model">Owlv2Model</a> forward method, overrides the <code>__call__</code> special method.',Tn,be,Jn,we,zs,ht,Cs,K,gt,Un,F,ut,xn,At,wo='The <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2TextModel">Owlv2TextModel</a> forward method, overrides the <code>__call__</code> special method.',$n,Me,zn,ve,Is,ft,Os,ee,_t,Cn,G,bt,In,Kt,Mo='The <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionModel">Owlv2VisionModel</a> forward method, overrides the <code>__call__</code> special method.',On,ye,Wn,je,Ws,wt,ks,P,Mt,kn,R,vt,Zn,es,vo='The <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ForObjectDetection">Owlv2ForObjectDetection</a> forward method, overrides the <code>__call__</code> special method.',Vn,Te,Bn,Je,Nn,E,yt,Hn,ts,yo='The <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ForObjectDetection">Owlv2ForObjectDetection</a> forward method, overrides the <code>__call__</code> special method.',Xn,Ue,Fn,xe,Zs,ns,Vs;return M=new B({props:{title:"OWLv2",local:"owlv2",headingTag:"h1"}}),y=new B({props:{title:"Overview",local:"overview",headingTag:"h2"}}),Ne=new B({props:{title:"Usage example",local:"usage-example",headingTag:"h2"}}),Fe=new A({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBPd2x2MlByb2Nlc3NvciUyQyUyME93bHYyRm9yT2JqZWN0RGV0ZWN0aW9uJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwT3dsdjJQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm93bHYyLWJhc2UtcGF0Y2gxNi1lbnNlbWJsZSUyMiklMEFtb2RlbCUyMCUzRCUyME93bHYyRm9yT2JqZWN0RGV0ZWN0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2Mi1iYXNlLXBhdGNoMTYtZW5zZW1ibGUlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQXRleHRzJTIwJTNEJTIwJTVCJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTVEJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKHRleHQlM0R0ZXh0cyUyQyUyMGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBJTIzJTIwVGFyZ2V0JTIwaW1hZ2UlMjBzaXplcyUyMChoZWlnaHQlMkMlMjB3aWR0aCklMjB0byUyMHJlc2NhbGUlMjBib3glMjBwcmVkaWN0aW9ucyUyMCU1QmJhdGNoX3NpemUlMkMlMjAyJTVEJTBBdGFyZ2V0X3NpemVzJTIwJTNEJTIwdG9yY2guVGVuc29yKCU1QmltYWdlLnNpemUlNUIlM0ElM0EtMSU1RCU1RCklMEElMjMlMjBDb252ZXJ0JTIwb3V0cHV0cyUyMChib3VuZGluZyUyMGJveGVzJTIwYW5kJTIwY2xhc3MlMjBsb2dpdHMpJTIwdG8lMjBQYXNjYWwlMjBWT0MlMjBGb3JtYXQlMjAoeG1pbiUyQyUyMHltaW4lMkMlMjB4bWF4JTJDJTIweW1heCklMEFyZXN1bHRzJTIwJTNEJTIwcHJvY2Vzc29yLnBvc3RfcHJvY2Vzc19vYmplY3RfZGV0ZWN0aW9uKG91dHB1dHMlM0RvdXRwdXRzJTJDJTIwdGFyZ2V0X3NpemVzJTNEdGFyZ2V0X3NpemVzJTJDJTIwdGhyZXNob2xkJTNEMC4xKSUwQWklMjAlM0QlMjAwJTIwJTIwJTIzJTIwUmV0cmlldmUlMjBwcmVkaWN0aW9ucyUyMGZvciUyMHRoZSUyMGZpcnN0JTIwaW1hZ2UlMjBmb3IlMjB0aGUlMjBjb3JyZXNwb25kaW5nJTIwdGV4dCUyMHF1ZXJpZXMlMEF0ZXh0JTIwJTNEJTIwdGV4dHMlNUJpJTVEJTBBYm94ZXMlMkMlMjBzY29yZXMlMkMlMjBsYWJlbHMlMjAlM0QlMjByZXN1bHRzJTVCaSU1RCU1QiUyMmJveGVzJTIyJTVEJTJDJTIwcmVzdWx0cyU1QmklNUQlNUIlMjJzY29yZXMlMjIlNUQlMkMlMjByZXN1bHRzJTVCaSU1RCU1QiUyMmxhYmVscyUyMiU1RCUwQWZvciUyMGJveCUyQyUyMHNjb3JlJTJDJTIwbGFiZWwlMjBpbiUyMHppcChib3hlcyUyQyUyMHNjb3JlcyUyQyUyMGxhYmVscyklM0ElMEElMjAlMjAlMjAlMjBib3glMjAlM0QlMjAlNUJyb3VuZChpJTJDJTIwMiklMjBmb3IlMjBpJTIwaW4lMjBib3gudG9saXN0KCklNUQlMEElMjAlMjAlMjAlMjBwcmludChmJTIyRGV0ZWN0ZWQlMjAlN0J0ZXh0JTVCbGFiZWwlNUQlN0QlMjB3aXRoJTIwY29uZmlkZW5jZSUyMCU3QnJvdW5kKHNjb3JlLml0ZW0oKSUyQyUyMDMpJTdEJTIwYXQlMjBsb2NhdGlvbiUyMCU3QmJveCU3RCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

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

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Owlv2Processor.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Owlv2ForObjectDetection.from_pretrained(<span class="hljs-string">&quot;google/owlv2-base-patch16-ensemble&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
<span class="hljs-meta">&gt;&gt;&gt; </span>texts = [[<span class="hljs-string">&quot;a photo of a cat&quot;</span>, <span class="hljs-string">&quot;a photo of a dog&quot;</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(text=texts, 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"># Target image sizes (height, width) to rescale box predictions [batch_size, 2]</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><span class="hljs-comment"># Convert outputs (bounding boxes and class logits) to Pascal VOC Format (xmin, ymin, xmax, ymax)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>results = processor.post_process_object_detection(outputs=outputs, target_sizes=target_sizes, threshold=<span class="hljs-number">0.1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>i = <span class="hljs-number">0</span>  <span class="hljs-comment"># Retrieve predictions for the first image for the corresponding text queries</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = texts[i]
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes, scores, labels = results[i][<span class="hljs-string">&quot;boxes&quot;</span>], results[i][<span class="hljs-string">&quot;scores&quot;</span>], results[i][<span class="hljs-string">&quot;labels&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> box, score, label <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(boxes, scores, labels):
<span class="hljs-meta">... </span>    box = [<span class="hljs-built_in">round</span>(i, <span class="hljs-number">2</span>) <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> box.tolist()]
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Detected <span class="hljs-subst">{text[label]}</span> with confidence <span class="hljs-subst">{<span class="hljs-built_in">round</span>(score.item(), <span class="hljs-number">3</span>)}</span> at location <span class="hljs-subst">{box}</span>&quot;</span>)
Detected a photo of a cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.614</span> at location [<span class="hljs-number">341.67</span>, <span class="hljs-number">17.54</span>, <span class="hljs-number">642.32</span>, <span class="hljs-number">278.51</span>]
Detected a photo of a cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.665</span> at location [<span class="hljs-number">6.75</span>, <span class="hljs-number">38.97</span>, <span class="hljs-number">326.62</span>, <span class="hljs-number">354.85</span>]`,wrap:!1}}),Ge=new B({props:{title:"Resources",local:"resources",headingTag:"h2"}}),ne=new Oe({props:{$$slots:{default:[zo]},$$scope:{ctx:j}}}),Ee=new B({props:{title:"Owlv2Config",local:"transformers.Owlv2Config",headingTag:"h2"}}),Pe=new U({props:{name:"class transformers.Owlv2Config",anchor:"transformers.Owlv2Config",parameters:[{name:"text_config",val:" = None"},{name:"vision_config",val:" = None"},{name:"projection_dim",val:" = 512"},{name:"logit_scale_init_value",val:" = 2.6592"},{name:"return_dict",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Owlv2Config.text_config",description:`<strong>text_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2TextConfig">Owlv2TextConfig</a>.`,name:"text_config"},{anchor:"transformers.Owlv2Config.vision_config",description:`<strong>vision_config</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Dictionary of configuration options used to initialize <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionConfig">Owlv2VisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.Owlv2Config.projection_dim",description:`<strong>projection_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of text and vision projection layers.`,name:"projection_dim"},{anchor:"transformers.Owlv2Config.logit_scale_init_value",description:`<strong>logit_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 2.6592) &#x2014;
The inital value of the <em>logit_scale</em> parameter. Default is used as per the original OWLv2
implementation.`,name:"logit_scale_init_value"},{anchor:"transformers.Owlv2Config.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return a dictionary. If <code>False</code>, returns a tuple.`,name:"return_dict"},{anchor:"transformers.Owlv2Config.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/configuration_owlv2.py#L256"}}),Qe=new U({props:{name:"from_text_vision_configs",anchor:"transformers.Owlv2Config.from_text_vision_configs",parameters:[{name:"text_config",val:": Dict"},{name:"vision_config",val:": Dict"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/configuration_owlv2.py#L325",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>An instance of a configuration object</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2Config"
>Owlv2Config</a></p>
`}}),Ye=new B({props:{title:"Owlv2TextConfig",local:"transformers.Owlv2TextConfig",headingTag:"h2"}}),Le=new U({props:{name:"class transformers.Owlv2TextConfig",anchor:"transformers.Owlv2TextConfig",parameters:[{name:"vocab_size",val:" = 49408"},{name:"hidden_size",val:" = 512"},{name:"intermediate_size",val:" = 2048"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 8"},{name:"max_position_embeddings",val:" = 16"},{name:"hidden_act",val:" = 'quick_gelu'"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"initializer_factor",val:" = 1.0"},{name:"pad_token_id",val:" = 0"},{name:"bos_token_id",val:" = 49406"},{name:"eos_token_id",val:" = 49407"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Owlv2TextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 49408) &#x2014;
Vocabulary size of the OWLv2 text model. Defines the number of different tokens that can be represented
by the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2TextModel">Owlv2TextModel</a>.`,name:"vocab_size"},{anchor:"transformers.Owlv2TextConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.Owlv2TextConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.Owlv2TextConfig.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.Owlv2TextConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.Owlv2TextConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.Owlv2TextConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;quick_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> \`<code>&quot;quick_gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.Owlv2TextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Owlv2TextConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Owlv2TextConfig.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.Owlv2TextConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"},{anchor:"transformers.Owlv2TextConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the padding token in the input sequences.`,name:"pad_token_id"},{anchor:"transformers.Owlv2TextConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 49406) &#x2014;
The id of the beginning-of-sequence token in the input sequences.`,name:"bos_token_id"},{anchor:"transformers.Owlv2TextConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 49407) &#x2014;
The id of the end-of-sequence token in the input sequences.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/configuration_owlv2.py#L36"}}),ae=new te({props:{anchor:"transformers.Owlv2TextConfig.example",$$slots:{default:[Co]},$$scope:{ctx:j}}}),qe=new B({props:{title:"Owlv2VisionConfig",local:"transformers.Owlv2VisionConfig",headingTag:"h2"}}),Se=new U({props:{name:"class transformers.Owlv2VisionConfig",anchor:"transformers.Owlv2VisionConfig",parameters:[{name:"hidden_size",val:" = 768"},{name:"intermediate_size",val:" = 3072"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"num_channels",val:" = 3"},{name:"image_size",val:" = 768"},{name:"patch_size",val:" = 16"},{name:"hidden_act",val:" = 'quick_gelu'"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"attention_dropout",val:" = 0.0"},{name:"initializer_range",val:" = 0.02"},{name:"initializer_factor",val:" = 1.0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Owlv2VisionConfig.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.Owlv2VisionConfig.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.Owlv2VisionConfig.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.Owlv2VisionConfig.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.Owlv2VisionConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
Number of channels in the input images.`,name:"num_channels"},{anchor:"transformers.Owlv2VisionConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.Owlv2VisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.Owlv2VisionConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;quick_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> \`<code>&quot;quick_gelu&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.Owlv2VisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Owlv2VisionConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.Owlv2VisionConfig.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.Owlv2VisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
testing).`,name:"initializer_factor"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/configuration_owlv2.py#L150"}}),re=new te({props:{anchor:"transformers.Owlv2VisionConfig.example",$$slots:{default:[Io]},$$scope:{ctx:j}}}),De=new B({props:{title:"Owlv2ImageProcessor",local:"transformers.Owlv2ImageProcessor",headingTag:"h2"}}),Ae=new U({props:{name:"class transformers.Owlv2ImageProcessor",anchor:"transformers.Owlv2ImageProcessor",parameters:[{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": Union = 0.00392156862745098"},{name:"do_pad",val:": bool = True"},{name:"do_resize",val:": bool = True"},{name:"size",val:": Dict = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Owlv2ImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overriden by <code>do_rescale</code> in
the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.Owlv2ImageProcessor.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 overriden by <code>rescale_factor</code> in the <code>preprocess</code>
method.`,name:"rescale_factor"},{anchor:"transformers.Owlv2ImageProcessor.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to pad the image to a square with gray pixels on the bottom and the right. Can be overriden by
<code>do_pad</code> in the <code>preprocess</code> method.`,name:"do_pad"},{anchor:"transformers.Owlv2ImageProcessor.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 overriden
by <code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.Owlv2ImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 960, &quot;width&quot;: 960}</code>):
Size to resize the image to. Can be overriden by <code>size</code> in the <code>preprocess</code> method.`,name:"size"},{anchor:"transformers.Owlv2ImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>Resampling.BILINEAR</code>) &#x2014;
Resampling method to use if resizing the image. Can be overriden by <code>resample</code> in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.Owlv2ImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"do_normalize"},{anchor:"transformers.Owlv2ImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>OPENAI_CLIP_MEAN</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.Owlv2ImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>OPENAI_CLIP_STD</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/image_processing_owlv2.py#L176"}}),Ke=new U({props:{name:"preprocess",anchor:"transformers.Owlv2ImageProcessor.preprocess",parameters:[{name:"images",val:": Union"},{name:"do_pad",val:": bool = None"},{name:"do_resize",val:": bool = None"},{name:"size",val:": Dict = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": bool = None"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = None"},{name:"return_tensors",val:": Union = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Owlv2ImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_pad</code>) &#x2014;
Whether to pad the image to a square with gray pixels on the bottom and the right.`,name:"do_pad"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size to resize the image to.`,name:"size"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image values between [0 - 1].`,name:"do_rescale"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean.`,name:"image_mean"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation.`,name:"image_std"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.Owlv2ImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/image_processing_owlv2.py#L333"}}),et=new U({props:{name:"post_process_object_detection",anchor:"transformers.Owlv2ImageProcessor.post_process_object_detection",parameters:[{name:"outputs",val:""},{name:"threshold",val:": float = 0.1"},{name:"target_sizes",val:": Union = None"}],parametersDescription:[{anchor:"transformers.Owlv2ImageProcessor.post_process_object_detection.outputs",description:`<strong>outputs</strong> (<code>OwlViTObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.Owlv2ImageProcessor.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.Owlv2ImageProcessor.post_process_object_detection.target_sizes",description:`<strong>target_sizes</strong> (<code>torch.Tensor</code> or <code>List[Tuple[int, int]]</code>, <em>optional</em>) &#x2014;
Tensor of shape <code>(batch_size, 2)</code> or list of tuples (<code>Tuple[int, int]</code>) containing the target size
<code>(height, width)</code> of each image in the batch. If unset, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/image_processing_owlv2.py#L464",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
in the batch as predicted by the model.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[Dict]</code></p>
`}}),tt=new U({props:{name:"post_process_image_guided_detection",anchor:"transformers.Owlv2ImageProcessor.post_process_image_guided_detection",parameters:[{name:"outputs",val:""},{name:"threshold",val:" = 0.0"},{name:"nms_threshold",val:" = 0.3"},{name:"target_sizes",val:" = None"}],parametersDescription:[{anchor:"transformers.Owlv2ImageProcessor.post_process_image_guided_detection.outputs",description:`<strong>outputs</strong> (<code>OwlViTImageGuidedObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.Owlv2ImageProcessor.post_process_image_guided_detection.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Minimum confidence threshold to use to filter out predicted boxes.`,name:"threshold"},{anchor:"transformers.Owlv2ImageProcessor.post_process_image_guided_detection.nms_threshold",description:`<strong>nms_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.3) &#x2014;
IoU threshold for non-maximum suppression of overlapping boxes.`,name:"nms_threshold"},{anchor:"transformers.Owlv2ImageProcessor.post_process_image_guided_detection.target_sizes",description:`<strong>target_sizes</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Tensor of shape (batch_size, 2) where each entry is the (height, width) of the corresponding image in
the batch. If set, predicted normalized bounding boxes are rescaled to the target sizes. If left to
None, predictions will not be unnormalized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/image_processing_owlv2.py#L520",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
in the batch as predicted by the model. All labels are set to None as
<code>OwlViTForObjectDetection.image_guided_detection</code> perform one-shot object detection.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[Dict]</code></p>
`}}),st=new B({props:{title:"Owlv2Processor",local:"transformers.Owlv2Processor",headingTag:"h2"}}),nt=new U({props:{name:"class transformers.Owlv2Processor",anchor:"transformers.Owlv2Processor",parameters:[{name:"image_processor",val:""},{name:"tokenizer",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Owlv2Processor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ImageProcessor">Owlv2ImageProcessor</a>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.Owlv2Processor.tokenizer",description:`<strong>tokenizer</strong> ([<code>CLIPTokenizer</code>, <code>CLIPTokenizerFast</code>]) &#x2014;
The tokenizer is a required input.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/processing_owlv2.py#L28"}}),ot=new U({props:{name:"batch_decode",anchor:"transformers.Owlv2Processor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/processing_owlv2.py#L178"}}),at=new U({props:{name:"decode",anchor:"transformers.Owlv2Processor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/processing_owlv2.py#L186"}}),rt=new U({props:{name:"post_process_image_guided_detection",anchor:"transformers.Owlv2Processor.post_process_image_guided_detection",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/processing_owlv2.py#L170"}}),lt=new U({props:{name:"post_process_object_detection",anchor:"transformers.Owlv2Processor.post_process_object_detection",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/processing_owlv2.py#L162"}}),it=new B({props:{title:"Owlv2Model",local:"transformers.Owlv2Model",headingTag:"h2"}}),ct=new U({props:{name:"class transformers.Owlv2Model",anchor:"transformers.Owlv2Model",parameters:[{name:"config",val:": Owlv2Config"}],parametersDescription:[{anchor:"transformers.Owlv2Model.config",description:`<strong>config</strong> (<code>Owvl2Config</code>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L1014"}}),dt=new U({props:{name:"forward",anchor:"transformers.Owlv2Model.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"pixel_values",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"return_loss",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_base_image_embeds",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.Owlv2Model.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.Owlv2Model.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.`,name:"pixel_values"},{anchor:"transformers.Owlv2Model.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.Owlv2Model.forward.return_loss",description:`<strong>return_loss</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the contrastive loss.`,name:"return_loss"},{anchor:"transformers.Owlv2Model.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.Owlv2Model.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.Owlv2Model.forward.return_base_image_embeds",description:`<strong>return_base_image_embeds</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the base image embeddings.`,name:"return_base_image_embeds"},{anchor:"transformers.Owlv2Model.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L1131",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.owlv2.modeling_owlv2.Owlv2Output</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 (<code>&lt;class 'transformers.models.owlv2.configuration_owlv2.Owlv2Config'&gt;</code>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>return_loss</code> is <code>True</code>) — Contrastive loss for image-text similarity.</li>
<li><strong>logits_per_image</strong> (<code>torch.FloatTensor</code> of shape <code>(image_batch_size, text_batch_size)</code>) — The scaled dot product scores between <code>image_embeds</code> and <code>text_embeds</code>. This represents the image-text
similarity scores.</li>
<li><strong>logits_per_text</strong> (<code>torch.FloatTensor</code> of shape <code>(text_batch_size, image_batch_size)</code>) — The scaled dot product scores between <code>text_embeds</code> and <code>image_embeds</code>. This represents the text-image
similarity scores.</li>
<li><strong>text_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_max_text_queries, output_dim</code>) — The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2TextModel"
>Owlv2TextModel</a>.</li>
<li><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>) — The image embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionModel"
>Owlv2VisionModel</a>.</li>
<li><strong>text_model_output</strong> (Tuple<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2TextModel"
>Owlv2TextModel</a>.</li>
<li><strong>vision_model_output</strong> (<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionModel"
>Owlv2VisionModel</a>.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.owlv2.modeling_owlv2.Owlv2Output</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ge=new Oe({props:{$$slots:{default:[Oo]},$$scope:{ctx:j}}}),ue=new te({props:{anchor:"transformers.Owlv2Model.forward.example",$$slots:{default:[Wo]},$$scope:{ctx:j}}}),mt=new U({props:{name:"get_text_features",anchor:"transformers.Owlv2Model.get_text_features",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.Owlv2Model.get_text_features.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size * num_max_text_queries, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.Owlv2Model.get_text_features.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_max_text_queries, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.Owlv2Model.get_text_features.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.Owlv2Model.get_text_features.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.Owlv2Model.get_text_features.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L1051",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The text embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2TextModel"
>Owlv2TextModel</a>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>text_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),fe=new Oe({props:{$$slots:{default:[ko]},$$scope:{ctx:j}}}),_e=new te({props:{anchor:"transformers.Owlv2Model.get_text_features.example",$$slots:{default:[Zo]},$$scope:{ctx:j}}}),pt=new U({props:{name:"get_image_features",anchor:"transformers.Owlv2Model.get_image_features",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.Owlv2Model.get_image_features.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values.`,name:"pixel_values"},{anchor:"transformers.Owlv2Model.get_image_features.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.Owlv2Model.get_image_features.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.Owlv2Model.get_image_features.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L1086",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The image embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionModel"
>Owlv2VisionModel</a>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>image_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),be=new Oe({props:{$$slots:{default:[Vo]},$$scope:{ctx:j}}}),we=new te({props:{anchor:"transformers.Owlv2Model.get_image_features.example",$$slots:{default:[Bo]},$$scope:{ctx:j}}}),ht=new B({props:{title:"Owlv2TextModel",local:"transformers.Owlv2TextModel",headingTag:"h2"}}),gt=new U({props:{name:"class transformers.Owlv2TextModel",anchor:"transformers.Owlv2TextModel",parameters:[{name:"config",val:": Owlv2TextConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L852"}}),ut=new U({props:{name:"forward",anchor:"transformers.Owlv2TextModel.forward",parameters:[{name:"input_ids",val:": Tensor"},{name:"attention_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.Owlv2TextModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size * num_max_text_queries, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>`,name:"input_ids"},{anchor:"transformers.Owlv2TextModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_max_text_queries, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.Owlv2TextModel.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.Owlv2TextModel.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.Owlv2TextModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L867",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.owlv2.configuration_owlv2.Owlv2TextConfig'&gt;</code>) 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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Me=new Oe({props:{$$slots:{default:[No]},$$scope:{ctx:j}}}),ve=new te({props:{anchor:"transformers.Owlv2TextModel.forward.example",$$slots:{default:[Ho]},$$scope:{ctx:j}}}),ft=new B({props:{title:"Owlv2VisionModel",local:"transformers.Owlv2VisionModel",headingTag:"h2"}}),_t=new U({props:{name:"class transformers.Owlv2VisionModel",anchor:"transformers.Owlv2VisionModel",parameters:[{name:"config",val:": Owlv2VisionConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L964"}}),bt=new U({props:{name:"forward",anchor:"transformers.Owlv2VisionModel.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.Owlv2VisionModel.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.`,name:"pixel_values"},{anchor:"transformers.Owlv2VisionModel.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.Owlv2VisionModel.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.Owlv2VisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L977",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.owlv2.configuration_owlv2.Owlv2VisionConfig'&gt;</code>) 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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ye=new Oe({props:{$$slots:{default:[Xo]},$$scope:{ctx:j}}}),je=new te({props:{anchor:"transformers.Owlv2VisionModel.forward.example",$$slots:{default:[Fo]},$$scope:{ctx:j}}}),wt=new B({props:{title:"Owlv2ForObjectDetection",local:"transformers.Owlv2ForObjectDetection",headingTag:"h2"}}),Mt=new U({props:{name:"class transformers.Owlv2ForObjectDetection",anchor:"transformers.Owlv2ForObjectDetection",parameters:[{name:"config",val:": Owlv2Config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L1300"}}),vt=new U({props:{name:"forward",anchor:"transformers.Owlv2ForObjectDetection.forward",parameters:[{name:"input_ids",val:": Tensor"},{name:"pixel_values",val:": FloatTensor"},{name:"attention_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.Owlv2ForObjectDetection.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.`,name:"pixel_values"},{anchor:"transformers.Owlv2ForObjectDetection.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size * num_max_text_queries, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details. <a href="../glossary#input-ids">What are input
IDs?</a>.`,name:"input_ids"},{anchor:"transformers.Owlv2ForObjectDetection.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_max_text_queries, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.
<a href="../glossary#attention-mask">What are attention masks?</a></li>
</ul>`,name:"attention_mask"},{anchor:"transformers.Owlv2ForObjectDetection.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the last hidden state. See <code>text_model_last_hidden_state</code> and
<code>vision_model_last_hidden_state</code> under returned tensors for more detail.`,name:"output_hidden_states"},{anchor:"transformers.Owlv2ForObjectDetection.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L1654",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.owlv2.modeling_owlv2.Owlv2ObjectDetectionOutput</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 (<code>&lt;class 'transformers.models.owlv2.configuration_owlv2.Owlv2Config'&gt;</code>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> are provided)) — Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a
bounding box loss. The latter is defined as a linear combination of the L1 loss and the generalized
scale-invariant IoU loss.</li>
<li><strong>loss_dict</strong> (<code>Dict</code>, <em>optional</em>) — A dictionary containing the individual losses. Useful for logging.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, num_queries)</code>) — Classification logits (including no-object) for all queries.</li>
<li><strong>objectness_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, 1)</code>) — The objectness logits of all image patches. OWL-ViT represents images as a set of image patches where the
total number of patches is (image_size / patch_size)**2.</li>
<li><strong>pred_boxes</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, 4)</code>) — Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding
possible padding). You can use <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ImageProcessor.post_process_object_detection"
>post_process_object_detection()</a> to retrieve the
unnormalized bounding boxes.</li>
<li><strong>text_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_max_text_queries, output_dim</code>) — The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2TextModel"
>Owlv2TextModel</a>.</li>
<li><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, patch_size, patch_size, output_dim</code>) — Pooled output of <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionModel"
>Owlv2VisionModel</a>. OWLv2 represents images as a set of image patches and computes image
embeddings for each patch.</li>
<li><strong>class_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, hidden_size)</code>) — Class embeddings of all image patches. OWLv2 represents images as a set of image patches where the total
number of patches is (image_size / patch_size)**2.</li>
<li><strong>text_model_output</strong> (Tuple<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2TextModel"
>Owlv2TextModel</a>.</li>
<li><strong>vision_model_output</strong> (<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionModel"
>Owlv2VisionModel</a>.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.owlv2.modeling_owlv2.Owlv2ObjectDetectionOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Te=new Oe({props:{$$slots:{default:[Go]},$$scope:{ctx:j}}}),Je=new te({props:{anchor:"transformers.Owlv2ForObjectDetection.forward.example",$$slots:{default:[Ro]},$$scope:{ctx:j}}}),yt=new U({props:{name:"image_guided_detection",anchor:"transformers.Owlv2ForObjectDetection.image_guided_detection",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"query_pixel_values",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.Owlv2ForObjectDetection.image_guided_detection.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values.`,name:"pixel_values"},{anchor:"transformers.Owlv2ForObjectDetection.image_guided_detection.query_pixel_values",description:`<strong>query_pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values of query image(s) to be detected. Pass in one query image per target image.`,name:"query_pixel_values"},{anchor:"transformers.Owlv2ForObjectDetection.image_guided_detection.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.Owlv2ForObjectDetection.image_guided_detection.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.Owlv2ForObjectDetection.image_guided_detection.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py#L1529",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.owlv2.modeling_owlv2.Owlv2ImageGuidedObjectDetectionOutput</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 (<code>&lt;class 'transformers.models.owlv2.configuration_owlv2.Owlv2Config'&gt;</code>) and inputs.</p>
<ul>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, num_queries)</code>) — Classification logits (including no-object) for all queries.</li>
<li><strong>target_pred_boxes</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, 4)</code>) — Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual target image in the batch
(disregarding possible padding). You can use <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ImageProcessor.post_process_object_detection"
>post_process_object_detection()</a> to
retrieve the unnormalized bounding boxes.</li>
<li><strong>query_pred_boxes</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, 4)</code>) — Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual query image in the batch
(disregarding possible padding). You can use <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2ImageProcessor.post_process_object_detection"
>post_process_object_detection()</a> to
retrieve the unnormalized bounding boxes.</li>
<li><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, patch_size, patch_size, output_dim</code>) — Pooled output of <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionModel"
>Owlv2VisionModel</a>. OWLv2 represents images as a set of image patches and computes
image embeddings for each patch.</li>
<li><strong>query_image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, patch_size, patch_size, output_dim</code>) — Pooled output of <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionModel"
>Owlv2VisionModel</a>. OWLv2 represents images as a set of image patches and computes
image embeddings for each patch.</li>
<li><strong>class_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, hidden_size)</code>) — Class embeddings of all image patches. OWLv2 represents images as a set of image patches where the total
number of patches is (image_size / patch_size)**2.</li>
<li><strong>text_model_output</strong> (Tuple<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2TextModel"
>Owlv2TextModel</a>.</li>
<li><strong>vision_model_output</strong> (<code>BaseModelOutputWithPooling</code>) — The output of the <a
  href="/docs/transformers/main/en/model_doc/owlv2#transformers.Owlv2VisionModel"
>Owlv2VisionModel</a>.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.owlv2.modeling_owlv2.Owlv2ImageGuidedObjectDetectionOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ue=new Oe({props:{$$slots:{default:[Eo]},$$scope:{ctx:j}}}),xe=new te({props:{anchor:"transformers.Owlv2ForObjectDetection.image_guided_detection.example",$$slots:{default:[Po]},$$scope:{ctx:j}}}),{c(){t=m("meta"),w=a(),l=m("p"),c=a(),h(M.$$.fragment),s=a(),h(y.$$.fragment),os=a(),We=m("p"),We.innerHTML=Gn,as=a(),ke=m("p"),ke.textContent=Rn,rs=a(),Ze=m("p"),Ze.innerHTML=En,ls=a(),se=m("img"),is=a(),Ve=m("small"),Ve.innerHTML=Qn,cs=a(),Be=m("p"),Be.innerHTML=Yn,ds=a(),h(Ne.$$.fragment),ms=a(),He=m("p"),He.innerHTML=Ln,ps=a(),Xe=m("p"),Xe.innerHTML=qn,hs=a(),h(Fe.$$.fragment),gs=a(),h(Ge.$$.fragment),us=a(),Re=m("ul"),Re.innerHTML=Sn,fs=a(),h(ne.$$.fragment),_s=a(),h(Ee.$$.fragment),bs=a(),W=m("div"),h(Pe.$$.fragment),Hs=a(),It=m("p"),It.innerHTML=Dn,Xs=a(),Ot=m("p"),Ot.innerHTML=An,Fs=a(),oe=m("div"),h(Qe.$$.fragment),Gs=a(),Wt=m("p"),Wt.innerHTML=Kn,ws=a(),h(Ye.$$.fragment),Ms=a(),k=m("div"),h(Le.$$.fragment),Rs=a(),kt=m("p"),kt.innerHTML=eo,Es=a(),Zt=m("p"),Zt.innerHTML=to,Ps=a(),h(ae.$$.fragment),vs=a(),h(qe.$$.fragment),ys=a(),Z=m("div"),h(Se.$$.fragment),Qs=a(),Vt=m("p"),Vt.innerHTML=so,Ys=a(),Bt=m("p"),Bt.innerHTML=no,Ls=a(),h(re.$$.fragment),js=a(),h(De.$$.fragment),Ts=a(),C=m("div"),h(Ae.$$.fragment),qs=a(),Nt=m("p"),Nt.textContent=oo,Ss=a(),le=m("div"),h(Ke.$$.fragment),Ds=a(),Ht=m("p"),Ht.textContent=ao,As=a(),ie=m("div"),h(et.$$.fragment),Ks=a(),Xt=m("p"),Xt.innerHTML=ro,en=a(),ce=m("div"),h(tt.$$.fragment),tn=a(),Ft=m("p"),Ft.innerHTML=lo,Js=a(),h(st.$$.fragment),Us=a(),x=m("div"),h(nt.$$.fragment),sn=a(),Gt=m("p"),Gt.innerHTML=io,nn=a(),de=m("div"),h(ot.$$.fragment),on=a(),Rt=m("p"),Rt.innerHTML=co,an=a(),me=m("div"),h(at.$$.fragment),rn=a(),Et=m("p"),Et.innerHTML=mo,ln=a(),pe=m("div"),h(rt.$$.fragment),cn=a(),Pt=m("p"),Pt.innerHTML=po,dn=a(),he=m("div"),h(lt.$$.fragment),mn=a(),Qt=m("p"),Qt.innerHTML=ho,xs=a(),h(it.$$.fragment),$s=a(),$=m("div"),h(ct.$$.fragment),pn=a(),Yt=m("p"),Yt.innerHTML=go,hn=a(),Lt=m("p"),Lt.innerHTML=uo,gn=a(),N=m("div"),h(dt.$$.fragment),un=a(),qt=m("p"),qt.innerHTML=fo,fn=a(),h(ge.$$.fragment),_n=a(),h(ue.$$.fragment),bn=a(),H=m("div"),h(mt.$$.fragment),wn=a(),St=m("p"),St.innerHTML=_o,Mn=a(),h(fe.$$.fragment),vn=a(),h(_e.$$.fragment),yn=a(),X=m("div"),h(pt.$$.fragment),jn=a(),Dt=m("p"),Dt.innerHTML=bo,Tn=a(),h(be.$$.fragment),Jn=a(),h(we.$$.fragment),zs=a(),h(ht.$$.fragment),Cs=a(),K=m("div"),h(gt.$$.fragment),Un=a(),F=m("div"),h(ut.$$.fragment),xn=a(),At=m("p"),At.innerHTML=wo,$n=a(),h(Me.$$.fragment),zn=a(),h(ve.$$.fragment),Is=a(),h(ft.$$.fragment),Os=a(),ee=m("div"),h(_t.$$.fragment),Cn=a(),G=m("div"),h(bt.$$.fragment),In=a(),Kt=m("p"),Kt.innerHTML=Mo,On=a(),h(ye.$$.fragment),Wn=a(),h(je.$$.fragment),Ws=a(),h(wt.$$.fragment),ks=a(),P=m("div"),h(Mt.$$.fragment),kn=a(),R=m("div"),h(vt.$$.fragment),Zn=a(),es=m("p"),es.innerHTML=vo,Vn=a(),h(Te.$$.fragment),Bn=a(),h(Je.$$.fragment),Nn=a(),E=m("div"),h(yt.$$.fragment),Hn=a(),ts=m("p"),ts.innerHTML=yo,Xn=a(),h(Ue.$$.fragment),Fn=a(),h(xe.$$.fragment),Zs=a(),ns=m("p"),this.h()},l(e){const o=$o("svelte-u9bgzb",document.head);t=p(o,"META",{name:!0,content:!0}),o.forEach(n),w=r(e),l=p(e,"P",{}),J(l).forEach(n),c=r(e),g(M.$$.fragment,e),s=r(e),g(y.$$.fragment,e),os=r(e),We=p(e,"P",{"data-svelte-h":!0}),v(We)!=="svelte-1jjmdbl"&&(We.innerHTML=Gn),as=r(e),ke=p(e,"P",{"data-svelte-h":!0}),v(ke)!=="svelte-vfdo9a"&&(ke.textContent=Rn),rs=r(e),Ze=p(e,"P",{"data-svelte-h":!0}),v(Ze)!=="svelte-17v2uvw"&&(Ze.innerHTML=En),ls=r(e),se=p(e,"IMG",{src:!0,alt:!0,width:!0}),is=r(e),Ve=p(e,"SMALL",{"data-svelte-h":!0}),v(Ve)!=="svelte-a4adom"&&(Ve.innerHTML=Qn),cs=r(e),Be=p(e,"P",{"data-svelte-h":!0}),v(Be)!=="svelte-h0sl6k"&&(Be.innerHTML=Yn),ds=r(e),g(Ne.$$.fragment,e),ms=r(e),He=p(e,"P",{"data-svelte-h":!0}),v(He)!=="svelte-44ncwu"&&(He.innerHTML=Ln),ps=r(e),Xe=p(e,"P",{"data-svelte-h":!0}),v(Xe)!=="svelte-2hrjcv"&&(Xe.innerHTML=qn),hs=r(e),g(Fe.$$.fragment,e),gs=r(e),g(Ge.$$.fragment,e),us=r(e),Re=p(e,"UL",{"data-svelte-h":!0}),v(Re)!=="svelte-yomnb6"&&(Re.innerHTML=Sn),fs=r(e),g(ne.$$.fragment,e),_s=r(e),g(Ee.$$.fragment,e),bs=r(e),W=p(e,"DIV",{class:!0});var Q=J(W);g(Pe.$$.fragment,Q),Hs=r(Q),It=p(Q,"P",{"data-svelte-h":!0}),v(It)!=="svelte-1eeue6z"&&(It.innerHTML=Dn),Xs=r(Q),Ot=p(Q,"P",{"data-svelte-h":!0}),v(Ot)!=="svelte-o55m63"&&(Ot.innerHTML=An),Fs=r(Q),oe=p(Q,"DIV",{class:!0});var jt=J(oe);g(Qe.$$.fragment,jt),Gs=r(jt),Wt=p(jt,"P",{"data-svelte-h":!0}),v(Wt)!=="svelte-1e3bs5y"&&(Wt.innerHTML=Kn),jt.forEach(n),Q.forEach(n),ws=r(e),g(Ye.$$.fragment,e),Ms=r(e),k=p(e,"DIV",{class:!0});var Y=J(k);g(Le.$$.fragment,Y),Rs=r(Y),kt=p(Y,"P",{"data-svelte-h":!0}),v(kt)!=="svelte-1qnmyr9"&&(kt.innerHTML=eo),Es=r(Y),Zt=p(Y,"P",{"data-svelte-h":!0}),v(Zt)!=="svelte-o55m63"&&(Zt.innerHTML=to),Ps=r(Y),g(ae.$$.fragment,Y),Y.forEach(n),vs=r(e),g(qe.$$.fragment,e),ys=r(e),Z=p(e,"DIV",{class:!0});var L=J(Z);g(Se.$$.fragment,L),Qs=r(L),Vt=p(L,"P",{"data-svelte-h":!0}),v(Vt)!=="svelte-1ww21ml"&&(Vt.innerHTML=so),Ys=r(L),Bt=p(L,"P",{"data-svelte-h":!0}),v(Bt)!=="svelte-o55m63"&&(Bt.innerHTML=no),Ls=r(L),g(re.$$.fragment,L),L.forEach(n),js=r(e),g(De.$$.fragment,e),Ts=r(e),C=p(e,"DIV",{class:!0});var V=J(C);g(Ae.$$.fragment,V),qs=r(V),Nt=p(V,"P",{"data-svelte-h":!0}),v(Nt)!=="svelte-dzqrng"&&(Nt.textContent=oo),Ss=r(V),le=p(V,"DIV",{class:!0});var Tt=J(le);g(Ke.$$.fragment,Tt),Ds=r(Tt),Ht=p(Tt,"P",{"data-svelte-h":!0}),v(Ht)!=="svelte-1x3yxsa"&&(Ht.textContent=ao),Tt.forEach(n),As=r(V),ie=p(V,"DIV",{class:!0});var Jt=J(ie);g(et.$$.fragment,Jt),Ks=r(Jt),Xt=p(Jt,"P",{"data-svelte-h":!0}),v(Xt)!=="svelte-1dv4izl"&&(Xt.innerHTML=ro),Jt.forEach(n),en=r(V),ce=p(V,"DIV",{class:!0});var Ut=J(ce);g(tt.$$.fragment,Ut),tn=r(Ut),Ft=p(Ut,"P",{"data-svelte-h":!0}),v(Ft)!=="svelte-dhbo7w"&&(Ft.innerHTML=lo),Ut.forEach(n),V.forEach(n),Js=r(e),g(st.$$.fragment,e),Us=r(e),x=p(e,"DIV",{class:!0});var I=J(x);g(nt.$$.fragment,I),sn=r(I),Gt=p(I,"P",{"data-svelte-h":!0}),v(Gt)!=="svelte-pgjqkb"&&(Gt.innerHTML=io),nn=r(I),de=p(I,"DIV",{class:!0});var xt=J(de);g(ot.$$.fragment,xt),on=r(xt),Rt=p(xt,"P",{"data-svelte-h":!0}),v(Rt)!=="svelte-vahtpx"&&(Rt.innerHTML=co),xt.forEach(n),an=r(I),me=p(I,"DIV",{class:!0});var $t=J(me);g(at.$$.fragment,$t),rn=r($t),Et=p($t,"P",{"data-svelte-h":!0}),v(Et)!=="svelte-174p0in"&&(Et.innerHTML=mo),$t.forEach(n),ln=r(I),pe=p(I,"DIV",{class:!0});var zt=J(pe);g(rt.$$.fragment,zt),cn=r(zt),Pt=p(zt,"P",{"data-svelte-h":!0}),v(Pt)!=="svelte-13us65f"&&(Pt.innerHTML=po),zt.forEach(n),dn=r(I),he=p(I,"DIV",{class:!0});var Ct=J(he);g(lt.$$.fragment,Ct),mn=r(Ct),Qt=p(Ct,"P",{"data-svelte-h":!0}),v(Qt)!=="svelte-1a63lc1"&&(Qt.innerHTML=ho),Ct.forEach(n),I.forEach(n),xs=r(e),g(it.$$.fragment,e),$s=r(e),$=p(e,"DIV",{class:!0});var O=J($);g(ct.$$.fragment,O),pn=r(O),Yt=p(O,"P",{"data-svelte-h":!0}),v(Yt)!=="svelte-6pahdo"&&(Yt.innerHTML=go),hn=r(O),Lt=p(O,"P",{"data-svelte-h":!0}),v(Lt)!=="svelte-hswkmf"&&(Lt.innerHTML=uo),gn=r(O),N=p(O,"DIV",{class:!0});var q=J(N);g(dt.$$.fragment,q),un=r(q),qt=p(q,"P",{"data-svelte-h":!0}),v(qt)!=="svelte-1snknjv"&&(qt.innerHTML=fo),fn=r(q),g(ge.$$.fragment,q),_n=r(q),g(ue.$$.fragment,q),q.forEach(n),bn=r(O),H=p(O,"DIV",{class:!0});var S=J(H);g(mt.$$.fragment,S),wn=r(S),St=p(S,"P",{"data-svelte-h":!0}),v(St)!=="svelte-1snknjv"&&(St.innerHTML=_o),Mn=r(S),g(fe.$$.fragment,S),vn=r(S),g(_e.$$.fragment,S),S.forEach(n),yn=r(O),X=p(O,"DIV",{class:!0});var D=J(X);g(pt.$$.fragment,D),jn=r(D),Dt=p(D,"P",{"data-svelte-h":!0}),v(Dt)!=="svelte-1snknjv"&&(Dt.innerHTML=bo),Tn=r(D),g(be.$$.fragment,D),Jn=r(D),g(we.$$.fragment,D),D.forEach(n),O.forEach(n),zs=r(e),g(ht.$$.fragment,e),Cs=r(e),K=p(e,"DIV",{class:!0});var Bs=J(K);g(gt.$$.fragment,Bs),Un=r(Bs),F=p(Bs,"DIV",{class:!0});var $e=J(F);g(ut.$$.fragment,$e),xn=r($e),At=p($e,"P",{"data-svelte-h":!0}),v(At)!=="svelte-1ncxtmd"&&(At.innerHTML=wo),$n=r($e),g(Me.$$.fragment,$e),zn=r($e),g(ve.$$.fragment,$e),$e.forEach(n),Bs.forEach(n),Is=r(e),g(ft.$$.fragment,e),Os=r(e),ee=p(e,"DIV",{class:!0});var Ns=J(ee);g(_t.$$.fragment,Ns),Cn=r(Ns),G=p(Ns,"DIV",{class:!0});var ze=J(G);g(bt.$$.fragment,ze),In=r(ze),Kt=p(ze,"P",{"data-svelte-h":!0}),v(Kt)!=="svelte-svi6u7"&&(Kt.innerHTML=Mo),On=r(ze),g(ye.$$.fragment,ze),Wn=r(ze),g(je.$$.fragment,ze),ze.forEach(n),Ns.forEach(n),Ws=r(e),g(wt.$$.fragment,e),ks=r(e),P=p(e,"DIV",{class:!0});var ss=J(P);g(Mt.$$.fragment,ss),kn=r(ss),R=p(ss,"DIV",{class:!0});var Ce=J(R);g(vt.$$.fragment,Ce),Zn=r(Ce),es=p(Ce,"P",{"data-svelte-h":!0}),v(es)!=="svelte-453pb5"&&(es.innerHTML=vo),Vn=r(Ce),g(Te.$$.fragment,Ce),Bn=r(Ce),g(Je.$$.fragment,Ce),Ce.forEach(n),Nn=r(ss),E=p(ss,"DIV",{class:!0});var Ie=J(E);g(yt.$$.fragment,Ie),Hn=r(Ie),ts=p(Ie,"P",{"data-svelte-h":!0}),v(ts)!=="svelte-453pb5"&&(ts.innerHTML=yo),Xn=r(Ie),g(Ue.$$.fragment,Ie),Fn=r(Ie),g(xe.$$.fragment,Ie),Ie.forEach(n),ss.forEach(n),Zs=r(e),ns=p(e,"P",{}),J(ns).forEach(n),this.h()},h(){T(t,"name","hf:doc:metadata"),T(t,"content",Yo),To(se.src,Pn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/owlv2_overview.png")||T(se,"src",Pn),T(se,"alt","drawing"),T(se,"width","600"),T(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,o){i(document.head,t),d(e,w,o),d(e,l,o),d(e,c,o),u(M,e,o),d(e,s,o),u(y,e,o),d(e,os,o),d(e,We,o),d(e,as,o),d(e,ke,o),d(e,rs,o),d(e,Ze,o),d(e,ls,o),d(e,se,o),d(e,is,o),d(e,Ve,o),d(e,cs,o),d(e,Be,o),d(e,ds,o),u(Ne,e,o),d(e,ms,o),d(e,He,o),d(e,ps,o),d(e,Xe,o),d(e,hs,o),u(Fe,e,o),d(e,gs,o),u(Ge,e,o),d(e,us,o),d(e,Re,o),d(e,fs,o),u(ne,e,o),d(e,_s,o),u(Ee,e,o),d(e,bs,o),d(e,W,o),u(Pe,W,null),i(W,Hs),i(W,It),i(W,Xs),i(W,Ot),i(W,Fs),i(W,oe),u(Qe,oe,null),i(oe,Gs),i(oe,Wt),d(e,ws,o),u(Ye,e,o),d(e,Ms,o),d(e,k,o),u(Le,k,null),i(k,Rs),i(k,kt),i(k,Es),i(k,Zt),i(k,Ps),u(ae,k,null),d(e,vs,o),u(qe,e,o),d(e,ys,o),d(e,Z,o),u(Se,Z,null),i(Z,Qs),i(Z,Vt),i(Z,Ys),i(Z,Bt),i(Z,Ls),u(re,Z,null),d(e,js,o),u(De,e,o),d(e,Ts,o),d(e,C,o),u(Ae,C,null),i(C,qs),i(C,Nt),i(C,Ss),i(C,le),u(Ke,le,null),i(le,Ds),i(le,Ht),i(C,As),i(C,ie),u(et,ie,null),i(ie,Ks),i(ie,Xt),i(C,en),i(C,ce),u(tt,ce,null),i(ce,tn),i(ce,Ft),d(e,Js,o),u(st,e,o),d(e,Us,o),d(e,x,o),u(nt,x,null),i(x,sn),i(x,Gt),i(x,nn),i(x,de),u(ot,de,null),i(de,on),i(de,Rt),i(x,an),i(x,me),u(at,me,null),i(me,rn),i(me,Et),i(x,ln),i(x,pe),u(rt,pe,null),i(pe,cn),i(pe,Pt),i(x,dn),i(x,he),u(lt,he,null),i(he,mn),i(he,Qt),d(e,xs,o),u(it,e,o),d(e,$s,o),d(e,$,o),u(ct,$,null),i($,pn),i($,Yt),i($,hn),i($,Lt),i($,gn),i($,N),u(dt,N,null),i(N,un),i(N,qt),i(N,fn),u(ge,N,null),i(N,_n),u(ue,N,null),i($,bn),i($,H),u(mt,H,null),i(H,wn),i(H,St),i(H,Mn),u(fe,H,null),i(H,vn),u(_e,H,null),i($,yn),i($,X),u(pt,X,null),i(X,jn),i(X,Dt),i(X,Tn),u(be,X,null),i(X,Jn),u(we,X,null),d(e,zs,o),u(ht,e,o),d(e,Cs,o),d(e,K,o),u(gt,K,null),i(K,Un),i(K,F),u(ut,F,null),i(F,xn),i(F,At),i(F,$n),u(Me,F,null),i(F,zn),u(ve,F,null),d(e,Is,o),u(ft,e,o),d(e,Os,o),d(e,ee,o),u(_t,ee,null),i(ee,Cn),i(ee,G),u(bt,G,null),i(G,In),i(G,Kt),i(G,On),u(ye,G,null),i(G,Wn),u(je,G,null),d(e,Ws,o),u(wt,e,o),d(e,ks,o),d(e,P,o),u(Mt,P,null),i(P,kn),i(P,R),u(vt,R,null),i(R,Zn),i(R,es),i(R,Vn),u(Te,R,null),i(R,Bn),u(Je,R,null),i(P,Nn),i(P,E),u(yt,E,null),i(E,Hn),i(E,ts),i(E,Xn),u(Ue,E,null),i(E,Fn),u(xe,E,null),d(e,Zs,o),d(e,ns,o),Vs=!0},p(e,[o]){const Q={};o&2&&(Q.$$scope={dirty:o,ctx:e}),ne.$set(Q);const jt={};o&2&&(jt.$$scope={dirty:o,ctx:e}),ae.$set(jt);const Y={};o&2&&(Y.$$scope={dirty:o,ctx:e}),re.$set(Y);const L={};o&2&&(L.$$scope={dirty:o,ctx:e}),ge.$set(L);const V={};o&2&&(V.$$scope={dirty:o,ctx:e}),ue.$set(V);const Tt={};o&2&&(Tt.$$scope={dirty:o,ctx:e}),fe.$set(Tt);const Jt={};o&2&&(Jt.$$scope={dirty:o,ctx:e}),_e.$set(Jt);const Ut={};o&2&&(Ut.$$scope={dirty:o,ctx:e}),be.$set(Ut);const I={};o&2&&(I.$$scope={dirty:o,ctx:e}),we.$set(I);const xt={};o&2&&(xt.$$scope={dirty:o,ctx:e}),Me.$set(xt);const $t={};o&2&&($t.$$scope={dirty:o,ctx:e}),ve.$set($t);const zt={};o&2&&(zt.$$scope={dirty:o,ctx:e}),ye.$set(zt);const Ct={};o&2&&(Ct.$$scope={dirty:o,ctx:e}),je.$set(Ct);const O={};o&2&&(O.$$scope={dirty:o,ctx:e}),Te.$set(O);const q={};o&2&&(q.$$scope={dirty:o,ctx:e}),Je.$set(q);const S={};o&2&&(S.$$scope={dirty:o,ctx:e}),Ue.$set(S);const D={};o&2&&(D.$$scope={dirty:o,ctx:e}),xe.$set(D)},i(e){Vs||(f(M.$$.fragment,e),f(y.$$.fragment,e),f(Ne.$$.fragment,e),f(Fe.$$.fragment,e),f(Ge.$$.fragment,e),f(ne.$$.fragment,e),f(Ee.$$.fragment,e),f(Pe.$$.fragment,e),f(Qe.$$.fragment,e),f(Ye.$$.fragment,e),f(Le.$$.fragment,e),f(ae.$$.fragment,e),f(qe.$$.fragment,e),f(Se.$$.fragment,e),f(re.$$.fragment,e),f(De.$$.fragment,e),f(Ae.$$.fragment,e),f(Ke.$$.fragment,e),f(et.$$.fragment,e),f(tt.$$.fragment,e),f(st.$$.fragment,e),f(nt.$$.fragment,e),f(ot.$$.fragment,e),f(at.$$.fragment,e),f(rt.$$.fragment,e),f(lt.$$.fragment,e),f(it.$$.fragment,e),f(ct.$$.fragment,e),f(dt.$$.fragment,e),f(ge.$$.fragment,e),f(ue.$$.fragment,e),f(mt.$$.fragment,e),f(fe.$$.fragment,e),f(_e.$$.fragment,e),f(pt.$$.fragment,e),f(be.$$.fragment,e),f(we.$$.fragment,e),f(ht.$$.fragment,e),f(gt.$$.fragment,e),f(ut.$$.fragment,e),f(Me.$$.fragment,e),f(ve.$$.fragment,e),f(ft.$$.fragment,e),f(_t.$$.fragment,e),f(bt.$$.fragment,e),f(ye.$$.fragment,e),f(je.$$.fragment,e),f(wt.$$.fragment,e),f(Mt.$$.fragment,e),f(vt.$$.fragment,e),f(Te.$$.fragment,e),f(Je.$$.fragment,e),f(yt.$$.fragment,e),f(Ue.$$.fragment,e),f(xe.$$.fragment,e),Vs=!0)},o(e){_(M.$$.fragment,e),_(y.$$.fragment,e),_(Ne.$$.fragment,e),_(Fe.$$.fragment,e),_(Ge.$$.fragment,e),_(ne.$$.fragment,e),_(Ee.$$.fragment,e),_(Pe.$$.fragment,e),_(Qe.$$.fragment,e),_(Ye.$$.fragment,e),_(Le.$$.fragment,e),_(ae.$$.fragment,e),_(qe.$$.fragment,e),_(Se.$$.fragment,e),_(re.$$.fragment,e),_(De.$$.fragment,e),_(Ae.$$.fragment,e),_(Ke.$$.fragment,e),_(et.$$.fragment,e),_(tt.$$.fragment,e),_(st.$$.fragment,e),_(nt.$$.fragment,e),_(ot.$$.fragment,e),_(at.$$.fragment,e),_(rt.$$.fragment,e),_(lt.$$.fragment,e),_(it.$$.fragment,e),_(ct.$$.fragment,e),_(dt.$$.fragment,e),_(ge.$$.fragment,e),_(ue.$$.fragment,e),_(mt.$$.fragment,e),_(fe.$$.fragment,e),_(_e.$$.fragment,e),_(pt.$$.fragment,e),_(be.$$.fragment,e),_(we.$$.fragment,e),_(ht.$$.fragment,e),_(gt.$$.fragment,e),_(ut.$$.fragment,e),_(Me.$$.fragment,e),_(ve.$$.fragment,e),_(ft.$$.fragment,e),_(_t.$$.fragment,e),_(bt.$$.fragment,e),_(ye.$$.fragment,e),_(je.$$.fragment,e),_(wt.$$.fragment,e),_(Mt.$$.fragment,e),_(vt.$$.fragment,e),_(Te.$$.fragment,e),_(Je.$$.fragment,e),_(yt.$$.fragment,e),_(Ue.$$.fragment,e),_(xe.$$.fragment,e),Vs=!1},d(e){e&&(n(w),n(l),n(c),n(s),n(os),n(We),n(as),n(ke),n(rs),n(Ze),n(ls),n(se),n(is),n(Ve),n(cs),n(Be),n(ds),n(ms),n(He),n(ps),n(Xe),n(hs),n(gs),n(us),n(Re),n(fs),n(_s),n(bs),n(W),n(ws),n(Ms),n(k),n(vs),n(ys),n(Z),n(js),n(Ts),n(C),n(Js),n(Us),n(x),n(xs),n($s),n($),n(zs),n(Cs),n(K),n(Is),n(Os),n(ee),n(Ws),n(ks),n(P),n(Zs),n(ns)),n(t),b(M,e),b(y,e),b(Ne,e),b(Fe,e),b(Ge,e),b(ne,e),b(Ee,e),b(Pe),b(Qe),b(Ye,e),b(Le),b(ae),b(qe,e),b(Se),b(re),b(De,e),b(Ae),b(Ke),b(et),b(tt),b(st,e),b(nt),b(ot),b(at),b(rt),b(lt),b(it,e),b(ct),b(dt),b(ge),b(ue),b(mt),b(fe),b(_e),b(pt),b(be),b(we),b(ht,e),b(gt),b(ut),b(Me),b(ve),b(ft,e),b(_t),b(bt),b(ye),b(je),b(wt,e),b(Mt),b(vt),b(Te),b(Je),b(yt),b(Ue),b(xe)}}}const Yo='{"title":"OWLv2","local":"owlv2","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage example","local":"usage-example","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"Owlv2Config","local":"transformers.Owlv2Config","sections":[],"depth":2},{"title":"Owlv2TextConfig","local":"transformers.Owlv2TextConfig","sections":[],"depth":2},{"title":"Owlv2VisionConfig","local":"transformers.Owlv2VisionConfig","sections":[],"depth":2},{"title":"Owlv2ImageProcessor","local":"transformers.Owlv2ImageProcessor","sections":[],"depth":2},{"title":"Owlv2Processor","local":"transformers.Owlv2Processor","sections":[],"depth":2},{"title":"Owlv2Model","local":"transformers.Owlv2Model","sections":[],"depth":2},{"title":"Owlv2TextModel","local":"transformers.Owlv2TextModel","sections":[],"depth":2},{"title":"Owlv2VisionModel","local":"transformers.Owlv2VisionModel","sections":[],"depth":2},{"title":"Owlv2ForObjectDetection","local":"transformers.Owlv2ForObjectDetection","sections":[],"depth":2}],"depth":1}';function Lo(j){return Jo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class sa extends Uo{constructor(t){super(),xo(this,t,Lo,Qo,jo,{})}}export{sa as component};
