dacapo.experiments.architectures
Submodules
dacapo.experiments.architectures.architecturedacapo.experiments.architectures.architecture_configdacapo.experiments.architectures.cnnectome_unetdacapo.experiments.architectures.cnnectome_unet_configdacapo.experiments.architectures.dummy_architecturedacapo.experiments.architectures.dummy_architecture_config
Package Contents
Classes
An abstract base class for defining the architecture of a neural network model. |
|
A class to represent the base configurations of any architecture. |
|
A dummy architecture configuration class used for testing purposes. |
|
A class used to represent a dummy architecture layer for a 3D CNN. |
|
This class configures the CNNectomeUNet based on |
|
An abstract base class for defining the architecture of a neural network model. |
- class dacapo.experiments.architectures.Architecture(*args, **kwargs)
An abstract base class for defining the architecture of a neural network model. It is inherited from PyTorch’s Module and built-in class ABC (Abstract Base Classes). Other classes can inherit this class to define their own specific variations of architecture. It requires to implement several property methods, and also includes additional methods related to the architecture design.
- abstract property input_shape: funlib.geometry.Coordinate
Abstract method to define the spatial input shape for the neural network architecture. The shape should not account for the channels and batch dimensions.
- Returns:
The spatial input shape.
- Return type:
Coordinate
- property eval_shape_increase: funlib.geometry.Coordinate
Provides information about how much to increase the input shape during prediction.
- Returns:
An instance representing the amount to increase in each dimension of the input shape.
- Return type:
Coordinate
- abstract property num_in_channels: int
Abstract method to return number of input channels required by the architecture.
- Returns:
Required number of input channels.
- Return type:
int
- abstract property num_out_channels: int
Abstract method to return the number of output channels provided by the architecture.
- Returns:
Number of output channels.
- Return type:
int
- property dims: int
Returns the number of dimensions of the input shape.
- Returns:
The number of dimensions.
- Return type:
int
- scale(input_voxel_size: funlib.geometry.Coordinate) funlib.geometry.Coordinate
Method to scale the input voxel size as required by the architecture.
- Parameters:
input_voxel_size (Coordinate) – The original size of the input voxel.
- Returns:
The scaled voxel size.
- Return type:
Coordinate
- class dacapo.experiments.architectures.ArchitectureConfig
A class to represent the base configurations of any architecture.
- name
a unique name for the architecture.
- Type:
str
- verify()
validates the given architecture.
- name: str
- verify() Tuple[bool, str]
A method to validate an architecture configuration.
- Returns:
bool – A flag indicating whether the config is valid or not.
str – A description of the architecture.
- class dacapo.experiments.architectures.DummyArchitectureConfig
A dummy architecture configuration class used for testing purposes.
It extends the base class “ArchitectureConfig”. This class contains dummy attributes and always returns that the configuration is invalid when verified.
- architecture_type
A class attribute assigning the DummyArchitecture class to this configuration.
- Type:
- num_in_channels
The number of input channels. This is a dummy attribute and has no real functionality or meaning.
- Type:
int
- num_out_channels
The number of output channels. This is also a dummy attribute and has no real functionality or meaning.
- Type:
int
- architecture_type
- num_in_channels: int
- num_out_channels: int
- verify() Tuple[bool, str]
Verifies the configuration validity.
Since this is a dummy configuration for testing purposes, this method always returns False indicating that the configuration is invalid.
- Returns:
A tuple containing a boolean validity flag and a reason message string.
- Return type:
tuple
- class dacapo.experiments.architectures.DummyArchitecture(architecture_config)
A class used to represent a dummy architecture layer for a 3D CNN.
- channels_in
An integer representing the number of input channels.
- channels_out
An integer representing the number of output channels.
- conv
A 3D convolution object.
- input_shape
A coordinate object representing the shape of the input.
- forward(x)
Performs the forward pass of the network.
- property input_shape
Returns the input shape for this architecture.
- Returns:
Input shape of the architecture.
- Return type:
Coordinate
- property num_in_channels
Returns the number of input channels for this architecture.
- Returns:
Number of input channels.
- Return type:
int
- property num_out_channels
Returns the number of output channels for this architecture.
- Returns:
Number of output channels.
- Return type:
int
- forward(x)
Perform the forward pass of the network.
- Parameters:
x – Input tensor.
- Returns:
Output tensor after the forward pass.
- Return type:
Tensor
- class dacapo.experiments.architectures.CNNectomeUNetConfig
This class configures the CNNectomeUNet based on https://github.com/saalfeldlab/CNNectome/blob/master/CNNectome/networks/unet_class.py
Includes support for super resolution via the upsampling factors.
- architecture_type
- input_shape: funlib.geometry.Coordinate
- fmaps_out: int
- fmaps_in: int
- num_fmaps: int
- fmap_inc_factor: int
- downsample_factors: List[funlib.geometry.Coordinate]
- constant_upsample: bool
- padding: str
- use_attention: bool
- class dacapo.experiments.architectures.CNNectomeUNet(architecture_config)
An abstract base class for defining the architecture of a neural network model. It is inherited from PyTorch’s Module and built-in class ABC (Abstract Base Classes). Other classes can inherit this class to define their own specific variations of architecture. It requires to implement several property methods, and also includes additional methods related to the architecture design.
- property eval_shape_increase
Provides information about how much to increase the input shape during prediction.
- Returns:
An instance representing the amount to increase in each dimension of the input shape.
- Return type:
Coordinate
- property input_shape
Abstract method to define the spatial input shape for the neural network architecture. The shape should not account for the channels and batch dimensions.
- Returns:
The spatial input shape.
- Return type:
Coordinate
- property num_in_channels: int
Abstract method to return number of input channels required by the architecture.
- Returns:
Required number of input channels.
- Return type:
int
- property num_out_channels: int
Abstract method to return the number of output channels provided by the architecture.
- Returns:
Number of output channels.
- Return type:
int
- module()
- scale(voxel_size)
Method to scale the input voxel size as required by the architecture.
- Parameters:
input_voxel_size (Coordinate) – The original size of the input voxel.
- Returns:
The scaled voxel size.
- Return type:
Coordinate
- forward(x)