sleap.nn.heads

Model head definitions for defining model output types.

class sleap.nn.heads.CenteredInstanceConfmapsHead(part_names: List[str], anchor_part: Optional[str] = None, sigma: float = 5.0, output_stride: int = 1, loss_weight: float = 1.0)[source]

Head for specifying centered instance confidence maps.

property channels

Return the number of channels in the tensor output by this head.

classmethod from_config(config: sleap.nn.config.model.CenteredInstanceConfmapsHeadConfig, part_names: Optional[List[str]] = None)sleap.nn.heads.CenteredInstanceConfmapsHead[source]

Create this head from a set of configurations.

config

A CenteredInstanceConfmapsHead instance specifying the head parameters.

part_names

Text name of the body parts (nodes) that the head will be configured to produce. The number of parts determines the number of channels in the output. This must be provided if the part_names attribute of the configuration is not set.

Returns

The instantiated head with the specified configuration options.

class sleap.nn.heads.CentroidConfmapsHead(anchor_part: Optional[str] = None, sigma: float = 5.0, output_stride: int = 1, loss_weight: float = 1.0)[source]

Head for specifying instance centroid confidence maps.

property channels

Return the number of channels in the tensor output by this head.

classmethod from_config(config: sleap.nn.config.model.CentroidsHeadConfig)sleap.nn.heads.CentroidConfmapsHead[source]

Create this head from a set of configurations.

config

A CentroidsHeadConfig instance specifying the head parameters.

Returns

The instantiated head with the specified configuration options.

class sleap.nn.heads.MultiInstanceConfmapsHead(part_names: List[str], sigma: float = 5.0, output_stride: int = 1, loss_weight: float = 1.0)[source]

Head for specifying multi-instance confidence maps.

property channels

Return the number of channels in the tensor output by this head.

classmethod from_config(config: sleap.nn.config.model.MultiInstanceConfmapsHeadConfig, part_names: Optional[List[str]] = None)sleap.nn.heads.MultiInstanceConfmapsHead[source]

Create this head from a set of configurations.

config

A MultiInstanceConfmapsHeadConfig instance specifying the head parameters.

part_names

Text name of the body parts (nodes) that the head will be configured to produce. The number of parts determines the number of channels in the output. This must be provided if the part_names attribute of the configuration is not set.

Returns

The instantiated head with the specified configuration options.

class sleap.nn.heads.PartAffinityFieldsHead(edges: Sequence[Tuple[str, str]], sigma: float = 15.0, output_stride: int = 1, loss_weight: float = 1.0)[source]

Head for specifying multi-instance part affinity fields.

property channels

Return the number of channels in the tensor output by this head.

classmethod from_config(config: sleap.nn.config.model.PartAffinityFieldsHeadConfig, edges: Optional[Sequence[Tuple[str, str]]] = None)sleap.nn.heads.PartAffinityFieldsHead[source]

Create this head from a set of configurations.

config

A PartAffinityFieldsHeadConfig instance specifying the head parameters.

edges

List of 2-tuples of the form (source_node, destination_node) that define pairs of text names of the directed edges of the graph. This must be set if the edges attribute of the configuration is not set.

Returns

The instantiated head with the specified configuration options.

class sleap.nn.heads.SingleInstanceConfmapsHead(part_names: List[str], sigma: float = 5.0, output_stride: int = 1, loss_weight: float = 1.0)[source]

Head for specifying single instance confidence maps.

property channels

Return the number of channels in the tensor output by this head.

classmethod from_config(config: sleap.nn.config.model.SingleInstanceConfmapsHeadConfig, part_names: Optional[List[str]] = None)sleap.nn.heads.SingleInstanceConfmapsHead[source]

Create this head from a set of configurations.

config

A SingleInstanceConfmapsHeadConfig instance specifying the head parameters.

part_names

Text name of the body parts (nodes) that the head will be configured to produce. The number of parts determines the number of channels in the output. This must be provided if the part_names attribute of the configuration is not set.

Returns

The instantiated head with the specified configuration options.