Constructs EfficientNetV2 model architectures as described in EfficientNetV2: Smaller Models and Faster Training.

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

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

model_efficientnet_v2_l(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_v2_s(): EfficientNetV2-S model

  • model_efficientnet_v2_m(): EfficientNetV2-M model

  • model_efficientnet_v2_l(): EfficientNetV2-L 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). Typical values for H and W are 384 for V2-S, 480 for V2-M, and 512 for V2-L.

Variants

ModelResolutionParams (M)GFLOPsTop-1 Acc.
V2-S384248.483.9
V2-M480552485.1
V2-L5121195585.7

Examples

if (FALSE) { # \dontrun{
model <- model_efficientnet_v2_s()
input <- torch::torch_randn(1, 3, 224, 224)
output <- model(input)

# Show Top-5 predictions
topk <- output$topk(k = 5, dim = 2)
indices <- as.integer(topk[[2]][1, ])
scores <- as.numeric(topk[[1]][1, ])
glue::glue("{seq_along(indices)}. {imagenet_label(indices)} ({round(scores, 2)}%)")
} # }