# helia_edge.models.unext

## U-NeXt

### Overview

U-NeXt is a modification of U-Net that utilizes techniques from ResNeXt and EfficientNetV2. During the encoding phase, mbconv blocks are used to efficiently process the input.

Parameters are in ``helia_edge.models.unext_params``.

**Functions**

| Name | Description |
| --- | --- |
| `build` | U-NeXt model from ``UNextParams`` |
| `unext_block` | Create U-NeXt block |
| `se_block` | Squeeze and excite block |
| `norm_layer` | Normalization layer |
| `unext_core` | Create U-NeXt core |
| `unext_layer` | Create U-NeXt layer |

### Additions

The U-NeXt architecture has been modified to allow the following:

* MBConv blocks used in the encoding phase.
* Squeeze and excitation (SE) blocks added within blocks.

## helia_edge.models.unext.se_block

`function` · `python`

```python
se_block(ratio: int = 8, name: str | None = None)
```

Squeeze and excite block

Source: `helia_edge/models/unext.py:35`

## helia_edge.models.unext.norm_layer

`function` · `python`

```python
norm_layer(norm: str, name: str) -> keras.Layer
```

Normalization layer

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| norm | str | Required | Normalization type |
| name | str | Required | Name |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | keras.Layer | keras.Layer: Layer |

Source: `helia_edge/models/unext.py:61`

## helia_edge.models.unext.unext_block

`function` · `python`

```python
unext_block(
    output_filters: int,
    expand_ratio: float = 1,
    kernel_size: int | tuple[int, int] = 3,
    strides: int | tuple[int, int] = 1,
    se_ratio: float = 4,
    dropout: float | None = 0,
    norm: Literal['batch', 'layer'] | None = 'batch',
    name: str | None = None,
) -> keras.Layer
```

Create UNext block

Source: `helia_edge/models/unext.py:91`

## helia_edge.models.unext.unext_core

`function` · `python`

```python
unext_core(x: keras.KerasTensor, params: UNextParams) -> keras.KerasTensor
```

Create UNext TF functional core

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| x | keras.KerasTensor | Required | Input tensor |
| params | UNextParams | Required | Model parameters. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | keras.KerasTensor | keras.KerasTensor: Output tensor |

Source: `helia_edge/models/unext.py:181`

## helia_edge.models.unext.unext_layer

`function` · `python`

```python
unext_layer(inputs: keras.KerasTensor, params: UNextParams) -> keras.KerasTensor
```

Create UNext TF functional model

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| inputs | keras.KerasTensor | Required | Input tensor |
| params | UNextParams | Required | Model parameters. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | keras.KerasTensor | keras.KerasTensor: Output tensor |

Source: `helia_edge/models/unext.py:328`

## helia_edge.models.unext.build

`function` · `python`

```python
build(
    params: UNextParams,
    input_shape: tuple[int | None, ...],
    *,
    batch_size: int | None = None,
    name: str | None = None,
) -> keras.Model
```

Build a UNext model.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| params | UNextParams | Required | Model parameters. |
| input_shape | tuple[int \| None, ...] | Required | Input shape without the batch axis; None for a variable axis. |
| batch_size | int \| None | None | Static batch size; None for a dynamic batch. |
| name | str \| None | None | Model name; the family when None. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | keras.Model | keras.Model: The model, named ``unext`` unless ``name`` is given. |

Source: `helia_edge/models/unext.py:371`
