{
  "$schema": "https://ambiqai.github.io/helia-ui/schema/reference-model-1.json",
  "generatedFrom": {
    "sourceCommit": "f341fb11f7f5d77a4974ba8273c4cd55d67c21f0",
    "tool": "pyref",
    "version": "1.7.3"
  },
  "language": "python",
  "modules": [
    {
      "description": "# MobileOne\n\n## Overview\n\nMobileOne is a fully convolutional neural network designed to have minimal latency when running in mobile/edge devices. The architecture consists of a series of depthwise separable convolutions and squeeze and excitation (SE) blocks. The network also uses standard batch normalization and ReLU activations that can be easily fused into the convolutional layers. Lastly, the network uses over-parameterized branches to improve training, yet can be merged into a single branch during inference.\n\nFor more info, refer to the original paper [MobileOne: An Improved One millisecond Mobile Backbone](https://doi.org/10.48550/arXiv.2206.04040).\n\nParameters are in ``helia_edge.models.mobileone_params``.\n\n**Functions**\n\n| Name | Description |\n| --- | --- |\n| `build` | MobileOne model from ``MobileOneParams`` |\n| `mobileone_block` | MobileOne block |\n| `mobileone_layer` | MobileOne layer |\n\n---\n\n## Additions\n\nThe MobileOne architecture has been modified to allow the following:\n\n* Enable 1D and 2D variants.\n* Enable dilated convolutions.\n\n## Usage\n\n```python\nfrom helia_edge.models import MobileOneBlockParams, MobileOneParams, ModelSpec, build\n\nparams = MobileOneParams(\n    input_filters=24,\n    input_kernel_size=(1, 7),\n    input_strides=(1, 2),\n    input_padding=(0, 3),\n    blocks=[\n        MobileOneBlockParams(\n            filters=32, depth=2, kernel_size=(1, 7), strides=(1, 2), padding=(0, 3), se_ratio=2, num_conv_branches=2\n        )\n    ],\n    include_top=True,\n    num_classes=5,\n)\nmodel = build(ModelSpec(params=params, input_shape=(1, 800, 1)))\nmodel.summary()\n```",
      "name": "mobileone",
      "path": "helia_edge.models.mobileone",
      "submodules": [],
      "summary": "MobileOne",
      "symbols": [
        {
          "description": "MBConv block w/ expansion and SE",
          "examples": [],
          "id": "helia_edge.models.mobileone.mobileone_block",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "mobileone_block",
          "params": [
            {
              "description": "Number of output filter channels",
              "name": "output_filters",
              "type": "int"
            },
            {
              "default": "3",
              "description": "Kernel size. Defaults to 3.",
              "name": "kernel_size",
              "type": "int | tuple[int, int]"
            },
            {
              "default": "1",
              "description": "Stride length. Defaults to 1.",
              "name": "strides",
              "type": "int | tuple[int, int]"
            },
            {
              "default": "0",
              "description": "SE ratio. Defaults to 8.",
              "name": "se_ratio",
              "type": "float"
            },
            {
              "default": "None",
              "description": "Block name. Defaults to None.",
              "name": "name",
              "type": "str | None"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "keras.Layer: Functional layer",
              "type": "keras.Layer"
            }
          ],
          "signature": "mobileone_block(\n    output_filters: int,\n    kernel_size: int | tuple[int, int] = 3,\n    strides: int | tuple[int, int] = 1,\n    padding: int | tuple[int, int] = 0,\n    groups: int = 1,\n    dilation: int = 1,\n    inference_mode: bool = False,\n    se_ratio: int = 0,\n    num_conv_branches: int = 1,\n    activation: str = 'relu6',\n    name: str | None = None,\n) -> keras.Layer",
          "source": {
            "line": 58,
            "path": "helia_edge/models/mobileone.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/models/mobileone.py#L58"
          },
          "summary": "MBConv block w/ expansion and SE"
        },
        {
          "description": "Create MobileOne TF functional model",
          "examples": [],
          "id": "helia_edge.models.mobileone.mobileone_layer",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "mobileone_layer",
          "params": [
            {
              "description": "Input tensor",
              "name": "x",
              "type": "keras.KerasTensor"
            },
            {
              "description": "Model parameters.",
              "name": "params",
              "type": "MobileOneParams"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "keras.KerasTensor: Output tensor",
              "type": "keras.KerasTensor"
            }
          ],
          "signature": "mobileone_layer(x: keras.KerasTensor, params: MobileOneParams, inference_mode: bool = False) -> keras.KerasTensor",
          "source": {
            "line": 199,
            "path": "helia_edge/models/mobileone.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/models/mobileone.py#L199"
          },
          "summary": "Create MobileOne TF functional model"
        },
        {
          "description": "Build a MobileOne model.",
          "examples": [],
          "id": "helia_edge.models.mobileone.build",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "build",
          "params": [
            {
              "description": "Model parameters.",
              "name": "params",
              "type": "MobileOneParams"
            },
            {
              "description": "Input shape without the batch axis; None for a variable axis.",
              "name": "input_shape",
              "type": "tuple[int | None, ...]"
            },
            {
              "default": "None",
              "description": "Static batch size; None for a dynamic batch.",
              "name": "batch_size",
              "type": "int | None"
            },
            {
              "default": "None",
              "description": "Model name; the family when None.",
              "name": "name",
              "type": "str | None"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "keras.Model: The model, named ``mobileone`` unless ``name`` is given.",
              "type": "keras.Model"
            }
          ],
          "signature": "build(\n    params: MobileOneParams,\n    input_shape: tuple[int | None, ...],\n    *,\n    batch_size: int | None = None,\n    name: str | None = None,\n) -> keras.Model",
          "source": {
            "line": 274,
            "path": "helia_edge/models/mobileone.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/models/mobileone.py#L274"
          },
          "summary": "Build a MobileOne model."
        }
      ]
    }
  ],
  "name": "helia_edge"
}
