sleap.nn.architectures.leap#
This module provides a generalized implementation of the LEAP CNN.
See the LeapCNN
class docstring for more information.
- class sleap.nn.architectures.leap.LeapCNN(stacks: int = 1, filters: int = 64, filters_rate: float = 2, down_blocks: int = 3, down_convs_per_block: int = 3, up_blocks: int = 3, up_interpolate: bool = False, up_convs_per_block: int = 2)[source]#
LEAP CNN from “Fast animal pose estimation using deep neural networks” (2019).
This is a simple encoder-decoder style architecture without skip connections.
This implementation is generalized from original paper (Pereira et al., 2019) and code.
Using the defaults will create a network with ~10.8M parameters.
- filters#
Base number of filters in the first encoder block. More filters will increase the representational capacity of the network at the cost of memory and runtime.
- Type:
int
- filters_rate#
Factor to increase the number of filters by in each block.
- Type:
float
- down_blocks#
Number of blocks with pooling in the encoder. More down blocks will increase the effective maximum receptive field, but may incur loss of spatial precision.
- Type:
int
- down_convs_per_block#
Number of convolutions in each encoder block. More convolutions per block will increase the representational capacity of the network at the cost of memory and runtime.
- Type:
int
- up_blocks#
Number of blocks with upsampling in the decoder. If this is equal to
down_blocks
, the output of this network will be at the same stride (scale) as the input.- Type:
int
- up_interpolate#
If True, use bilinear interpolation instead of transposed convolutions for upsampling. Interpolation is faster but transposed convolutions may be able to learn richer or more complex upsampling to recover details from higher scales. If using transposed convolutions, the number of filters are determined by
filters
andfilters_rate
to progressively decrease the number of filters at each step.- Type:
bool
- up_convs_per_block#
Number of convolution layers after each upsampling operation. These will use the
filters
andfilters_rate
to progressively decrease the number of filters at each step.- Type:
int
- property decoder_stack: List[SimpleUpsamplingBlock]#
Return the decoder block configuration.
- property encoder_stack: List[SimpleConvBlock]#
Return the encoder block configuration.
- classmethod from_config(config: LEAPConfig) LeapCNN [source]#
Create a model from a set of configuration parameters.
- Parameters:
config – An
LEAPConfig
instance with the desired parameters.- Returns:
An instance of this class with the specified configuration.