class_docstr: This class implements `MobileOne architecture <https://arxiv.org/pdf/2206.04040.pdf>`_
code: def __init__(self, opts, *args, **kwargs) -> None:
      cfg = get_configuration(opts=opts)
  
      super().__init__(opts, *args, **kwargs)
  
      self.opts = opts
      image_channels = 3
      num_blocks_per_stage = cfg["num_blocks_per_stage"]
      width_multipliers = cfg["width_multipliers"]
      use_se = cfg["use_se"]
      self.num_conv_branches = cfg["num_conv_branches"]
      num_classes = getattr(opts, "model.classification.n_classes")
      self.inference_mode = getattr(
          opts, "model.classification.mobileone.inference_mode"
      )
  
      assert len(width_multipliers) == 4
      self.in_planes = min(64, int(64 * width_multipliers[0]))
      self.model_conf_dict = dict()
  
      # First dense conv
      self.conv_1 = MobileOneBlock(
          opts,
          in_channels=image_channels,
          out_channels=self.in_planes,
          kernel_size=3,
          stride=2,
          padding=1,
          inference_mode=self.inference_mode,
      )
      self.model_conf_dict["conv1"] = {
          "in": image_channels,
          "out": self.in_planes,
      }
  
      self.layer_1 = Identity()
      self.model_conf_dict["layer1"] = {
          "in": self.in_planes,
          "out": self.in_planes,
      }
  
      # Build stages
      self.cur_layer_idx = 1
      self.model_conf_dict["layer2"] = {
          "in": self.in_planes,
          "out": int(64 * width_multipliers[0]),
      }
      self.layer_2 = self._make_stage(
          int(64 * width_multipliers[0]),
          num_blocks_per_stage[0],
          num_se_blocks=0,
      )
      self.model_conf_dict["layer3"] = {
          "in": self.in_planes,
          "out": int(128 * width_multipliers[1]),
      }
      self.layer_3 = self._make_stage(
          int(128 * width_multipliers[1]),
          num_blocks_per_stage[1],
          num_se_blocks=0,
      )
      self.model_conf_dict["layer4"] = {
          "in": self.in_planes,
          "out": int(256 * width_multipliers[2]),
      }
      self.layer_4 = self._make_stage(
          int(256 * width_multipliers[2]),
          num_blocks_per_stage[2],
          num_se_blocks=int(num_blocks_per_stage[2] // 2)
          if use_se
          else 0,
      )
      self.model_conf_dict["layer5"] = {
          "in": self.in_planes,
          "out": int(512 * width_multipliers[3]),
      }
      self.layer_5 = self._make_stage(
          int(512 * width_multipliers[3]),
          num_blocks_per_stage[3],
          num_se_blocks=num_blocks_per_stage[3] if use_se else 0,
      )
  
      # No extra 1x1 conv before classifier
      self.conv_1x1_exp = Identity()
      self.model_conf_dict["exp_before_cls"] = {
          "in": int(512 * width_multipliers[3]),
          "out": int(512 * width_multipliers[3]),
      }
  
      # Build classifier
      pool_type = getattr(opts, "model.layer.global_pool")
      self.classifier = nn.Sequential()
      self.classifier.add_module(
          name="global_pool",
          module=GlobalPool(pool_type=pool_type, keep_dim=False),
      )
      self.classifier.add_module(
          name="classifier_fc",
          module=LinearLayer(
              in_features=int(512 * width_multipliers[3]),
              out_features=num_classes,
              bias=True,
          ),
      )
      self.model_conf_dict["cls"] = {
          "in": int(512 * width_multipliers[3]),
          "out": num_classes,
      }
  
      # check model
      self.check_model()
  
      # weight initialization
      self.reset_parameters(opts=opts)
  
file_path: ml-cvnets/cvnets/models/classification/mobileone.py
imports: import argparse
  import copy
  import torch.nn
  from cvnets.layers import GlobalPool, Identity, LinearLayer
  from cvnets.models import MODEL_REGISTRY
  from cvnets.models.classification.base_image_encoder import BaseImageEncoder
  from cvnets.models.classification.config.mobileone import get_configuration
  from cvnets.modules.mobileone_block import MobileOneBlock
label_desc: Use image node_id 1 to create a new MobileOne object from inherited base classes: BaseImageEncoder with example: obj = MobileOne(opts)