Keras Blocks

Here can be found all blocks implemented in Keras for the architecture’s implementation in that framework.

TSFEDL.blocks_keras.densenet_transition_block(x, ...)

A transition block of densenet for 1D data.

TSFEDL.blocks_keras.densenet_conv_block(x, ...)

A building block for a dense block from densenet for 1D data.

TSFEDL.blocks_keras.densenet_dense_block(x, ...)

A dense block of densenet for 1D data.

TSFEDL.blocks_keras.squeeze_excitation_module(x, ...)

Squeeze-and-Excitation Module.

TSFEDL.blocks_keras.conv_block_YiboGao(in_x, ...)

Convolutional block of YiboGao's model.

TSFEDL.blocks_keras.attention_branch_YiboGao(...)

Attention bronch of YiboGao's model.

TSFEDL.blocks_keras.RTA_block(in_x, ...)

Residual-based Temporal Attention (RTA) block.

TSFEDL.blocks_keras.spatial_attention_block_ZhangJin(...)

Spatial attention module of ZhangJin's model

TSFEDL.blocks_keras.temporal_attention_block_ZhangJin(x)

Temporal attention module of ZhangJin's Model.

TSFEDL.blocks_keras.densenet_transition_block(x, reduction, name)[source]

A transition block of densenet for 1D data.

Parameters:
  • x (input tensor.) –

  • reduction (float) – Compression rate at transition layers.

  • name (str) – Block label.

Returns:

x

Return type:

output tensor for the block.

TSFEDL.blocks_keras.densenet_conv_block(x, growth_rate, name)[source]

A building block for a dense block from densenet for 1D data.

Parameters:
  • x (input tensor.) –

  • growth_rate (float) – Growth rate at dense layers.

  • name (str) – Block label.

Returns:

x

Return type:

Output tensor for the block.

TSFEDL.blocks_keras.densenet_dense_block(x, blocks, growth_rate, name)[source]

A dense block of densenet for 1D data.

Parameters:
  • x (input tensor.) –

  • blocks (int) – The number of building blocks.

  • name (str) – Block label.

Returns:

x

Return type:

Output tensor for the block.

TSFEDL.blocks_keras.squeeze_excitation_module(x, dense_units)[source]

Squeeze-and-Excitation Module.

References

Squeeze-and-Excitation Networks, Jie Hu, Li Shen, Samuel Albanie, Gang Sun, Enhua Wu (arXiv:1709.01507v4)

Parameters:
  • x (keras.Tensor) – The input tensor.

  • dense_units (int) – The number units on each dense layer.

Returns:

se – Output tensor for the block.

Return type:

Keras.Tensor

TSFEDL.blocks_keras.conv_block_YiboGao(in_x, nb_filter, kernel_size)[source]

Convolutional block of YiboGao’s model.

Parameters:
  • in_x (keras.Tensor) – Input tensor of the convolution bock.

  • nb_filter (int) – Number of filerts for the convolution.

  • kernel_size (int) – Kernel size of the convolution.

Returns:

x – Output tensor of the block.

Return type:

keras.Tensor

TSFEDL.blocks_keras.attention_branch_YiboGao(in_x, nb_filter, kernel_size)[source]

Attention bronch of YiboGao’s model.

Parameters:
  • in_x (keras.Tensor) – Input tensor.

  • nb_filter (int) – Number of filerts for the convolutional YiboGao block.

  • kernel_size (int) – Kernel size for the convolutional block.

Returns:

x – Output tensor of the block.

Return type:

keras.Tensor

TSFEDL.blocks_keras.RTA_block(in_x, nb_filter, kernel_size)[source]

Residual-based Temporal Attention (RTA) block.

References

Gao, Y., Wang, H., & Liu, Z. (2021). An end-to-end atrial fibrillation detection by a novel residual-based temporal attention convolutional neural network with exponential nonlinearity loss. Knowledge-Based Systems, 212, 106589.

Parameters:
  • in_x (keras.Tensor) – Input tensor.

  • nb_filter (int) – Number of filerts for the convolutional YiboGao block.

  • kernel_size (int) – Kernel size for the convolutional block.

Returns:

out – Output tensor of the block.

Return type:

keras.Tensor

TSFEDL.blocks_keras.spatial_attention_block_ZhangJin(decrease_ratio, x)[source]

Spatial attention module of ZhangJin’s model

Parameters:
  • x (keras.Tensor) – Input tensor.

  • decrease_ratio (int) – Decrease ratio of the number of units in the neural network.

Returns:

x – Output tensor of the block.

Return type:

keras.Tensor

TSFEDL.blocks_keras.temporal_attention_block_ZhangJin(x)[source]

Temporal attention module of ZhangJin’s Model.

Parameters:

x (keras.Tensor) – Input tensor.

Returns:

x – Output tensor of the block.

Return type:

keras.Tensor