Prediction Using Pre-trained EfficientNet

Explore the fundamental concepts of the EfficientNet model architecture.

This lesson will provide a step-by-step guide to building inference scripts using EfficientNet. Moreover, this lesson has multiple interactive playgrounds for you to practice with.

Overview of EfficientNet

EfficientNet is another convolutional neural network architecture that performs well on Imagenet and other image classification tasks. During its initial release in 2019, it was considered a state-of-the-art model.

It’s an efficiency-oriented model that utilizes a scaling method that uniformly scales all dimensions (depth, width, and resolution) using a compound coefficient. Hence, it tends to outperform other architectures without extensive grid search of hyperparameters.

Variant (B0 - B7)

EfficientNet comes with eight different variants, and each one contains different parameters:

  • resolution: This has different resolutions for each variant.
  • depth and width: The channel size is a multiple of 8.
  • resource limit: This is the increasing depth or width. Retaining the resolution might improve performance.

The table below highlights the desired resolution of the input image for all the variants.

Base Model Resolution
EfficientNetB0 224
EfficientNetB1 240
EfficientNetB2 260
EfficientNetB3 300
EfficientNetB4 380
EfficientNetB5 456
EfficientNetB6 528
EfficientNetB7 600

PyTorch Image Model

Like ResNet, the PyTorch Image Model framework has a pre-trained model for EfficientNet. Currently, it provides the pre-trained weights for B0, B1, B2, B3, and B4.

Import

We can use the create_model function provided by timm and easily load the pre-trained model by using the following code snippet:

Get hands-on with 1400+ tech skills courses.