deepof.models.get_TCN_encoder
- deepof.models.get_TCN_encoder(input_shape: tuple, edge_feature_shape: tuple, adjacency_matrix: ndarray, latent_dim: int, use_gnn: bool = True, conv_filters: int = 32, kernel_size: int = 4, conv_stacks: int = 2, conv_dilations: tuple = (1, 2, 4, 8), padding: str = 'causal', use_skip_connections: bool = True, dropout_rate: int = 0, activation: str = 'relu', interaction_regularization: float = 0.0)
Return a Temporal Convolutional Network (TCN) encoder.
Builds a neural network that can be used to encode motion tracking instances into a vector. Each layer contains a residual block with a convolutional layer and a skip connection. See the following paper for more details: https://arxiv.org/pdf/1803.01271.pdf
- Parameters:
input_shape – shape of the input data
edge_feature_shape (tuple) – shape of the adjacency matrix to use in the graph attention layers. Should be time x edges x features.
adjacency_matrix (np.ndarray) – adjacency matrix for the mice connectivity graph. Shape should be nodes x nodes.
use_gnn (bool) – If True, the encoder uses a graph representation of the input, with coordinates and speeds as node attributes, and distances as edge attributes. If False, a regular 3D tensor is used as input.
latent_dim – dimensionality of the latent space
conv_filters – number of filters in the TCN layers
kernel_size – size of the convolutional kernels
conv_stacks – number of TCN layers
conv_dilations – list of dilation factors for each TCN layer
padding – padding mode for the TCN layers
use_skip_connections – whether to use skip connections between TCN layers
dropout_rate – dropout rate for the TCN layers
activation – activation function for the TCN layers
interaction_regularization (float) – Regularization parameter for the interaction features
- Returns:
a keras model that can be trained to encode a sequence of motion tracking instances into a latent space using temporal convolutional networks.
- Return type:
keras.Model