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

<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>score_threshold = <span class="hljs-number">0.1</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-keyword">if</span> score &gt;= score_threshold:
<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 F({}),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.30.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.30.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.30.0/src/transformers/models/owlvit/configuration_owlvit.py#L248"}}),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.30.0/src/transformers/models/owlvit/configuration_owlvit.py#L314",returnDescription:`
<p>An instance of a configuration object</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTConfig"
>OwlViTConfig</a></p>
`}}),Nt=new F({}),Ft=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.30.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.30.0/src/transformers/models/owlvit/configuration_owlvit.py#L41"}}),Ce=new $e({props:{anchor:"transformers.OwlViTTextConfig.example",$$slots:{default:[Xp]},$$scope:{ctx:$}}}),Pt=new F({}),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.30.0/src/transformers/models/owlvit/configuration_owlvit.py#L145"}}),We=new $e({props:{anchor:"transformers.OwlViTVisionConfig.example",$$slots:{default:[Dp]},$$scope:{ctx:$}}}),Xt=new F({}),Dt=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.30.0/src/transformers/models/owlvit/image_processing_owlvit.py#L91"}}),Qt=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:"**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"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/owlvit/image_processing_owlvit.py#L226"}}),Ht=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.30.0/src/transformers/models/owlvit/image_processing_owlvit.py#L384",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>
`}}),Yt=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.30.0/src/transformers/models/owlvit/image_processing_owlvit.py#L440",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 F({}),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.30.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.30.0/src/transformers/image_processing_utils.py#L462"}}),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.30.0/src/transformers/models/owlvit/image_processing_owlvit.py#L338",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.30.0/src/transformers/models/owlvit/image_processing_owlvit.py#L440",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 F({}),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.30.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.30.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.30.0/src/transformers/models/owlvit/processing_owlvit.py#L195"}}),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.30.0/src/transformers/models/owlvit/processing_owlvit.py#L202"}}),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.30.0/src/transformers/models/owlvit/processing_owlvit.py#L174"}}),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.30.0/src/transformers/models/owlvit/processing_owlvit.py#L188"}}),_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.30.0/src/transformers/models/owlvit/processing_owlvit.py#L181"}}),bo=new F({}),To=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.30.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.30.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.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L1037"}}),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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.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.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L1152",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.30.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.30.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.30.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.30.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:[Qp]},$$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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.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.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L1072",returnDescription:`
<p>The text embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.30.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:[Hp]},$$scope:{ctx:$}}}),ot=new $e({props:{anchor:"transformers.OwlViTModel.get_text_features.example",$$slots:{default:[Sp]},$$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.30.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.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L1107",returnDescription:`
<p>The image embeddings obtained by
applying the projection layer to the pooled output of <a
  href="/docs/transformers/v4.30.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:[Yp]},$$scope:{ctx:$}}}),nt=new $e({props:{anchor:"transformers.OwlViTModel.get_image_features.example",$$slots:{default:[Lp]},$$scope:{ctx:$}}}),Vo=new F({}),jo=new J({props:{name:"class transformers.OwlViTTextModel",anchor:"transformers.OwlViTTextModel",parameters:[{name:"config",val:": OwlViTTextConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L876"}}),$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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.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.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L891",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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 F({}),Oo=new J({props:{name:"class transformers.OwlViTVisionModel",anchor:"transformers.OwlViTVisionModel",parameters:[{name:"config",val:": OwlViTVisionConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L986"}}),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.30.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.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L999",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.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.30.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:$}}}),Uo=new F({}),zo=new J({props:{name:"class transformers.OwlViTForObjectDetection",anchor:"transformers.OwlViTForObjectDetection",parameters:[{name:"config",val:": OwlViTConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L1319"}}),Io=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.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__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.30.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.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L1621",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.30.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.30.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.30.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.30.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.30.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.30.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.30.0/src/transformers/models/owlvit/modeling_owlvit.py#L1526",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.30.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.30.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.30.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.30.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.30.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.30.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"),b=m(),g=s("h1"),f=s("a"),w=s("span"),T(r.$$.fragment),p=m(),O=s("span"),Hr=i("OWL-ViT"),Wn=m(),ee=s("h2"),Oe=s("a"),Rs=s("span"),T(Ot.$$.fragment),Sr=m(),Ps=s("span"),Yr=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(),Fo=s("p"),ta=i("The abstract from the paper is the following:"),Fn=m(),Ro=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."),Rn=m(),te=s("h2"),Ue=s("a"),As=s("span"),T(Ut.$$.fragment),sa=m(),Xs=s("span"),na=i("Usage"),Pn=m(),ze=s("p"),ra=i("OWL-ViT is a zero-shot text-conditioned object detection model. OWL-ViT uses "),Po=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("OwlViTFeatureExtractor"),ca=i(" can be used to resize (or rescale) and normalize images for the model and "),Ao=s("a"),da=i("CLIPTokenizer"),pa=i(" is used to encode the text. "),Xo=s("a"),ma=i("OwlViTProcessor"),ha=i(" wraps "),Do=s("a"),fa=i("OwlViTFeatureExtractor"),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 "),Qo=s("a"),wa=i("OwlViTProcessor"),ba=i(" and "),Ho=s("a"),Ta=i("OwlViTForObjectDetection"),va=i("."),An=m(),T(zt.$$.fragment),Xn=m(),Y=s("p"),ya=i("This model was contributed by "),It=s("a"),Ma=i("adirik"),Va=i(". The original code can be found "),kt=s("a"),ja=i("here"),$a=i("."),Dn=m(),oe=s("h2"),Ie=s("a"),Ds=s("span"),T(Et.$$.fragment),Ja=m(),qs=s("span"),Oa=i("OwlViTConfig"),qn=m(),C=s("div"),T(Ct.$$.fragment),xa=m(),L=s("p"),So=s("a"),Ua=i("OwlViTConfig"),za=i(" is the configuration class to store the configuration of an "),Yo=s("a"),Ia=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"),Fa=i("PretrainedConfig"),Ra=i(" for more information."),Pa=m(),ke=s("div"),T(Wt.$$.fragment),Ga=m(),Bt=s("p"),Aa=i("Instantiate a "),es=s("a"),Xa=i("OwlViTConfig"),Da=i(` (or a derived class) from owlvit text model configuration and owlvit vision
model configuration.`),Qn=m(),ne=s("h2"),Ee=s("a"),Qs=s("span"),T(Nt.$$.fragment),qa=m(),Hs=s("span"),Qa=i("OwlViTTextConfig"),Hn=m(),Z=s("div"),T(Ft.$$.fragment),Ha=m(),re=s("p"),Sa=i("This is the configuration class to store the configuration of an "),ts=s("a"),Ya=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
`),Rt=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(),T(Ce.$$.fragment),Sn=m(),ie=s("h2"),Ze=s("a"),Ss=s("span"),T(Pt.$$.fragment),li=m(),Ys=s("span"),ci=i("OwlViTVisionConfig"),Yn=m(),W=s("div"),T(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
`),At=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"),bi=i(` and can be used to control the model outputs. Read the
documentation from `),as=s("a"),Ti=i("PretrainedConfig"),vi=i(" for more information."),yi=m(),T(We.$$.fragment),Ln=m(),de=s("h2"),Be=s("a"),Ls=s("span"),T(Xt.$$.fragment),Mi=m(),Ks=s("span"),Vi=i("OwlViTImageProcessor"),Kn=m(),z=s("div"),T(Dt.$$.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"),Ui=i(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),zi=m(),Ne=s("div"),T(Qt.$$.fragment),Ii=m(),tn=s("p"),ki=i("Prepares an image or batch of images for the model."),Ei=m(),Fe=s("div"),T(Ht.$$.fragment),Ci=m(),St=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(),Re=s("div"),T(Yt.$$.fragment),Fi=m(),Lt=s("p"),Ri=i("Converts the output of "),cs=s("a"),Pi=i("OwlViTForObjectDetection.image_guided_detection()"),Gi=i(` into the format expected by the COCO
api.`),er=m(),pe=s("h2"),Pe=s("a"),on=s("span"),T(Kt.$$.fragment),Ai=m(),sn=s("span"),Xi=i("OwlViTFeatureExtractor"),tr=m(),B=s("div"),T(eo.$$.fragment),Di=m(),Ge=s("div"),T(to.$$.fragment),qi=m(),nn=s("p"),Qi=i("Preprocess an image or a batch of images."),Hi=m(),Ae=s("div"),T(oo.$$.fragment),Si=m(),so=s("p"),Yi=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(),Xe=s("div"),T(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"),De=s("a"),rn=s("span"),T(ao.$$.fragment),rl=m(),an=s("span"),al=i("OwlViTProcessor"),sr=m(),U=s("div"),T(io.$$.fragment),il=m(),I=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."),bl=m(),qe=s("div"),T(lo.$$.fragment),Tl=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(),Qe=s("div"),T(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(),He=s("div"),T(ho.$$.fragment),Ul=m(),fo=s("p"),zl=i("This method forwards all its arguments to "),ws=s("a"),Il=i("OwlViTImageProcessor.post_process()"),kl=i(`. Please refer to the docstring
of this method for more information.`),El=m(),Se=s("div"),T(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(),Ye=s("div"),T(_o.$$.fragment),Fl=m(),wo=s("p"),Rl=i("This method forwards all its arguments to "),bs=s("a"),Pl=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"),T(bo.$$.fragment),Al=m(),pn=s("span"),Xl=i("OwlViTModel"),rr=m(),N=s("div"),T(To.$$.fragment),Dl=m(),R=s("div"),T(vo.$$.fragment),ql=m(),fe=s("p"),Ql=i("The "),Ts=s("a"),Hl=i("OwlViTModel"),Sl=i(" forward method, overrides the "),mn=s("code"),Yl=i("__call__"),Ll=i(" special method."),Kl=m(),T(Ke.$$.fragment),ec=m(),T(et.$$.fragment),tc=m(),P=s("div"),T(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(),T(tt.$$.fragment),cc=m(),T(ot.$$.fragment),dc=m(),G=s("div"),T(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(),T(st.$$.fragment),wc=m(),T(nt.$$.fragment),ar=m(),_e=s("h2"),rt=s("a"),gn=s("span"),T(Vo.$$.fragment),bc=m(),un=s("span"),Tc=i("OwlViTTextModel"),ir=m(),we=s("div"),T(jo.$$.fragment),vc=m(),A=s("div"),T($o.$$.fragment),yc=m(),be=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(),T(at.$$.fragment),xc=m(),T(it.$$.fragment),lr=m(),Te=s("h2"),lt=s("a"),wn=s("span"),T(Jo.$$.fragment),Uc=m(),bn=s("span"),zc=i("OwlViTVisionModel"),cr=m(),ve=s("div"),T(Oo.$$.fragment),Ic=m(),X=s("div"),T(xo.$$.fragment),kc=m(),ye=s("p"),Ec=i("The "),Vs=s("a"),Cc=i("OwlViTVisionModel"),Zc=i(" forward method, overrides the "),Tn=s("code"),Wc=i("__call__"),Bc=i(" special method."),Nc=m(),T(ct.$$.fragment),Fc=m(),T(dt.$$.fragment),dr=m(),Me=s("h2"),pt=s("a"),vn=s("span"),T(Uo.$$.fragment),Rc=m(),yn=s("span"),Pc=i("OwlViTForObjectDetection"),pr=m(),S=s("div"),T(zo.$$.fragment),Gc=m(),D=s("div"),T(Io.$$.fragment),Ac=m(),Ve=s("p"),Xc=i("The "),js=s("a"),Dc=i("OwlViTForObjectDetection"),qc=i(" forward method, overrides the "),Mn=s("code"),Qc=i("__call__"),Hc=i(" special method."),Sc=m(),T(mt.$$.fragment),Yc=m(),T(ht.$$.fragment),Lc=m(),q=s("div"),T(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(),T(ft.$$.fragment),ad=m(),T(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),b=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);Hr=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);Rs=n(On,"SPAN",{});var xn=a(Rs);v(Ot.$$.fragment,xn),xn.forEach(o),On.forEach(o),Sr=h(Co),Ps=n(Co,"SPAN",{});var Un=a(Ps);Yr=l(Un,"Overview"),Un.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 zn=a(xt);Kr=l(zn,"Simple Open-Vocabulary Object Detection with Vision Transformers"),zn.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),Fo=n(t,"P",{});var In=a(Fo);ta=l(In,"The abstract from the paper is the following:"),In.forEach(o),Fn=h(t),Ro=n(t,"P",{});var kn=a(Ro);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),Rn=h(t),te=n(t,"H2",{class:!0});var Wo=a(te);Ue=n(Wo,"A",{id:!0,class:!0,href:!0});var Cn=a(Ue);As=n(Cn,"SPAN",{});var Zn=a(As);v(Ut.$$.fragment,Zn),Zn.forEach(o),Cn.forEach(o),sa=h(Wo),Xs=n(Wo,"SPAN",{});var id=a(Xs);na=l(id,"Usage"),id.forEach(o),Wo.forEach(o),Pn=h(t),ze=n(t,"P",{});var hr=a(ze);ra=l(hr,"OWL-ViT is a zero-shot text-conditioned object detection model. OWL-ViT uses "),Po=n(hr,"A",{href:!0});var ld=a(Po);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,"OwlViTFeatureExtractor"),cd.forEach(o),ca=l(k," can be used to resize (or rescale) and normalize images for the model and "),Ao=n(k,"A",{href:!0});var dd=a(Ao);da=l(dd,"CLIPTokenizer"),dd.forEach(o),pa=l(k," is used to encode the text. "),Xo=n(k,"A",{href:!0});var pd=a(Xo);ma=l(pd,"OwlViTProcessor"),pd.forEach(o),ha=l(k," wraps "),Do=n(k,"A",{href:!0});var md=a(Do);fa=l(md,"OwlViTFeatureExtractor"),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 "),Qo=n(k,"A",{href:!0});var fd=a(Qo);wa=l(fd,"OwlViTProcessor"),fd.forEach(o),ba=l(k," and "),Ho=n(k,"A",{href:!0});var gd=a(Ho);Ta=l(gd,"OwlViTForObjectDetection"),gd.forEach(o),va=l(k,"."),k.forEach(o),An=h(t),v(zt.$$.fragment,t),Xn=h(t),Y=n(t,"P",{});var Js=a(Y);ya=l(Js,"This model was contributed by "),It=n(Js,"A",{href:!0,rel:!0});var ud=a(It);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),Dn=h(t),oe=n(t,"H2",{class:!0});var fr=a(oe);Ie=n(fr,"A",{id:!0,class:!0,href:!0});var wd=a(Ie);Ds=n(wd,"SPAN",{});var bd=a(Ds);v(Et.$$.fragment,bd),bd.forEach(o),wd.forEach(o),Ja=h(fr),qs=n(fr,"SPAN",{});var Td=a(qs);Oa=l(Td,"OwlViTConfig"),Td.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);So=n(Bo,"A",{href:!0});var vd=a(So);Ua=l(vd,"OwlViTConfig"),vd.forEach(o),za=l(Bo," is the configuration class to store the configuration of an "),Yo=n(Bo,"A",{href:!0});var yd=a(Yo);Ia=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);Fa=l(jd,"PretrainedConfig"),jd.forEach(o),Ra=l(Os," for more information."),Os.forEach(o),Pa=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);Aa=l(ur,"Instantiate a "),es=n(ur,"A",{href:!0});var $d=a(es);Xa=l($d,"OwlViTConfig"),$d.forEach(o),Da=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),Qn=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);Qs=n(Jd,"SPAN",{});var Od=a(Qs);v(Nt.$$.fragment,Od),Od.forEach(o),Jd.forEach(o),qa=h(_r),Hs=n(_r,"SPAN",{});var xd=a(Hs);Qa=l(xd,"OwlViTTextConfig"),xd.forEach(o),_r.forEach(o),Hn=h(t),Z=n(t,"DIV",{class:!0});var _t=a(Z);v(Ft.$$.fragment,_t),Ha=h(_t),re=n(_t,"P",{});var xs=a(re);Sa=l(xs,"This is the configuration class to store the configuration of an "),ts=n(xs,"A",{href:!0});var Ud=a(ts);Ya=l(Ud,"OwlViTTextModel"),Ud.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
`),Rt=n(xs,"A",{href:!0,rel:!0});var zd=a(Rt);Ka=l(zd,"google/owlvit-base-patch32"),zd.forEach(o),ei=l(xs," architecture."),xs.forEach(o),ti=h(_t),ae=n(_t,"P",{});var Us=a(ae);oi=l(Us,"Configuration objects inherit from "),os=n(Us,"A",{href:!0});var Id=a(os);si=l(Id,"PretrainedConfig"),Id.forEach(o),ni=l(Us,` and can be used to control the model outputs. Read the
documentation from `),ss=n(Us,"A",{href:!0});var kd=a(ss);ri=l(kd,"PretrainedConfig"),kd.forEach(o),ai=l(Us," for more information."),Us.forEach(o),ii=h(_t),v(Ce.$$.fragment,_t),_t.forEach(o),Sn=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);Ss=n(Ed,"SPAN",{});var Cd=a(Ss);v(Pt.$$.fragment,Cd),Cd.forEach(o),Ed.forEach(o),li=h(wr),Ys=n(wr,"SPAN",{});var Zd=a(Ys);ci=l(Zd,"OwlViTVisionConfig"),Zd.forEach(o),wr.forEach(o),Yn=h(t),W=n(t,"DIV",{class:!0});var wt=a(W);v(Gt.$$.fragment,wt),di=h(wt),le=n(wt,"P",{});var zs=a(le);pi=l(zs,"This is the configuration class to store the configuration of an "),ns=n(zs,"A",{href:!0});var Wd=a(ns);mi=l(Wd,"OwlViTVisionModel"),Wd.forEach(o),hi=l(zs,`. 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
`),At=n(zs,"A",{href:!0,rel:!0});var Bd=a(At);fi=l(Bd,"google/owlvit-base-patch32"),Bd.forEach(o),gi=l(zs," architecture."),zs.forEach(o),ui=h(wt),ce=n(wt,"P",{});var Is=a(ce);_i=l(Is,"Configuration objects inherit from "),rs=n(Is,"A",{href:!0});var Nd=a(rs);wi=l(Nd,"PretrainedConfig"),Nd.forEach(o),bi=l(Is,` and can be used to control the model outputs. Read the
documentation from `),as=n(Is,"A",{href:!0});var Fd=a(as);Ti=l(Fd,"PretrainedConfig"),Fd.forEach(o),vi=l(Is," for more information."),Is.forEach(o),yi=h(wt),v(We.$$.fragment,wt),wt.forEach(o),Ln=h(t),de=n(t,"H2",{class:!0});var br=a(de);Be=n(br,"A",{id:!0,class:!0,href:!0});var Rd=a(Be);Ls=n(Rd,"SPAN",{});var Pd=a(Ls);v(Xt.$$.fragment,Pd),Pd.forEach(o),Rd.forEach(o),Mi=h(br),Ks=n(br,"SPAN",{});var Gd=a(Ks);Vi=l(Gd,"OwlViTImageProcessor"),Gd.forEach(o),br.forEach(o),Kn=h(t),z=n(t,"DIV",{class:!0});var Q=a(z);v(Dt.$$.fragment,Q),ji=h(Q),en=n(Q,"P",{});var Ad=a(en);$i=l(Ad,"Constructs an OWL-ViT image processor."),Ad.forEach(o),Ji=h(Q),qt=n(Q,"P",{});var Tr=a(qt);Oi=l(Tr,"This image processor inherits from "),is=n(Tr,"A",{href:!0});var Xd=a(is);xi=l(Xd,"ImageProcessingMixin"),Xd.forEach(o),Ui=l(Tr,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Tr.forEach(o),zi=h(Q),Ne=n(Q,"DIV",{class:!0});var vr=a(Ne);v(Qt.$$.fragment,vr),Ii=h(vr),tn=n(vr,"P",{});var Dd=a(tn);ki=l(Dd,"Prepares an image or batch of images for the model."),Dd.forEach(o),vr.forEach(o),Ei=h(Q),Fe=n(Q,"DIV",{class:!0});var yr=a(Fe);v(Ht.$$.fragment,yr),Ci=h(yr),St=n(yr,"P",{});var Mr=a(St);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(Q),Re=n(Q,"DIV",{class:!0});var Vr=a(Re);v(Yt.$$.fragment,Vr),Fi=h(Vr),Lt=n(Vr,"P",{});var jr=a(Lt);Ri=l(jr,"Converts the output of "),cs=n(jr,"A",{href:!0});var Qd=a(cs);Pi=l(Qd,"OwlViTForObjectDetection.image_guided_detection()"),Qd.forEach(o),Gi=l(jr,` into the format expected by the COCO
api.`),jr.forEach(o),Vr.forEach(o),Q.forEach(o),er=h(t),pe=n(t,"H2",{class:!0});var $r=a(pe);Pe=n($r,"A",{id:!0,class:!0,href:!0});var Hd=a(Pe);on=n(Hd,"SPAN",{});var Sd=a(on);v(Kt.$$.fragment,Sd),Sd.forEach(o),Hd.forEach(o),Ai=h($r),sn=n($r,"SPAN",{});var Yd=a(sn);Xi=l(Yd,"OwlViTFeatureExtractor"),Yd.forEach(o),$r.forEach(o),tr=h(t),B=n(t,"DIV",{class:!0});var bt=a(B);v(eo.$$.fragment,bt),Di=h(bt),Ge=n(bt,"DIV",{class:!0});var Jr=a(Ge);v(to.$$.fragment,Jr),qi=h(Jr),nn=n(Jr,"P",{});var Ld=a(nn);Qi=l(Ld,"Preprocess an image or a batch of images."),Ld.forEach(o),Jr.forEach(o),Hi=h(bt),Ae=n(bt,"DIV",{class:!0});var Or=a(Ae);v(oo.$$.fragment,Or),Si=h(Or),so=n(Or,"P",{});var xr=a(so);Yi=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(bt),Xe=n(bt,"DIV",{class:!0});var Ur=a(Xe);v(no.$$.fragment,Ur),tl=h(Ur),ro=n(Ur,"P",{});var zr=a(ro);ol=l(zr,"Converts the output of "),ps=n(zr,"A",{href:!0});var ep=a(ps);sl=l(ep,"OwlViTForObjectDetection.image_guided_detection()"),ep.forEach(o),nl=l(zr,` into the format expected by the COCO
api.`),zr.forEach(o),Ur.forEach(o),bt.forEach(o),or=h(t),me=n(t,"H2",{class:!0});var Ir=a(me);De=n(Ir,"A",{id:!0,class:!0,href:!0});var tp=a(De);rn=n(tp,"SPAN",{});var op=a(rn);v(ao.$$.fragment,op),op.forEach(o),tp.forEach(o),rl=h(Ir),an=n(Ir,"SPAN",{});var sp=a(an);al=l(sp,"OwlViTProcessor"),sp.forEach(o),Ir.forEach(o),sr=h(t),U=n(t,"DIV",{class:!0});var E=a(U);v(io.$$.fragment,E),il=h(E),I=n(E,"P",{});var H=a(I);ll=l(H,"Constructs an OWL-ViT processor which wraps "),ms=n(H,"A",{href:!0});var np=a(ms);cl=l(np,"OwlViTImageProcessor"),np.forEach(o),dl=l(H," and "),hs=n(H,"A",{href:!0});var rp=a(hs);pl=l(rp,"CLIPTokenizer"),rp.forEach(o),ml=l(H,"/"),fs=n(H,"A",{href:!0});var ap=a(fs);hl=l(ap,"CLIPTokenizerFast"),ap.forEach(o),fl=l(H,`
into a single processor that interits both the image processor and tokenizer functionalities. See the
`),ln=n(H,"CODE",{});var ip=a(ln);gl=l(ip,"__call__()"),ip.forEach(o),ul=l(H," and "),gs=n(H,"A",{href:!0});var lp=a(gs);_l=l(lp,"decode()"),lp.forEach(o),wl=l(H," for more information."),H.forEach(o),bl=h(E),qe=n(E,"DIV",{class:!0});var kr=a(qe);v(lo.$$.fragment,kr),Tl=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),Qe=n(E,"DIV",{class:!0});var Cr=a(Qe);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),He=n(E,"DIV",{class:!0});var Wr=a(He);v(ho.$$.fragment,Wr),Ul=h(Wr),fo=n(Wr,"P",{});var Br=a(fo);zl=l(Br,"This method forwards all its arguments to "),ws=n(Br,"A",{href:!0});var pp=a(ws);Il=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),Se=n(E,"DIV",{class:!0});var Nr=a(Se);v(go.$$.fragment,Nr),Cl=h(Nr),uo=n(Nr,"P",{});var Fr=a(uo);Zl=l(Fr,"This method forwards all its arguments to "),cn=n(Fr,"CODE",{});var mp=a(cn);Wl=l(mp,"OwlViTImageProcessor.post_process_one_shot_object_detection"),mp.forEach(o),Bl=l(Fr,`.
Please refer to the docstring of this method for more information.`),Fr.forEach(o),Nr.forEach(o),Nl=h(E),Ye=n(E,"DIV",{class:!0});var Rr=a(Ye);v(_o.$$.fragment,Rr),Fl=h(Rr),wo=n(Rr,"P",{});var Pr=a(wo);Rl=l(Pr,"This method forwards all its arguments to "),bs=n(Pr,"A",{href:!0});var hp=a(bs);Pl=l(hp,"OwlViTImageProcessor.post_process_object_detection()"),hp.forEach(o),Gl=l(Pr,`. Please refer
to the docstring of this method for more information.`),Pr.forEach(o),Rr.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(bo.$$.fragment,gp),gp.forEach(o),fp.forEach(o),Al=h(Gr),pn=n(Gr,"SPAN",{});var up=a(pn);Xl=l(up,"OwlViTModel"),up.forEach(o),Gr.forEach(o),rr=h(t),N=n(t,"DIV",{class:!0});var Tt=a(N);v(To.$$.fragment,Tt),Dl=h(Tt),R=n(Tt,"DIV",{class:!0});var vt=a(R);v(vo.$$.fragment,vt),ql=h(vt),fe=n(vt,"P",{});var ks=a(fe);Ql=l(ks,"The "),Ts=n(ks,"A",{href:!0});var _p=a(Ts);Hl=l(_p,"OwlViTModel"),_p.forEach(o),Sl=l(ks," forward method, overrides the "),mn=n(ks,"CODE",{});var wp=a(mn);Yl=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(Tt),P=n(Tt,"DIV",{class:!0});var yt=a(P);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 bp=a(vs);nc=l(bp,"OwlViTModel"),bp.forEach(o),rc=l(Es," forward method, overrides the "),hn=n(Es,"CODE",{});var Tp=a(hn);ac=l(Tp,"__call__"),Tp.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(Tt),G=n(Tt,"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),Tt.forEach(o),ar=h(t),_e=n(t,"H2",{class:!0});var Ar=a(_e);rt=n(Ar,"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),bc=h(Ar),un=n(Ar,"SPAN",{});var jp=a(un);Tc=l(jp,"OwlViTTextModel"),jp.forEach(o),Ar.forEach(o),ir=h(t),we=n(t,"DIV",{class:!0});var Xr=a(we);v(jo.$$.fragment,Xr),vc=h(Xr),A=n(Xr,"DIV",{class:!0});var Vt=a(A);v($o.$$.fragment,Vt),yc=h(Vt),be=n(Vt,"P",{});var Zs=a(be);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),Xr.forEach(o),lr=h(t),Te=n(t,"H2",{class:!0});var Dr=a(Te);lt=n(Dr,"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),Uc=h(Dr),bn=n(Dr,"SPAN",{});var Up=a(bn);zc=l(Up,"OwlViTVisionModel"),Up.forEach(o),Dr.forEach(o),cr=h(t),ve=n(t,"DIV",{class:!0});var qr=a(ve);v(Oo.$$.fragment,qr),Ic=h(qr),X=n(qr,"DIV",{class:!0});var jt=a(X);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 zp=a(Vs);Cc=l(zp,"OwlViTVisionModel"),zp.forEach(o),Zc=l(Ws," forward method, overrides the "),Tn=n(Ws,"CODE",{});var Ip=a(Tn);Wc=l(Ip,"__call__"),Ip.forEach(o),Bc=l(Ws," special method."),Ws.forEach(o),Nc=h(jt),v(ct.$$.fragment,jt),Fc=h(jt),v(dt.$$.fragment,jt),jt.forEach(o),qr.forEach(o),dr=h(t),Me=n(t,"H2",{class:!0});var Qr=a(Me);pt=n(Qr,"A",{id:!0,class:!0,href:!0});var kp=a(pt);vn=n(kp,"SPAN",{});var Ep=a(vn);v(Uo.$$.fragment,Ep),Ep.forEach(o),kp.forEach(o),Rc=h(Qr),yn=n(Qr,"SPAN",{});var Cp=a(yn);Pc=l(Cp,"OwlViTForObjectDetection"),Cp.forEach(o),Qr.forEach(o),pr=h(t),S=n(t,"DIV",{class:!0});var Bs=a(S);v(zo.$$.fragment,Bs),Gc=h(Bs),D=n(Bs,"DIV",{class:!0});var $t=a(D);v(Io.$$.fragment,$t),Ac=h($t),Ve=n($t,"P",{});var Ns=a(Ve);Xc=l(Ns,"The "),js=n(Ns,"A",{href:!0});var Zp=a(js);Dc=l(Zp,"OwlViTForObjectDetection"),Zp.forEach(o),qc=l(Ns," forward method, overrides the "),Mn=n(Ns,"CODE",{});var Wp=a(Mn);Qc=l(Wp,"__call__"),Wp.forEach(o),Hc=l(Ns," special method."),Ns.forEach(o),Sc=h($t),v(mt.$$.fragment,$t),Yc=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 Fs=a(je);ed=l(Fs,"The "),$s=n(Fs,"A",{href:!0});var Bp=a($s);td=l(Bp,"OwlViTForObjectDetection"),Bp.forEach(o),od=l(Fs," forward method, overrides the "),Vn=n(Fs,"CODE",{});var Np=a(Vn);sd=l(Np,"__call__"),Np.forEach(o),nd=l(Fs," special method."),Fs.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(Ue,"id","usage"),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","#usage"),d(te,"class","relative group"),d(Po,"href","clip"),d(Go,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTFeatureExtractor"),d(Ao,"href","/docs/transformers/v4.30.0/en/model_doc/clip#transformers.CLIPTokenizer"),d(Xo,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTProcessor"),d(Do,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTFeatureExtractor"),d(qo,"href","/docs/transformers/v4.30.0/en/model_doc/clip#transformers.CLIPTokenizer"),d(Qo,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTProcessor"),d(Ho,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection"),d(It,"href","https://huggingface.co/adirik"),d(It,"rel","nofollow"),d(kt,"href","https://github.com/google-research/scenic/tree/main/scenic/projects/owl_vit"),d(kt,"rel","nofollow"),d(Ie,"id","transformers.OwlViTConfig"),d(Ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ie,"href","#transformers.OwlViTConfig"),d(oe,"class","relative group"),d(So,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTConfig"),d(Yo,"href","/docs/transformers/v4.30.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.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Ko,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(es,"href","/docs/transformers/v4.30.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.30.0/en/model_doc/owlvit#transformers.OwlViTTextModel"),d(Rt,"href","https://huggingface.co/google/owlvit-base-patch32"),d(Rt,"rel","nofollow"),d(os,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(ss,"href","/docs/transformers/v4.30.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.30.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"),d(At,"href","https://huggingface.co/google/owlvit-base-patch32"),d(At,"rel","nofollow"),d(rs,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(as,"href","/docs/transformers/v4.30.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.30.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.30.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection"),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(cs,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection.image_guided_detection"),d(Re,"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(Pe,"id","transformers.OwlViTFeatureExtractor"),d(Pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Pe,"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.30.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection"),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(ps,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection.image_guided_detection"),d(Xe,"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(De,"id","transformers.OwlViTProcessor"),d(De,"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(De,"href","#transformers.OwlViTProcessor"),d(me,"class","relative group"),d(ms,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTImageProcessor"),d(hs,"href","/docs/transformers/v4.30.0/en/model_doc/clip#transformers.CLIPTokenizer"),d(fs,"href","/docs/transformers/v4.30.0/en/model_doc/clip#transformers.CLIPTokenizerFast"),d(gs,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTProcessor.decode"),d(us,"href","/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.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.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.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(ws,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTFeatureExtractor.post_process"),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(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(bs,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTImageProcessor.post_process_object_detection"),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(U,"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(Ts,"href","/docs/transformers/v4.30.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(vs,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTModel"),d(P,"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.30.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.30.0/en/model_doc/owlvit#transformers.OwlViTTextModel"),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(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(Te,"class","relative group"),d(Vs,"href","/docs/transformers/v4.30.0/en/model_doc/owlvit#transformers.OwlViTVisionModel"),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(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.30.0/en/model_doc/owlvit#transformers.OwlViTForObjectDetection"),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($s,"href","/docs/transformers/v4.30.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(S,"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,b,u),_(t,g,u),e(g,f),e(f,w),y(r,w,null),e(g,p),e(g,O),e(O,Hr),_(t,Wn,u),_(t,ee,u),e(ee,Oe),e(Oe,Rs),y(Ot,Rs,null),e(ee,Sr),e(ee,Ps),e(Ps,Yr),_(t,Bn,u),_(t,xe,u),e(xe,Lr),e(xe,xt),e(xt,Kr),e(xe,ea),_(t,Nn,u),_(t,Fo,u),e(Fo,ta),_(t,Fn,u),_(t,Ro,u),e(Ro,Gs),e(Gs,oa),_(t,Rn,u),_(t,te,u),e(te,Ue),e(Ue,As),y(Ut,As,null),e(te,sa),e(te,Xs),e(Xs,na),_(t,Pn,u),_(t,ze,u),e(ze,ra),e(ze,Po),e(Po,aa),e(ze,ia),_(t,Gn,u),_(t,x,u),e(x,Go),e(Go,la),e(x,ca),e(x,Ao),e(Ao,da),e(x,pa),e(x,Xo),e(Xo,ma),e(x,ha),e(x,Do),e(Do,fa),e(x,ga),e(x,qo),e(qo,ua),e(x,_a),e(x,Qo),e(Qo,wa),e(x,ba),e(x,Ho),e(Ho,Ta),e(x,va),_(t,An,u),y(zt,t,u),_(t,Xn,u),_(t,Y,u),e(Y,ya),e(Y,It),e(It,Ma),e(Y,Va),e(Y,kt),e(kt,ja),e(Y,$a),_(t,Dn,u),_(t,oe,u),e(oe,Ie),e(Ie,Ds),y(Et,Ds,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,So),e(So,Ua),e(L,za),e(L,Yo),e(Yo,Ia),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,Fa),e(se,Ra),e(C,Pa),e(C,ke),y(Wt,ke,null),e(ke,Ga),e(ke,Bt),e(Bt,Aa),e(Bt,es),e(es,Xa),e(Bt,Da),_(t,Qn,u),_(t,ne,u),e(ne,Ee),e(Ee,Qs),y(Nt,Qs,null),e(ne,qa),e(ne,Hs),e(Hs,Qa),_(t,Hn,u),_(t,Z,u),y(Ft,Z,null),e(Z,Ha),e(Z,re),e(re,Sa),e(re,ts),e(ts,Ya),e(re,La),e(re,Rt),e(Rt,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,Sn,u),_(t,ie,u),e(ie,Ze),e(Ze,Ss),y(Pt,Ss,null),e(ie,li),e(ie,Ys),e(Ys,ci),_(t,Yn,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,At),e(At,fi),e(le,gi),e(W,ui),e(W,ce),e(ce,_i),e(ce,rs),e(rs,wi),e(ce,bi),e(ce,as),e(as,Ti),e(ce,vi),e(W,yi),y(We,W,null),_(t,Ln,u),_(t,de,u),e(de,Be),e(Be,Ls),y(Xt,Ls,null),e(de,Mi),e(de,Ks),e(Ks,Vi),_(t,Kn,u),_(t,z,u),y(Dt,z,null),e(z,ji),e(z,en),e(en,$i),e(z,Ji),e(z,qt),e(qt,Oi),e(qt,is),e(is,xi),e(qt,Ui),e(z,zi),e(z,Ne),y(Qt,Ne,null),e(Ne,Ii),e(Ne,tn),e(tn,ki),e(z,Ei),e(z,Fe),y(Ht,Fe,null),e(Fe,Ci),e(Fe,St),e(St,Zi),e(St,ls),e(ls,Wi),e(St,Bi),e(z,Ni),e(z,Re),y(Yt,Re,null),e(Re,Fi),e(Re,Lt),e(Lt,Ri),e(Lt,cs),e(cs,Pi),e(Lt,Gi),_(t,er,u),_(t,pe,u),e(pe,Pe),e(Pe,on),y(Kt,on,null),e(pe,Ai),e(pe,sn),e(sn,Xi),_(t,tr,u),_(t,B,u),y(eo,B,null),e(B,Di),e(B,Ge),y(to,Ge,null),e(Ge,qi),e(Ge,nn),e(nn,Qi),e(B,Hi),e(B,Ae),y(oo,Ae,null),e(Ae,Si),e(Ae,so),e(so,Yi),e(so,ds),e(ds,Li),e(so,Ki),e(B,el),e(B,Xe),y(no,Xe,null),e(Xe,tl),e(Xe,ro),e(ro,ol),e(ro,ps),e(ps,sl),e(ro,nl),_(t,or,u),_(t,me,u),e(me,De),e(De,rn),y(ao,rn,null),e(me,rl),e(me,an),e(an,al),_(t,sr,u),_(t,U,u),y(io,U,null),e(U,il),e(U,I),e(I,ll),e(I,ms),e(ms,cl),e(I,dl),e(I,hs),e(hs,pl),e(I,ml),e(I,fs),e(fs,hl),e(I,fl),e(I,ln),e(ln,gl),e(I,ul),e(I,gs),e(gs,_l),e(I,wl),e(U,bl),e(U,qe),y(lo,qe,null),e(qe,Tl),e(qe,co),e(co,vl),e(co,us),e(us,yl),e(co,Ml),e(U,Vl),e(U,Qe),y(po,Qe,null),e(Qe,jl),e(Qe,mo),e(mo,$l),e(mo,_s),e(_s,Jl),e(mo,Ol),e(U,xl),e(U,He),y(ho,He,null),e(He,Ul),e(He,fo),e(fo,zl),e(fo,ws),e(ws,Il),e(fo,kl),e(U,El),e(U,Se),y(go,Se,null),e(Se,Cl),e(Se,uo),e(uo,Zl),e(uo,cn),e(cn,Wl),e(uo,Bl),e(U,Nl),e(U,Ye),y(_o,Ye,null),e(Ye,Fl),e(Ye,wo),e(wo,Rl),e(wo,bs),e(bs,Pl),e(wo,Gl),_(t,nr,u),_(t,he,u),e(he,Le),e(Le,dn),y(bo,dn,null),e(he,Al),e(he,pn),e(pn,Xl),_(t,rr,u),_(t,N,u),y(To,N,null),e(N,Dl),e(N,R),y(vo,R,null),e(R,ql),e(R,fe),e(fe,Ql),e(fe,Ts),e(Ts,Hl),e(fe,Sl),e(fe,mn),e(mn,Yl),e(fe,Ll),e(R,Kl),y(Ke,R,null),e(R,ec),y(et,R,null),e(N,tc),e(N,P),y(yo,P,null),e(P,oc),e(P,ge),e(ge,sc),e(ge,vs),e(vs,nc),e(ge,rc),e(ge,hn),e(hn,ac),e(ge,ic),e(P,lc),y(tt,P,null),e(P,cc),y(ot,P,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,bc),e(_e,un),e(un,Tc),_(t,ir,u),_(t,we,u),y(jo,we,null),e(we,vc),e(we,A),y($o,A,null),e(A,yc),e(A,be),e(be,Mc),e(be,Ms),e(Ms,Vc),e(be,jc),e(be,_n),e(_n,$c),e(be,Jc),e(A,Oc),y(at,A,null),e(A,xc),y(it,A,null),_(t,lr,u),_(t,Te,u),e(Te,lt),e(lt,wn),y(Jo,wn,null),e(Te,Uc),e(Te,bn),e(bn,zc),_(t,cr,u),_(t,ve,u),y(Oo,ve,null),e(ve,Ic),e(ve,X),y(xo,X,null),e(X,kc),e(X,ye),e(ye,Ec),e(ye,Vs),e(Vs,Cc),e(ye,Zc),e(ye,Tn),e(Tn,Wc),e(ye,Bc),e(X,Nc),y(ct,X,null),e(X,Fc),y(dt,X,null),_(t,dr,u),_(t,Me,u),e(Me,pt),e(pt,vn),y(Uo,vn,null),e(Me,Rc),e(Me,yn),e(yn,Pc),_(t,pr,u),_(t,S,u),y(zo,S,null),e(S,Gc),e(S,D),y(Io,D,null),e(D,Ac),e(D,Ve),e(Ve,Xc),e(Ve,js),e(js,Dc),e(Ve,qc),e(Ve,Mn),e(Mn,Qc),e(Ve,Hc),e(D,Sc),y(mt,D,null),e(D,Yc),y(ht,D,null),e(S,Lc),e(S,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 Un={};u&2&&(Un.$$scope={dirty:u,ctx:t}),nt.$set(Un);const Zo={};u&2&&(Zo.$$scope={dirty:u,ctx:t}),at.$set(Zo);const zn={};u&2&&(zn.$$scope={dirty:u,ctx:t}),it.$set(zn);const In={};u&2&&(In.$$scope={dirty:u,ctx:t}),ct.$set(In);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(Ut.$$.fragment,t),M(zt.$$.fragment,t),M(Et.$$.fragment,t),M(Ct.$$.fragment,t),M(Wt.$$.fragment,t),M(Nt.$$.fragment,t),M(Ft.$$.fragment,t),M(Ce.$$.fragment,t),M(Pt.$$.fragment,t),M(Gt.$$.fragment,t),M(We.$$.fragment,t),M(Xt.$$.fragment,t),M(Dt.$$.fragment,t),M(Qt.$$.fragment,t),M(Ht.$$.fragment,t),M(Yt.$$.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(bo.$$.fragment,t),M(To.$$.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(Uo.$$.fragment,t),M(zo.$$.fragment,t),M(Io.$$.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(Ut.$$.fragment,t),V(zt.$$.fragment,t),V(Et.$$.fragment,t),V(Ct.$$.fragment,t),V(Wt.$$.fragment,t),V(Nt.$$.fragment,t),V(Ft.$$.fragment,t),V(Ce.$$.fragment,t),V(Pt.$$.fragment,t),V(Gt.$$.fragment,t),V(We.$$.fragment,t),V(Xt.$$.fragment,t),V(Dt.$$.fragment,t),V(Qt.$$.fragment,t),V(Ht.$$.fragment,t),V(Yt.$$.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(bo.$$.fragment,t),V(To.$$.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(Uo.$$.fragment,t),V(zo.$$.fragment,t),V(Io.$$.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(b),t&&o(g),j(r),t&&o(Wn),t&&o(ee),j(Ot),t&&o(Bn),t&&o(xe),t&&o(Nn),t&&o(Fo),t&&o(Fn),t&&o(Ro),t&&o(Rn),t&&o(te),j(Ut),t&&o(Pn),t&&o(ze),t&&o(Gn),t&&o(x),t&&o(An),j(zt,t),t&&o(Xn),t&&o(Y),t&&o(Dn),t&&o(oe),j(Et),t&&o(qn),t&&o(C),j(Ct),j(Wt),t&&o(Qn),t&&o(ne),j(Nt),t&&o(Hn),t&&o(Z),j(Ft),j(Ce),t&&o(Sn),t&&o(ie),j(Pt),t&&o(Yn),t&&o(W),j(Gt),j(We),t&&o(Ln),t&&o(de),j(Xt),t&&o(Kn),t&&o(z),j(Dt),j(Qt),j(Ht),j(Yt),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(U),j(io),j(lo),j(po),j(ho),j(go),j(_o),t&&o(nr),t&&o(he),j(bo),t&&o(rr),t&&o(N),j(To),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(Te),j(Jo),t&&o(cr),t&&o(ve),j(Oo),j(xo),j(ct),j(dt),t&&o(dr),t&&o(Me),j(Uo),t&&o(pr),t&&o(S),j(zo),j(Io),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 Ap(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class um extends Fp{constructor(c){super();Rp(this,c,cm,im,Pp,{})}}export{um as default,lm as metadata};
