import{S as Pp,i as Fp,s as Rp,e as s,k as m,w as b,t as i,M as Gp,c as n,d as o,m as h,a,x as v,h as l,b as d,G as e,g as _,y,q as M,o as V,B as j,v as Dp,L as Je}from"../../chunks/vendor-hf-doc-builder.js";import{T as No}from"../../chunks/Tip-hf-doc-builder.js";import{D as J}from"../../chunks/Docstring-hf-doc-builder.js";import{C as K}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as P}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as $e}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ap($){let c,T,g,f,w;return f=new K({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME93bFZpVFRleHRDb25maWclMkMlMjBPd2xWaVRUZXh0TW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwT3dsVmlUVGV4dE1vZGVsJTIwd2l0aCUyMGdvb2dsZSUyRm93bHZpdC1iYXNlLXBhdGNoMzIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwT3dsVmlUVGV4dENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyME93bFZpVFRleHRDb25maWclMjBmcm9tJTIwdGhlJTIwZ29vZ2xlJTJGb3dsdml0LWJhc2UtcGF0Y2gzMiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwT3dsVmlUVGV4dE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> OwlViTTextConfig, OwlViTTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a OwlViTTextModel with google/owlvit-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = OwlViTTextConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a OwlViTTextConfig from the google/owlvit-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OwlViTTextModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){c=s("p"),T=i("Example:"),g=m(),b(f.$$.fragment)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Example:"),p.forEach(o),g=h(r),v(f.$$.fragment,r)},m(r,p){_(r,c,p),e(c,T),_(r,g,p),y(f,r,p),w=!0},p:Je,i(r){w||(M(f.$$.fragment,r),w=!0)},o(r){V(f.$$.fragment,r),w=!1},d(r){r&&o(c),r&&o(g),j(f,r)}}}function Xp($){let c,T,g,f,w;return f=new K({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME93bFZpVFZpc2lvbkNvbmZpZyUyQyUyME93bFZpVFZpc2lvbk1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyME93bFZpVFZpc2lvbk1vZGVsJTIwd2l0aCUyMGdvb2dsZSUyRm93bHZpdC1iYXNlLXBhdGNoMzIlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwT3dsVmlUVmlzaW9uQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwT3dsVmlUVmlzaW9uTW9kZWwlMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBnb29nbGUlMkZvd2x2aXQtYmFzZS1wYXRjaDMyJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBPd2xWaVRWaXNpb25Nb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> OwlViTVisionConfig, OwlViTVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a OwlViTVisionModel with google/owlvit-base-patch32 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = OwlViTVisionConfig()

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){c=s("p"),T=i("Example:"),g=m(),b(f.$$.fragment)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Example:"),p.forEach(o),g=h(r),v(f.$$.fragment,r)},m(r,p){_(r,c,p),e(c,T),_(r,g,p),y(f,r,p),w=!0},p:Je,i(r){w||(M(f.$$.fragment,r),w=!0)},o(r){V(f.$$.fragment,r),w=!1},d(r){r&&o(c),r&&o(g),j(f,r)}}}function qp($){let c,T,g,f,w;return{c(){c=s("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),f=i("Module"),w=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(p,"CODE",{});var O=a(g);f=l(O,"Module"),O.forEach(o),w=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(r,p){_(r,c,p),e(c,T),e(c,g),e(g,f),e(c,w)},d(r){r&&o(c)}}}function Hp($){let c,T,g,f,w;return f=new K({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyME93bFZpVE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBPd2xWaVRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdml0LWJhc2UtcGF0Y2gzMiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2aXQtYmFzZS1wYXRjaDMyJTIyKSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRCU1QiU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCU1RCUyQyUyMGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbG9naXRzX3Blcl9pbWFnZSUyMCUzRCUyMG91dHB1dHMubG9naXRzX3Blcl9pbWFnZSUyMCUyMCUyMyUyMHRoaXMlMjBpcyUyMHRoZSUyMGltYWdlLXRleHQlMjBzaW1pbGFyaXR5JTIwc2NvcmUlMEFwcm9icyUyMCUzRCUyMGxvZ2l0c19wZXJfaW1hZ2Uuc29mdG1heChkaW0lM0QxKSUyMCUyMCUyMyUyMHdlJTIwY2FuJTIwdGFrZSUyMHRoZSUyMHNvZnRtYXglMjB0byUyMGdldCUyMHRoZSUyMGxhYmVsJTIwcHJvYmFiaWxpdGllcw==",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, OwlViTModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = OwlViTModel.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&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>`}}),{c(){c=s("p"),T=i("Examples:"),g=m(),b(f.$$.fragment)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Examples:"),p.forEach(o),g=h(r),v(f.$$.fragment,r)},m(r,p){_(r,c,p),e(c,T),_(r,g,p),y(f,r,p),w=!0},p:Je,i(r){w||(M(f.$$.fragment,r),w=!0)},o(r){V(f.$$.fragment,r),w=!1},d(r){r&&o(c),r&&o(g),j(f,r)}}}function Qp($){let c,T,g,f,w;return{c(){c=s("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),f=i("Module"),w=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(p,"CODE",{});var O=a(g);f=l(O,"Module"),O.forEach(o),w=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(r,p){_(r,c,p),e(c,T),e(c,g),e(g,f),e(c,w)},d(r){r&&o(c)}}}function Yp($){let c,T,g,f,w;return f=new K({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBPd2xWaVRNb2RlbCUwQSUwQW1vZGVsJTIwJTNEJTIwT3dsVmlUTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm93bHZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdml0LWJhc2UtcGF0Y2gzMiUyMiklMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoJTBBJTIwJTIwJTIwJTIwdGV4dCUzRCU1QiU1QiUyMmElMjBwaG90byUyMG9mJTIwYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMGRvZyUyMiU1RCUyQyUyMCU1QiUyMnBob3RvJTIwb2YlMjBhJTIwYXN0cmFuYXV0JTIyJTVEJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUwQSklMEF0ZXh0X2ZlYXR1cmVzJTIwJTNEJTIwbW9kZWwuZ2V0X3RleHRfZmVhdHVyZXMoKippbnB1dHMp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, OwlViTModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = OwlViTModel.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&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)`}}),{c(){c=s("p"),T=i("Examples:"),g=m(),b(f.$$.fragment)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Examples:"),p.forEach(o),g=h(r),v(f.$$.fragment,r)},m(r,p){_(r,c,p),e(c,T),_(r,g,p),y(f,r,p),w=!0},p:Je,i(r){w||(M(f.$$.fragment,r),w=!0)},o(r){V(f.$$.fragment,r),w=!1},d(r){r&&o(c),r&&o(g),j(f,r)}}}function Sp($){let c,T,g,f,w;return{c(){c=s("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),f=i("Module"),w=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(p,"CODE",{});var O=a(g);f=l(O,"Module"),O.forEach(o),w=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(r,p){_(r,c,p),e(c,T),e(c,g),e(g,f),e(c,w)},d(r){r&&o(c)}}}function Lp($){let c,T,g,f,w;return f=new K({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyME93bFZpVE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBPd2xWaVRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdml0LWJhc2UtcGF0Y2gzMiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2aXQtYmFzZS1wYXRjaDMyJTIyKSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQWltYWdlX2ZlYXR1cmVzJTIwJTNEJTIwbW9kZWwuZ2V0X2ltYWdlX2ZlYXR1cmVzKCoqaW5wdXRzKQ==",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, OwlViTModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = OwlViTModel.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&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)`}}),{c(){c=s("p"),T=i("Examples:"),g=m(),b(f.$$.fragment)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Examples:"),p.forEach(o),g=h(r),v(f.$$.fragment,r)},m(r,p){_(r,c,p),e(c,T),_(r,g,p),y(f,r,p),w=!0},p:Je,i(r){w||(M(f.$$.fragment,r),w=!0)},o(r){V(f.$$.fragment,r),w=!1},d(r){r&&o(c),r&&o(g),j(f,r)}}}function Kp($){let c,T,g,f,w;return{c(){c=s("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),f=i("Module"),w=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(p,"CODE",{});var O=a(g);f=l(O,"Module"),O.forEach(o),w=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(r,p){_(r,c,p),e(c,T),e(c,g),e(g,f),e(c,w)},d(r){r&&o(c)}}}function em($){let c,T,g,f,w;return f=new K({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMkMlMjBPd2xWaVRUZXh0TW9kZWwlMEElMEFtb2RlbCUyMCUzRCUyME93bFZpVFRleHRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdml0LWJhc2UtcGF0Y2gzMiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2aXQtYmFzZS1wYXRjaDMyJTIyKSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvciglMEElMjAlMjAlMjAlMjB0ZXh0JTNEJTVCJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTJDJTIwJTVCJTIycGhvdG8lMjBvZiUyMGElMjBhc3RyYW5hdXQlMjIlNUQlNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsYXN0X2hpZGRlbl9zdGF0ZSUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFwb29sZWRfb3V0cHV0JTIwJTNEJTIwb3V0cHV0cy5wb29sZXJfb3V0cHV0JTIwJTIwJTIzJTIwcG9vbGVkJTIwKEVPUyUyMHRva2VuKSUyMHN0YXRlcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, OwlViTTextModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = OwlViTTextModel.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&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>`}}),{c(){c=s("p"),T=i("Examples:"),g=m(),b(f.$$.fragment)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Examples:"),p.forEach(o),g=h(r),v(f.$$.fragment,r)},m(r,p){_(r,c,p),e(c,T),_(r,g,p),y(f,r,p),w=!0},p:Je,i(r){w||(M(f.$$.fragment,r),w=!0)},o(r){V(f.$$.fragment,r),w=!1},d(r){r&&o(c),r&&o(g),j(f,r)}}}function tm($){let c,T,g,f,w;return{c(){c=s("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),f=i("Module"),w=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(p,"CODE",{});var O=a(g);f=l(O,"Module"),O.forEach(o),w=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(r,p){_(r,c,p),e(c,T),e(c,g),e(g,f),e(c,w)},d(r){r&&o(c)}}}function om($){let c,T,g,f,w;return f=new K({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Byb2Nlc3NvciUyQyUyME93bFZpVFZpc2lvbk1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBPd2xWaVRWaXNpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdml0LWJhc2UtcGF0Y2gzMiUyMiklMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZvd2x2aXQtYmFzZS1wYXRjaDMyJTIyKSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsYXN0X2hpZGRlbl9zdGF0ZSUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFwb29sZWRfb3V0cHV0JTIwJTNEJTIwb3V0cHV0cy5wb29sZXJfb3V0cHV0JTIwJTIwJTIzJTIwcG9vbGVkJTIwQ0xTJTIwc3RhdGVz",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, OwlViTVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = OwlViTVisionModel.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&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>`}}),{c(){c=s("p"),T=i("Examples:"),g=m(),b(f.$$.fragment)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Examples:"),p.forEach(o),g=h(r),v(f.$$.fragment,r)},m(r,p){_(r,c,p),e(c,T),_(r,g,p),y(f,r,p),w=!0},p:Je,i(r){w||(M(f.$$.fragment,r),w=!0)},o(r){V(f.$$.fragment,r),w=!1},d(r){r&&o(c),r&&o(g),j(f,r)}}}function sm($){let c,T,g,f,w;return{c(){c=s("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),f=i("Module"),w=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(p,"CODE",{});var O=a(g);f=l(O,"Module"),O.forEach(o),w=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(r,p){_(r,c,p),e(c,T),e(c,g),e(g,f),e(c,w)},d(r){r&&o(c)}}}function nm($){let c,T,g,f,w;return f=new K({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwT3dsVmlURm9yT2JqZWN0RGV0ZWN0aW9uJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdml0LWJhc2UtcGF0Y2gzMiUyMiklMEFtb2RlbCUyMCUzRCUyME93bFZpVEZvck9iamVjdERldGVjdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdml0LWJhc2UtcGF0Y2gzMiUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBdGV4dHMlMjAlM0QlMjAlNUIlNUIlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBjYXQlMjIlMkMlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGElMjBkb2clMjIlNUQlNUQlMEFpbnB1dHMlMjAlM0QlMjBwcm9jZXNzb3IodGV4dCUzRHRleHRzJTJDJTIwaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEElMjMlMjBUYXJnZXQlMjBpbWFnZSUyMHNpemVzJTIwKGhlaWdodCUyQyUyMHdpZHRoKSUyMHRvJTIwcmVzY2FsZSUyMGJveCUyMHByZWRpY3Rpb25zJTIwJTVCYmF0Y2hfc2l6ZSUyQyUyMDIlNUQlMEF0YXJnZXRfc2l6ZXMlMjAlM0QlMjB0b3JjaC5UZW5zb3IoJTVCaW1hZ2Uuc2l6ZSU1QiUzQSUzQS0xJTVEJTVEKSUwQSUyMyUyMENvbnZlcnQlMjBvdXRwdXRzJTIwKGJvdW5kaW5nJTIwYm94ZXMlMjBhbmQlMjBjbGFzcyUyMGxvZ2l0cyklMjB0byUyMGZpbmFsJTIwYm91bmRpbmclMjBib3hlcyUyMGFuZCUyMHNjb3JlcyUwQXJlc3VsdHMlMjAlM0QlMjBwcm9jZXNzb3IucG9zdF9wcm9jZXNzX29iamVjdF9kZXRlY3Rpb24oJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUzRG91dHB1dHMlMkMlMjB0aHJlc2hvbGQlM0QwLjElMkMlMjB0YXJnZXRfc2l6ZXMlM0R0YXJnZXRfc2l6ZXMlMEEpJTBBJTBBaSUyMCUzRCUyMDAlMjAlMjAlMjMlMjBSZXRyaWV2ZSUyMHByZWRpY3Rpb25zJTIwZm9yJTIwdGhlJTIwZmlyc3QlMjBpbWFnZSUyMGZvciUyMHRoZSUyMGNvcnJlc3BvbmRpbmclMjB0ZXh0JTIwcXVlcmllcyUwQXRleHQlMjAlM0QlMjB0ZXh0cyU1QmklNUQlMEFib3hlcyUyQyUyMHNjb3JlcyUyQyUyMGxhYmVscyUyMCUzRCUyMHJlc3VsdHMlNUJpJTVEJTVCJTIyYm94ZXMlMjIlNUQlMkMlMjByZXN1bHRzJTVCaSU1RCU1QiUyMnNjb3JlcyUyMiU1RCUyQyUyMHJlc3VsdHMlNUJpJTVEJTVCJTIybGFiZWxzJTIyJTVEJTBBJTBBZm9yJTIwYm94JTJDJTIwc2NvcmUlMkMlMjBsYWJlbCUyMGluJTIwemlwKGJveGVzJTJDJTIwc2NvcmVzJTJDJTIwbGFiZWxzKSUzQSUwQSUyMCUyMCUyMCUyMGJveCUyMCUzRCUyMCU1QnJvdW5kKGklMkMlMjAyKSUyMGZvciUyMGklMjBpbiUyMGJveC50b2xpc3QoKSU1RCUwQSUyMCUyMCUyMCUyMHByaW50KGYlMjJEZXRlY3RlZCUyMCU3QnRleHQlNUJsYWJlbCU1RCU3RCUyMHdpdGglMjBjb25maWRlbmNlJTIwJTdCcm91bmQoc2NvcmUuaXRlbSgpJTJDJTIwMyklN0QlMjBhdCUyMGxvY2F0aW9uJTIwJTdCYm94JTdEJTIyKQ==",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> AutoProcessor, OwlViTForObjectDetection

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OwlViTForObjectDetection.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&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 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.1</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.707</span> at location [<span class="hljs-number">324.97</span>, <span class="hljs-number">20.44</span>, <span class="hljs-number">640.58</span>, <span class="hljs-number">373.29</span>]
Detected a photo of a cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.717</span> at location [<span class="hljs-number">1.46</span>, <span class="hljs-number">55.26</span>, <span class="hljs-number">315.55</span>, <span class="hljs-number">472.17</span>]`}}),{c(){c=s("p"),T=i("Examples:"),g=m(),b(f.$$.fragment)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Examples:"),p.forEach(o),g=h(r),v(f.$$.fragment,r)},m(r,p){_(r,c,p),e(c,T),_(r,g,p),y(f,r,p),w=!0},p:Je,i(r){w||(M(f.$$.fragment,r),w=!0)},o(r){V(f.$$.fragment,r),w=!1},d(r){r&&o(c),r&&o(g),j(f,r)}}}function rm($){let c,T,g,f,w;return{c(){c=s("p"),T=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s("code"),f=i("Module"),w=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n(p,"CODE",{});var O=a(g);f=l(O,"Module"),O.forEach(o),w=l(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(r,p){_(r,c,p),e(c,T),e(c,g),e(g,f),e(c,w)},d(r){r&&o(c)}}}function am($){let c,T,g,f,w;return f=new K({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwT3dsVmlURm9yT2JqZWN0RGV0ZWN0aW9uJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdml0LWJhc2UtcGF0Y2gxNiUyMiklMEFtb2RlbCUyMCUzRCUyME93bFZpVEZvck9iamVjdERldGVjdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGb3dsdml0LWJhc2UtcGF0Y2gxNiUyMiklMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMzk3NjkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBcXVlcnlfdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDAxNjc1LmpwZyUyMiUwQXF1ZXJ5X2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQocXVlcnlfdXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZXMlM0RpbWFnZSUyQyUyMHF1ZXJ5X2ltYWdlcyUzRHF1ZXJ5X2ltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmltYWdlX2d1aWRlZF9kZXRlY3Rpb24oKippbnB1dHMpJTBBJTIzJTIwVGFyZ2V0JTIwaW1hZ2UlMjBzaXplcyUyMChoZWlnaHQlMkMlMjB3aWR0aCklMjB0byUyMHJlc2NhbGUlMjBib3glMjBwcmVkaWN0aW9ucyUyMCU1QmJhdGNoX3NpemUlMkMlMjAyJTVEJTBBdGFyZ2V0X3NpemVzJTIwJTNEJTIwdG9yY2guVGVuc29yKCU1QmltYWdlLnNpemUlNUIlM0ElM0EtMSU1RCU1RCklMEElMjMlMjBDb252ZXJ0JTIwb3V0cHV0cyUyMChib3VuZGluZyUyMGJveGVzJTIwYW5kJTIwY2xhc3MlMjBsb2dpdHMpJTIwdG8lMjBDT0NPJTIwQVBJJTBBcmVzdWx0cyUyMCUzRCUyMHByb2Nlc3Nvci5wb3N0X3Byb2Nlc3NfaW1hZ2VfZ3VpZGVkX2RldGVjdGlvbiglMEElMjAlMjAlMjAlMjBvdXRwdXRzJTNEb3V0cHV0cyUyQyUyMHRocmVzaG9sZCUzRDAuNiUyQyUyMG5tc190aHJlc2hvbGQlM0QwLjMlMkMlMjB0YXJnZXRfc2l6ZXMlM0R0YXJnZXRfc2l6ZXMlMEEpJTBBaSUyMCUzRCUyMDAlMjAlMjAlMjMlMjBSZXRyaWV2ZSUyMHByZWRpY3Rpb25zJTIwZm9yJTIwdGhlJTIwZmlyc3QlMjBpbWFnZSUwQWJveGVzJTJDJTIwc2NvcmVzJTIwJTNEJTIwcmVzdWx0cyU1QmklNUQlNUIlMjJib3hlcyUyMiU1RCUyQyUyMHJlc3VsdHMlNUJpJTVEJTVCJTIyc2NvcmVzJTIyJTVEJTBBZm9yJTIwYm94JTJDJTIwc2NvcmUlMjBpbiUyMHppcChib3hlcyUyQyUyMHNjb3JlcyklM0ElMEElMjAlMjAlMjAlMjBib3glMjAlM0QlMjAlNUJyb3VuZChpJTJDJTIwMiklMjBmb3IlMjBpJTIwaW4lMjBib3gudG9saXN0KCklNUQlMEElMjAlMjAlMjAlMjBwcmludChmJTIyRGV0ZWN0ZWQlMjBzaW1pbGFyJTIwb2JqZWN0JTIwd2l0aCUyMGNvbmZpZGVuY2UlMjAlN0Jyb3VuZChzY29yZS5pdGVtKCklMkMlMjAzKSU3RCUyMGF0JTIwbG9jYXRpb24lMjAlN0Jib3glN0QlMjIp",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> AutoProcessor, OwlViTForObjectDetection

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch16&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OwlViTForObjectDetection.from_pretrained(<span class="hljs-string">&quot;google/owlvit-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>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-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"># 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 COCO API</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.6</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.856</span> at location [<span class="hljs-number">10.94</span>, <span class="hljs-number">50.4</span>, <span class="hljs-number">315.8</span>, <span class="hljs-number">471.39</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">334.84</span>, <span class="hljs-number">25.33</span>, <span class="hljs-number">636.16</span>, <span class="hljs-number">374.71</span>]`}}),{c(){c=s("p"),T=i("Examples:"),g=m(),b(f.$$.fragment)},l(r){c=n(r,"P",{});var p=a(c);T=l(p,"Examples:"),p.forEach(o),g=h(r),v(f.$$.fragment,r)},m(r,p){_(r,c,p),e(c,T),_(r,g,p),y(f,r,p),w=!0},p:Je,i(r){w||(M(f.$$.fragment,r),w=!0)},o(r){V(f.$$.fragment,r),w=!1},d(r){r&&o(c),r&&o(g),j(f,r)}}}function im($){let c,T,g,f,w,r,p,O,Qr,Wn,ee,Oe,Fs,Ot,Yr,Rs,Sr,Bn,xe,Lr,xt,Kr,ea,Nn,Po,ta,Pn,Fo,Gs,oa,Fn,te,ze,Ds,zt,sa,As,na,Rn,Ie,ra,Ro,aa,ia,Gn,x,Go,la,ca,Do,da,pa,Ao,ma,ha,Xo,fa,ga,qo,ua,_a,Ho,wa,Ta,Qo,ba,va,Dn,It,An,S,ya,Ut,Ma,Va,kt,ja,$a,Xn,oe,Ue,Xs,Et,Ja,qs,Oa,qn,C,Ct,xa,L,Yo,za,Ia,So,Ua,ka,Zt,Ea,Ca,Za,se,Wa,Lo,Ba,Na,Ko,Pa,Fa,Ra,ke,Wt,Ga,Bt,Da,es,Aa,Xa,Hn,ne,Ee,Hs,Nt,qa,Qs,Ha,Qn,Z,Pt,Qa,re,Ya,ts,Sa,La,Ft,Ka,ei,ti,ae,oi,os,si,ni,ss,ri,ai,ii,Ce,Yn,ie,Ze,Ys,Rt,li,Ss,ci,Sn,W,Gt,di,le,pi,ns,mi,hi,Dt,fi,gi,ui,ce,_i,rs,wi,Ti,as,bi,vi,yi,We,Ln,de,Be,Ls,At,Mi,Ks,Vi,Kn,I,Xt,ji,en,$i,Ji,qt,Oi,is,xi,zi,Ii,Ne,Ht,Ui,tn,ki,Ei,Pe,Qt,Ci,Yt,Zi,ls,Wi,Bi,Ni,Fe,St,Pi,Lt,Fi,cs,Ri,Gi,er,pe,Re,on,Kt,Di,sn,Ai,tr,B,eo,Xi,Ge,to,qi,nn,Hi,Qi,De,oo,Yi,so,Si,ds,Li,Ki,el,Ae,no,tl,ro,ol,ps,sl,nl,or,me,Xe,rn,ao,rl,an,al,sr,z,io,il,U,ll,ms,cl,dl,hs,pl,ml,fs,hl,fl,ln,gl,ul,gs,_l,wl,Tl,qe,lo,bl,co,vl,us,yl,Ml,Vl,He,po,jl,mo,$l,_s,Jl,Ol,xl,Qe,ho,zl,fo,Il,ws,Ul,kl,El,Ye,go,Cl,uo,Zl,cn,Wl,Bl,Nl,Se,_o,Pl,wo,Fl,Ts,Rl,Gl,nr,he,Le,dn,To,Dl,pn,Al,rr,N,bo,Xl,F,vo,ql,fe,Hl,bs,Ql,Yl,mn,Sl,Ll,Kl,Ke,ec,et,tc,R,yo,oc,ge,sc,vs,nc,rc,hn,ac,ic,lc,tt,cc,ot,dc,G,Mo,pc,ue,mc,ys,hc,fc,fn,gc,uc,_c,st,wc,nt,ar,_e,rt,gn,Vo,Tc,un,bc,ir,we,jo,vc,D,$o,yc,Te,Mc,Ms,Vc,jc,_n,$c,Jc,Oc,at,xc,it,lr,be,lt,wn,Jo,zc,Tn,Ic,cr,ve,Oo,Uc,A,xo,kc,ye,Ec,Vs,Cc,Zc,bn,Wc,Bc,Nc,ct,Pc,dt,dr,Me,pt,vn,zo,Fc,yn,Rc,pr,Y,Io,Gc,X,Uo,Dc,Ve,Ac,js,Xc,qc,Mn,Hc,Qc,Yc,mt,Sc,ht,Lc,q,ko,Kc,je,ed,$s,td,od,Vn,sd,nd,rd,ft,ad,gt,mr;return r=new P({}),Ot=new P({}),zt=new P({}),It=new K({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBPd2xWaVRQcm9jZXNzb3IlMkMlMjBPd2xWaVRGb3JPYmplY3REZXRlY3Rpb24lMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBPd2xWaVRQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm93bHZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBbW9kZWwlMjAlM0QlMjBPd2xWaVRGb3JPYmplY3REZXRlY3Rpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm93bHZpdC1iYXNlLXBhdGNoMzIlMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQXRleHRzJTIwJTNEJTIwJTVCJTVCJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwY2F0JTIyJTJDJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhJTIwZG9nJTIyJTVEJTVEJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKHRleHQlM0R0ZXh0cyUyQyUyMGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBJTIzJTIwVGFyZ2V0JTIwaW1hZ2UlMjBzaXplcyUyMChoZWlnaHQlMkMlMjB3aWR0aCklMjB0byUyMHJlc2NhbGUlMjBib3glMjBwcmVkaWN0aW9ucyUyMCU1QmJhdGNoX3NpemUlMkMlMjAyJTVEJTBBdGFyZ2V0X3NpemVzJTIwJTNEJTIwdG9yY2guVGVuc29yKCU1QmltYWdlLnNpemUlNUIlM0ElM0EtMSU1RCU1RCklMEElMjMlMjBDb252ZXJ0JTIwb3V0cHV0cyUyMChib3VuZGluZyUyMGJveGVzJTIwYW5kJTIwY2xhc3MlMjBsb2dpdHMpJTIwdG8lMjBDT0NPJTIwQVBJJTBBcmVzdWx0cyUyMCUzRCUyMHByb2Nlc3Nvci5wb3N0X3Byb2Nlc3Nfb2JqZWN0X2RldGVjdGlvbihvdXRwdXRzJTNEb3V0cHV0cyUyQyUyMHRhcmdldF9zaXplcyUzRHRhcmdldF9zaXplcyUyQyUyMHRocmVzaG9sZCUzRDAuMSklMEFpJTIwJTNEJTIwMCUyMCUyMCUyMyUyMFJldHJpZXZlJTIwcHJlZGljdGlvbnMlMjBmb3IlMjB0aGUlMjBmaXJzdCUyMGltYWdlJTIwZm9yJTIwdGhlJTIwY29ycmVzcG9uZGluZyUyMHRleHQlMjBxdWVyaWVzJTBBdGV4dCUyMCUzRCUyMHRleHRzJTVCaSU1RCUwQWJveGVzJTJDJTIwc2NvcmVzJTJDJTIwbGFiZWxzJTIwJTNEJTIwcmVzdWx0cyU1QmklNUQlNUIlMjJib3hlcyUyMiU1RCUyQyUyMHJlc3VsdHMlNUJpJTVEJTVCJTIyc2NvcmVzJTIyJTVEJTJDJTIwcmVzdWx0cyU1QmklNUQlNUIlMjJsYWJlbHMlMjIlNUQlMEFmb3IlMjBib3glMkMlMjBzY29yZSUyQyUyMGxhYmVsJTIwaW4lMjB6aXAoYm94ZXMlMkMlMjBzY29yZXMlMkMlMjBsYWJlbHMpJTNBJTBBJTIwJTIwJTIwJTIwYm94JTIwJTNEJTIwJTVCcm91bmQoaSUyQyUyMDIpJTIwZm9yJTIwaSUyMGluJTIwYm94LnRvbGlzdCgpJTVEJTBBJTIwJTIwJTIwJTIwcHJpbnQoZiUyMkRldGVjdGVkJTIwJTdCdGV4dCU1QmxhYmVsJTVEJTdEJTIwd2l0aCUyMGNvbmZpZGVuY2UlMjAlN0Jyb3VuZChzY29yZS5pdGVtKCklMkMlMjAzKSU3RCUyMGF0JTIwbG9jYXRpb24lMjAlN0Jib3glN0QlMjIp",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> OwlViTProcessor, OwlViTForObjectDetection

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = OwlViTProcessor.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OwlViTForObjectDetection.from_pretrained(<span class="hljs-string">&quot;google/owlvit-base-patch32&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 COCO API</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.707</span> at location [<span class="hljs-number">324.97</span>, <span class="hljs-number">20.44</span>, <span class="hljs-number">640.58</span>, <span class="hljs-number">373.29</span>]
Detected a photo of a cat <span class="hljs-keyword">with</span> confidence <span class="hljs-number">0.717</span> at location [<span class="hljs-number">1.46</span>, <span class="hljs-number">55.26</span>, <span class="hljs-number">315.55</span>, <span class="hljs-number">472.17</span>]`}}),Et=new P({}),Ct=new J({props:{name:"class transformers.OwlViTConfig",anchor:"transformers.OwlViTConfig",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.OwlViTConfig.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/v4.32.0/en/model_doc/owlvit#transformers.OwlViTTextConfig">OwlViTTextConfig</a>.`,name:"text_config"},{anchor:"transformers.OwlViTConfig.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/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionConfig">OwlViTVisionConfig</a>.`,name:"vision_config"},{anchor:"transformers.OwlViTConfig.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.OwlViTConfig.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 OWL-ViT
implementation.`,name:"logit_scale_init_value"},{anchor:"transformers.OwlViTConfig.kwargs",description:`<strong>kwargs</strong> (<em>optional</em>) &#x2014;
Dictionary of keyword arguments.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/configuration_owlvit.py#L251"}}),Wt=new J({props:{name:"from_text_vision_configs",anchor:"transformers.OwlViTConfig.from_text_vision_configs",parameters:[{name:"text_config",val:": typing.Dict"},{name:"vision_config",val:": typing.Dict"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/configuration_owlvit.py#L318",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTConfig"
>OwlViTConfig</a></p>
`}}),Nt=new P({}),Pt=new J({props:{name:"class transformers.OwlViTTextConfig",anchor:"transformers.OwlViTTextConfig",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.OwlViTTextConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 49408) &#x2014;
Vocabulary size of the OWL-ViT 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/v4.32.0/en/model_doc/owlvit#transformers.OwlViTTextModel">OwlViTTextModel</a>.`,name:"vocab_size"},{anchor:"transformers.OwlViTTextConfig.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.OwlViTTextConfig.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.OwlViTTextConfig.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.OwlViTTextConfig.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.OwlViTTextConfig.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.OwlViTTextConfig.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.OwlViTTextConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.OwlViTTextConfig.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.OwlViTTextConfig.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.OwlViTTextConfig.initializer_factor",description:`<strong>initializer_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#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/v4.32.0/src/transformers/models/owlvit/configuration_owlvit.py#L40"}}),Ce=new $e({props:{anchor:"transformers.OwlViTTextConfig.example",$$slots:{default:[Ap]},$$scope:{ctx:$}}}),Rt=new P({}),Gt=new J({props:{name:"class transformers.OwlViTVisionConfig",anchor:"transformers.OwlViTVisionConfig",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:" = 32"},{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.OwlViTVisionConfig.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.OwlViTVisionConfig.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.OwlViTVisionConfig.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.OwlViTVisionConfig.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.OwlViTVisionConfig.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.OwlViTVisionConfig.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.OwlViTVisionConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.OwlViTVisionConfig.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.OwlViTVisionConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.OwlViTVisionConfig.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.OwlViTVisionConfig.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.OwlViTVisionConfig.initializer_factor",description:`<strong>initializer_factor</strong> (\`float&#x201C;, <em>optional</em>, defaults to 1) &#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/v4.32.0/src/transformers/models/owlvit/configuration_owlvit.py#L146"}}),We=new $e({props:{anchor:"transformers.OwlViTVisionConfig.example",$$slots:{default:[Xp]},$$scope:{ctx:$}}}),At=new P({}),Xt=new J({props:{name:"class transformers.OwlViTImageProcessor",anchor:"transformers.OwlViTImageProcessor",parameters:[{name:"do_resize",val:" = True"},{name:"size",val:" = None"},{name:"resample",val:" = <Resampling.BICUBIC: 3>"},{name:"do_center_crop",val:" = False"},{name:"crop_size",val:" = None"},{name:"do_rescale",val:" = True"},{name:"rescale_factor",val:" = 0.00392156862745098"},{name:"do_normalize",val:" = True"},{name:"image_mean",val:" = None"},{name:"image_std",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.OwlViTImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the shorter edge of the input to a certain <code>size</code>.`,name:"do_resize"},{anchor:"transformers.OwlViTImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to {&#x201C;height&#x201D; &#x2014; 768, &#x201C;width&#x201D;: 768}):
The size to use for resizing the image. Only has an effect if <code>do_resize</code> is set to <code>True</code>. If <code>size</code> is a
sequence like (h, w), output size will be matched to this. If <code>size</code> is an int, then image will be resized
to (size, size).`,name:"size"},{anchor:"transformers.OwlViTImageProcessor.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>PIL.Image.Resampling.BICUBIC</code>) &#x2014;
An optional resampling filter. This can be one of <code>PIL.Image.Resampling.NEAREST</code>,
<code>PIL.Image.Resampling.BOX</code>, <code>PIL.Image.Resampling.BILINEAR</code>, <code>PIL.Image.Resampling.HAMMING</code>,
<code>PIL.Image.Resampling.BICUBIC</code> or <code>PIL.Image.Resampling.LANCZOS</code>. Only has an effect if <code>do_resize</code> is set
to <code>True</code>.`,name:"resample"},{anchor:"transformers.OwlViTImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to crop the input at the center. If the input size is smaller than <code>crop_size</code> along any edge, the
image is padded with 0&#x2019;s and then center cropped.`,name:"do_center_crop"},{anchor:"transformers.OwlViTImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>int</code>, <em>optional</em>, defaults to {&#x201C;height&#x201D; &#x2014; 768, &#x201C;width&#x201D;: 768}):
The size to use for center cropping the image. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.OwlViTImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the input by a certain factor.`,name:"do_rescale"},{anchor:"transformers.OwlViTImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
The factor to use for rescaling the image. Only has an effect if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.OwlViTImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to normalize the input with <code>image_mean</code> and <code>image_std</code>. Desired output size when applying
center-cropping. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"do_normalize"},{anchor:"transformers.OwlViTImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[0.48145466, 0.4578275, 0.40821073]</code>) &#x2014;
The sequence of means for each channel, to be used when normalizing images.`,name:"image_mean"},{anchor:"transformers.OwlViTImageProcessor.image_std",description:`<strong>image_std</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[0.26862954, 0.26130258, 0.27577711]</code>) &#x2014;
The sequence of standard deviations for each channel, to be used when normalizing images.`,name:"image_std"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/image_processing_owlvit.py#L90"}}),Ht=new J({props:{name:"preprocess",anchor:"transformers.OwlViTImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"resample",val:": Resampling = None"},{name:"do_center_crop",val:": typing.Optional[bool] = None"},{name:"crop_size",val:": typing.Union[typing.Dict[str, int], NoneType] = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.OwlViTImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
The image or batch of images to be prepared.`,name:"images"},{anchor:"transformers.OwlViTImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether or not to resize the input. If <code>True</code>, will resize the input to the size specified by <code>size</code>.`,name:"do_resize"},{anchor:"transformers.OwlViTImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
The size to resize the input to. Only has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"size"},{anchor:"transformers.OwlViTImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
The resampling filter to use when resizing the input. Only has an effect if <code>do_resize</code> is set to
<code>True</code>.`,name:"resample"},{anchor:"transformers.OwlViTImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether or not to center crop the input. If <code>True</code>, will center crop the input to the size specified by
<code>crop_size</code>.`,name:"do_center_crop"},{anchor:"transformers.OwlViTImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
The size to center crop the input to. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.OwlViTImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether or not to rescale the input. If <code>True</code>, will rescale the input by dividing it by
<code>rescale_factor</code>.`,name:"do_rescale"},{anchor:"transformers.OwlViTImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
The factor to rescale the input by. Only has an effect if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.OwlViTImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether or not to normalize the input. If <code>True</code>, will normalize the input by subtracting <code>image_mean</code>
and dividing by <code>image_std</code>.`,name:"do_normalize"},{anchor:"transformers.OwlViTImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>Union[float, List[float]]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
The mean to subtract from the input when normalizing. Only has an effect if <code>do_normalize</code> is set to
<code>True</code>.`,name:"image_mean"},{anchor:"transformers.OwlViTImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>Union[float, List[float]]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
The standard deviation to divide the input by when normalizing. Only has an effect if <code>do_normalize</code> is
set to <code>True</code>.`,name:"image_std"},{anchor:"transformers.OwlViTImageProcessor.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.OwlViTImageProcessor.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>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: defaults to the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.OwlViTImageProcessor.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/v4.32.0/src/transformers/models/owlvit/image_processing_owlvit.py#L268"}}),Qt=new J({props:{name:"post_process_object_detection",anchor:"transformers.OwlViTImageProcessor.post_process_object_detection",parameters:[{name:"outputs",val:""},{name:"threshold",val:": float = 0.1"},{name:"target_sizes",val:": typing.Union[transformers.utils.generic.TensorType, typing.List[typing.Tuple]] = None"}],parametersDescription:[{anchor:"transformers.OwlViTImageProcessor.post_process_object_detection.outputs",description:`<strong>outputs</strong> (<code>OwlViTObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.OwlViTImageProcessor.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.OwlViTImageProcessor.post_process_object_detection.target_sizes",description:`<strong>target_sizes</strong> (<code>torch.Tensor</code> or <code>List[Tuple[int, int]]</code>, <em>optional</em>) &#x2014;
Tensor of shape <code>(batch_size, 2)</code> or list of tuples (<code>Tuple[int, int]</code>) containing the target size
<code>(height, width)</code> of each image in the batch. If unset, predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/image_processing_owlvit.py#L450",returnDescription:`
<p>A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
in the batch as predicted by the model.</p>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),St=new J({props:{name:"post_process_image_guided_detection",anchor:"transformers.OwlViTImageProcessor.post_process_image_guided_detection",parameters:[{name:"outputs",val:""},{name:"threshold",val:" = 0.6"},{name:"nms_threshold",val:" = 0.3"},{name:"target_sizes",val:" = None"}],parametersDescription:[{anchor:"transformers.OwlViTImageProcessor.post_process_image_guided_detection.outputs",description:`<strong>outputs</strong> (<code>OwlViTImageGuidedObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.OwlViTImageProcessor.post_process_image_guided_detection.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.6) &#x2014;
Minimum confidence threshold to use to filter out predicted boxes.`,name:"threshold"},{anchor:"transformers.OwlViTImageProcessor.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.OwlViTImageProcessor.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/v4.32.0/src/transformers/models/owlvit/image_processing_owlvit.py#L506",returnDescription:`
<p>A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
in the batch as predicted by the model. All labels are set to None as
<code>OwlViTForObjectDetection.image_guided_detection</code> perform one-shot object detection.</p>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),Kt=new P({}),eo=new J({props:{name:"class transformers.OwlViTFeatureExtractor",anchor:"transformers.OwlViTFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/feature_extraction_owlvit.py#L26"}}),to=new J({props:{name:"__call__",anchor:"transformers.OwlViTFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/image_processing_utils.py#L544"}}),oo=new J({props:{name:"post_process",anchor:"transformers.OwlViTFeatureExtractor.post_process",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:""}],parametersDescription:[{anchor:"transformers.OwlViTFeatureExtractor.post_process.outputs",description:`<strong>outputs</strong> (<code>OwlViTObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.OwlViTFeatureExtractor.post_process.target_sizes",description:`<strong>target_sizes</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, 2)</code>) &#x2014;
Tensor containing the size (h, w) of each image of the batch. For evaluation, this must be the original
image size (before any data augmentation). For visualization, this should be the image size after data
augment, but before padding.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/image_processing_owlvit.py#L404",returnDescription:`
<p>A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
in the batch as predicted by the model.</p>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),no=new J({props:{name:"post_process_image_guided_detection",anchor:"transformers.OwlViTFeatureExtractor.post_process_image_guided_detection",parameters:[{name:"outputs",val:""},{name:"threshold",val:" = 0.6"},{name:"nms_threshold",val:" = 0.3"},{name:"target_sizes",val:" = None"}],parametersDescription:[{anchor:"transformers.OwlViTFeatureExtractor.post_process_image_guided_detection.outputs",description:`<strong>outputs</strong> (<code>OwlViTImageGuidedObjectDetectionOutput</code>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.OwlViTFeatureExtractor.post_process_image_guided_detection.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.6) &#x2014;
Minimum confidence threshold to use to filter out predicted boxes.`,name:"threshold"},{anchor:"transformers.OwlViTFeatureExtractor.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.OwlViTFeatureExtractor.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/v4.32.0/src/transformers/models/owlvit/image_processing_owlvit.py#L506",returnDescription:`
<p>A list of dictionaries, each dictionary containing the scores, labels and boxes for an image
in the batch as predicted by the model. All labels are set to None as
<code>OwlViTForObjectDetection.image_guided_detection</code> perform one-shot object detection.</p>
`,returnType:`
<p><code>List[Dict]</code></p>
`}}),ao=new P({}),io=new J({props:{name:"class transformers.OwlViTProcessor",anchor:"transformers.OwlViTProcessor",parameters:[{name:"image_processor",val:" = None"},{name:"tokenizer",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.OwlViTProcessor.image_processor",description:`<strong>image_processor</strong> (<a href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTImageProcessor">OwlViTImageProcessor</a>) &#x2014;
The image processor is a required input.`,name:"image_processor"},{anchor:"transformers.OwlViTProcessor.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/v4.32.0/src/transformers/models/owlvit/processing_owlvit.py#L29"}}),lo=new J({props:{name:"batch_decode",anchor:"transformers.OwlViTProcessor.batch_decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/processing_owlvit.py#L196"}}),po=new J({props:{name:"decode",anchor:"transformers.OwlViTProcessor.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/processing_owlvit.py#L203"}}),ho=new J({props:{name:"post_process",anchor:"transformers.OwlViTProcessor.post_process",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/processing_owlvit.py#L175"}}),go=new J({props:{name:"post_process_image_guided_detection",anchor:"transformers.OwlViTProcessor.post_process_image_guided_detection",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/processing_owlvit.py#L189"}}),_o=new J({props:{name:"post_process_object_detection",anchor:"transformers.OwlViTProcessor.post_process_object_detection",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/processing_owlvit.py#L182"}}),To=new P({}),bo=new J({props:{name:"class transformers.OwlViTModel",anchor:"transformers.OwlViTModel",parameters:[{name:"config",val:": OwlViTConfig"}],parametersDescription:[{anchor:"transformers.OwlViTModel.This",description:`<strong>This</strong> model is a PyTorch [torch.nn.Module](https &#x2014;
//pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it`,name:"This"},{anchor:"transformers.OwlViTModel.as",description:`<strong>as</strong> a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and &#x2014;
behavior. &#x2014;
config (<a href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTConfig">OwlViTConfig</a>): Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"as"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L1038"}}),vo=new J({props:{name:"forward",anchor:"transformers.OwlViTModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"return_loss",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_base_image_embeds",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.OwlViTModel.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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.32.0/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.OwlViTModel.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.OwlViTModel.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.OwlViTModel.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.OwlViTModel.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.OwlViTModel.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.OwlViTModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L1153",returnDescription:`
<p>A <code>transformers.models.owlvit.modeling_owlvit.OwlViTOutput</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.owlvit.configuration_owlvit.OwlViTConfig'&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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTTextModel"
>OwlViTTextModel</a>.</li>
<li><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>) \u2014 The image embeddings obtained by applying the projection layer to the pooled output of
<a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"
>OwlViTVisionModel</a>.</li>
<li><strong>text_model_output</strong> (Tuple<code>BaseModelOutputWithPooling</code>) \u2014 The output of the <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTTextModel"
>OwlViTTextModel</a>.</li>
<li><strong>vision_model_output</strong> (<code>BaseModelOutputWithPooling</code>) \u2014 The output of the <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"
>OwlViTVisionModel</a>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.owlvit.modeling_owlvit.OwlViTOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ke=new No({props:{$$slots:{default:[qp]},$$scope:{ctx:$}}}),et=new $e({props:{anchor:"transformers.OwlViTModel.forward.example",$$slots:{default:[Hp]},$$scope:{ctx:$}}}),yo=new J({props:{name:"get_text_features",anchor:"transformers.OwlViTModel.get_text_features",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.OwlViTModel.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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.32.0/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.OwlViTModel.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.OwlViTModel.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.OwlViTModel.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.OwlViTModel.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/v4.32.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L1073",returnDescription:`
<p>The text embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTTextModel"
>OwlViTTextModel</a>.</p>
`,returnType:`
<p>text_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),tt=new No({props:{$$slots:{default:[Qp]},$$scope:{ctx:$}}}),ot=new $e({props:{anchor:"transformers.OwlViTModel.get_text_features.example",$$slots:{default:[Yp]},$$scope:{ctx:$}}}),Mo=new J({props:{name:"get_image_features",anchor:"transformers.OwlViTModel.get_image_features",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.OwlViTModel.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.OwlViTModel.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.OwlViTModel.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.OwlViTModel.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/v4.32.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L1108",returnDescription:`
<p>The image embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"
>OwlViTVisionModel</a>.</p>
`,returnType:`
<p>image_features (<code>torch.FloatTensor</code> of shape <code>(batch_size, output_dim</code>)</p>
`}}),st=new No({props:{$$slots:{default:[Sp]},$$scope:{ctx:$}}}),nt=new $e({props:{anchor:"transformers.OwlViTModel.get_image_features.example",$$slots:{default:[Lp]},$$scope:{ctx:$}}}),Vo=new P({}),jo=new J({props:{name:"class transformers.OwlViTTextModel",anchor:"transformers.OwlViTTextModel",parameters:[{name:"config",val:": OwlViTTextConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L877"}}),$o=new J({props:{name:"forward",anchor:"transformers.OwlViTTextModel.forward",parameters:[{name:"input_ids",val:": Tensor"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.OwlViTTextModel.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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.32.0/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.OwlViTTextModel.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.OwlViTTextModel.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.OwlViTTextModel.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.OwlViTTextModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L892",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.owlvit.configuration_owlvit.OwlViTTextConfig'&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>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),at=new No({props:{$$slots:{default:[Kp]},$$scope:{ctx:$}}}),it=new $e({props:{anchor:"transformers.OwlViTTextModel.forward.example",$$slots:{default:[em]},$$scope:{ctx:$}}}),Jo=new P({}),Oo=new J({props:{name:"class transformers.OwlViTVisionModel",anchor:"transformers.OwlViTVisionModel",parameters:[{name:"config",val:": OwlViTVisionConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L987"}}),xo=new J({props:{name:"forward",anchor:"transformers.OwlViTVisionModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.OwlViTVisionModel.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.OwlViTVisionModel.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.OwlViTVisionModel.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.OwlViTVisionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L1000",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<code>&lt;class 'transformers.models.owlvit.configuration_owlvit.OwlViTVisionConfig'&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>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ct=new No({props:{$$slots:{default:[tm]},$$scope:{ctx:$}}}),dt=new $e({props:{anchor:"transformers.OwlViTVisionModel.forward.example",$$slots:{default:[om]},$$scope:{ctx:$}}}),zo=new P({}),Io=new J({props:{name:"class transformers.OwlViTForObjectDetection",anchor:"transformers.OwlViTForObjectDetection",parameters:[{name:"config",val:": OwlViTConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L1320"}}),Uo=new J({props:{name:"forward",anchor:"transformers.OwlViTForObjectDetection.forward",parameters:[{name:"input_ids",val:": Tensor"},{name:"pixel_values",val:": FloatTensor"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.OwlViTForObjectDetection.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.OwlViTForObjectDetection.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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.32.0/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.OwlViTForObjectDetection.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.OwlViTForObjectDetection.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.OwlViTForObjectDetection.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L1622",returnDescription:`
<p>A <code>transformers.models.owlvit.modeling_owlvit.OwlViTObjectDetectionOutput</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.owlvit.configuration_owlvit.OwlViTConfig'&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)) \u2014 Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a
bounding box loss. The latter is defined as a linear combination of the L1 loss and the generalized
scale-invariant IoU loss.</li>
<li><strong>loss_dict</strong> (<code>Dict</code>, <em>optional</em>) \u2014 A dictionary containing the individual losses. Useful for logging.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, num_queries)</code>) \u2014 Classification logits (including no-object) for all queries.</li>
<li><strong>pred_boxes</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, 4)</code>) \u2014 Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding
possible padding). You can use <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTImageProcessor.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>) \u2014 The text embeddings obtained by applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTTextModel"
>OwlViTTextModel</a>.</li>
<li><strong>image_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, patch_size, patch_size, output_dim</code>) \u2014 Pooled output of <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"
>OwlViTVisionModel</a>. OWL-ViT 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>) \u2014 Class embeddings 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>text_model_output</strong> (Tuple<code>BaseModelOutputWithPooling</code>) \u2014 The output of the <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTTextModel"
>OwlViTTextModel</a>.</li>
<li><strong>vision_model_output</strong> (<code>BaseModelOutputWithPooling</code>) \u2014 The output of the <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"
>OwlViTVisionModel</a>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.owlvit.modeling_owlvit.OwlViTObjectDetectionOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),mt=new No({props:{$$slots:{default:[sm]},$$scope:{ctx:$}}}),ht=new $e({props:{anchor:"transformers.OwlViTForObjectDetection.forward.example",$$slots:{default:[nm]},$$scope:{ctx:$}}}),ko=new J({props:{name:"image_guided_detection",anchor:"transformers.OwlViTForObjectDetection.image_guided_detection",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"query_pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.OwlViTForObjectDetection.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.OwlViTForObjectDetection.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.OwlViTForObjectDetection.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.OwlViTForObjectDetection.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.OwlViTForObjectDetection.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/v4.32.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/owlvit/modeling_owlvit.py#L1527",returnDescription:`
<p>A <code>transformers.models.owlvit.modeling_owlvit.OwlViTImageGuidedObjectDetectionOutput</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.owlvit.configuration_owlvit.OwlViTConfig'&gt;</code>) and inputs.</p>
<ul>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_patches, num_queries)</code>) \u2014 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>) \u2014 Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual target image in the batch
(disregarding possible padding). You can use <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTImageProcessor.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>) \u2014 Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). These
values are normalized in [0, 1], relative to the size of each individual query image in the batch
(disregarding possible padding). You can use <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTImageProcessor.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>) \u2014 Pooled output of <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"
>OwlViTVisionModel</a>. OWL-ViT 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>) \u2014 Pooled output of <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"
>OwlViTVisionModel</a>. OWL-ViT 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>) \u2014 Class embeddings 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>text_model_output</strong> (Tuple<code>BaseModelOutputWithPooling</code>) \u2014 The output of the <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTTextModel"
>OwlViTTextModel</a>.</li>
<li><strong>vision_model_output</strong> (<code>BaseModelOutputWithPooling</code>) \u2014 The output of the <a
  href="/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"
>OwlViTVisionModel</a>.</li>
</ul>
`,returnType:`
<p><code>transformers.models.owlvit.modeling_owlvit.OwlViTImageGuidedObjectDetectionOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ft=new No({props:{$$slots:{default:[rm]},$$scope:{ctx:$}}}),gt=new $e({props:{anchor:"transformers.OwlViTForObjectDetection.image_guided_detection.example",$$slots:{default:[am]},$$scope:{ctx:$}}}),{c(){c=s("meta"),T=m(),g=s("h1"),f=s("a"),w=s("span"),b(r.$$.fragment),p=m(),O=s("span"),Qr=i("OWL-ViT"),Wn=m(),ee=s("h2"),Oe=s("a"),Fs=s("span"),b(Ot.$$.fragment),Yr=m(),Rs=s("span"),Sr=i("Overview"),Bn=m(),xe=s("p"),Lr=i("The OWL-ViT (short for Vision Transformer for Open-World Localization) was proposed in "),xt=s("a"),Kr=i("Simple Open-Vocabulary Object Detection with Vision Transformers"),ea=i(" by Matthias Minderer, Alexey Gritsenko, Austin Stone, Maxim Neumann, Dirk Weissenborn, Alexey Dosovitskiy, Aravindh Mahendran, Anurag Arnab, Mostafa Dehghani, Zhuoran Shen, Xiao Wang, Xiaohua Zhai, Thomas Kipf, and Neil Houlsby. OWL-ViT is an open-vocabulary object detection network trained on a variety of (image, text) pairs. It can be used to query an image with one or multiple text queries to search for and detect target objects described in text."),Nn=m(),Po=s("p"),ta=i("The abstract from the paper is the following:"),Pn=m(),Fo=s("p"),Gs=s("em"),oa=i("Combining simple architectures with large-scale pre-training has led to massive improvements in image classification. For object detection, pre-training and scaling approaches are less well established, especially in the long-tailed and open-vocabulary setting, where training data is relatively scarce. In this paper, we propose a strong recipe for transferring image-text models to open-vocabulary object detection. We use a standard Vision Transformer architecture with minimal modifications, contrastive image-text pre-training, and end-to-end detection fine-tuning. Our analysis of the scaling properties of this setup shows that increasing image-level pre-training and model size yield consistent improvements on the downstream detection task. We provide the adaptation strategies and regularizations needed to attain very strong performance on zero-shot text-conditioned and one-shot image-conditioned object detection. Code and models are available on GitHub."),Fn=m(),te=s("h2"),ze=s("a"),Ds=s("span"),b(zt.$$.fragment),sa=m(),As=s("span"),na=i("Usage"),Rn=m(),Ie=s("p"),ra=i("OWL-ViT is a zero-shot text-conditioned object detection model. OWL-ViT uses "),Ro=s("a"),aa=i("CLIP"),ia=i(" 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."),Gn=m(),x=s("p"),Go=s("a"),la=i("OwlViTImageProcessor"),ca=i(" can be used to resize (or rescale) and normalize images for the model and "),Do=s("a"),da=i("CLIPTokenizer"),pa=i(" is used to encode the text. "),Ao=s("a"),ma=i("OwlViTProcessor"),ha=i(" wraps "),Xo=s("a"),fa=i("OwlViTImageProcessor"),ga=i(" and "),qo=s("a"),ua=i("CLIPTokenizer"),_a=i(" into a single instance to both encode the text and prepare the images. The following example shows how to perform object detection using "),Ho=s("a"),wa=i("OwlViTProcessor"),Ta=i(" and "),Qo=s("a"),ba=i("OwlViTForObjectDetection"),va=i("."),Dn=m(),b(It.$$.fragment),An=m(),S=s("p"),ya=i("This model was contributed by "),Ut=s("a"),Ma=i("adirik"),Va=i(". The original code can be found "),kt=s("a"),ja=i("here"),$a=i("."),Xn=m(),oe=s("h2"),Ue=s("a"),Xs=s("span"),b(Et.$$.fragment),Ja=m(),qs=s("span"),Oa=i("OwlViTConfig"),qn=m(),C=s("div"),b(Ct.$$.fragment),xa=m(),L=s("p"),Yo=s("a"),za=i("OwlViTConfig"),Ia=i(" is the configuration class to store the configuration of an "),So=s("a"),Ua=i("OwlViTModel"),ka=i(`. It is used to
instantiate an OWL-ViT 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 OWL-ViT
`),Zt=s("a"),Ea=i("google/owlvit-base-patch32"),Ca=i(" architecture."),Za=m(),se=s("p"),Wa=i("Configuration objects inherit from "),Lo=s("a"),Ba=i("PretrainedConfig"),Na=i(` and can be used to control the model outputs. Read the
documentation from `),Ko=s("a"),Pa=i("PretrainedConfig"),Fa=i(" for more information."),Ra=m(),ke=s("div"),b(Wt.$$.fragment),Ga=m(),Bt=s("p"),Da=i("Instantiate a "),es=s("a"),Aa=i("OwlViTConfig"),Xa=i(` (or a derived class) from owlvit text model configuration and owlvit vision
model configuration.`),Hn=m(),ne=s("h2"),Ee=s("a"),Hs=s("span"),b(Nt.$$.fragment),qa=m(),Qs=s("span"),Ha=i("OwlViTTextConfig"),Qn=m(),Z=s("div"),b(Pt.$$.fragment),Qa=m(),re=s("p"),Ya=i("This is the configuration class to store the configuration of an "),ts=s("a"),Sa=i("OwlViTTextModel"),La=i(`. It is used to instantiate an
OwlViT 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 OwlViT
`),Ft=s("a"),Ka=i("google/owlvit-base-patch32"),ei=i(" architecture."),ti=m(),ae=s("p"),oi=i("Configuration objects inherit from "),os=s("a"),si=i("PretrainedConfig"),ni=i(` and can be used to control the model outputs. Read the
documentation from `),ss=s("a"),ri=i("PretrainedConfig"),ai=i(" for more information."),ii=m(),b(Ce.$$.fragment),Yn=m(),ie=s("h2"),Ze=s("a"),Ys=s("span"),b(Rt.$$.fragment),li=m(),Ss=s("span"),ci=i("OwlViTVisionConfig"),Sn=m(),W=s("div"),b(Gt.$$.fragment),di=m(),le=s("p"),pi=i("This is the configuration class to store the configuration of an "),ns=s("a"),mi=i("OwlViTVisionModel"),hi=i(`. It is used to instantiate
an OWL-ViT 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 OWL-ViT
`),Dt=s("a"),fi=i("google/owlvit-base-patch32"),gi=i(" architecture."),ui=m(),ce=s("p"),_i=i("Configuration objects inherit from "),rs=s("a"),wi=i("PretrainedConfig"),Ti=i(` and can be used to control the model outputs. Read the
documentation from `),as=s("a"),bi=i("PretrainedConfig"),vi=i(" for more information."),yi=m(),b(We.$$.fragment),Ln=m(),de=s("h2"),Be=s("a"),Ls=s("span"),b(At.$$.fragment),Mi=m(),Ks=s("span"),Vi=i("OwlViTImageProcessor"),Kn=m(),I=s("div"),b(Xt.$$.fragment),ji=m(),en=s("p"),$i=i("Constructs an OWL-ViT image processor."),Ji=m(),qt=s("p"),Oi=i("This image processor inherits from "),is=s("a"),xi=i("ImageProcessingMixin"),zi=i(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Ii=m(),Ne=s("div"),b(Ht.$$.fragment),Ui=m(),tn=s("p"),ki=i("Prepares an image or batch of images for the model."),Ei=m(),Pe=s("div"),b(Qt.$$.fragment),Ci=m(),Yt=s("p"),Zi=i("Converts the raw output of "),ls=s("a"),Wi=i("OwlViTForObjectDetection"),Bi=i(` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format.`),Ni=m(),Fe=s("div"),b(St.$$.fragment),Pi=m(),Lt=s("p"),Fi=i("Converts the output of "),cs=s("a"),Ri=i("OwlViTForObjectDetection.image_guided_detection()"),Gi=i(` into the format expected by the COCO
api.`),er=m(),pe=s("h2"),Re=s("a"),on=s("span"),b(Kt.$$.fragment),Di=m(),sn=s("span"),Ai=i("OwlViTFeatureExtractor"),tr=m(),B=s("div"),b(eo.$$.fragment),Xi=m(),Ge=s("div"),b(to.$$.fragment),qi=m(),nn=s("p"),Hi=i("Preprocess an image or a batch of images."),Qi=m(),De=s("div"),b(oo.$$.fragment),Yi=m(),so=s("p"),Si=i("Converts the raw output of "),ds=s("a"),Li=i("OwlViTForObjectDetection"),Ki=i(` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format.`),el=m(),Ae=s("div"),b(no.$$.fragment),tl=m(),ro=s("p"),ol=i("Converts the output of "),ps=s("a"),sl=i("OwlViTForObjectDetection.image_guided_detection()"),nl=i(` into the format expected by the COCO
api.`),or=m(),me=s("h2"),Xe=s("a"),rn=s("span"),b(ao.$$.fragment),rl=m(),an=s("span"),al=i("OwlViTProcessor"),sr=m(),z=s("div"),b(io.$$.fragment),il=m(),U=s("p"),ll=i("Constructs an OWL-ViT processor which wraps "),ms=s("a"),cl=i("OwlViTImageProcessor"),dl=i(" and "),hs=s("a"),pl=i("CLIPTokenizer"),ml=i("/"),fs=s("a"),hl=i("CLIPTokenizerFast"),fl=i(`
into a single processor that interits both the image processor and tokenizer functionalities. See the
`),ln=s("code"),gl=i("__call__()"),ul=i(" and "),gs=s("a"),_l=i("decode()"),wl=i(" for more information."),Tl=m(),qe=s("div"),b(lo.$$.fragment),bl=m(),co=s("p"),vl=i("This method forwards all its arguments to CLIPTokenizerFast\u2019s "),us=s("a"),yl=i("batch_decode()"),Ml=i(`. Please
refer to the docstring of this method for more information.`),Vl=m(),He=s("div"),b(po.$$.fragment),jl=m(),mo=s("p"),$l=i("This method forwards all its arguments to CLIPTokenizerFast\u2019s "),_s=s("a"),Jl=i("decode()"),Ol=i(`. Please refer to
the docstring of this method for more information.`),xl=m(),Qe=s("div"),b(ho.$$.fragment),zl=m(),fo=s("p"),Il=i("This method forwards all its arguments to "),ws=s("a"),Ul=i("OwlViTImageProcessor.post_process()"),kl=i(`. Please refer to the docstring
of this method for more information.`),El=m(),Ye=s("div"),b(go.$$.fragment),Cl=m(),uo=s("p"),Zl=i("This method forwards all its arguments to "),cn=s("code"),Wl=i("OwlViTImageProcessor.post_process_one_shot_object_detection"),Bl=i(`.
Please refer to the docstring of this method for more information.`),Nl=m(),Se=s("div"),b(_o.$$.fragment),Pl=m(),wo=s("p"),Fl=i("This method forwards all its arguments to "),Ts=s("a"),Rl=i("OwlViTImageProcessor.post_process_object_detection()"),Gl=i(`. Please refer
to the docstring of this method for more information.`),nr=m(),he=s("h2"),Le=s("a"),dn=s("span"),b(To.$$.fragment),Dl=m(),pn=s("span"),Al=i("OwlViTModel"),rr=m(),N=s("div"),b(bo.$$.fragment),Xl=m(),F=s("div"),b(vo.$$.fragment),ql=m(),fe=s("p"),Hl=i("The "),bs=s("a"),Ql=i("OwlViTModel"),Yl=i(" forward method, overrides the "),mn=s("code"),Sl=i("__call__"),Ll=i(" special method."),Kl=m(),b(Ke.$$.fragment),ec=m(),b(et.$$.fragment),tc=m(),R=s("div"),b(yo.$$.fragment),oc=m(),ge=s("p"),sc=i("The "),vs=s("a"),nc=i("OwlViTModel"),rc=i(" forward method, overrides the "),hn=s("code"),ac=i("__call__"),ic=i(" special method."),lc=m(),b(tt.$$.fragment),cc=m(),b(ot.$$.fragment),dc=m(),G=s("div"),b(Mo.$$.fragment),pc=m(),ue=s("p"),mc=i("The "),ys=s("a"),hc=i("OwlViTModel"),fc=i(" forward method, overrides the "),fn=s("code"),gc=i("__call__"),uc=i(" special method."),_c=m(),b(st.$$.fragment),wc=m(),b(nt.$$.fragment),ar=m(),_e=s("h2"),rt=s("a"),gn=s("span"),b(Vo.$$.fragment),Tc=m(),un=s("span"),bc=i("OwlViTTextModel"),ir=m(),we=s("div"),b(jo.$$.fragment),vc=m(),D=s("div"),b($o.$$.fragment),yc=m(),Te=s("p"),Mc=i("The "),Ms=s("a"),Vc=i("OwlViTTextModel"),jc=i(" forward method, overrides the "),_n=s("code"),$c=i("__call__"),Jc=i(" special method."),Oc=m(),b(at.$$.fragment),xc=m(),b(it.$$.fragment),lr=m(),be=s("h2"),lt=s("a"),wn=s("span"),b(Jo.$$.fragment),zc=m(),Tn=s("span"),Ic=i("OwlViTVisionModel"),cr=m(),ve=s("div"),b(Oo.$$.fragment),Uc=m(),A=s("div"),b(xo.$$.fragment),kc=m(),ye=s("p"),Ec=i("The "),Vs=s("a"),Cc=i("OwlViTVisionModel"),Zc=i(" forward method, overrides the "),bn=s("code"),Wc=i("__call__"),Bc=i(" special method."),Nc=m(),b(ct.$$.fragment),Pc=m(),b(dt.$$.fragment),dr=m(),Me=s("h2"),pt=s("a"),vn=s("span"),b(zo.$$.fragment),Fc=m(),yn=s("span"),Rc=i("OwlViTForObjectDetection"),pr=m(),Y=s("div"),b(Io.$$.fragment),Gc=m(),X=s("div"),b(Uo.$$.fragment),Dc=m(),Ve=s("p"),Ac=i("The "),js=s("a"),Xc=i("OwlViTForObjectDetection"),qc=i(" forward method, overrides the "),Mn=s("code"),Hc=i("__call__"),Qc=i(" special method."),Yc=m(),b(mt.$$.fragment),Sc=m(),b(ht.$$.fragment),Lc=m(),q=s("div"),b(ko.$$.fragment),Kc=m(),je=s("p"),ed=i("The "),$s=s("a"),td=i("OwlViTForObjectDetection"),od=i(" forward method, overrides the "),Vn=s("code"),sd=i("__call__"),nd=i(" special method."),rd=m(),b(ft.$$.fragment),ad=m(),b(gt.$$.fragment),this.h()},l(t){const u=Gp('[data-svelte="svelte-1phssyn"]',document.head);c=n(u,"META",{name:!0,content:!0}),u.forEach(o),T=h(t),g=n(t,"H1",{class:!0});var Eo=a(g);f=n(Eo,"A",{id:!0,class:!0,href:!0});var jn=a(f);w=n(jn,"SPAN",{});var $n=a(w);v(r.$$.fragment,$n),$n.forEach(o),jn.forEach(o),p=h(Eo),O=n(Eo,"SPAN",{});var Jn=a(O);Qr=l(Jn,"OWL-ViT"),Jn.forEach(o),Eo.forEach(o),Wn=h(t),ee=n(t,"H2",{class:!0});var Co=a(ee);Oe=n(Co,"A",{id:!0,class:!0,href:!0});var On=a(Oe);Fs=n(On,"SPAN",{});var xn=a(Fs);v(Ot.$$.fragment,xn),xn.forEach(o),On.forEach(o),Yr=h(Co),Rs=n(Co,"SPAN",{});var zn=a(Rs);Sr=l(zn,"Overview"),zn.forEach(o),Co.forEach(o),Bn=h(t),xe=n(t,"P",{});var Zo=a(xe);Lr=l(Zo,"The OWL-ViT (short for Vision Transformer for Open-World Localization) was proposed in "),xt=n(Zo,"A",{href:!0,rel:!0});var In=a(xt);Kr=l(In,"Simple Open-Vocabulary Object Detection with Vision Transformers"),In.forEach(o),ea=l(Zo," by Matthias Minderer, Alexey Gritsenko, Austin Stone, Maxim Neumann, Dirk Weissenborn, Alexey Dosovitskiy, Aravindh Mahendran, Anurag Arnab, Mostafa Dehghani, Zhuoran Shen, Xiao Wang, Xiaohua Zhai, Thomas Kipf, and Neil Houlsby. OWL-ViT is an open-vocabulary object detection network trained on a variety of (image, text) pairs. It can be used to query an image with one or multiple text queries to search for and detect target objects described in text."),Zo.forEach(o),Nn=h(t),Po=n(t,"P",{});var Un=a(Po);ta=l(Un,"The abstract from the paper is the following:"),Un.forEach(o),Pn=h(t),Fo=n(t,"P",{});var kn=a(Fo);Gs=n(kn,"EM",{});var En=a(Gs);oa=l(En,"Combining simple architectures with large-scale pre-training has led to massive improvements in image classification. For object detection, pre-training and scaling approaches are less well established, especially in the long-tailed and open-vocabulary setting, where training data is relatively scarce. In this paper, we propose a strong recipe for transferring image-text models to open-vocabulary object detection. We use a standard Vision Transformer architecture with minimal modifications, contrastive image-text pre-training, and end-to-end detection fine-tuning. Our analysis of the scaling properties of this setup shows that increasing image-level pre-training and model size yield consistent improvements on the downstream detection task. We provide the adaptation strategies and regularizations needed to attain very strong performance on zero-shot text-conditioned and one-shot image-conditioned object detection. Code and models are available on GitHub."),En.forEach(o),kn.forEach(o),Fn=h(t),te=n(t,"H2",{class:!0});var Wo=a(te);ze=n(Wo,"A",{id:!0,class:!0,href:!0});var Cn=a(ze);Ds=n(Cn,"SPAN",{});var Zn=a(Ds);v(zt.$$.fragment,Zn),Zn.forEach(o),Cn.forEach(o),sa=h(Wo),As=n(Wo,"SPAN",{});var id=a(As);na=l(id,"Usage"),id.forEach(o),Wo.forEach(o),Rn=h(t),Ie=n(t,"P",{});var hr=a(Ie);ra=l(hr,"OWL-ViT is a zero-shot text-conditioned object detection model. OWL-ViT uses "),Ro=n(hr,"A",{href:!0});var ld=a(Ro);aa=l(ld,"CLIP"),ld.forEach(o),ia=l(hr," 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."),hr.forEach(o),Gn=h(t),x=n(t,"P",{});var k=a(x);Go=n(k,"A",{href:!0});var cd=a(Go);la=l(cd,"OwlViTImageProcessor"),cd.forEach(o),ca=l(k," can be used to resize (or rescale) and normalize images for the model and "),Do=n(k,"A",{href:!0});var dd=a(Do);da=l(dd,"CLIPTokenizer"),dd.forEach(o),pa=l(k," is used to encode the text. "),Ao=n(k,"A",{href:!0});var pd=a(Ao);ma=l(pd,"OwlViTProcessor"),pd.forEach(o),ha=l(k," wraps "),Xo=n(k,"A",{href:!0});var md=a(Xo);fa=l(md,"OwlViTImageProcessor"),md.forEach(o),ga=l(k," and "),qo=n(k,"A",{href:!0});var hd=a(qo);ua=l(hd,"CLIPTokenizer"),hd.forEach(o),_a=l(k," into a single instance to both encode the text and prepare the images. The following example shows how to perform object detection using "),Ho=n(k,"A",{href:!0});var fd=a(Ho);wa=l(fd,"OwlViTProcessor"),fd.forEach(o),Ta=l(k," and "),Qo=n(k,"A",{href:!0});var gd=a(Qo);ba=l(gd,"OwlViTForObjectDetection"),gd.forEach(o),va=l(k,"."),k.forEach(o),Dn=h(t),v(It.$$.fragment,t),An=h(t),S=n(t,"P",{});var Js=a(S);ya=l(Js,"This model was contributed by "),Ut=n(Js,"A",{href:!0,rel:!0});var ud=a(Ut);Ma=l(ud,"adirik"),ud.forEach(o),Va=l(Js,". The original code can be found "),kt=n(Js,"A",{href:!0,rel:!0});var _d=a(kt);ja=l(_d,"here"),_d.forEach(o),$a=l(Js,"."),Js.forEach(o),Xn=h(t),oe=n(t,"H2",{class:!0});var fr=a(oe);Ue=n(fr,"A",{id:!0,class:!0,href:!0});var wd=a(Ue);Xs=n(wd,"SPAN",{});var Td=a(Xs);v(Et.$$.fragment,Td),Td.forEach(o),wd.forEach(o),Ja=h(fr),qs=n(fr,"SPAN",{});var bd=a(qs);Oa=l(bd,"OwlViTConfig"),bd.forEach(o),fr.forEach(o),qn=h(t),C=n(t,"DIV",{class:!0});var ut=a(C);v(Ct.$$.fragment,ut),xa=h(ut),L=n(ut,"P",{});var Bo=a(L);Yo=n(Bo,"A",{href:!0});var vd=a(Yo);za=l(vd,"OwlViTConfig"),vd.forEach(o),Ia=l(Bo," is the configuration class to store the configuration of an "),So=n(Bo,"A",{href:!0});var yd=a(So);Ua=l(yd,"OwlViTModel"),yd.forEach(o),ka=l(Bo,`. It is used to
instantiate an OWL-ViT 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 OWL-ViT
`),Zt=n(Bo,"A",{href:!0,rel:!0});var Md=a(Zt);Ea=l(Md,"google/owlvit-base-patch32"),Md.forEach(o),Ca=l(Bo," architecture."),Bo.forEach(o),Za=h(ut),se=n(ut,"P",{});var Os=a(se);Wa=l(Os,"Configuration objects inherit from "),Lo=n(Os,"A",{href:!0});var Vd=a(Lo);Ba=l(Vd,"PretrainedConfig"),Vd.forEach(o),Na=l(Os,` and can be used to control the model outputs. Read the
documentation from `),Ko=n(Os,"A",{href:!0});var jd=a(Ko);Pa=l(jd,"PretrainedConfig"),jd.forEach(o),Fa=l(Os," for more information."),Os.forEach(o),Ra=h(ut),ke=n(ut,"DIV",{class:!0});var gr=a(ke);v(Wt.$$.fragment,gr),Ga=h(gr),Bt=n(gr,"P",{});var ur=a(Bt);Da=l(ur,"Instantiate a "),es=n(ur,"A",{href:!0});var $d=a(es);Aa=l($d,"OwlViTConfig"),$d.forEach(o),Xa=l(ur,` (or a derived class) from owlvit text model configuration and owlvit vision
model configuration.`),ur.forEach(o),gr.forEach(o),ut.forEach(o),Hn=h(t),ne=n(t,"H2",{class:!0});var _r=a(ne);Ee=n(_r,"A",{id:!0,class:!0,href:!0});var Jd=a(Ee);Hs=n(Jd,"SPAN",{});var Od=a(Hs);v(Nt.$$.fragment,Od),Od.forEach(o),Jd.forEach(o),qa=h(_r),Qs=n(_r,"SPAN",{});var xd=a(Qs);Ha=l(xd,"OwlViTTextConfig"),xd.forEach(o),_r.forEach(o),Qn=h(t),Z=n(t,"DIV",{class:!0});var _t=a(Z);v(Pt.$$.fragment,_t),Qa=h(_t),re=n(_t,"P",{});var xs=a(re);Ya=l(xs,"This is the configuration class to store the configuration of an "),ts=n(xs,"A",{href:!0});var zd=a(ts);Sa=l(zd,"OwlViTTextModel"),zd.forEach(o),La=l(xs,`. It is used to instantiate an
OwlViT 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 OwlViT
`),Ft=n(xs,"A",{href:!0,rel:!0});var Id=a(Ft);Ka=l(Id,"google/owlvit-base-patch32"),Id.forEach(o),ei=l(xs," architecture."),xs.forEach(o),ti=h(_t),ae=n(_t,"P",{});var zs=a(ae);oi=l(zs,"Configuration objects inherit from "),os=n(zs,"A",{href:!0});var Ud=a(os);si=l(Ud,"PretrainedConfig"),Ud.forEach(o),ni=l(zs,` and can be used to control the model outputs. Read the
documentation from `),ss=n(zs,"A",{href:!0});var kd=a(ss);ri=l(kd,"PretrainedConfig"),kd.forEach(o),ai=l(zs," for more information."),zs.forEach(o),ii=h(_t),v(Ce.$$.fragment,_t),_t.forEach(o),Yn=h(t),ie=n(t,"H2",{class:!0});var wr=a(ie);Ze=n(wr,"A",{id:!0,class:!0,href:!0});var Ed=a(Ze);Ys=n(Ed,"SPAN",{});var Cd=a(Ys);v(Rt.$$.fragment,Cd),Cd.forEach(o),Ed.forEach(o),li=h(wr),Ss=n(wr,"SPAN",{});var Zd=a(Ss);ci=l(Zd,"OwlViTVisionConfig"),Zd.forEach(o),wr.forEach(o),Sn=h(t),W=n(t,"DIV",{class:!0});var wt=a(W);v(Gt.$$.fragment,wt),di=h(wt),le=n(wt,"P",{});var Is=a(le);pi=l(Is,"This is the configuration class to store the configuration of an "),ns=n(Is,"A",{href:!0});var Wd=a(ns);mi=l(Wd,"OwlViTVisionModel"),Wd.forEach(o),hi=l(Is,`. It is used to instantiate
an OWL-ViT 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 OWL-ViT
`),Dt=n(Is,"A",{href:!0,rel:!0});var Bd=a(Dt);fi=l(Bd,"google/owlvit-base-patch32"),Bd.forEach(o),gi=l(Is," architecture."),Is.forEach(o),ui=h(wt),ce=n(wt,"P",{});var Us=a(ce);_i=l(Us,"Configuration objects inherit from "),rs=n(Us,"A",{href:!0});var Nd=a(rs);wi=l(Nd,"PretrainedConfig"),Nd.forEach(o),Ti=l(Us,` and can be used to control the model outputs. Read the
documentation from `),as=n(Us,"A",{href:!0});var Pd=a(as);bi=l(Pd,"PretrainedConfig"),Pd.forEach(o),vi=l(Us," for more information."),Us.forEach(o),yi=h(wt),v(We.$$.fragment,wt),wt.forEach(o),Ln=h(t),de=n(t,"H2",{class:!0});var Tr=a(de);Be=n(Tr,"A",{id:!0,class:!0,href:!0});var Fd=a(Be);Ls=n(Fd,"SPAN",{});var Rd=a(Ls);v(At.$$.fragment,Rd),Rd.forEach(o),Fd.forEach(o),Mi=h(Tr),Ks=n(Tr,"SPAN",{});var Gd=a(Ks);Vi=l(Gd,"OwlViTImageProcessor"),Gd.forEach(o),Tr.forEach(o),Kn=h(t),I=n(t,"DIV",{class:!0});var H=a(I);v(Xt.$$.fragment,H),ji=h(H),en=n(H,"P",{});var Dd=a(en);$i=l(Dd,"Constructs an OWL-ViT image processor."),Dd.forEach(o),Ji=h(H),qt=n(H,"P",{});var br=a(qt);Oi=l(br,"This image processor inherits from "),is=n(br,"A",{href:!0});var Ad=a(is);xi=l(Ad,"ImageProcessingMixin"),Ad.forEach(o),zi=l(br,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),br.forEach(o),Ii=h(H),Ne=n(H,"DIV",{class:!0});var vr=a(Ne);v(Ht.$$.fragment,vr),Ui=h(vr),tn=n(vr,"P",{});var Xd=a(tn);ki=l(Xd,"Prepares an image or batch of images for the model."),Xd.forEach(o),vr.forEach(o),Ei=h(H),Pe=n(H,"DIV",{class:!0});var yr=a(Pe);v(Qt.$$.fragment,yr),Ci=h(yr),Yt=n(yr,"P",{});var Mr=a(Yt);Zi=l(Mr,"Converts the raw output of "),ls=n(Mr,"A",{href:!0});var qd=a(ls);Wi=l(qd,"OwlViTForObjectDetection"),qd.forEach(o),Bi=l(Mr,` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format.`),Mr.forEach(o),yr.forEach(o),Ni=h(H),Fe=n(H,"DIV",{class:!0});var Vr=a(Fe);v(St.$$.fragment,Vr),Pi=h(Vr),Lt=n(Vr,"P",{});var jr=a(Lt);Fi=l(jr,"Converts the output of "),cs=n(jr,"A",{href:!0});var Hd=a(cs);Ri=l(Hd,"OwlViTForObjectDetection.image_guided_detection()"),Hd.forEach(o),Gi=l(jr,` into the format expected by the COCO
api.`),jr.forEach(o),Vr.forEach(o),H.forEach(o),er=h(t),pe=n(t,"H2",{class:!0});var $r=a(pe);Re=n($r,"A",{id:!0,class:!0,href:!0});var Qd=a(Re);on=n(Qd,"SPAN",{});var Yd=a(on);v(Kt.$$.fragment,Yd),Yd.forEach(o),Qd.forEach(o),Di=h($r),sn=n($r,"SPAN",{});var Sd=a(sn);Ai=l(Sd,"OwlViTFeatureExtractor"),Sd.forEach(o),$r.forEach(o),tr=h(t),B=n(t,"DIV",{class:!0});var Tt=a(B);v(eo.$$.fragment,Tt),Xi=h(Tt),Ge=n(Tt,"DIV",{class:!0});var Jr=a(Ge);v(to.$$.fragment,Jr),qi=h(Jr),nn=n(Jr,"P",{});var Ld=a(nn);Hi=l(Ld,"Preprocess an image or a batch of images."),Ld.forEach(o),Jr.forEach(o),Qi=h(Tt),De=n(Tt,"DIV",{class:!0});var Or=a(De);v(oo.$$.fragment,Or),Yi=h(Or),so=n(Or,"P",{});var xr=a(so);Si=l(xr,"Converts the raw output of "),ds=n(xr,"A",{href:!0});var Kd=a(ds);Li=l(Kd,"OwlViTForObjectDetection"),Kd.forEach(o),Ki=l(xr,` into final bounding boxes in (top_left_x, top_left_y,
bottom_right_x, bottom_right_y) format.`),xr.forEach(o),Or.forEach(o),el=h(Tt),Ae=n(Tt,"DIV",{class:!0});var zr=a(Ae);v(no.$$.fragment,zr),tl=h(zr),ro=n(zr,"P",{});var Ir=a(ro);ol=l(Ir,"Converts the output of "),ps=n(Ir,"A",{href:!0});var ep=a(ps);sl=l(ep,"OwlViTForObjectDetection.image_guided_detection()"),ep.forEach(o),nl=l(Ir,` into the format expected by the COCO
api.`),Ir.forEach(o),zr.forEach(o),Tt.forEach(o),or=h(t),me=n(t,"H2",{class:!0});var Ur=a(me);Xe=n(Ur,"A",{id:!0,class:!0,href:!0});var tp=a(Xe);rn=n(tp,"SPAN",{});var op=a(rn);v(ao.$$.fragment,op),op.forEach(o),tp.forEach(o),rl=h(Ur),an=n(Ur,"SPAN",{});var sp=a(an);al=l(sp,"OwlViTProcessor"),sp.forEach(o),Ur.forEach(o),sr=h(t),z=n(t,"DIV",{class:!0});var E=a(z);v(io.$$.fragment,E),il=h(E),U=n(E,"P",{});var Q=a(U);ll=l(Q,"Constructs an OWL-ViT processor which wraps "),ms=n(Q,"A",{href:!0});var np=a(ms);cl=l(np,"OwlViTImageProcessor"),np.forEach(o),dl=l(Q," and "),hs=n(Q,"A",{href:!0});var rp=a(hs);pl=l(rp,"CLIPTokenizer"),rp.forEach(o),ml=l(Q,"/"),fs=n(Q,"A",{href:!0});var ap=a(fs);hl=l(ap,"CLIPTokenizerFast"),ap.forEach(o),fl=l(Q,`
into a single processor that interits both the image processor and tokenizer functionalities. See the
`),ln=n(Q,"CODE",{});var ip=a(ln);gl=l(ip,"__call__()"),ip.forEach(o),ul=l(Q," and "),gs=n(Q,"A",{href:!0});var lp=a(gs);_l=l(lp,"decode()"),lp.forEach(o),wl=l(Q," for more information."),Q.forEach(o),Tl=h(E),qe=n(E,"DIV",{class:!0});var kr=a(qe);v(lo.$$.fragment,kr),bl=h(kr),co=n(kr,"P",{});var Er=a(co);vl=l(Er,"This method forwards all its arguments to CLIPTokenizerFast\u2019s "),us=n(Er,"A",{href:!0});var cp=a(us);yl=l(cp,"batch_decode()"),cp.forEach(o),Ml=l(Er,`. Please
refer to the docstring of this method for more information.`),Er.forEach(o),kr.forEach(o),Vl=h(E),He=n(E,"DIV",{class:!0});var Cr=a(He);v(po.$$.fragment,Cr),jl=h(Cr),mo=n(Cr,"P",{});var Zr=a(mo);$l=l(Zr,"This method forwards all its arguments to CLIPTokenizerFast\u2019s "),_s=n(Zr,"A",{href:!0});var dp=a(_s);Jl=l(dp,"decode()"),dp.forEach(o),Ol=l(Zr,`. Please refer to
the docstring of this method for more information.`),Zr.forEach(o),Cr.forEach(o),xl=h(E),Qe=n(E,"DIV",{class:!0});var Wr=a(Qe);v(ho.$$.fragment,Wr),zl=h(Wr),fo=n(Wr,"P",{});var Br=a(fo);Il=l(Br,"This method forwards all its arguments to "),ws=n(Br,"A",{href:!0});var pp=a(ws);Ul=l(pp,"OwlViTImageProcessor.post_process()"),pp.forEach(o),kl=l(Br,`. Please refer to the docstring
of this method for more information.`),Br.forEach(o),Wr.forEach(o),El=h(E),Ye=n(E,"DIV",{class:!0});var Nr=a(Ye);v(go.$$.fragment,Nr),Cl=h(Nr),uo=n(Nr,"P",{});var Pr=a(uo);Zl=l(Pr,"This method forwards all its arguments to "),cn=n(Pr,"CODE",{});var mp=a(cn);Wl=l(mp,"OwlViTImageProcessor.post_process_one_shot_object_detection"),mp.forEach(o),Bl=l(Pr,`.
Please refer to the docstring of this method for more information.`),Pr.forEach(o),Nr.forEach(o),Nl=h(E),Se=n(E,"DIV",{class:!0});var Fr=a(Se);v(_o.$$.fragment,Fr),Pl=h(Fr),wo=n(Fr,"P",{});var Rr=a(wo);Fl=l(Rr,"This method forwards all its arguments to "),Ts=n(Rr,"A",{href:!0});var hp=a(Ts);Rl=l(hp,"OwlViTImageProcessor.post_process_object_detection()"),hp.forEach(o),Gl=l(Rr,`. Please refer
to the docstring of this method for more information.`),Rr.forEach(o),Fr.forEach(o),E.forEach(o),nr=h(t),he=n(t,"H2",{class:!0});var Gr=a(he);Le=n(Gr,"A",{id:!0,class:!0,href:!0});var fp=a(Le);dn=n(fp,"SPAN",{});var gp=a(dn);v(To.$$.fragment,gp),gp.forEach(o),fp.forEach(o),Dl=h(Gr),pn=n(Gr,"SPAN",{});var up=a(pn);Al=l(up,"OwlViTModel"),up.forEach(o),Gr.forEach(o),rr=h(t),N=n(t,"DIV",{class:!0});var bt=a(N);v(bo.$$.fragment,bt),Xl=h(bt),F=n(bt,"DIV",{class:!0});var vt=a(F);v(vo.$$.fragment,vt),ql=h(vt),fe=n(vt,"P",{});var ks=a(fe);Hl=l(ks,"The "),bs=n(ks,"A",{href:!0});var _p=a(bs);Ql=l(_p,"OwlViTModel"),_p.forEach(o),Yl=l(ks," forward method, overrides the "),mn=n(ks,"CODE",{});var wp=a(mn);Sl=l(wp,"__call__"),wp.forEach(o),Ll=l(ks," special method."),ks.forEach(o),Kl=h(vt),v(Ke.$$.fragment,vt),ec=h(vt),v(et.$$.fragment,vt),vt.forEach(o),tc=h(bt),R=n(bt,"DIV",{class:!0});var yt=a(R);v(yo.$$.fragment,yt),oc=h(yt),ge=n(yt,"P",{});var Es=a(ge);sc=l(Es,"The "),vs=n(Es,"A",{href:!0});var Tp=a(vs);nc=l(Tp,"OwlViTModel"),Tp.forEach(o),rc=l(Es," forward method, overrides the "),hn=n(Es,"CODE",{});var bp=a(hn);ac=l(bp,"__call__"),bp.forEach(o),ic=l(Es," special method."),Es.forEach(o),lc=h(yt),v(tt.$$.fragment,yt),cc=h(yt),v(ot.$$.fragment,yt),yt.forEach(o),dc=h(bt),G=n(bt,"DIV",{class:!0});var Mt=a(G);v(Mo.$$.fragment,Mt),pc=h(Mt),ue=n(Mt,"P",{});var Cs=a(ue);mc=l(Cs,"The "),ys=n(Cs,"A",{href:!0});var vp=a(ys);hc=l(vp,"OwlViTModel"),vp.forEach(o),fc=l(Cs," forward method, overrides the "),fn=n(Cs,"CODE",{});var yp=a(fn);gc=l(yp,"__call__"),yp.forEach(o),uc=l(Cs," special method."),Cs.forEach(o),_c=h(Mt),v(st.$$.fragment,Mt),wc=h(Mt),v(nt.$$.fragment,Mt),Mt.forEach(o),bt.forEach(o),ar=h(t),_e=n(t,"H2",{class:!0});var Dr=a(_e);rt=n(Dr,"A",{id:!0,class:!0,href:!0});var Mp=a(rt);gn=n(Mp,"SPAN",{});var Vp=a(gn);v(Vo.$$.fragment,Vp),Vp.forEach(o),Mp.forEach(o),Tc=h(Dr),un=n(Dr,"SPAN",{});var jp=a(un);bc=l(jp,"OwlViTTextModel"),jp.forEach(o),Dr.forEach(o),ir=h(t),we=n(t,"DIV",{class:!0});var Ar=a(we);v(jo.$$.fragment,Ar),vc=h(Ar),D=n(Ar,"DIV",{class:!0});var Vt=a(D);v($o.$$.fragment,Vt),yc=h(Vt),Te=n(Vt,"P",{});var Zs=a(Te);Mc=l(Zs,"The "),Ms=n(Zs,"A",{href:!0});var $p=a(Ms);Vc=l($p,"OwlViTTextModel"),$p.forEach(o),jc=l(Zs," forward method, overrides the "),_n=n(Zs,"CODE",{});var Jp=a(_n);$c=l(Jp,"__call__"),Jp.forEach(o),Jc=l(Zs," special method."),Zs.forEach(o),Oc=h(Vt),v(at.$$.fragment,Vt),xc=h(Vt),v(it.$$.fragment,Vt),Vt.forEach(o),Ar.forEach(o),lr=h(t),be=n(t,"H2",{class:!0});var Xr=a(be);lt=n(Xr,"A",{id:!0,class:!0,href:!0});var Op=a(lt);wn=n(Op,"SPAN",{});var xp=a(wn);v(Jo.$$.fragment,xp),xp.forEach(o),Op.forEach(o),zc=h(Xr),Tn=n(Xr,"SPAN",{});var zp=a(Tn);Ic=l(zp,"OwlViTVisionModel"),zp.forEach(o),Xr.forEach(o),cr=h(t),ve=n(t,"DIV",{class:!0});var qr=a(ve);v(Oo.$$.fragment,qr),Uc=h(qr),A=n(qr,"DIV",{class:!0});var jt=a(A);v(xo.$$.fragment,jt),kc=h(jt),ye=n(jt,"P",{});var Ws=a(ye);Ec=l(Ws,"The "),Vs=n(Ws,"A",{href:!0});var Ip=a(Vs);Cc=l(Ip,"OwlViTVisionModel"),Ip.forEach(o),Zc=l(Ws," forward method, overrides the "),bn=n(Ws,"CODE",{});var Up=a(bn);Wc=l(Up,"__call__"),Up.forEach(o),Bc=l(Ws," special method."),Ws.forEach(o),Nc=h(jt),v(ct.$$.fragment,jt),Pc=h(jt),v(dt.$$.fragment,jt),jt.forEach(o),qr.forEach(o),dr=h(t),Me=n(t,"H2",{class:!0});var Hr=a(Me);pt=n(Hr,"A",{id:!0,class:!0,href:!0});var kp=a(pt);vn=n(kp,"SPAN",{});var Ep=a(vn);v(zo.$$.fragment,Ep),Ep.forEach(o),kp.forEach(o),Fc=h(Hr),yn=n(Hr,"SPAN",{});var Cp=a(yn);Rc=l(Cp,"OwlViTForObjectDetection"),Cp.forEach(o),Hr.forEach(o),pr=h(t),Y=n(t,"DIV",{class:!0});var Bs=a(Y);v(Io.$$.fragment,Bs),Gc=h(Bs),X=n(Bs,"DIV",{class:!0});var $t=a(X);v(Uo.$$.fragment,$t),Dc=h($t),Ve=n($t,"P",{});var Ns=a(Ve);Ac=l(Ns,"The "),js=n(Ns,"A",{href:!0});var Zp=a(js);Xc=l(Zp,"OwlViTForObjectDetection"),Zp.forEach(o),qc=l(Ns," forward method, overrides the "),Mn=n(Ns,"CODE",{});var Wp=a(Mn);Hc=l(Wp,"__call__"),Wp.forEach(o),Qc=l(Ns," special method."),Ns.forEach(o),Yc=h($t),v(mt.$$.fragment,$t),Sc=h($t),v(ht.$$.fragment,$t),$t.forEach(o),Lc=h(Bs),q=n(Bs,"DIV",{class:!0});var Jt=a(q);v(ko.$$.fragment,Jt),Kc=h(Jt),je=n(Jt,"P",{});var Ps=a(je);ed=l(Ps,"The "),$s=n(Ps,"A",{href:!0});var Bp=a($s);td=l(Bp,"OwlViTForObjectDetection"),Bp.forEach(o),od=l(Ps," forward method, overrides the "),Vn=n(Ps,"CODE",{});var Np=a(Vn);sd=l(Np,"__call__"),Np.forEach(o),nd=l(Ps," special method."),Ps.forEach(o),rd=h(Jt),v(ft.$$.fragment,Jt),ad=h(Jt),v(gt.$$.fragment,Jt),Jt.forEach(o),Bs.forEach(o),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(lm)),d(f,"id","owlvit"),d(f,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(f,"href","#owlvit"),d(g,"class","relative group"),d(Oe,"id","overview"),d(Oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Oe,"href","#overview"),d(ee,"class","relative group"),d(xt,"href","https://arxiv.org/abs/2205.06230"),d(xt,"rel","nofollow"),d(ze,"id","usage"),d(ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ze,"href","#usage"),d(te,"class","relative group"),d(Ro,"href","clip"),d(Go,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTImageProcessor"),d(Do,"href","/docs/transformers/v4.32.0/en/model_doc/clip#transformers.CLIPTokenizer"),d(Ao,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTProcessor"),d(Xo,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTImageProcessor"),d(qo,"href","/docs/transformers/v4.32.0/en/model_doc/clip#transformers.CLIPTokenizer"),d(Ho,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTProcessor"),d(Qo,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection"),d(Ut,"href","https://huggingface.co/adirik"),d(Ut,"rel","nofollow"),d(kt,"href","https://github.com/google-research/scenic/tree/main/scenic/projects/owl_vit"),d(kt,"rel","nofollow"),d(Ue,"id","transformers.OwlViTConfig"),d(Ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ue,"href","#transformers.OwlViTConfig"),d(oe,"class","relative group"),d(Yo,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTConfig"),d(So,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTModel"),d(Zt,"href","https://huggingface.co/google/owlvit-base-patch32"),d(Zt,"rel","nofollow"),d(Lo,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Ko,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(es,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTConfig"),d(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ee,"id","transformers.OwlViTTextConfig"),d(Ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ee,"href","#transformers.OwlViTTextConfig"),d(ne,"class","relative group"),d(ts,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTTextModel"),d(Ft,"href","https://huggingface.co/google/owlvit-base-patch32"),d(Ft,"rel","nofollow"),d(os,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(ss,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ze,"id","transformers.OwlViTVisionConfig"),d(Ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ze,"href","#transformers.OwlViTVisionConfig"),d(ie,"class","relative group"),d(ns,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"),d(Dt,"href","https://huggingface.co/google/owlvit-base-patch32"),d(Dt,"rel","nofollow"),d(rs,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(as,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Be,"id","transformers.OwlViTImageProcessor"),d(Be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Be,"href","#transformers.OwlViTImageProcessor"),d(de,"class","relative group"),d(is,"href","/docs/transformers/v4.32.0/en/internal/image_processing_utils#transformers.ImageProcessingMixin"),d(Ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ls,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection"),d(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(cs,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection.image_guided_detection"),d(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Re,"id","transformers.OwlViTFeatureExtractor"),d(Re,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Re,"href","#transformers.OwlViTFeatureExtractor"),d(pe,"class","relative group"),d(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ds,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection"),d(De,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ps,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection.image_guided_detection"),d(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Xe,"id","transformers.OwlViTProcessor"),d(Xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Xe,"href","#transformers.OwlViTProcessor"),d(me,"class","relative group"),d(ms,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTImageProcessor"),d(hs,"href","/docs/transformers/v4.32.0/en/model_doc/clip#transformers.CLIPTokenizer"),d(fs,"href","/docs/transformers/v4.32.0/en/model_doc/clip#transformers.CLIPTokenizerFast"),d(gs,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTProcessor.decode"),d(us,"href","/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.batch_decode"),d(qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(_s,"href","/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.decode"),d(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ws,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTFeatureExtractor.post_process"),d(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ts,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTImageProcessor.post_process_object_detection"),d(Se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Le,"id","transformers.OwlViTModel"),d(Le,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Le,"href","#transformers.OwlViTModel"),d(he,"class","relative group"),d(bs,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTModel"),d(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(vs,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTModel"),d(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ys,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTModel"),d(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(rt,"id","transformers.OwlViTTextModel"),d(rt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(rt,"href","#transformers.OwlViTTextModel"),d(_e,"class","relative group"),d(Ms,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTTextModel"),d(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(lt,"id","transformers.OwlViTVisionModel"),d(lt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(lt,"href","#transformers.OwlViTVisionModel"),d(be,"class","relative group"),d(Vs,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"),d(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(pt,"id","transformers.OwlViTForObjectDetection"),d(pt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(pt,"href","#transformers.OwlViTForObjectDetection"),d(Me,"class","relative group"),d(js,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection"),d(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d($s,"href","/docs/transformers/v4.32.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection"),d(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,u){e(document.head,c),_(t,T,u),_(t,g,u),e(g,f),e(f,w),y(r,w,null),e(g,p),e(g,O),e(O,Qr),_(t,Wn,u),_(t,ee,u),e(ee,Oe),e(Oe,Fs),y(Ot,Fs,null),e(ee,Yr),e(ee,Rs),e(Rs,Sr),_(t,Bn,u),_(t,xe,u),e(xe,Lr),e(xe,xt),e(xt,Kr),e(xe,ea),_(t,Nn,u),_(t,Po,u),e(Po,ta),_(t,Pn,u),_(t,Fo,u),e(Fo,Gs),e(Gs,oa),_(t,Fn,u),_(t,te,u),e(te,ze),e(ze,Ds),y(zt,Ds,null),e(te,sa),e(te,As),e(As,na),_(t,Rn,u),_(t,Ie,u),e(Ie,ra),e(Ie,Ro),e(Ro,aa),e(Ie,ia),_(t,Gn,u),_(t,x,u),e(x,Go),e(Go,la),e(x,ca),e(x,Do),e(Do,da),e(x,pa),e(x,Ao),e(Ao,ma),e(x,ha),e(x,Xo),e(Xo,fa),e(x,ga),e(x,qo),e(qo,ua),e(x,_a),e(x,Ho),e(Ho,wa),e(x,Ta),e(x,Qo),e(Qo,ba),e(x,va),_(t,Dn,u),y(It,t,u),_(t,An,u),_(t,S,u),e(S,ya),e(S,Ut),e(Ut,Ma),e(S,Va),e(S,kt),e(kt,ja),e(S,$a),_(t,Xn,u),_(t,oe,u),e(oe,Ue),e(Ue,Xs),y(Et,Xs,null),e(oe,Ja),e(oe,qs),e(qs,Oa),_(t,qn,u),_(t,C,u),y(Ct,C,null),e(C,xa),e(C,L),e(L,Yo),e(Yo,za),e(L,Ia),e(L,So),e(So,Ua),e(L,ka),e(L,Zt),e(Zt,Ea),e(L,Ca),e(C,Za),e(C,se),e(se,Wa),e(se,Lo),e(Lo,Ba),e(se,Na),e(se,Ko),e(Ko,Pa),e(se,Fa),e(C,Ra),e(C,ke),y(Wt,ke,null),e(ke,Ga),e(ke,Bt),e(Bt,Da),e(Bt,es),e(es,Aa),e(Bt,Xa),_(t,Hn,u),_(t,ne,u),e(ne,Ee),e(Ee,Hs),y(Nt,Hs,null),e(ne,qa),e(ne,Qs),e(Qs,Ha),_(t,Qn,u),_(t,Z,u),y(Pt,Z,null),e(Z,Qa),e(Z,re),e(re,Ya),e(re,ts),e(ts,Sa),e(re,La),e(re,Ft),e(Ft,Ka),e(re,ei),e(Z,ti),e(Z,ae),e(ae,oi),e(ae,os),e(os,si),e(ae,ni),e(ae,ss),e(ss,ri),e(ae,ai),e(Z,ii),y(Ce,Z,null),_(t,Yn,u),_(t,ie,u),e(ie,Ze),e(Ze,Ys),y(Rt,Ys,null),e(ie,li),e(ie,Ss),e(Ss,ci),_(t,Sn,u),_(t,W,u),y(Gt,W,null),e(W,di),e(W,le),e(le,pi),e(le,ns),e(ns,mi),e(le,hi),e(le,Dt),e(Dt,fi),e(le,gi),e(W,ui),e(W,ce),e(ce,_i),e(ce,rs),e(rs,wi),e(ce,Ti),e(ce,as),e(as,bi),e(ce,vi),e(W,yi),y(We,W,null),_(t,Ln,u),_(t,de,u),e(de,Be),e(Be,Ls),y(At,Ls,null),e(de,Mi),e(de,Ks),e(Ks,Vi),_(t,Kn,u),_(t,I,u),y(Xt,I,null),e(I,ji),e(I,en),e(en,$i),e(I,Ji),e(I,qt),e(qt,Oi),e(qt,is),e(is,xi),e(qt,zi),e(I,Ii),e(I,Ne),y(Ht,Ne,null),e(Ne,Ui),e(Ne,tn),e(tn,ki),e(I,Ei),e(I,Pe),y(Qt,Pe,null),e(Pe,Ci),e(Pe,Yt),e(Yt,Zi),e(Yt,ls),e(ls,Wi),e(Yt,Bi),e(I,Ni),e(I,Fe),y(St,Fe,null),e(Fe,Pi),e(Fe,Lt),e(Lt,Fi),e(Lt,cs),e(cs,Ri),e(Lt,Gi),_(t,er,u),_(t,pe,u),e(pe,Re),e(Re,on),y(Kt,on,null),e(pe,Di),e(pe,sn),e(sn,Ai),_(t,tr,u),_(t,B,u),y(eo,B,null),e(B,Xi),e(B,Ge),y(to,Ge,null),e(Ge,qi),e(Ge,nn),e(nn,Hi),e(B,Qi),e(B,De),y(oo,De,null),e(De,Yi),e(De,so),e(so,Si),e(so,ds),e(ds,Li),e(so,Ki),e(B,el),e(B,Ae),y(no,Ae,null),e(Ae,tl),e(Ae,ro),e(ro,ol),e(ro,ps),e(ps,sl),e(ro,nl),_(t,or,u),_(t,me,u),e(me,Xe),e(Xe,rn),y(ao,rn,null),e(me,rl),e(me,an),e(an,al),_(t,sr,u),_(t,z,u),y(io,z,null),e(z,il),e(z,U),e(U,ll),e(U,ms),e(ms,cl),e(U,dl),e(U,hs),e(hs,pl),e(U,ml),e(U,fs),e(fs,hl),e(U,fl),e(U,ln),e(ln,gl),e(U,ul),e(U,gs),e(gs,_l),e(U,wl),e(z,Tl),e(z,qe),y(lo,qe,null),e(qe,bl),e(qe,co),e(co,vl),e(co,us),e(us,yl),e(co,Ml),e(z,Vl),e(z,He),y(po,He,null),e(He,jl),e(He,mo),e(mo,$l),e(mo,_s),e(_s,Jl),e(mo,Ol),e(z,xl),e(z,Qe),y(ho,Qe,null),e(Qe,zl),e(Qe,fo),e(fo,Il),e(fo,ws),e(ws,Ul),e(fo,kl),e(z,El),e(z,Ye),y(go,Ye,null),e(Ye,Cl),e(Ye,uo),e(uo,Zl),e(uo,cn),e(cn,Wl),e(uo,Bl),e(z,Nl),e(z,Se),y(_o,Se,null),e(Se,Pl),e(Se,wo),e(wo,Fl),e(wo,Ts),e(Ts,Rl),e(wo,Gl),_(t,nr,u),_(t,he,u),e(he,Le),e(Le,dn),y(To,dn,null),e(he,Dl),e(he,pn),e(pn,Al),_(t,rr,u),_(t,N,u),y(bo,N,null),e(N,Xl),e(N,F),y(vo,F,null),e(F,ql),e(F,fe),e(fe,Hl),e(fe,bs),e(bs,Ql),e(fe,Yl),e(fe,mn),e(mn,Sl),e(fe,Ll),e(F,Kl),y(Ke,F,null),e(F,ec),y(et,F,null),e(N,tc),e(N,R),y(yo,R,null),e(R,oc),e(R,ge),e(ge,sc),e(ge,vs),e(vs,nc),e(ge,rc),e(ge,hn),e(hn,ac),e(ge,ic),e(R,lc),y(tt,R,null),e(R,cc),y(ot,R,null),e(N,dc),e(N,G),y(Mo,G,null),e(G,pc),e(G,ue),e(ue,mc),e(ue,ys),e(ys,hc),e(ue,fc),e(ue,fn),e(fn,gc),e(ue,uc),e(G,_c),y(st,G,null),e(G,wc),y(nt,G,null),_(t,ar,u),_(t,_e,u),e(_e,rt),e(rt,gn),y(Vo,gn,null),e(_e,Tc),e(_e,un),e(un,bc),_(t,ir,u),_(t,we,u),y(jo,we,null),e(we,vc),e(we,D),y($o,D,null),e(D,yc),e(D,Te),e(Te,Mc),e(Te,Ms),e(Ms,Vc),e(Te,jc),e(Te,_n),e(_n,$c),e(Te,Jc),e(D,Oc),y(at,D,null),e(D,xc),y(it,D,null),_(t,lr,u),_(t,be,u),e(be,lt),e(lt,wn),y(Jo,wn,null),e(be,zc),e(be,Tn),e(Tn,Ic),_(t,cr,u),_(t,ve,u),y(Oo,ve,null),e(ve,Uc),e(ve,A),y(xo,A,null),e(A,kc),e(A,ye),e(ye,Ec),e(ye,Vs),e(Vs,Cc),e(ye,Zc),e(ye,bn),e(bn,Wc),e(ye,Bc),e(A,Nc),y(ct,A,null),e(A,Pc),y(dt,A,null),_(t,dr,u),_(t,Me,u),e(Me,pt),e(pt,vn),y(zo,vn,null),e(Me,Fc),e(Me,yn),e(yn,Rc),_(t,pr,u),_(t,Y,u),y(Io,Y,null),e(Y,Gc),e(Y,X),y(Uo,X,null),e(X,Dc),e(X,Ve),e(Ve,Ac),e(Ve,js),e(js,Xc),e(Ve,qc),e(Ve,Mn),e(Mn,Hc),e(Ve,Qc),e(X,Yc),y(mt,X,null),e(X,Sc),y(ht,X,null),e(Y,Lc),e(Y,q),y(ko,q,null),e(q,Kc),e(q,je),e(je,ed),e(je,$s),e($s,td),e(je,od),e(je,Vn),e(Vn,sd),e(je,nd),e(q,rd),y(ft,q,null),e(q,ad),y(gt,q,null),mr=!0},p(t,[u]){const Eo={};u&2&&(Eo.$$scope={dirty:u,ctx:t}),Ce.$set(Eo);const jn={};u&2&&(jn.$$scope={dirty:u,ctx:t}),We.$set(jn);const $n={};u&2&&($n.$$scope={dirty:u,ctx:t}),Ke.$set($n);const Jn={};u&2&&(Jn.$$scope={dirty:u,ctx:t}),et.$set(Jn);const Co={};u&2&&(Co.$$scope={dirty:u,ctx:t}),tt.$set(Co);const On={};u&2&&(On.$$scope={dirty:u,ctx:t}),ot.$set(On);const xn={};u&2&&(xn.$$scope={dirty:u,ctx:t}),st.$set(xn);const zn={};u&2&&(zn.$$scope={dirty:u,ctx:t}),nt.$set(zn);const Zo={};u&2&&(Zo.$$scope={dirty:u,ctx:t}),at.$set(Zo);const In={};u&2&&(In.$$scope={dirty:u,ctx:t}),it.$set(In);const Un={};u&2&&(Un.$$scope={dirty:u,ctx:t}),ct.$set(Un);const kn={};u&2&&(kn.$$scope={dirty:u,ctx:t}),dt.$set(kn);const En={};u&2&&(En.$$scope={dirty:u,ctx:t}),mt.$set(En);const Wo={};u&2&&(Wo.$$scope={dirty:u,ctx:t}),ht.$set(Wo);const Cn={};u&2&&(Cn.$$scope={dirty:u,ctx:t}),ft.$set(Cn);const Zn={};u&2&&(Zn.$$scope={dirty:u,ctx:t}),gt.$set(Zn)},i(t){mr||(M(r.$$.fragment,t),M(Ot.$$.fragment,t),M(zt.$$.fragment,t),M(It.$$.fragment,t),M(Et.$$.fragment,t),M(Ct.$$.fragment,t),M(Wt.$$.fragment,t),M(Nt.$$.fragment,t),M(Pt.$$.fragment,t),M(Ce.$$.fragment,t),M(Rt.$$.fragment,t),M(Gt.$$.fragment,t),M(We.$$.fragment,t),M(At.$$.fragment,t),M(Xt.$$.fragment,t),M(Ht.$$.fragment,t),M(Qt.$$.fragment,t),M(St.$$.fragment,t),M(Kt.$$.fragment,t),M(eo.$$.fragment,t),M(to.$$.fragment,t),M(oo.$$.fragment,t),M(no.$$.fragment,t),M(ao.$$.fragment,t),M(io.$$.fragment,t),M(lo.$$.fragment,t),M(po.$$.fragment,t),M(ho.$$.fragment,t),M(go.$$.fragment,t),M(_o.$$.fragment,t),M(To.$$.fragment,t),M(bo.$$.fragment,t),M(vo.$$.fragment,t),M(Ke.$$.fragment,t),M(et.$$.fragment,t),M(yo.$$.fragment,t),M(tt.$$.fragment,t),M(ot.$$.fragment,t),M(Mo.$$.fragment,t),M(st.$$.fragment,t),M(nt.$$.fragment,t),M(Vo.$$.fragment,t),M(jo.$$.fragment,t),M($o.$$.fragment,t),M(at.$$.fragment,t),M(it.$$.fragment,t),M(Jo.$$.fragment,t),M(Oo.$$.fragment,t),M(xo.$$.fragment,t),M(ct.$$.fragment,t),M(dt.$$.fragment,t),M(zo.$$.fragment,t),M(Io.$$.fragment,t),M(Uo.$$.fragment,t),M(mt.$$.fragment,t),M(ht.$$.fragment,t),M(ko.$$.fragment,t),M(ft.$$.fragment,t),M(gt.$$.fragment,t),mr=!0)},o(t){V(r.$$.fragment,t),V(Ot.$$.fragment,t),V(zt.$$.fragment,t),V(It.$$.fragment,t),V(Et.$$.fragment,t),V(Ct.$$.fragment,t),V(Wt.$$.fragment,t),V(Nt.$$.fragment,t),V(Pt.$$.fragment,t),V(Ce.$$.fragment,t),V(Rt.$$.fragment,t),V(Gt.$$.fragment,t),V(We.$$.fragment,t),V(At.$$.fragment,t),V(Xt.$$.fragment,t),V(Ht.$$.fragment,t),V(Qt.$$.fragment,t),V(St.$$.fragment,t),V(Kt.$$.fragment,t),V(eo.$$.fragment,t),V(to.$$.fragment,t),V(oo.$$.fragment,t),V(no.$$.fragment,t),V(ao.$$.fragment,t),V(io.$$.fragment,t),V(lo.$$.fragment,t),V(po.$$.fragment,t),V(ho.$$.fragment,t),V(go.$$.fragment,t),V(_o.$$.fragment,t),V(To.$$.fragment,t),V(bo.$$.fragment,t),V(vo.$$.fragment,t),V(Ke.$$.fragment,t),V(et.$$.fragment,t),V(yo.$$.fragment,t),V(tt.$$.fragment,t),V(ot.$$.fragment,t),V(Mo.$$.fragment,t),V(st.$$.fragment,t),V(nt.$$.fragment,t),V(Vo.$$.fragment,t),V(jo.$$.fragment,t),V($o.$$.fragment,t),V(at.$$.fragment,t),V(it.$$.fragment,t),V(Jo.$$.fragment,t),V(Oo.$$.fragment,t),V(xo.$$.fragment,t),V(ct.$$.fragment,t),V(dt.$$.fragment,t),V(zo.$$.fragment,t),V(Io.$$.fragment,t),V(Uo.$$.fragment,t),V(mt.$$.fragment,t),V(ht.$$.fragment,t),V(ko.$$.fragment,t),V(ft.$$.fragment,t),V(gt.$$.fragment,t),mr=!1},d(t){o(c),t&&o(T),t&&o(g),j(r),t&&o(Wn),t&&o(ee),j(Ot),t&&o(Bn),t&&o(xe),t&&o(Nn),t&&o(Po),t&&o(Pn),t&&o(Fo),t&&o(Fn),t&&o(te),j(zt),t&&o(Rn),t&&o(Ie),t&&o(Gn),t&&o(x),t&&o(Dn),j(It,t),t&&o(An),t&&o(S),t&&o(Xn),t&&o(oe),j(Et),t&&o(qn),t&&o(C),j(Ct),j(Wt),t&&o(Hn),t&&o(ne),j(Nt),t&&o(Qn),t&&o(Z),j(Pt),j(Ce),t&&o(Yn),t&&o(ie),j(Rt),t&&o(Sn),t&&o(W),j(Gt),j(We),t&&o(Ln),t&&o(de),j(At),t&&o(Kn),t&&o(I),j(Xt),j(Ht),j(Qt),j(St),t&&o(er),t&&o(pe),j(Kt),t&&o(tr),t&&o(B),j(eo),j(to),j(oo),j(no),t&&o(or),t&&o(me),j(ao),t&&o(sr),t&&o(z),j(io),j(lo),j(po),j(ho),j(go),j(_o),t&&o(nr),t&&o(he),j(To),t&&o(rr),t&&o(N),j(bo),j(vo),j(Ke),j(et),j(yo),j(tt),j(ot),j(Mo),j(st),j(nt),t&&o(ar),t&&o(_e),j(Vo),t&&o(ir),t&&o(we),j(jo),j($o),j(at),j(it),t&&o(lr),t&&o(be),j(Jo),t&&o(cr),t&&o(ve),j(Oo),j(xo),j(ct),j(dt),t&&o(dr),t&&o(Me),j(zo),t&&o(pr),t&&o(Y),j(Io),j(Uo),j(mt),j(ht),j(ko),j(ft),j(gt)}}}const lm={local:"owlvit",sections:[{local:"overview",title:"Overview"},{local:"usage",title:"Usage"},{local:"transformers.OwlViTConfig",title:"OwlViTConfig"},{local:"transformers.OwlViTTextConfig",title:"OwlViTTextConfig"},{local:"transformers.OwlViTVisionConfig",title:"OwlViTVisionConfig"},{local:"transformers.OwlViTImageProcessor",title:"OwlViTImageProcessor"},{local:"transformers.OwlViTFeatureExtractor",title:"OwlViTFeatureExtractor"},{local:"transformers.OwlViTProcessor",title:"OwlViTProcessor"},{local:"transformers.OwlViTModel",title:"OwlViTModel"},{local:"transformers.OwlViTTextModel",title:"OwlViTTextModel"},{local:"transformers.OwlViTVisionModel",title:"OwlViTVisionModel"},{local:"transformers.OwlViTForObjectDetection",title:"OwlViTForObjectDetection"}],title:"OWL-ViT"};function cm($){return Dp(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class um extends Pp{constructor(c){super();Fp(this,c,cm,im,Rp,{})}}export{um as default,lm as metadata};
