Constructs EfficientNet model architectures as described in EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks. These models are designed for image classification tasks and provide a balance between accuracy and computational efficiency through compound scaling.

model_efficientnet_b0(pretrained = FALSE, progress = TRUE, ...)

model_efficientnet_b1(pretrained = FALSE, progress = TRUE, ...)

model_efficientnet_b2(pretrained = FALSE, progress = TRUE, ...)

model_efficientnet_b3(pretrained = FALSE, progress = TRUE, ...)

model_efficientnet_b4(pretrained = FALSE, progress = TRUE, ...)

model_efficientnet_b5(pretrained = FALSE, progress = TRUE, ...)

model_efficientnet_b6(pretrained = FALSE, progress = TRUE, ...)

model_efficientnet_b7(pretrained = FALSE, progress = TRUE, ...)

Arguments

pretrained

(bool): If TRUE, returns a model pre-trained on ImageNet.

progress

(bool): If TRUE, displays a progress bar of the download to stderr.

...

Other parameters passed to the model implementation, such as num_classes to change the output dimension.

Functions

  • model_efficientnet_b0(): EfficientNet B0 model

  • model_efficientnet_b1(): EfficientNet B1 model

  • model_efficientnet_b2(): EfficientNet B2 model

  • model_efficientnet_b3(): EfficientNet B3 model

  • model_efficientnet_b4(): EfficientNet B4 model

  • model_efficientnet_b5(): EfficientNet B5 model

  • model_efficientnet_b6(): EfficientNet B6 model

  • model_efficientnet_b7(): EfficientNet B7 model

Task

Image classification with 1000 output classes by default (ImageNet).

Input Format

The models expect input tensors of shape (batch_size, 3, H, W), where H and W should typically be 224 for B0 and scaled versions for B1–B7 (e.g., B7 uses 600x600).

Variants and Scaling

ModelWidthDepthResolutionParams (M)GFLOPsTop-1 Acc.
B01.01.02245.30.3977.1
B11.01.12407.80.7079.1
B21.11.22609.21.0080.1
B31.21.430012.01.8081.6
B41.41.838019.04.2082.9
B51.62.245630.09.9083.6
B61.82.652843.019.084.0
B72.03.160066.037.084.3

Examples

if (FALSE) { # \dontrun{
model <- model_efficientnet_b0()
image_batch <- torch::torch_randn(1, 3, 224, 224)
output <- model(image_batch)
which.max(as.numeric(output))  # class 815 in ImageNet is a Egyptian cat (see
                               # <https://image-net.org>)
} # }

if (FALSE) { # \dontrun{
# Example of using EfficientNet-B5 with its native image size
model <- model_efficientnet_b5()
image_batch <- torch::torch_randn(1, 3, 456, 456)
output <- model(image_batch)
which.max(as.numeric(output))
} # }