import{s as Go,o as Ho,n as ke}from"../chunks/scheduler.25b97de1.js";import{S as Do,i as Xo,g as c,s as n,r as f,A as qo,h as d,f as o,c as s,j as $,u as h,x as M,k as x,y as l,a,v as g,d as u,t as _,w as b}from"../chunks/index.d9030fc9.js";import{T as go}from"../chunks/Tip.baa67368.js";import{D as z}from"../chunks/Docstring.e257edda.js";import{C as Zt}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Rt}from"../chunks/ExampleCodeBlock.20db4b6e.js";import{P as Ao}from"../chunks/PipelineTag.5f100392.js";import{H as Z,E as Yo}from"../chunks/EditOnGithub.91d95064.js";function Oo(T){let r,y="Example:",m,p,v;return p=new Zt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1vYmlsZU5ldFYyQ29uZmlnJTJDJTIwTW9iaWxlTmV0VjJNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjAlMjJtb2JpbGVuZXRfdjJfMS4wXzIyNCUyMiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBNb2JpbGVOZXRWMkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMCUyMm1vYmlsZW5ldF92Ml8xLjBfMjI0JTIyJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBNb2JpbGVOZXRWMk1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> MobileNetV2Config, MobileNetV2Model

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a &quot;mobilenet_v2_1.0_224&quot; style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = MobileNetV2Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the &quot;mobilenet_v2_1.0_224&quot; style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MobileNetV2Model(configuration)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/mobilenet_v2_1.0_224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MobileNetV2Model.from_pretrained(<span class="hljs-string">&quot;google/mobilenet_v2_1.0_224&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">1280</span>, <span class="hljs-number">7</span>, <span class="hljs-number">7</span>]`,wrap:!1}}),{c(){r=c("p"),r.textContent=y,m=n(),f(p.$$.fragment)},l(i){r=d(i,"P",{"data-svelte-h":!0}),M(r)!=="svelte-11lpom8"&&(r.textContent=y),m=s(i),h(p.$$.fragment,i)},m(i,w){a(i,r,w),a(i,m,w),g(p,i,w),v=!0},p:ke,i(i){v||(u(p.$$.fragment,i),v=!0)},o(i){_(p.$$.fragment,i),v=!1},d(i){i&&(o(r),o(m)),b(p,i)}}}function en(T){let r,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){r=c("p"),r.innerHTML=y},l(m){r=d(m,"P",{"data-svelte-h":!0}),M(r)!=="svelte-fincs2"&&(r.innerHTML=y)},m(m,p){a(m,r,p)},p:ke,d(m){m&&o(r)}}}function tn(T){let r,y="Example:",m,p,v;return p=new Zt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1vYmlsZU5ldFYyRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGbW9iaWxlbmV0X3YyXzEuMF8yMjQlMjIpJTBBbW9kZWwlMjAlM0QlMjBNb2JpbGVOZXRWMkZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRm1vYmlsZW5ldF92Ml8xLjBfMjI0JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEElMjMlMjBtb2RlbCUyMHByZWRpY3RzJTIwb25lJTIwb2YlMjB0aGUlMjAxMDAwJTIwSW1hZ2VOZXQlMjBjbGFzc2VzJTBBcHJlZGljdGVkX2xhYmVsJTIwJTNEJTIwbG9naXRzLmFyZ21heCgtMSkuaXRlbSgpJTBBcHJpbnQobW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2xhYmVsJTVEKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, MobileNetV2ForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/mobilenet_v2_1.0_224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MobileNetV2ForImageClassification.from_pretrained(<span class="hljs-string">&quot;google/mobilenet_v2_1.0_224&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># model predicts one of the 1000 ImageNet classes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])
tabby, tabby cat`,wrap:!1}}),{c(){r=c("p"),r.textContent=y,m=n(),f(p.$$.fragment)},l(i){r=d(i,"P",{"data-svelte-h":!0}),M(r)!=="svelte-11lpom8"&&(r.textContent=y),m=s(i),h(p.$$.fragment,i)},m(i,w){a(i,r,w),a(i,m,w),g(p,i,w),v=!0},p:ke,i(i){v||(u(p.$$.fragment,i),v=!0)},o(i){_(p.$$.fragment,i),v=!1},d(i){i&&(o(r),o(m)),b(p,i)}}}function on(T){let r,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){r=c("p"),r.innerHTML=y},l(m){r=d(m,"P",{"data-svelte-h":!0}),M(r)!=="svelte-fincs2"&&(r.innerHTML=y)},m(m,p){a(m,r,p)},p:ke,d(m){m&&o(r)}}}function nn(T){let r,y="Examples:",m,p,v;return p=new Zt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyME1vYmlsZU5ldFYyRm9yU2VtYW50aWNTZWdtZW50YXRpb24lMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmRlZXBsYWJ2M19tb2JpbGVuZXRfdjJfMS4wXzUxMyUyMiklMEFtb2RlbCUyMCUzRCUyME1vYmlsZU5ldFYyRm9yU2VtYW50aWNTZWdtZW50YXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmRlZXBsYWJ2M19tb2JpbGVuZXRfdjJfMS4wXzUxMyUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBJTIzJTIwbG9naXRzJTIwYXJlJTIwb2YlMjBzaGFwZSUyMChiYXRjaF9zaXplJTJDJTIwbnVtX2xhYmVscyUyQyUyMGhlaWdodCUyQyUyMHdpZHRoKSUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, MobileNetV2ForSemanticSegmentation
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

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

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/deeplabv3_mobilenet_v2_1.0_513&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MobileNetV2ForSemanticSegmentation.from_pretrained(<span class="hljs-string">&quot;google/deeplabv3_mobilenet_v2_1.0_513&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># logits are of shape (batch_size, num_labels, height, width)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`,wrap:!1}}),{c(){r=c("p"),r.textContent=y,m=n(),f(p.$$.fragment)},l(i){r=d(i,"P",{"data-svelte-h":!0}),M(r)!=="svelte-kvfsh7"&&(r.textContent=y),m=s(i),h(p.$$.fragment,i)},m(i,w){a(i,r,w),a(i,m,w),g(p,i,w),v=!0},p:ke,i(i){v||(u(p.$$.fragment,i),v=!0)},o(i){_(p.$$.fragment,i),v=!1},d(i){i&&(o(r),o(m)),b(p,i)}}}function sn(T){let r,y,m,p,v,i,w,at,oe,uo='The MobileNet model was proposed in <a href="https://arxiv.org/abs/1801.04381" rel="nofollow">MobileNetV2: Inverted Residuals and Linear Bottlenecks</a> by Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, Liang-Chieh Chen.',it,ne,_o="The abstract from the paper is the following:",lt,se,bo="<em>In this paper we describe a new mobile architecture, MobileNetV2, that improves the state of the art performance of mobile models on multiple tasks and benchmarks as well as across a spectrum of different model sizes. We also describe efficient ways of applying these mobile models to object detection in a novel framework we call SSDLite. Additionally, we demonstrate how to build mobile semantic segmentation models through a reduced form of DeepLabv3 which we call Mobile DeepLabv3.</em>",ct,re,Mo="<em>The MobileNetV2 architecture is based on an inverted residual structure where the input and output of the residual block are thin bottleneck layers opposite to traditional residual models which use expanded representations in the input an MobileNetV2 uses lightweight depthwise convolutions to filter features in the intermediate expansion layer. Additionally, we find that it is important to remove non-linearities in the narrow layers in order to maintain representational power. We demonstrate that this improves performance and provide an intuition that led to this design. Finally, our approach allows decoupling of the input/output domains from the expressiveness of the transformation, which provides a convenient framework for further analysis. We measure our performance on Imagenet classification, COCO object detection, VOC image segmentation. We evaluate the trade-offs between accuracy, and number of operations measured by multiply-adds (MAdd), as well as the number of parameters.</em>",dt,ae,vo='This model was contributed by <a href="https://huggingface.co/Matthijs" rel="nofollow">matthijs</a>. The original code and weights can be found <a href="https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet" rel="nofollow">here for the main model</a> and <a href="https://github.com/tensorflow/models/tree/master/research/deeplab" rel="nofollow">here for DeepLabV3+</a>.',mt,ie,pt,le,yo='<li><p>The checkpoints are named <strong>mobilenet_v2_<em>depth</em>_<em>size</em></strong>, for example <strong>mobilenet_v2_1.0_224</strong>, where <strong>1.0</strong> is the depth multiplier (sometimes also referred to as “alpha” or the width multiplier) and <strong>224</strong> is the resolution of the input images the model was trained on.</p></li> <li><p>Even though the checkpoint is trained on images of specific size, the model will work on images of any size. The smallest supported image size is 32x32.</p></li> <li><p>One can use <a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2ImageProcessor">MobileNetV2ImageProcessor</a> to prepare images for the model.</p></li> <li><p>The available image classification checkpoints are pre-trained on <a href="https://huggingface.co/datasets/imagenet-1k" rel="nofollow">ImageNet-1k</a> (also referred to as ILSVRC 2012, a collection of 1.3 million images and 1,000 classes). However, the model predicts 1001 classes: the 1000 classes from ImageNet plus an extra “background” class (index 0).</p></li> <li><p>The segmentation model uses a <a href="https://arxiv.org/abs/1802.02611" rel="nofollow">DeepLabV3+</a> head. The available semantic segmentation checkpoints are pre-trained on <a href="http://host.robots.ox.ac.uk/pascal/VOC/" rel="nofollow">PASCAL VOC</a>.</p></li> <li><p>The original TensorFlow checkpoints use different padding rules than PyTorch, requiring the model to determine the padding amount at inference time, since this depends on the input image size. To use native PyTorch padding behavior, create a <a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Config">MobileNetV2Config</a> with <code>tf_padding = False</code>.</p></li>',ft,ce,wo="Unsupported features:",ht,de,To='<li><p>The <a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Model">MobileNetV2Model</a> outputs a globally pooled version of the last hidden state. In the original model it is possible to use an average pooling layer with a fixed 7x7 window and stride 1 instead of global pooling. For inputs that are larger than the recommended image size, this gives a pooled output that is larger than 1x1. The Hugging Face implementation does not support this.</p></li> <li><p>The original TensorFlow checkpoints include quantized models. We do not support these models as they include additional “FakeQuantization” operations to unquantize the weights.</p></li> <li><p>It’s common to extract the output from the expansion layers at indices 10 and 13, as well as the output from the final 1x1 convolution layer, for downstream purposes. Using <code>output_hidden_states=True</code> returns the output from all intermediate layers. There is currently no way to limit this to specific layers.</p></li> <li><p>The DeepLabV3+ segmentation head does not use the final convolution layer from the backbone, but this layer gets computed anyway. There is currently no way to tell <a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Model">MobileNetV2Model</a> up to which layer it should run.</p></li>',gt,me,ut,pe,$o="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with MobileNetV2.",_t,fe,bt,he,xo='<li><a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2ForImageClassification">MobileNetV2ForImageClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb" rel="nofollow">notebook</a>.</li> <li>See also: <a href="../tasks/image_classification">Image classification task guide</a></li>',Mt,ge,No="<strong>Semantic segmentation</strong>",vt,ue,Vo='<li><a href="../tasks/semantic_segmentation">Semantic segmentation task guide</a></li>',yt,_e,Co="If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",wt,be,Tt,N,Me,Pt,Be,Io=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Model">MobileNetV2Model</a>. It is used to instantiate a
MobileNetV2 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the MobileNetV2
<a href="https://huggingface.co/google/mobilenet_v2_1.0_224" rel="nofollow">google/mobilenet_v2_1.0_224</a> architecture.`,Et,Ge,zo=`Configuration objects inherit from <a href="/docs/transformers/pr_30530/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/pr_30530/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Lt,E,$t,ve,xt,S,ye,kt,L,we,Bt,He,jo="Preprocess an image or batch of images.",Gt,k,Te,Ht,De,Uo='Converts the output of <a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2ForSemanticSegmentation">MobileNetV2ForSemanticSegmentation</a> into semantic segmentation maps. Only supports PyTorch.',Nt,$e,Vt,V,xe,Dt,Xe,Fo="Constructs a MobileNetV2 image processor.",Xt,B,Ne,qt,qe,So="Preprocess an image or batch of images.",At,G,Ve,Yt,Ae,Wo='Converts the output of <a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2ForSemanticSegmentation">MobileNetV2ForSemanticSegmentation</a> into semantic segmentation maps. Only supports PyTorch.',Ct,Ce,It,W,Ie,Ot,Ye,Jo=`The bare MobileNetV2 model outputting raw hidden-states without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Qt,j,ze,Kt,Oe,Ro='The <a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Model">MobileNetV2Model</a> forward method, overrides the <code>__call__</code> special method.',eo,H,to,D,zt,je,jt,C,Ue,oo,Qe,Zo=`MobileNetV2 model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
ImageNet.`,no,Ke,Po=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,so,U,Fe,ro,et,Eo='The <a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2ForImageClassification">MobileNetV2ForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',ao,X,io,q,Ut,Se,Ft,I,We,lo,tt,Lo="MobileNetV2 model with a semantic segmentation head on top, e.g. for Pascal VOC.",co,ot,ko=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,mo,F,Je,po,nt,Bo='The <a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2ForSemanticSegmentation">MobileNetV2ForSemanticSegmentation</a> forward method, overrides the <code>__call__</code> special method.',fo,A,ho,Y,St,Re,Wt,rt,Jt;return v=new Z({props:{title:"MobileNet V2",local:"mobilenet-v2",headingTag:"h1"}}),w=new Z({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ie=new Z({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),me=new Z({props:{title:"Resources",local:"resources",headingTag:"h2"}}),fe=new Ao({props:{pipeline:"image-classification"}}),be=new Z({props:{title:"MobileNetV2Config",local:"transformers.MobileNetV2Config",headingTag:"h2"}}),Me=new z({props:{name:"class transformers.MobileNetV2Config",anchor:"transformers.MobileNetV2Config",parameters:[{name:"num_channels",val:" = 3"},{name:"image_size",val:" = 224"},{name:"depth_multiplier",val:" = 1.0"},{name:"depth_divisible_by",val:" = 8"},{name:"min_depth",val:" = 8"},{name:"expand_ratio",val:" = 6.0"},{name:"output_stride",val:" = 32"},{name:"first_layer_is_expansion",val:" = True"},{name:"finegrained_output",val:" = True"},{name:"hidden_act",val:" = 'relu6'"},{name:"tf_padding",val:" = True"},{name:"classifier_dropout_prob",val:" = 0.8"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 0.001"},{name:"semantic_loss_ignore_index",val:" = 255"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MobileNetV2Config.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of input channels.`,name:"num_channels"},{anchor:"transformers.MobileNetV2Config.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.MobileNetV2Config.depth_multiplier",description:`<strong>depth_multiplier</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Shrinks or expands the number of channels in each layer. Default is 1.0, which starts the network with 32
channels. This is sometimes also called &#x201C;alpha&#x201D; or &#x201C;width multiplier&#x201D;.`,name:"depth_multiplier"},{anchor:"transformers.MobileNetV2Config.depth_divisible_by",description:`<strong>depth_divisible_by</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The number of channels in each layer will always be a multiple of this number.`,name:"depth_divisible_by"},{anchor:"transformers.MobileNetV2Config.min_depth",description:`<strong>min_depth</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
All layers will have at least this many channels.`,name:"min_depth"},{anchor:"transformers.MobileNetV2Config.expand_ratio",description:`<strong>expand_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 6.0) &#x2014;
The number of output channels of the first layer in each block is input channels times expansion ratio.`,name:"expand_ratio"},{anchor:"transformers.MobileNetV2Config.output_stride",description:`<strong>output_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The ratio between the spatial resolution of the input and output feature maps. By default the model reduces
the input dimensions by a factor of 32. If <code>output_stride</code> is 8 or 16, the model uses dilated convolutions
on the depthwise layers instead of regular convolutions, so that the feature maps never become more than 8x
or 16x smaller than the input image.`,name:"output_stride"},{anchor:"transformers.MobileNetV2Config.first_layer_is_expansion",description:`<strong>first_layer_is_expansion</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
True if the very first convolution layer is also the expansion layer for the first expansion block.`,name:"first_layer_is_expansion"},{anchor:"transformers.MobileNetV2Config.finegrained_output",description:`<strong>finegrained_output</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
If true, the number of output channels in the final convolution layer will stay large (1280) even if
<code>depth_multiplier</code> is less than 1.`,name:"finegrained_output"},{anchor:"transformers.MobileNetV2Config.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;relu6&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the Transformer encoder and convolution layers.`,name:"hidden_act"},{anchor:"transformers.MobileNetV2Config.tf_padding",description:`<strong>tf_padding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use TensorFlow padding rules on the convolution layers.`,name:"tf_padding"},{anchor:"transformers.MobileNetV2Config.classifier_dropout_prob",description:`<strong>classifier_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
The dropout ratio for attached classifiers.`,name:"classifier_dropout_prob"},{anchor:"transformers.MobileNetV2Config.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.MobileNetV2Config.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 0.001) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.MobileNetV2Config.semantic_loss_ignore_index",description:`<strong>semantic_loss_ignore_index</strong> (<code>int</code>, <em>optional</em>, defaults to 255) &#x2014;
The index that is ignored by the loss function of the semantic segmentation model.`,name:"semantic_loss_ignore_index"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/configuration_mobilenet_v2.py#L30"}}),E=new Rt({props:{anchor:"transformers.MobileNetV2Config.example",$$slots:{default:[Oo]},$$scope:{ctx:T}}}),ve=new Z({props:{title:"MobileNetV2FeatureExtractor",local:"transformers.MobileNetV2FeatureExtractor",headingTag:"h2"}}),ye=new z({props:{name:"class transformers.MobileNetV2FeatureExtractor",anchor:"transformers.MobileNetV2FeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/feature_extraction_mobilenet_v2.py#L26"}}),we=new z({props:{name:"preprocess",anchor:"transformers.MobileNetV2FeatureExtractor.preprocess",parameters:[{name:"images",val:": Union"},{name:"do_resize",val:": Optional = None"},{name:"size",val:": Dict = None"},{name:"resample",val:": Resampling = None"},{name:"do_center_crop",val:": bool = None"},{name:"crop_size",val:": Dict = None"},{name:"do_rescale",val:": Optional = None"},{name:"rescale_factor",val:": Optional = None"},{name:"do_normalize",val:": Optional = None"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = None"},{name:"return_tensors",val:": Union = None"},{name:"data_format",val:": Union = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing. Shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio.`,name:"size"},{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code> filter, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
<code>PILImageResampling</code> filter to use if resizing the image e.g. <code>PILImageResampling.BILINEAR</code>. Only has
an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.MobileNetV2FeatureExtractor.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 to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the center crop. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image values between [0 - 1].`,name:"do_rescale"},{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to use if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to use if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_std"},{anchor:"transformers.MobileNetV2FeatureExtractor.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.MobileNetV2FeatureExtractor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.MobileNetV2FeatureExtractor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/image_processing_mobilenet_v2.py#L188"}}),Te=new z({props:{name:"post_process_semantic_segmentation",anchor:"transformers.MobileNetV2FeatureExtractor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": List = None"}],parametersDescription:[{anchor:"transformers.MobileNetV2FeatureExtractor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2ForSemanticSegmentation">MobileNetV2ForSemanticSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.MobileNetV2FeatureExtractor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code> of length <code>batch_size</code>, <em>optional</em>) &#x2014;
List of tuples corresponding to the requested final size (height, width) of each prediction. If unset,
predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/image_processing_mobilenet_v2.py#L332",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[torch.Tensor]</code> of length <code>batch_size</code>, where each item is a semantic
segmentation map of shape (height, width) corresponding to the target_sizes entry (if <code>target_sizes</code> is
specified). Each entry of each <code>torch.Tensor</code> correspond to a semantic class id.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>semantic_segmentation</p>
`}}),$e=new Z({props:{title:"MobileNetV2ImageProcessor",local:"transformers.MobileNetV2ImageProcessor",headingTag:"h2"}}),xe=new z({props:{name:"class transformers.MobileNetV2ImageProcessor",anchor:"transformers.MobileNetV2ImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": Optional = None"},{name:"resample",val:": Resampling = <Resampling.BILINEAR: 2>"},{name:"do_center_crop",val:": bool = True"},{name:"crop_size",val:": Dict = None"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": Union = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MobileNetV2ImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by
<code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.MobileNetV2ImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 256}</code>):
Size of the image after resizing. The shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio. Can be overridden by <code>size</code> in the <code>preprocess</code>
method.`,name:"size"},{anchor:"transformers.MobileNetV2ImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BILINEAR</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by the <code>resample</code> parameter in the
<code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.MobileNetV2ImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to center crop the image. 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. Can be overridden by the <code>do_center_crop</code> parameter in the
<code>preprocess</code> method.`,name:"do_center_crop"},{anchor:"transformers.MobileNetV2ImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 224, &quot;width&quot;: 224}</code>):
Desired output size when applying center-cropping. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.
Can be overridden by the <code>crop_size</code> parameter in the <code>preprocess</code> method.`,name:"crop_size"},{anchor:"transformers.MobileNetV2ImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the <code>do_rescale</code>
parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.MobileNetV2ImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by the <code>rescale_factor</code> parameter in the
<code>preprocess</code> method.
do_normalize &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"rescale_factor"},{anchor:"transformers.MobileNetV2ImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_MEAN</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.MobileNetV2ImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_STD</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/image_processing_mobilenet_v2.py#L51"}}),Ne=new z({props:{name:"preprocess",anchor:"transformers.MobileNetV2ImageProcessor.preprocess",parameters:[{name:"images",val:": Union"},{name:"do_resize",val:": Optional = None"},{name:"size",val:": Dict = None"},{name:"resample",val:": Resampling = None"},{name:"do_center_crop",val:": bool = None"},{name:"crop_size",val:": Dict = None"},{name:"do_rescale",val:": Optional = None"},{name:"rescale_factor",val:": Optional = None"},{name:"do_normalize",val:": Optional = None"},{name:"image_mean",val:": Union = None"},{name:"image_std",val:": Union = None"},{name:"return_tensors",val:": Union = None"},{name:"data_format",val:": Union = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": Union = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after resizing. Shortest edge of the image is resized to size[&#x201C;shortest_edge&#x201D;], with
the longest edge resized to keep the input aspect ratio.`,name:"size"},{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code> filter, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
<code>PILImageResampling</code> filter to use if resizing the image e.g. <code>PILImageResampling.BILINEAR</code>. Only has
an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.MobileNetV2ImageProcessor.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 to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the center crop. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>.`,name:"crop_size"},{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image values between [0 - 1].`,name:"do_rescale"},{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to use if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to use if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_std"},{anchor:"transformers.MobileNetV2ImageProcessor.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.MobileNetV2ImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.MobileNetV2ImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/image_processing_mobilenet_v2.py#L188"}}),Ve=new z({props:{name:"post_process_semantic_segmentation",anchor:"transformers.MobileNetV2ImageProcessor.post_process_semantic_segmentation",parameters:[{name:"outputs",val:""},{name:"target_sizes",val:": List = None"}],parametersDescription:[{anchor:"transformers.MobileNetV2ImageProcessor.post_process_semantic_segmentation.outputs",description:`<strong>outputs</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2ForSemanticSegmentation">MobileNetV2ForSemanticSegmentation</a>) &#x2014;
Raw outputs of the model.`,name:"outputs"},{anchor:"transformers.MobileNetV2ImageProcessor.post_process_semantic_segmentation.target_sizes",description:`<strong>target_sizes</strong> (<code>List[Tuple]</code> of length <code>batch_size</code>, <em>optional</em>) &#x2014;
List of tuples corresponding to the requested final size (height, width) of each prediction. If unset,
predictions will not be resized.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/image_processing_mobilenet_v2.py#L332",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[torch.Tensor]</code> of length <code>batch_size</code>, where each item is a semantic
segmentation map of shape (height, width) corresponding to the target_sizes entry (if <code>target_sizes</code> is
specified). Each entry of each <code>torch.Tensor</code> correspond to a semantic class id.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>semantic_segmentation</p>
`}}),Ce=new Z({props:{title:"MobileNetV2Model",local:"transformers.MobileNetV2Model",headingTag:"h2"}}),Ie=new z({props:{name:"class transformers.MobileNetV2Model",anchor:"transformers.MobileNetV2Model",parameters:[{name:"config",val:": MobileNetV2Config"},{name:"add_pooling_layer",val:": bool = True"}],parametersDescription:[{anchor:"transformers.MobileNetV2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Config">MobileNetV2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/modeling_mobilenet_v2.py#L489"}}),ze=new z({props:{name:"forward",anchor:"transformers.MobileNetV2Model.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.MobileNetV2Model.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_30530/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/pr_30530/en/model_doc/levit#transformers.LevitFeatureExtractor.__call__">MobileNetV2ImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.MobileNetV2Model.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.MobileNetV2Model.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/pr_30530/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/modeling_mobilenet_v2.py#L557",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Config"
>MobileNetV2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) — Last layer hidden-state after a pooling operation on the spatial dimensions.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, num_channels, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),H=new go({props:{$$slots:{default:[Qo]},$$scope:{ctx:T}}}),D=new Rt({props:{anchor:"transformers.MobileNetV2Model.forward.example",$$slots:{default:[Ko]},$$scope:{ctx:T}}}),je=new Z({props:{title:"MobileNetV2ForImageClassification",local:"transformers.MobileNetV2ForImageClassification",headingTag:"h2"}}),Ue=new z({props:{name:"class transformers.MobileNetV2ForImageClassification",anchor:"transformers.MobileNetV2ForImageClassification",parameters:[{name:"config",val:": MobileNetV2Config"}],parametersDescription:[{anchor:"transformers.MobileNetV2ForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Config">MobileNetV2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/modeling_mobilenet_v2.py#L606"}}),Fe=new z({props:{name:"forward",anchor:"transformers.MobileNetV2ForImageClassification.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.MobileNetV2ForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_30530/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/pr_30530/en/model_doc/levit#transformers.LevitFeatureExtractor.__call__">MobileNetV2ImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.MobileNetV2ForImageClassification.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.MobileNetV2ForImageClassification.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/pr_30530/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.MobileNetV2ForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss). If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/modeling_mobilenet_v2.py#L629",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30530/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Config"
>MobileNetV2Config</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (or regression if config.num_labels==1) loss.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — 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 stage) of shape <code>(batch_size, num_channels, height, width)</code>. Hidden-states (also
called feature maps) of the model at the output of each stage.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_30530/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),X=new go({props:{$$slots:{default:[en]},$$scope:{ctx:T}}}),q=new Rt({props:{anchor:"transformers.MobileNetV2ForImageClassification.forward.example",$$slots:{default:[tn]},$$scope:{ctx:T}}}),Se=new Z({props:{title:"MobileNetV2ForSemanticSegmentation",local:"transformers.MobileNetV2ForSemanticSegmentation",headingTag:"h2"}}),We=new z({props:{name:"class transformers.MobileNetV2ForSemanticSegmentation",anchor:"transformers.MobileNetV2ForSemanticSegmentation",parameters:[{name:"config",val:": MobileNetV2Config"}],parametersDescription:[{anchor:"transformers.MobileNetV2ForSemanticSegmentation.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Config">MobileNetV2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/pr_30530/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/modeling_mobilenet_v2.py#L766"}}),Je=new z({props:{name:"forward",anchor:"transformers.MobileNetV2ForSemanticSegmentation.forward",parameters:[{name:"pixel_values",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.MobileNetV2ForSemanticSegmentation.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/pr_30530/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/pr_30530/en/model_doc/levit#transformers.LevitFeatureExtractor.__call__">MobileNetV2ImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.MobileNetV2ForSemanticSegmentation.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.MobileNetV2ForSemanticSegmentation.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/pr_30530/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.MobileNetV2ForSemanticSegmentation.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, height, width)</code>, <em>optional</em>) &#x2014;
Ground truth semantic segmentation maps for computing the loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels &gt; 1</code>, a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/models/mobilenet_v2/modeling_mobilenet_v2.py#L783",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30530/en/main_classes/output#transformers.modeling_outputs.SemanticSegmenterOutput"
>transformers.modeling_outputs.SemanticSegmenterOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/pr_30530/en/model_doc/mobilenet_v2#transformers.MobileNetV2Config"
>MobileNetV2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels, logits_height, logits_width)</code>) — Classification scores for each pixel.</p>
<Tip warning={true}>
<p>The logits returned do not necessarily have the same size as the <code>pixel_values</code> passed as inputs. This is
to avoid doing two interpolations and lose some quality when a user needs to resize the logits to the
original image size as post-processing. You should always check your logits shape and resize as needed.</p>
</Tip>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, patch_size, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_30530/en/main_classes/output#transformers.modeling_outputs.SemanticSegmenterOutput"
>transformers.modeling_outputs.SemanticSegmenterOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),A=new go({props:{$$slots:{default:[on]},$$scope:{ctx:T}}}),Y=new Rt({props:{anchor:"transformers.MobileNetV2ForSemanticSegmentation.forward.example",$$slots:{default:[nn]},$$scope:{ctx:T}}}),Re=new Yo({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/mobilenet_v2.md"}}),{c(){r=c("meta"),y=n(),m=c("p"),p=n(),f(v.$$.fragment),i=n(),f(w.$$.fragment),at=n(),oe=c("p"),oe.innerHTML=uo,it=n(),ne=c("p"),ne.textContent=_o,lt=n(),se=c("p"),se.innerHTML=bo,ct=n(),re=c("p"),re.innerHTML=Mo,dt=n(),ae=c("p"),ae.innerHTML=vo,mt=n(),f(ie.$$.fragment),pt=n(),le=c("ul"),le.innerHTML=yo,ft=n(),ce=c("p"),ce.textContent=wo,ht=n(),de=c("ul"),de.innerHTML=To,gt=n(),f(me.$$.fragment),ut=n(),pe=c("p"),pe.textContent=$o,_t=n(),f(fe.$$.fragment),bt=n(),he=c("ul"),he.innerHTML=xo,Mt=n(),ge=c("p"),ge.innerHTML=No,vt=n(),ue=c("ul"),ue.innerHTML=Vo,yt=n(),_e=c("p"),_e.textContent=Co,wt=n(),f(be.$$.fragment),Tt=n(),N=c("div"),f(Me.$$.fragment),Pt=n(),Be=c("p"),Be.innerHTML=Io,Et=n(),Ge=c("p"),Ge.innerHTML=zo,Lt=n(),f(E.$$.fragment),$t=n(),f(ve.$$.fragment),xt=n(),S=c("div"),f(ye.$$.fragment),kt=n(),L=c("div"),f(we.$$.fragment),Bt=n(),He=c("p"),He.textContent=jo,Gt=n(),k=c("div"),f(Te.$$.fragment),Ht=n(),De=c("p"),De.innerHTML=Uo,Nt=n(),f($e.$$.fragment),Vt=n(),V=c("div"),f(xe.$$.fragment),Dt=n(),Xe=c("p"),Xe.textContent=Fo,Xt=n(),B=c("div"),f(Ne.$$.fragment),qt=n(),qe=c("p"),qe.textContent=So,At=n(),G=c("div"),f(Ve.$$.fragment),Yt=n(),Ae=c("p"),Ae.innerHTML=Wo,Ct=n(),f(Ce.$$.fragment),It=n(),W=c("div"),f(Ie.$$.fragment),Ot=n(),Ye=c("p"),Ye.innerHTML=Jo,Qt=n(),j=c("div"),f(ze.$$.fragment),Kt=n(),Oe=c("p"),Oe.innerHTML=Ro,eo=n(),f(H.$$.fragment),to=n(),f(D.$$.fragment),zt=n(),f(je.$$.fragment),jt=n(),C=c("div"),f(Ue.$$.fragment),oo=n(),Qe=c("p"),Qe.textContent=Zo,no=n(),Ke=c("p"),Ke.innerHTML=Po,so=n(),U=c("div"),f(Fe.$$.fragment),ro=n(),et=c("p"),et.innerHTML=Eo,ao=n(),f(X.$$.fragment),io=n(),f(q.$$.fragment),Ut=n(),f(Se.$$.fragment),Ft=n(),I=c("div"),f(We.$$.fragment),lo=n(),tt=c("p"),tt.textContent=Lo,co=n(),ot=c("p"),ot.innerHTML=ko,mo=n(),F=c("div"),f(Je.$$.fragment),po=n(),nt=c("p"),nt.innerHTML=Bo,fo=n(),f(A.$$.fragment),ho=n(),f(Y.$$.fragment),St=n(),f(Re.$$.fragment),Wt=n(),rt=c("p"),this.h()},l(e){const t=qo("svelte-u9bgzb",document.head);r=d(t,"META",{name:!0,content:!0}),t.forEach(o),y=s(e),m=d(e,"P",{}),$(m).forEach(o),p=s(e),h(v.$$.fragment,e),i=s(e),h(w.$$.fragment,e),at=s(e),oe=d(e,"P",{"data-svelte-h":!0}),M(oe)!=="svelte-17rxl9l"&&(oe.innerHTML=uo),it=s(e),ne=d(e,"P",{"data-svelte-h":!0}),M(ne)!=="svelte-vfdo9a"&&(ne.textContent=_o),lt=s(e),se=d(e,"P",{"data-svelte-h":!0}),M(se)!=="svelte-8ynb3"&&(se.innerHTML=bo),ct=s(e),re=d(e,"P",{"data-svelte-h":!0}),M(re)!=="svelte-1boky5r"&&(re.innerHTML=Mo),dt=s(e),ae=d(e,"P",{"data-svelte-h":!0}),M(ae)!=="svelte-1phamvp"&&(ae.innerHTML=vo),mt=s(e),h(ie.$$.fragment,e),pt=s(e),le=d(e,"UL",{"data-svelte-h":!0}),M(le)!=="svelte-q0him"&&(le.innerHTML=yo),ft=s(e),ce=d(e,"P",{"data-svelte-h":!0}),M(ce)!=="svelte-3u9dfs"&&(ce.textContent=wo),ht=s(e),de=d(e,"UL",{"data-svelte-h":!0}),M(de)!=="svelte-irx2ti"&&(de.innerHTML=To),gt=s(e),h(me.$$.fragment,e),ut=s(e),pe=d(e,"P",{"data-svelte-h":!0}),M(pe)!=="svelte-1s4mgd4"&&(pe.textContent=$o),_t=s(e),h(fe.$$.fragment,e),bt=s(e),he=d(e,"UL",{"data-svelte-h":!0}),M(he)!=="svelte-ji9neg"&&(he.innerHTML=xo),Mt=s(e),ge=d(e,"P",{"data-svelte-h":!0}),M(ge)!=="svelte-1qspi63"&&(ge.innerHTML=No),vt=s(e),ue=d(e,"UL",{"data-svelte-h":!0}),M(ue)!=="svelte-bnel3y"&&(ue.innerHTML=Vo),yt=s(e),_e=d(e,"P",{"data-svelte-h":!0}),M(_e)!=="svelte-1xesile"&&(_e.textContent=Co),wt=s(e),h(be.$$.fragment,e),Tt=s(e),N=d(e,"DIV",{class:!0});var J=$(N);h(Me.$$.fragment,J),Pt=s(J),Be=d(J,"P",{"data-svelte-h":!0}),M(Be)!=="svelte-gzsgw4"&&(Be.innerHTML=Io),Et=s(J),Ge=d(J,"P",{"data-svelte-h":!0}),M(Ge)!=="svelte-l1blo3"&&(Ge.innerHTML=zo),Lt=s(J),h(E.$$.fragment,J),J.forEach(o),$t=s(e),h(ve.$$.fragment,e),xt=s(e),S=d(e,"DIV",{class:!0});var P=$(S);h(ye.$$.fragment,P),kt=s(P),L=d(P,"DIV",{class:!0});var Ze=$(L);h(we.$$.fragment,Ze),Bt=s(Ze),He=d(Ze,"P",{"data-svelte-h":!0}),M(He)!=="svelte-1x3yxsa"&&(He.textContent=jo),Ze.forEach(o),Gt=s(P),k=d(P,"DIV",{class:!0});var Pe=$(k);h(Te.$$.fragment,Pe),Ht=s(Pe),De=d(Pe,"P",{"data-svelte-h":!0}),M(De)!=="svelte-16fg5gd"&&(De.innerHTML=Uo),Pe.forEach(o),P.forEach(o),Nt=s(e),h($e.$$.fragment,e),Vt=s(e),V=d(e,"DIV",{class:!0});var R=$(V);h(xe.$$.fragment,R),Dt=s(R),Xe=d(R,"P",{"data-svelte-h":!0}),M(Xe)!=="svelte-byi2j1"&&(Xe.textContent=Fo),Xt=s(R),B=d(R,"DIV",{class:!0});var Ee=$(B);h(Ne.$$.fragment,Ee),qt=s(Ee),qe=d(Ee,"P",{"data-svelte-h":!0}),M(qe)!=="svelte-1x3yxsa"&&(qe.textContent=So),Ee.forEach(o),At=s(R),G=d(R,"DIV",{class:!0});var Le=$(G);h(Ve.$$.fragment,Le),Yt=s(Le),Ae=d(Le,"P",{"data-svelte-h":!0}),M(Ae)!=="svelte-16fg5gd"&&(Ae.innerHTML=Wo),Le.forEach(o),R.forEach(o),Ct=s(e),h(Ce.$$.fragment,e),It=s(e),W=d(e,"DIV",{class:!0});var st=$(W);h(Ie.$$.fragment,st),Ot=s(st),Ye=d(st,"P",{"data-svelte-h":!0}),M(Ye)!=="svelte-xugesj"&&(Ye.innerHTML=Jo),Qt=s(st),j=d(st,"DIV",{class:!0});var O=$(j);h(ze.$$.fragment,O),Kt=s(O),Oe=d(O,"P",{"data-svelte-h":!0}),M(Oe)!=="svelte-15dpa0u"&&(Oe.innerHTML=Ro),eo=s(O),h(H.$$.fragment,O),to=s(O),h(D.$$.fragment,O),O.forEach(o),st.forEach(o),zt=s(e),h(je.$$.fragment,e),jt=s(e),C=d(e,"DIV",{class:!0});var Q=$(C);h(Ue.$$.fragment,Q),oo=s(Q),Qe=d(Q,"P",{"data-svelte-h":!0}),M(Qe)!=="svelte-1cewssh"&&(Qe.textContent=Zo),no=s(Q),Ke=d(Q,"P",{"data-svelte-h":!0}),M(Ke)!=="svelte-1gjh92c"&&(Ke.innerHTML=Po),so=s(Q),U=d(Q,"DIV",{class:!0});var K=$(U);h(Fe.$$.fragment,K),ro=s(K),et=d(K,"P",{"data-svelte-h":!0}),M(et)!=="svelte-1eyhmim"&&(et.innerHTML=Eo),ao=s(K),h(X.$$.fragment,K),io=s(K),h(q.$$.fragment,K),K.forEach(o),Q.forEach(o),Ut=s(e),h(Se.$$.fragment,e),Ft=s(e),I=d(e,"DIV",{class:!0});var ee=$(I);h(We.$$.fragment,ee),lo=s(ee),tt=d(ee,"P",{"data-svelte-h":!0}),M(tt)!=="svelte-7ygchu"&&(tt.textContent=Lo),co=s(ee),ot=d(ee,"P",{"data-svelte-h":!0}),M(ot)!=="svelte-1gjh92c"&&(ot.innerHTML=ko),mo=s(ee),F=d(ee,"DIV",{class:!0});var te=$(F);h(Je.$$.fragment,te),po=s(te),nt=d(te,"P",{"data-svelte-h":!0}),M(nt)!=="svelte-18sts7i"&&(nt.innerHTML=Bo),fo=s(te),h(A.$$.fragment,te),ho=s(te),h(Y.$$.fragment,te),te.forEach(o),ee.forEach(o),St=s(e),h(Re.$$.fragment,e),Wt=s(e),rt=d(e,"P",{}),$(rt).forEach(o),this.h()},h(){x(r,"name","hf:doc:metadata"),x(r,"content",rn),x(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){l(document.head,r),a(e,y,t),a(e,m,t),a(e,p,t),g(v,e,t),a(e,i,t),g(w,e,t),a(e,at,t),a(e,oe,t),a(e,it,t),a(e,ne,t),a(e,lt,t),a(e,se,t),a(e,ct,t),a(e,re,t),a(e,dt,t),a(e,ae,t),a(e,mt,t),g(ie,e,t),a(e,pt,t),a(e,le,t),a(e,ft,t),a(e,ce,t),a(e,ht,t),a(e,de,t),a(e,gt,t),g(me,e,t),a(e,ut,t),a(e,pe,t),a(e,_t,t),g(fe,e,t),a(e,bt,t),a(e,he,t),a(e,Mt,t),a(e,ge,t),a(e,vt,t),a(e,ue,t),a(e,yt,t),a(e,_e,t),a(e,wt,t),g(be,e,t),a(e,Tt,t),a(e,N,t),g(Me,N,null),l(N,Pt),l(N,Be),l(N,Et),l(N,Ge),l(N,Lt),g(E,N,null),a(e,$t,t),g(ve,e,t),a(e,xt,t),a(e,S,t),g(ye,S,null),l(S,kt),l(S,L),g(we,L,null),l(L,Bt),l(L,He),l(S,Gt),l(S,k),g(Te,k,null),l(k,Ht),l(k,De),a(e,Nt,t),g($e,e,t),a(e,Vt,t),a(e,V,t),g(xe,V,null),l(V,Dt),l(V,Xe),l(V,Xt),l(V,B),g(Ne,B,null),l(B,qt),l(B,qe),l(V,At),l(V,G),g(Ve,G,null),l(G,Yt),l(G,Ae),a(e,Ct,t),g(Ce,e,t),a(e,It,t),a(e,W,t),g(Ie,W,null),l(W,Ot),l(W,Ye),l(W,Qt),l(W,j),g(ze,j,null),l(j,Kt),l(j,Oe),l(j,eo),g(H,j,null),l(j,to),g(D,j,null),a(e,zt,t),g(je,e,t),a(e,jt,t),a(e,C,t),g(Ue,C,null),l(C,oo),l(C,Qe),l(C,no),l(C,Ke),l(C,so),l(C,U),g(Fe,U,null),l(U,ro),l(U,et),l(U,ao),g(X,U,null),l(U,io),g(q,U,null),a(e,Ut,t),g(Se,e,t),a(e,Ft,t),a(e,I,t),g(We,I,null),l(I,lo),l(I,tt),l(I,co),l(I,ot),l(I,mo),l(I,F),g(Je,F,null),l(F,po),l(F,nt),l(F,fo),g(A,F,null),l(F,ho),g(Y,F,null),a(e,St,t),g(Re,e,t),a(e,Wt,t),a(e,rt,t),Jt=!0},p(e,[t]){const J={};t&2&&(J.$$scope={dirty:t,ctx:e}),E.$set(J);const P={};t&2&&(P.$$scope={dirty:t,ctx:e}),H.$set(P);const Ze={};t&2&&(Ze.$$scope={dirty:t,ctx:e}),D.$set(Ze);const Pe={};t&2&&(Pe.$$scope={dirty:t,ctx:e}),X.$set(Pe);const R={};t&2&&(R.$$scope={dirty:t,ctx:e}),q.$set(R);const Ee={};t&2&&(Ee.$$scope={dirty:t,ctx:e}),A.$set(Ee);const Le={};t&2&&(Le.$$scope={dirty:t,ctx:e}),Y.$set(Le)},i(e){Jt||(u(v.$$.fragment,e),u(w.$$.fragment,e),u(ie.$$.fragment,e),u(me.$$.fragment,e),u(fe.$$.fragment,e),u(be.$$.fragment,e),u(Me.$$.fragment,e),u(E.$$.fragment,e),u(ve.$$.fragment,e),u(ye.$$.fragment,e),u(we.$$.fragment,e),u(Te.$$.fragment,e),u($e.$$.fragment,e),u(xe.$$.fragment,e),u(Ne.$$.fragment,e),u(Ve.$$.fragment,e),u(Ce.$$.fragment,e),u(Ie.$$.fragment,e),u(ze.$$.fragment,e),u(H.$$.fragment,e),u(D.$$.fragment,e),u(je.$$.fragment,e),u(Ue.$$.fragment,e),u(Fe.$$.fragment,e),u(X.$$.fragment,e),u(q.$$.fragment,e),u(Se.$$.fragment,e),u(We.$$.fragment,e),u(Je.$$.fragment,e),u(A.$$.fragment,e),u(Y.$$.fragment,e),u(Re.$$.fragment,e),Jt=!0)},o(e){_(v.$$.fragment,e),_(w.$$.fragment,e),_(ie.$$.fragment,e),_(me.$$.fragment,e),_(fe.$$.fragment,e),_(be.$$.fragment,e),_(Me.$$.fragment,e),_(E.$$.fragment,e),_(ve.$$.fragment,e),_(ye.$$.fragment,e),_(we.$$.fragment,e),_(Te.$$.fragment,e),_($e.$$.fragment,e),_(xe.$$.fragment,e),_(Ne.$$.fragment,e),_(Ve.$$.fragment,e),_(Ce.$$.fragment,e),_(Ie.$$.fragment,e),_(ze.$$.fragment,e),_(H.$$.fragment,e),_(D.$$.fragment,e),_(je.$$.fragment,e),_(Ue.$$.fragment,e),_(Fe.$$.fragment,e),_(X.$$.fragment,e),_(q.$$.fragment,e),_(Se.$$.fragment,e),_(We.$$.fragment,e),_(Je.$$.fragment,e),_(A.$$.fragment,e),_(Y.$$.fragment,e),_(Re.$$.fragment,e),Jt=!1},d(e){e&&(o(y),o(m),o(p),o(i),o(at),o(oe),o(it),o(ne),o(lt),o(se),o(ct),o(re),o(dt),o(ae),o(mt),o(pt),o(le),o(ft),o(ce),o(ht),o(de),o(gt),o(ut),o(pe),o(_t),o(bt),o(he),o(Mt),o(ge),o(vt),o(ue),o(yt),o(_e),o(wt),o(Tt),o(N),o($t),o(xt),o(S),o(Nt),o(Vt),o(V),o(Ct),o(It),o(W),o(zt),o(jt),o(C),o(Ut),o(Ft),o(I),o(St),o(Wt),o(rt)),o(r),b(v,e),b(w,e),b(ie,e),b(me,e),b(fe,e),b(be,e),b(Me),b(E),b(ve,e),b(ye),b(we),b(Te),b($e,e),b(xe),b(Ne),b(Ve),b(Ce,e),b(Ie),b(ze),b(H),b(D),b(je,e),b(Ue),b(Fe),b(X),b(q),b(Se,e),b(We),b(Je),b(A),b(Y),b(Re,e)}}}const rn='{"title":"MobileNet V2","local":"mobilenet-v2","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"MobileNetV2Config","local":"transformers.MobileNetV2Config","sections":[],"depth":2},{"title":"MobileNetV2FeatureExtractor","local":"transformers.MobileNetV2FeatureExtractor","sections":[],"depth":2},{"title":"MobileNetV2ImageProcessor","local":"transformers.MobileNetV2ImageProcessor","sections":[],"depth":2},{"title":"MobileNetV2Model","local":"transformers.MobileNetV2Model","sections":[],"depth":2},{"title":"MobileNetV2ForImageClassification","local":"transformers.MobileNetV2ForImageClassification","sections":[],"depth":2},{"title":"MobileNetV2ForSemanticSegmentation","local":"transformers.MobileNetV2ForSemanticSegmentation","sections":[],"depth":2}],"depth":1}';function an(T){return Ho(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class un extends Do{constructor(r){super(),Xo(this,r,an,sn,Go,{})}}export{un as component};
