Class MobileNetV2

java.lang.Object
ai.djl.basicmodelzoo.cv.classification.MobileNetV2

public final class MobileNetV2 extends Object
MobileNetV2 contains a generic implementation of MobilenetV2 adapted from https://github.com/weiaicunzai/pytorch-cifar100/blob/master/models/mobilenetv2.py (Original author weiaicunzai).

see https://arxiv.org/pdf/1801.04381.pdf for more information about MobileNetV2

  • Field Details

  • Method Details

    • linearBottleNeck

      public static ai.djl.nn.Block linearBottleNeck(int inputChannels, int outputChannels, int stride, int t, float batchNormMomentum)
      Builds a Block that represent an inverted residual Unit used in the implementation of the MobileNetV2 Model.
      Parameters:
      inputChannels - number of inputChannels of the block
      outputChannels - number of outputChannels of the block
      stride - control the stride of a depthWise kernel
      t - the multiTime of the first pointWise Block
      batchNormMomentum - the momentum of batchNormLayer
      Returns:
      a Block that represent an inverted residual Unit
    • makeStage

      public static ai.djl.nn.Block makeStage(int repeat, int inputChannels, int outputChannels, int stride, int t, float batchNormMomentum)
      Builds a Block that represent multiple repeats of an inverted residual Unit.
      Parameters:
      repeat - the repeatTimes of an inverted residual Block
      inputChannels - number of inputChannels of the block
      outputChannels - number of outputChannels of the block
      stride - the stride of an inverted residual Unit
      t - the multipleTime of a pointWise Kernel
      batchNormMomentum - the momentum of batchNormLayer
      Returns:
      a Block that represent several repeated inverted residual Units
    • mobilenetV2

      public static ai.djl.nn.Block mobilenetV2(MobileNetV2.Builder builder)
      Creates a new Block of MobileNetV2 with the arguments from the given MobileNetV2.Builder.
      Parameters:
      builder - the MobileNetV2.Builder with the necessary arguments
      Returns:
      a Block that represents the required MobileNetV2 model
    • builder

      public static MobileNetV2.Builder builder()
      Creates a builder to build a MobileNetV2.
      Returns:
      a new builder