import{S as zn,i as kn,s as jn,e as a,k as p,w as E,t as i,M as An,c as r,d as o,m as h,a as s,x as N,h as c,b as l,G as t,g as _,y as w,q as y,o as $,B as I,v as Mn,L as Vo}from"../../chunks/vendor-hf-doc-builder.js";import{T as Pn}from"../../chunks/Tip-hf-doc-builder.js";import{D as Te}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Go}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ue}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ho}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Fn(T){let f,b,u,m,v;return m=new Go({props:{code:`from transformers import EfficientNetConfig, EfficientNetModel

# Initializing a EfficientNet efficientnet-b7 style configuration
configuration = EfficientNetConfig()

# Initializing a model (with random weights) from the efficientnet-b7 style configuration
model = EfficientNetModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> EfficientNetConfig, EfficientNetModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a EfficientNet efficientnet-b7 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = EfficientNetConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the efficientnet-b7 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = EfficientNetModel(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(){f=a("p"),b=i("Example:"),u=p(),E(m.$$.fragment)},l(n){f=r(n,"P",{});var g=s(f);b=c(g,"Example:"),g.forEach(o),u=h(n),N(m.$$.fragment,n)},m(n,g){_(n,f,g),t(f,b),_(n,u,g),w(m,n,g),v=!0},p:Vo,i(n){v||(y(m.$$.fragment,n),v=!0)},o(n){$(m.$$.fragment,n),v=!1},d(n){n&&o(f),n&&o(u),I(m,n)}}}function qn(T){let f,b,u,m,v;return{c(){f=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=i("Module"),v=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(n){f=r(n,"P",{});var g=s(f);b=c(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(g,"CODE",{});var k=s(u);m=c(k,"Module"),k.forEach(o),v=c(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(o)},m(n,g){_(n,f,g),t(f,b),t(f,u),t(u,m),t(f,v)},d(n){n&&o(f)}}}function Ln(T){let f,b,u,m,v;return m=new Go({props:{code:`from transformers import AutoImageProcessor, EfficientNetModel
import torch
from datasets import load_dataset

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

image_processor = AutoImageProcessor.from_pretrained("google/efficientnet-b7")
model = EfficientNetModel.from_pretrained("google/efficientnet-b7")

inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, EfficientNetModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

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

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/efficientnet-b7&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = EfficientNetModel.from_pretrained(<span class="hljs-string">&quot;google/efficientnet-b7&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">768</span>, <span class="hljs-number">7</span>, <span class="hljs-number">7</span>]`}}),{c(){f=a("p"),b=i("Example:"),u=p(),E(m.$$.fragment)},l(n){f=r(n,"P",{});var g=s(f);b=c(g,"Example:"),g.forEach(o),u=h(n),N(m.$$.fragment,n)},m(n,g){_(n,f,g),t(f,b),_(n,u,g),w(m,n,g),v=!0},p:Vo,i(n){v||(y(m.$$.fragment,n),v=!0)},o(n){$(m.$$.fragment,n),v=!1},d(n){n&&o(f),n&&o(u),I(m,n)}}}function Dn(T){let f,b,u,m,v;return{c(){f=a("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=a("code"),m=i("Module"),v=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(n){f=r(n,"P",{});var g=s(f);b=c(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(g,"CODE",{});var k=s(u);m=c(k,"Module"),k.forEach(o),v=c(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(o)},m(n,g){_(n,f,g),t(f,b),t(f,u),t(u,m),t(f,v)},d(n){n&&o(f)}}}function Sn(T){let f,b,u,m,v;return m=new Go({props:{code:`from transformers import AutoImageProcessor, EfficientNetForImageClassification
import torch
from datasets import load_dataset

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

image_processor = AutoImageProcessor.from_pretrained("google/efficientnet-b7")
model = EfficientNetForImageClassification.from_pretrained("google/efficientnet-b7")

inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

# model predicts one of the 1000 ImageNet classes
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, EfficientNetForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

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

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;google/efficientnet-b7&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = EfficientNetForImageClassification.from_pretrained(<span class="hljs-string">&quot;google/efficientnet-b7&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`}}),{c(){f=a("p"),b=i("Example:"),u=p(),E(m.$$.fragment)},l(n){f=r(n,"P",{});var g=s(f);b=c(g,"Example:"),g.forEach(o),u=h(n),N(m.$$.fragment,n)},m(n,g){_(n,f,g),t(f,b),_(n,u,g),w(m,n,g),v=!0},p:Vo,i(n){v||(y(m.$$.fragment,n),v=!0)},o(n){$(m.$$.fragment,n),v=!1},d(n){n&&o(f),n&&o(u),I(m,n)}}}function Rn(T){let f,b,u,m,v,n,g,k,kt,lt,F,B,Be,se,jt,He,At,ft,H,Mt,ie,Ft,qt,dt,Pe,Lt,mt,ze,Ve,Dt,pt,M,St,ce,Rt,Ot,le,Wt,Ut,ht,q,V,Ge,fe,Bt,Je,Ht,gt,x,de,Vt,L,Gt,ke,Jt,Qt,me,Yt,Xt,Kt,D,Zt,je,eo,to,Ae,oo,no,ao,G,ut,S,J,Qe,pe,ro,Ye,so,_t,j,he,io,Xe,co,lo,Q,ge,fo,Ke,mo,vt,R,Y,Ze,ue,po,et,ho,bt,A,_e,go,ve,uo,be,_o,vo,bo,P,Ee,Eo,O,No,Me,wo,yo,tt,$o,Io,xo,X,Co,K,Et,W,Z,ot,Ne,To,nt,Po,Nt,C,we,zo,at,ko,jo,ye,Ao,$e,Mo,Fo,qo,z,Ie,Lo,U,Do,Fe,So,Ro,rt,Oo,Wo,Uo,ee,Bo,te,wt;return n=new Ue({}),se=new Ue({}),fe=new Ue({}),de=new Te({props:{name:"class transformers.EfficientNetConfig",anchor:"transformers.EfficientNetConfig",parameters:[{name:"num_channels",val:": int = 3"},{name:"image_size",val:": int = 600"},{name:"width_coefficient",val:": float = 2.0"},{name:"depth_coefficient",val:": float = 3.1"},{name:"depth_divisor",val:": int = 8"},{name:"kernel_sizes",val:": typing.List[int] = [3, 3, 5, 3, 5, 5, 3]"},{name:"in_channels",val:": typing.List[int] = [32, 16, 24, 40, 80, 112, 192]"},{name:"out_channels",val:": typing.List[int] = [16, 24, 40, 80, 112, 192, 320]"},{name:"depthwise_padding",val:": typing.List[int] = []"},{name:"strides",val:": typing.List[int] = [1, 2, 2, 2, 1, 2, 1]"},{name:"num_block_repeats",val:": typing.List[int] = [1, 2, 2, 3, 3, 4, 1]"},{name:"expand_ratios",val:": typing.List[int] = [1, 6, 6, 6, 6, 6, 6]"},{name:"squeeze_expansion_ratio",val:": float = 0.25"},{name:"hidden_act",val:": str = 'swish'"},{name:"hidden_dim",val:": int = 2560"},{name:"pooling_type",val:": str = 'mean'"},{name:"initializer_range",val:": float = 0.02"},{name:"batch_norm_eps",val:": float = 0.001"},{name:"batch_norm_momentum",val:": float = 0.99"},{name:"dropout_rate",val:": float = 0.5"},{name:"drop_connect_rate",val:": float = 0.2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.EfficientNetConfig.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.EfficientNetConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 600) &#x2014;
The input image size.`,name:"image_size"},{anchor:"transformers.EfficientNetConfig.width_coefficient",description:`<strong>width_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 2.0) &#x2014;
Scaling coefficient for network width at each stage.`,name:"width_coefficient"},{anchor:"transformers.EfficientNetConfig.depth_coefficient",description:`<strong>depth_coefficient</strong> (<code>float</code>, <em>optional</em>, defaults to 3.1) &#x2014;
Scaling coefficient for network depth at each stage.`,name:"depth_coefficient"},{anchor:"transformers.EfficientNetConfig.depth_divisor",description:`<strong>depth_divisor</strong> <code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
A unit of network width.`,name:"depth_divisor"},{anchor:"transformers.EfficientNetConfig.kernel_sizes",description:`<strong>kernel_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[3, 3, 5, 3, 5, 5, 3]</code>) &#x2014;
List of kernel sizes to be used in each block.`,name:"kernel_sizes"},{anchor:"transformers.EfficientNetConfig.in_channels",description:`<strong>in_channels</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[32, 16, 24, 40, 80, 112, 192]</code>) &#x2014;
List of input channel sizes to be used in each block for convolutional layers.`,name:"in_channels"},{anchor:"transformers.EfficientNetConfig.out_channels",description:`<strong>out_channels</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[16, 24, 40, 80, 112, 192, 320]</code>) &#x2014;
List of output channel sizes to be used in each block for convolutional layers.`,name:"out_channels"},{anchor:"transformers.EfficientNetConfig.depthwise_padding",description:`<strong>depthwise_padding</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[]</code>) &#x2014;
List of block indices with square padding.
strides &#x2014; (<code>List[int]</code>, <em>optional</em>, defaults to <code>[1, 2, 2, 2, 1, 2, 1]</code>):
List of stride sizes to be used in each block for convolutional layers.`,name:"depthwise_padding"},{anchor:"transformers.EfficientNetConfig.num_block_repeats",description:`<strong>num_block_repeats</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[1, 2, 2, 3, 3, 4, 1]</code>) &#x2014;
List of the number of times each block is to repeated.`,name:"num_block_repeats"},{anchor:"transformers.EfficientNetConfig.expand_ratios",description:`<strong>expand_ratios</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[1, 6, 6, 6, 6, 6, 6]</code>) &#x2014;
List of scaling coefficient of each block.`,name:"expand_ratios"},{anchor:"transformers.EfficientNetConfig.squeeze_expansion_ratio",description:`<strong>squeeze_expansion_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 0.25) &#x2014;
Squeeze expansion ratio.`,name:"squeeze_expansion_ratio"},{anchor:"transformers.EfficientNetConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in each block. If string, <code>&quot;gelu&quot;</code>, <code>&quot;relu&quot;</code>,
<code>&quot;selu&quot;, </code>&#x201C;gelu_new&#x201D;<code>, </code>&#x201C;silu&#x201D;<code>and</code>&#x201C;mish&#x201D;\` are supported.`,name:"hidden_act"},{anchor:"transformers.EfficientNetConfig.hiddem_dim",description:`<strong>hiddem_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 1280) &#x2014;
The hidden dimension of the layer before the classification head.`,name:"hiddem_dim"},{anchor:"transformers.EfficientNetConfig.pooling_type",description:`<strong>pooling_type</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;mean&quot;</code>) &#x2014;
Type of final pooling to be applied before the dense classification head. Available options are [<code>&quot;mean&quot;</code>,
<code>&quot;max&quot;</code>]`,name:"pooling_type"},{anchor:"transformers.EfficientNetConfig.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.EfficientNetConfig.batch_norm_eps",description:`<strong>batch_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-3) &#x2014;
The epsilon used by the batch normalization layers.`,name:"batch_norm_eps"},{anchor:"transformers.EfficientNetConfig.batch_norm_momentum",description:`<strong>batch_norm_momentum</strong> (<code>float</code>, <em>optional</em>, defaults to 0.99) &#x2014;
The momentum used by the batch normalization layers.`,name:"batch_norm_momentum"},{anchor:"transformers.EfficientNetConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The dropout rate to be applied before final classifier layer.`,name:"dropout_rate"},{anchor:"transformers.EfficientNetConfig.drop_connect_rate",description:`<strong>drop_connect_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.2) &#x2014;
The drop rate for skip connections.`,name:"drop_connect_rate"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/efficientnet/configuration_efficientnet.py#L34"}}),G=new Ho({props:{anchor:"transformers.EfficientNetConfig.example",$$slots:{default:[Fn]},$$scope:{ctx:T}}}),pe=new Ue({}),he=new Te({props:{name:"class transformers.EfficientNetImageProcessor",anchor:"transformers.EfficientNetImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:": Resampling = 0"},{name:"do_center_crop",val:": bool = False"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"rescale_offset",val:": bool = False"},{name:"do_rescale",val:": bool = True"},{name:"do_normalize",val:": bool = True"},{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:"include_top",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.EfficientNetImageProcessor.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 <code>preprocess</code>.`,name:"do_resize"},{anchor:"transformers.EfficientNetImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 346, &quot;width&quot;: 346}</code>):
Size of the image after <code>resize</code>. Can be overridden by <code>size</code> in <code>preprocess</code>.`,name:"size"},{anchor:"transformers.EfficientNetImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code> filter, <em>optional</em>, defaults to <code>PILImageResampling.NEAREST</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in <code>preprocess</code>.`,name:"resample"},{anchor:"transformers.EfficientNetImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</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 <code>do_center_crop</code> in <code>preprocess</code>.`,name:"do_center_crop"},{anchor:"transformers.EfficientNetImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 289, &quot;width&quot;: 289}</code>):
Desired output size when applying center-cropping. Can be overridden by <code>crop_size</code> in <code>preprocess</code>.`,name:"crop_size"},{anchor:"transformers.EfficientNetImageProcessor.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.EfficientNetImageProcessor.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.`,name:"rescale_factor"},{anchor:"transformers.EfficientNetImageProcessor.rescale_offset",description:`<strong>rescale_offset</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to rescale the image between [-scale_range, scale_range] instead of [0, scale_range]. Can be
overridden by the <code>rescale_factor</code> parameter in the <code>preprocess</code> method.`,name:"rescale_offset"},{anchor:"transformers.EfficientNetImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the <code>preprocess</code>
method.`,name:"do_normalize"},{anchor:"transformers.EfficientNetImageProcessor.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.EfficientNetImageProcessor.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"},{anchor:"transformers.EfficientNetImageProcessor.include_top",description:`<strong>include_top</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image again. Should be set to True if the inputs are used for image classification.`,name:"include_top"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/efficientnet/image_processing_efficientnet.py#L43"}}),ge=new Te({props:{name:"preprocess",anchor:"transformers.EfficientNetImageProcessor.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:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"resample",val:" = None"},{name:"do_center_crop",val:": bool = None"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"rescale_offset",val:": bool = None"},{name:"do_normalize",val:": 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:"include_top",val:": bool = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.EfficientNetImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.EfficientNetImageProcessor.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.EfficientNetImageProcessor.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 <code>resize</code>.`,name:"size"},{anchor:"transformers.EfficientNetImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
PILImageResampling filter to use if resizing the image Only has an effect if <code>do_resize</code> is set to
<code>True</code>.`,name:"resample"},{anchor:"transformers.EfficientNetImageProcessor.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.EfficientNetImageProcessor.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 image after center crop. If one edge the image is smaller than <code>crop_size</code>, it will be
padded with zeros and then cropped`,name:"crop_size"},{anchor:"transformers.EfficientNetImageProcessor.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.EfficientNetImageProcessor.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.EfficientNetImageProcessor.preprocess.rescale_offset",description:`<strong>rescale_offset</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.rescale_offset</code>) &#x2014;
Whether to rescale the image between [-scale_range, scale_range] instead of [0, scale_range].`,name:"rescale_offset"},{anchor:"transformers.EfficientNetImageProcessor.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.EfficientNetImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean.`,name:"image_mean"},{anchor:"transformers.EfficientNetImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation.`,name:"image_std"},{anchor:"transformers.EfficientNetImageProcessor.preprocess.include_top",description:`<strong>include_top</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.include_top</code>) &#x2014;
Rescales the image again for image classification if set to True.`,name:"include_top"},{anchor:"transformers.EfficientNetImageProcessor.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><code>None</code>: 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.EfficientNetImageProcessor.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>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/efficientnet/image_processing_efficientnet.py#L224"}}),ue=new Ue({}),_e=new Te({props:{name:"class transformers.EfficientNetModel",anchor:"transformers.EfficientNetModel",parameters:[{name:"config",val:": EfficientNetConfig"}],parametersDescription:[{anchor:"transformers.EfficientNetModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/efficientnet#transformers.EfficientNetConfig">EfficientNetConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/efficientnet/modeling_efficientnet.py#L512"}}),Ee=new Te({props:{name:"forward",anchor:"transformers.EfficientNetModel.forward",parameters:[{name:"pixel_values",val:": FloatTensor = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.EfficientNetModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>AutoImageProcessor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.EfficientNetModel.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.EfficientNetModel.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.29.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.29.0/src/transformers/models/efficientnet/modeling_efficientnet.py#L530",returnDescription:`
<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/v4.29.0/en/model_doc/efficientnet#transformers.EfficientNetConfig"
>EfficientNetConfig</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>) \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 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>) \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, 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:`
<p><code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),X=new Pn({props:{$$slots:{default:[qn]},$$scope:{ctx:T}}}),K=new Ho({props:{anchor:"transformers.EfficientNetModel.forward.example",$$slots:{default:[Ln]},$$scope:{ctx:T}}}),Ne=new Ue({}),we=new Te({props:{name:"class transformers.EfficientNetForImageClassification",anchor:"transformers.EfficientNetForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.EfficientNetForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/efficientnet#transformers.EfficientNetConfig">EfficientNetConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/efficientnet/modeling_efficientnet.py#L582"}}),Ie=new Te({props:{name:"forward",anchor:"transformers.EfficientNetForImageClassification.forward",parameters:[{name:"pixel_values",val:": FloatTensor = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.EfficientNetForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>AutoImageProcessor.__call__()</code> for details.`,name:"pixel_values"},{anchor:"transformers.EfficientNetForImageClassification.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.EfficientNetForImageClassification.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.EfficientNetForImageClassification.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/v4.29.0/src/transformers/models/efficientnet/modeling_efficientnet.py#L596",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/en/model_doc/efficientnet#transformers.EfficientNetConfig"
>EfficientNetConfig</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) \u2014 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>) \u2014 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>) \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 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:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ee=new Pn({props:{$$slots:{default:[Dn]},$$scope:{ctx:T}}}),te=new Ho({props:{anchor:"transformers.EfficientNetForImageClassification.forward.example",$$slots:{default:[Sn]},$$scope:{ctx:T}}}),{c(){f=a("meta"),b=p(),u=a("h1"),m=a("a"),v=a("span"),E(n.$$.fragment),g=p(),k=a("span"),kt=i("EfficientNet"),lt=p(),F=a("h2"),B=a("a"),Be=a("span"),E(se.$$.fragment),jt=p(),He=a("span"),At=i("Overview"),ft=p(),H=a("p"),Mt=i("The EfficientNet model was proposed in "),ie=a("a"),Ft=i("EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks"),qt=i(`
by Mingxing Tan and Quoc V. Le. EfficientNets are a family of image classification models, which achieve state-of-the-art accuracy, yet being an order-of-magnitude smaller and faster than previous models.`),dt=p(),Pe=a("p"),Lt=i("The abstract from the paper is the following:"),mt=p(),ze=a("p"),Ve=a("em"),Dt=i(`Convolutional Neural Networks (ConvNets) are commonly developed at a fixed resource budget, and then scaled up for better accuracy if more resources are available. In this paper, we systematically study model scaling and identify that carefully balancing network depth, width, and resolution can lead to better performance. Based on this observation, we propose a new scaling method that uniformly scales all dimensions of depth/width/resolution using a simple yet highly effective compound coefficient. We demonstrate the effectiveness of this method on scaling up MobileNets and ResNet.
To go even further, we use neural architecture search to design a new baseline network and scale it up to obtain a family of models, called EfficientNets, which achieve much better accuracy and efficiency than previous ConvNets. In particular, our EfficientNet-B7 achieves state-of-the-art 84.3% top-1 accuracy on ImageNet, while being 8.4x smaller and 6.1x faster on inference than the best existing ConvNet. Our EfficientNets also transfer well and achieve state-of-the-art accuracy on CIFAR-100 (91.7%), Flowers (98.8%), and 3 other transfer learning datasets, with an order of magnitude fewer parameters.`),pt=p(),M=a("p"),St=i("This model was contributed by "),ce=a("a"),Rt=i("adirik"),Ot=i(`.
The original code can be found `),le=a("a"),Wt=i("here"),Ut=i("."),ht=p(),q=a("h2"),V=a("a"),Ge=a("span"),E(fe.$$.fragment),Bt=p(),Je=a("span"),Ht=i("EfficientNetConfig"),gt=p(),x=a("div"),E(de.$$.fragment),Vt=p(),L=a("p"),Gt=i("This is the configuration class to store the configuration of a "),ke=a("a"),Jt=i("EfficientNetModel"),Qt=i(`. It is used to instantiate an
EfficientNet 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 EfficientNet
`),me=a("a"),Yt=i("google/efficientnet-b7"),Xt=i(" architecture."),Kt=p(),D=a("p"),Zt=i("Configuration objects inherit from "),je=a("a"),eo=i("PretrainedConfig"),to=i(` and can be used to control the model outputs. Read the
documentation from `),Ae=a("a"),oo=i("PretrainedConfig"),no=i(" for more information."),ao=p(),E(G.$$.fragment),ut=p(),S=a("h2"),J=a("a"),Qe=a("span"),E(pe.$$.fragment),ro=p(),Ye=a("span"),so=i("EfficientNetImageProcessor"),_t=p(),j=a("div"),E(he.$$.fragment),io=p(),Xe=a("p"),co=i("Constructs a EfficientNet image processor."),lo=p(),Q=a("div"),E(ge.$$.fragment),fo=p(),Ke=a("p"),mo=i("Preprocess an image or batch of images."),vt=p(),R=a("h2"),Y=a("a"),Ze=a("span"),E(ue.$$.fragment),po=p(),et=a("span"),ho=i("EfficientNetModel"),bt=p(),A=a("div"),E(_e.$$.fragment),go=p(),ve=a("p"),uo=i(`The bare EfficientNet model outputting raw features without any specific head on top.
This model is a PyTorch `),be=a("a"),_o=i("torch.nn.Module"),vo=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),bo=p(),P=a("div"),E(Ee.$$.fragment),Eo=p(),O=a("p"),No=i("The "),Me=a("a"),wo=i("EfficientNetModel"),yo=i(" forward method, overrides the "),tt=a("code"),$o=i("__call__"),Io=i(" special method."),xo=p(),E(X.$$.fragment),Co=p(),E(K.$$.fragment),Et=p(),W=a("h2"),Z=a("a"),ot=a("span"),E(Ne.$$.fragment),To=p(),nt=a("span"),Po=i("EfficientNetForImageClassification"),Nt=p(),C=a("div"),E(we.$$.fragment),zo=p(),at=a("p"),ko=i(`EfficientNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g.
for ImageNet.`),jo=p(),ye=a("p"),Ao=i("This model is a PyTorch "),$e=a("a"),Mo=i("torch.nn.Module"),Fo=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),qo=p(),z=a("div"),E(Ie.$$.fragment),Lo=p(),U=a("p"),Do=i("The "),Fe=a("a"),So=i("EfficientNetForImageClassification"),Ro=i(" forward method, overrides the "),rt=a("code"),Oo=i("__call__"),Wo=i(" special method."),Uo=p(),E(ee.$$.fragment),Bo=p(),E(te.$$.fragment),this.h()},l(e){const d=An('[data-svelte="svelte-1phssyn"]',document.head);f=r(d,"META",{name:!0,content:!0}),d.forEach(o),b=h(e),u=r(e,"H1",{class:!0});var xe=s(u);m=r(xe,"A",{id:!0,class:!0,href:!0});var st=s(m);v=r(st,"SPAN",{});var it=s(v);N(n.$$.fragment,it),it.forEach(o),st.forEach(o),g=h(xe),k=r(xe,"SPAN",{});var ct=s(k);kt=c(ct,"EfficientNet"),ct.forEach(o),xe.forEach(o),lt=h(e),F=r(e,"H2",{class:!0});var Ce=s(F);B=r(Ce,"A",{id:!0,class:!0,href:!0});var Jo=s(B);Be=r(Jo,"SPAN",{});var Qo=s(Be);N(se.$$.fragment,Qo),Qo.forEach(o),Jo.forEach(o),jt=h(Ce),He=r(Ce,"SPAN",{});var Yo=s(He);At=c(Yo,"Overview"),Yo.forEach(o),Ce.forEach(o),ft=h(e),H=r(e,"P",{});var yt=s(H);Mt=c(yt,"The EfficientNet model was proposed in "),ie=r(yt,"A",{href:!0,rel:!0});var Xo=s(ie);Ft=c(Xo,"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks"),Xo.forEach(o),qt=c(yt,`
by Mingxing Tan and Quoc V. Le. EfficientNets are a family of image classification models, which achieve state-of-the-art accuracy, yet being an order-of-magnitude smaller and faster than previous models.`),yt.forEach(o),dt=h(e),Pe=r(e,"P",{});var Ko=s(Pe);Lt=c(Ko,"The abstract from the paper is the following:"),Ko.forEach(o),mt=h(e),ze=r(e,"P",{});var Zo=s(ze);Ve=r(Zo,"EM",{});var en=s(Ve);Dt=c(en,`Convolutional Neural Networks (ConvNets) are commonly developed at a fixed resource budget, and then scaled up for better accuracy if more resources are available. In this paper, we systematically study model scaling and identify that carefully balancing network depth, width, and resolution can lead to better performance. Based on this observation, we propose a new scaling method that uniformly scales all dimensions of depth/width/resolution using a simple yet highly effective compound coefficient. We demonstrate the effectiveness of this method on scaling up MobileNets and ResNet.
To go even further, we use neural architecture search to design a new baseline network and scale it up to obtain a family of models, called EfficientNets, which achieve much better accuracy and efficiency than previous ConvNets. In particular, our EfficientNet-B7 achieves state-of-the-art 84.3% top-1 accuracy on ImageNet, while being 8.4x smaller and 6.1x faster on inference than the best existing ConvNet. Our EfficientNets also transfer well and achieve state-of-the-art accuracy on CIFAR-100 (91.7%), Flowers (98.8%), and 3 other transfer learning datasets, with an order of magnitude fewer parameters.`),en.forEach(o),Zo.forEach(o),pt=h(e),M=r(e,"P",{});var qe=s(M);St=c(qe,"This model was contributed by "),ce=r(qe,"A",{href:!0,rel:!0});var tn=s(ce);Rt=c(tn,"adirik"),tn.forEach(o),Ot=c(qe,`.
The original code can be found `),le=r(qe,"A",{href:!0,rel:!0});var on=s(le);Wt=c(on,"here"),on.forEach(o),Ut=c(qe,"."),qe.forEach(o),ht=h(e),q=r(e,"H2",{class:!0});var $t=s(q);V=r($t,"A",{id:!0,class:!0,href:!0});var nn=s(V);Ge=r(nn,"SPAN",{});var an=s(Ge);N(fe.$$.fragment,an),an.forEach(o),nn.forEach(o),Bt=h($t),Je=r($t,"SPAN",{});var rn=s(Je);Ht=c(rn,"EfficientNetConfig"),rn.forEach(o),$t.forEach(o),gt=h(e),x=r(e,"DIV",{class:!0});var oe=s(x);N(de.$$.fragment,oe),Vt=h(oe),L=r(oe,"P",{});var Le=s(L);Gt=c(Le,"This is the configuration class to store the configuration of a "),ke=r(Le,"A",{href:!0});var sn=s(ke);Jt=c(sn,"EfficientNetModel"),sn.forEach(o),Qt=c(Le,`. It is used to instantiate an
EfficientNet 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 EfficientNet
`),me=r(Le,"A",{href:!0,rel:!0});var cn=s(me);Yt=c(cn,"google/efficientnet-b7"),cn.forEach(o),Xt=c(Le," architecture."),Le.forEach(o),Kt=h(oe),D=r(oe,"P",{});var De=s(D);Zt=c(De,"Configuration objects inherit from "),je=r(De,"A",{href:!0});var ln=s(je);eo=c(ln,"PretrainedConfig"),ln.forEach(o),to=c(De,` and can be used to control the model outputs. Read the
documentation from `),Ae=r(De,"A",{href:!0});var fn=s(Ae);oo=c(fn,"PretrainedConfig"),fn.forEach(o),no=c(De," for more information."),De.forEach(o),ao=h(oe),N(G.$$.fragment,oe),oe.forEach(o),ut=h(e),S=r(e,"H2",{class:!0});var It=s(S);J=r(It,"A",{id:!0,class:!0,href:!0});var dn=s(J);Qe=r(dn,"SPAN",{});var mn=s(Qe);N(pe.$$.fragment,mn),mn.forEach(o),dn.forEach(o),ro=h(It),Ye=r(It,"SPAN",{});var pn=s(Ye);so=c(pn,"EfficientNetImageProcessor"),pn.forEach(o),It.forEach(o),_t=h(e),j=r(e,"DIV",{class:!0});var Se=s(j);N(he.$$.fragment,Se),io=h(Se),Xe=r(Se,"P",{});var hn=s(Xe);co=c(hn,"Constructs a EfficientNet image processor."),hn.forEach(o),lo=h(Se),Q=r(Se,"DIV",{class:!0});var xt=s(Q);N(ge.$$.fragment,xt),fo=h(xt),Ke=r(xt,"P",{});var gn=s(Ke);mo=c(gn,"Preprocess an image or batch of images."),gn.forEach(o),xt.forEach(o),Se.forEach(o),vt=h(e),R=r(e,"H2",{class:!0});var Ct=s(R);Y=r(Ct,"A",{id:!0,class:!0,href:!0});var un=s(Y);Ze=r(un,"SPAN",{});var _n=s(Ze);N(ue.$$.fragment,_n),_n.forEach(o),un.forEach(o),po=h(Ct),et=r(Ct,"SPAN",{});var vn=s(et);ho=c(vn,"EfficientNetModel"),vn.forEach(o),Ct.forEach(o),bt=h(e),A=r(e,"DIV",{class:!0});var Re=s(A);N(_e.$$.fragment,Re),go=h(Re),ve=r(Re,"P",{});var Tt=s(ve);uo=c(Tt,`The bare EfficientNet model outputting raw features without any specific head on top.
This model is a PyTorch `),be=r(Tt,"A",{href:!0,rel:!0});var bn=s(be);_o=c(bn,"torch.nn.Module"),bn.forEach(o),vo=c(Tt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Tt.forEach(o),bo=h(Re),P=r(Re,"DIV",{class:!0});var ne=s(P);N(Ee.$$.fragment,ne),Eo=h(ne),O=r(ne,"P",{});var Oe=s(O);No=c(Oe,"The "),Me=r(Oe,"A",{href:!0});var En=s(Me);wo=c(En,"EfficientNetModel"),En.forEach(o),yo=c(Oe," forward method, overrides the "),tt=r(Oe,"CODE",{});var Nn=s(tt);$o=c(Nn,"__call__"),Nn.forEach(o),Io=c(Oe," special method."),Oe.forEach(o),xo=h(ne),N(X.$$.fragment,ne),Co=h(ne),N(K.$$.fragment,ne),ne.forEach(o),Re.forEach(o),Et=h(e),W=r(e,"H2",{class:!0});var Pt=s(W);Z=r(Pt,"A",{id:!0,class:!0,href:!0});var wn=s(Z);ot=r(wn,"SPAN",{});var yn=s(ot);N(Ne.$$.fragment,yn),yn.forEach(o),wn.forEach(o),To=h(Pt),nt=r(Pt,"SPAN",{});var $n=s(nt);Po=c($n,"EfficientNetForImageClassification"),$n.forEach(o),Pt.forEach(o),Nt=h(e),C=r(e,"DIV",{class:!0});var ae=s(C);N(we.$$.fragment,ae),zo=h(ae),at=r(ae,"P",{});var In=s(at);ko=c(In,`EfficientNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g.
for ImageNet.`),In.forEach(o),jo=h(ae),ye=r(ae,"P",{});var zt=s(ye);Ao=c(zt,"This model is a PyTorch "),$e=r(zt,"A",{href:!0,rel:!0});var xn=s($e);Mo=c(xn,"torch.nn.Module"),xn.forEach(o),Fo=c(zt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),zt.forEach(o),qo=h(ae),z=r(ae,"DIV",{class:!0});var re=s(z);N(Ie.$$.fragment,re),Lo=h(re),U=r(re,"P",{});var We=s(U);Do=c(We,"The "),Fe=r(We,"A",{href:!0});var Cn=s(Fe);So=c(Cn,"EfficientNetForImageClassification"),Cn.forEach(o),Ro=c(We," forward method, overrides the "),rt=r(We,"CODE",{});var Tn=s(rt);Oo=c(Tn,"__call__"),Tn.forEach(o),Wo=c(We," special method."),We.forEach(o),Uo=h(re),N(ee.$$.fragment,re),Bo=h(re),N(te.$$.fragment,re),re.forEach(o),ae.forEach(o),this.h()},h(){l(f,"name","hf:doc:metadata"),l(f,"content",JSON.stringify(On)),l(m,"id","efficientnet"),l(m,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(m,"href","#efficientnet"),l(u,"class","relative group"),l(B,"id","overview"),l(B,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(B,"href","#overview"),l(F,"class","relative group"),l(ie,"href","https://arxiv.org/abs/1905.11946"),l(ie,"rel","nofollow"),l(ce,"href","https://huggingface.co/adirik"),l(ce,"rel","nofollow"),l(le,"href","https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet"),l(le,"rel","nofollow"),l(V,"id","transformers.EfficientNetConfig"),l(V,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(V,"href","#transformers.EfficientNetConfig"),l(q,"class","relative group"),l(ke,"href","/docs/transformers/v4.29.0/en/model_doc/efficientnet#transformers.EfficientNetModel"),l(me,"href","https://huggingface.co/google/efficientnet-b7"),l(me,"rel","nofollow"),l(je,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(Ae,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(J,"id","transformers.EfficientNetImageProcessor"),l(J,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(J,"href","#transformers.EfficientNetImageProcessor"),l(S,"class","relative group"),l(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Y,"id","transformers.EfficientNetModel"),l(Y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Y,"href","#transformers.EfficientNetModel"),l(R,"class","relative group"),l(be,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(be,"rel","nofollow"),l(Me,"href","/docs/transformers/v4.29.0/en/model_doc/efficientnet#transformers.EfficientNetModel"),l(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Z,"id","transformers.EfficientNetForImageClassification"),l(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Z,"href","#transformers.EfficientNetForImageClassification"),l(W,"class","relative group"),l($e,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l($e,"rel","nofollow"),l(Fe,"href","/docs/transformers/v4.29.0/en/model_doc/efficientnet#transformers.EfficientNetForImageClassification"),l(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(C,"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,d){t(document.head,f),_(e,b,d),_(e,u,d),t(u,m),t(m,v),w(n,v,null),t(u,g),t(u,k),t(k,kt),_(e,lt,d),_(e,F,d),t(F,B),t(B,Be),w(se,Be,null),t(F,jt),t(F,He),t(He,At),_(e,ft,d),_(e,H,d),t(H,Mt),t(H,ie),t(ie,Ft),t(H,qt),_(e,dt,d),_(e,Pe,d),t(Pe,Lt),_(e,mt,d),_(e,ze,d),t(ze,Ve),t(Ve,Dt),_(e,pt,d),_(e,M,d),t(M,St),t(M,ce),t(ce,Rt),t(M,Ot),t(M,le),t(le,Wt),t(M,Ut),_(e,ht,d),_(e,q,d),t(q,V),t(V,Ge),w(fe,Ge,null),t(q,Bt),t(q,Je),t(Je,Ht),_(e,gt,d),_(e,x,d),w(de,x,null),t(x,Vt),t(x,L),t(L,Gt),t(L,ke),t(ke,Jt),t(L,Qt),t(L,me),t(me,Yt),t(L,Xt),t(x,Kt),t(x,D),t(D,Zt),t(D,je),t(je,eo),t(D,to),t(D,Ae),t(Ae,oo),t(D,no),t(x,ao),w(G,x,null),_(e,ut,d),_(e,S,d),t(S,J),t(J,Qe),w(pe,Qe,null),t(S,ro),t(S,Ye),t(Ye,so),_(e,_t,d),_(e,j,d),w(he,j,null),t(j,io),t(j,Xe),t(Xe,co),t(j,lo),t(j,Q),w(ge,Q,null),t(Q,fo),t(Q,Ke),t(Ke,mo),_(e,vt,d),_(e,R,d),t(R,Y),t(Y,Ze),w(ue,Ze,null),t(R,po),t(R,et),t(et,ho),_(e,bt,d),_(e,A,d),w(_e,A,null),t(A,go),t(A,ve),t(ve,uo),t(ve,be),t(be,_o),t(ve,vo),t(A,bo),t(A,P),w(Ee,P,null),t(P,Eo),t(P,O),t(O,No),t(O,Me),t(Me,wo),t(O,yo),t(O,tt),t(tt,$o),t(O,Io),t(P,xo),w(X,P,null),t(P,Co),w(K,P,null),_(e,Et,d),_(e,W,d),t(W,Z),t(Z,ot),w(Ne,ot,null),t(W,To),t(W,nt),t(nt,Po),_(e,Nt,d),_(e,C,d),w(we,C,null),t(C,zo),t(C,at),t(at,ko),t(C,jo),t(C,ye),t(ye,Ao),t(ye,$e),t($e,Mo),t(ye,Fo),t(C,qo),t(C,z),w(Ie,z,null),t(z,Lo),t(z,U),t(U,Do),t(U,Fe),t(Fe,So),t(U,Ro),t(U,rt),t(rt,Oo),t(U,Wo),t(z,Uo),w(ee,z,null),t(z,Bo),w(te,z,null),wt=!0},p(e,[d]){const xe={};d&2&&(xe.$$scope={dirty:d,ctx:e}),G.$set(xe);const st={};d&2&&(st.$$scope={dirty:d,ctx:e}),X.$set(st);const it={};d&2&&(it.$$scope={dirty:d,ctx:e}),K.$set(it);const ct={};d&2&&(ct.$$scope={dirty:d,ctx:e}),ee.$set(ct);const Ce={};d&2&&(Ce.$$scope={dirty:d,ctx:e}),te.$set(Ce)},i(e){wt||(y(n.$$.fragment,e),y(se.$$.fragment,e),y(fe.$$.fragment,e),y(de.$$.fragment,e),y(G.$$.fragment,e),y(pe.$$.fragment,e),y(he.$$.fragment,e),y(ge.$$.fragment,e),y(ue.$$.fragment,e),y(_e.$$.fragment,e),y(Ee.$$.fragment,e),y(X.$$.fragment,e),y(K.$$.fragment,e),y(Ne.$$.fragment,e),y(we.$$.fragment,e),y(Ie.$$.fragment,e),y(ee.$$.fragment,e),y(te.$$.fragment,e),wt=!0)},o(e){$(n.$$.fragment,e),$(se.$$.fragment,e),$(fe.$$.fragment,e),$(de.$$.fragment,e),$(G.$$.fragment,e),$(pe.$$.fragment,e),$(he.$$.fragment,e),$(ge.$$.fragment,e),$(ue.$$.fragment,e),$(_e.$$.fragment,e),$(Ee.$$.fragment,e),$(X.$$.fragment,e),$(K.$$.fragment,e),$(Ne.$$.fragment,e),$(we.$$.fragment,e),$(Ie.$$.fragment,e),$(ee.$$.fragment,e),$(te.$$.fragment,e),wt=!1},d(e){o(f),e&&o(b),e&&o(u),I(n),e&&o(lt),e&&o(F),I(se),e&&o(ft),e&&o(H),e&&o(dt),e&&o(Pe),e&&o(mt),e&&o(ze),e&&o(pt),e&&o(M),e&&o(ht),e&&o(q),I(fe),e&&o(gt),e&&o(x),I(de),I(G),e&&o(ut),e&&o(S),I(pe),e&&o(_t),e&&o(j),I(he),I(ge),e&&o(vt),e&&o(R),I(ue),e&&o(bt),e&&o(A),I(_e),I(Ee),I(X),I(K),e&&o(Et),e&&o(W),I(Ne),e&&o(Nt),e&&o(C),I(we),I(Ie),I(ee),I(te)}}}const On={local:"efficientnet",sections:[{local:"overview",title:"Overview"},{local:"transformers.EfficientNetConfig",title:"EfficientNetConfig"},{local:"transformers.EfficientNetImageProcessor",title:"EfficientNetImageProcessor"},{local:"transformers.EfficientNetModel",title:"EfficientNetModel"},{local:"transformers.EfficientNetForImageClassification",title:"EfficientNetForImageClassification"}],title:"EfficientNet"};function Wn(T){return Mn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qn extends zn{constructor(f){super();kn(this,f,Wn,Rn,jn,{})}}export{Qn as default,On as metadata};
