contraction_net.contraction_net

Classes

ContractionNet

ContractionNet model for detecting contraction intervals from time-series data of individual Z-band positions

Module Contents

class contraction_net.contraction_net.ContractionNet(n_filter=64, in_channels=1, out_channels=2, dropout_rate=0.5)[source]

Bases: torch.nn.Module

ContractionNet model for detecting contraction intervals from time-series data of individual Z-band positions and sarcomere lengths of beating cardiomyocytes.

This neural network is designed to handle noisy data and distinguish between contracting and non-contracting intervals. The network first extracts various features from a single input time-series by two convolutional layers with kernel size 5, followed by a dilated convolution in the third layer to capture broader temporal patterns. Each convolution is followed by instance normalization and ReLU activation. A self-attention layer enhances focus on salient features. The processed signal then undergoes two further convolutions before being outputted through a sigmoid activation function.

forward(x)[source]

Forward pass through the network.

conv1
in1
conv2
bn2
conv3
bn3
attention
norm1
dropout_attention
conv4
bn4
dropout_pre_output
conv_out
forward(x)[source]

Forward pass through the network.

Parameters:

x (torch.Tensor) – Input tensor of shape (batch_size, in_channels, sequence_length).

Returns:

  • torch.Tensor – Output tensor of shape (batch_size, out_channels, sequence_length) after sigmoid activation.

  • torch.Tensor – Raw output tensor of shape (batch_size, out_channels, sequence_length).