CTLearnModel#
- class ctlearn.core.CTLearnModel(*args: t.Any, **kwargs: t.Any)[source]#
Bases:
ComponentBase component for creating a Keras model to be used in CTLearn.
This class defines the basic functionality for creating a Keras model to be used in CTLearn. It provides the necessary methods to build the backbone of the model and the fully connected head for the specified tasks.
Attributes Summary
Type of squeeze and excitation attention mechanism to use.
Reduction ratio for the squeeze and excitation attention mechanism.
Convolution backend for the model backbone.
Dictionary containing the activation function for the fully connected head for each task ('type', 'energy', 'cameradirection', 'skydirection').
Dictionary containing the number of neurons in the fully connected head for each task ('type', 'energy', 'cameradirection', 'skydirection').
Initial padding to apply to the input data.
Attributes Documentation
- attention_mechanism#
Type of squeeze and excitation attention mechanism to use.
- attention_reduction_ratio#
Reduction ratio for the squeeze and excitation attention mechanism.
- conv_backend#
Convolution backend for the model backbone. ‘square’ uses the framework’s own Conv2D/MaxPool2D/AveragePooling2D layers (default, expects a square-mapped input, e.g. from BilinearMapper). ‘hexagdly’ uses the Conv2d/MaxPool2d/AvgPool2d layers of keras_hexagdly (Keras) or pytorch_hexagdly (PyTorch) for hex-native convolution (expects hex-addressed input, e.g. from HexagdlyMapper). kernel_size and the pooling size mean the same for both backends, a square-kernel width: with ‘hexagdly’, 3 is the 7-cell hexagon and 1 a plain 1x1. A hexagonal window is centred on a cell, so an even size has no exact equivalent: it is rounded up to the next odd one, with a warning from the hexagonal layers.
- head_activation_function#
Dictionary containing the activation function for the fully connected head for each task (‘type’, ‘energy’, ‘cameradirection’, ‘skydirection’). Note: The default activation functions are ‘relu’ for ‘type’ and ‘energy’ tasks, and ‘tanh’ for ‘cameradirection’ and ‘skydirection’ tasks. The ‘type’ task uses ‘softmax’ as the final activation function.
- head_layers#
Dictionary containing the number of neurons in the fully connected head for each task (‘type’, ‘energy’, ‘cameradirection’, ‘skydirection’). Note: The number of neurons in the last layer must match the number of classes or the number of reconstructed values.
- init_padding#
Initial padding to apply to the input data.