se_block
PythonSqueeze and excite block
se_block(ratio: int = 8, name: str | None = None)Squeeze and excite block
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 |
The U-NeXt architecture has been modified to allow the following:
se_blockfunctionSqueeze and excite blocknorm_layerfunctionNormalization layerunext_blockfunctionCreate UNext blockunext_corefunctionCreate UNext TF functional coreunext_layerfunctionCreate UNext TF functional modelbuildfunctionBuild a UNext model.Squeeze and excite block
se_block(ratio: int = 8, name: str | None = None)Squeeze and excite block
Normalization layer
norm_layer(norm: str, name: str) -> keras.LayerNormalization layer
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
norm | str | Required | Normalization type |
name | str | Required | Name |
Returns
| Type | Description |
|---|---|
keras.Layer | keras.Layer: Layer |
Create UNext block
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.LayerCreate UNext block
Create UNext TF functional core
unext_core(x: keras.KerasTensor, params: UNextParams) -> keras.KerasTensorCreate UNext TF functional core
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
x | keras.KerasTensor | Required | Input tensor |
params | UNextParams | Required | Model parameters. |
Returns
| Type | Description |
|---|---|
keras.KerasTensor | keras.KerasTensor: Output tensor |
Create UNext TF functional model
unext_layer(inputs: keras.KerasTensor, params: UNextParams) -> keras.KerasTensorCreate UNext TF functional model
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
inputs | keras.KerasTensor | Required | Input tensor |
params | UNextParams | Required | Model parameters. |
Returns
| Type | Description |
|---|---|
keras.KerasTensor | keras.KerasTensor: Output tensor |
Build a UNext model.
build( params: UNextParams, input_shape: tuple[int | None, ...], *, batch_size: int | None = None, name: str | None = None,) -> keras.ModelBuild 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
| Type | Description |
|---|---|
keras.Model | keras.Model: The model, named ``unext`` unless ``name`` is given. |