mlreco.models.layers.common.ppnplus module¶
-
class
mlreco.models.layers.common.ppnplus.AttentionMask(score_threshold=0.5)[source]¶ Bases:
torch.nn.modules.module.ModuleReturns a masked tensor of x according to mask, where the number of coordinates between x and mask differ
-
__init__(score_threshold=0.5)[source]¶ Initializes internal Module state, shared by both nn.Module and ScriptModule.
-
forward(x, mask)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
__module__= 'mlreco.models.layers.common.ppnplus'¶
-
training: bool¶
-
-
class
mlreco.models.layers.common.ppnplus.MergeConcat[source]¶ Bases:
torch.nn.modules.module.Module-
forward(input, other)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
__module__= 'mlreco.models.layers.common.ppnplus'¶
-
training: bool¶
-
-
class
mlreco.models.layers.common.ppnplus.ExpandAs[source]¶ Bases:
torch.nn.modules.module.Module-
forward(x, shape, labels=None)[source]¶ x: feature tensor of input sparse tensor (N x F) labels: N x 0 tensor of labels
-
__module__= 'mlreco.models.layers.common.ppnplus'¶
-
training: bool¶
-
-
class
mlreco.models.layers.common.ppnplus.PPN(cfg, name='ppn')[source]¶ Bases:
torch.nn.modules.module.ModulePoint Proposal Network (PPN) implementation using MinkowskiEngine
It requires a UResNet network as a backbone.
- Configuration
data_dim (int, default 3)
num_input (int, default 1)
allow_bias (bool, default False)
spatial_size (int, default 512)
leakiness (float, default 0.33)
activation (dict) – For activation function, defaults to {‘name’: ‘lrelu’, ‘args’: {}}
norm_layer (dict) – For normalization function, defaults to {‘name’: ‘batch_norm’, ‘args’: {}}
depth (int, default 5) – Depth of UResNet, also corresponds to how many times we down/upsample.
filters (int, default 16) – Number of filters in the first convolution of UResNet. Will increase linearly with depth.
reps (int, default 2) – Convolution block repetition factor
input_kernel (int, default 3) – Receptive field size for very first convolution after input layer.
num_classes (int, default 5)
score_threshold (float, default 0.5)
classify_endpoints (bool, default False) – Enable classification of points into start vs end points.
ppn_resolution (float, default 1.0)
ghost (bool, default False)
downsample_ghost (bool, default True)
use_true_ghost_mask (bool, default False)
mask_loss_name (str, default ‘BCE’) – Can be ‘BCE’ or ‘LogDice’
particles_label_seg_col (int, default -2) – Which column corresponds to particles’ semantic label
track_label (int, default 1)
- Output
points (torch.Tensor) – Contains X, Y, Z predictions, semantic class prediction logits, and prob score
mask_ppn (list of torch.Tensor) – Binary mask at various spatial scales of PPN predictions (voxel-wise score > some threshold)
ppn_coords (list of torch.Tensor) – List of XYZ coordinates at various spatial scales.
ppn_layers (list of torch.Tensor) – List of score features at various spatial scales.
ppn_output_coordinates (torch.Tensor) – XYZ coordinates tensor at the very last layer of PPN (initial spatial scale)
classify_endpoints (torch.Tensor) – Logits for end/start point classification.
See also
-
__init__(cfg, name='ppn')[source]¶ Initializes internal Module state, shared by both nn.Module and ScriptModule.
-
forward(final, decoderTensors, ghost=None, ghost_labels=None)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
__module__= 'mlreco.models.layers.common.ppnplus'¶
-
training: bool¶
-
class
mlreco.models.layers.common.ppnplus.PPNLonelyLoss(cfg, name='ppn')[source]¶ Bases:
torch.nn.modules.loss._LossLoss function for PPN.
- Output
reg_loss (float) – Distance loss
mask_loss (float) – Binary voxel-wise prediction (is there an object of interest or not)
type_loss (float) – Semantic prediction loss.
classify_endpoints_loss (float)
classify_endpoints_acc (float)
See also
-
__init__(cfg, name='ppn')[source]¶ Initializes internal Module state, shared by both nn.Module and ScriptModule.
-
__module__= 'mlreco.models.layers.common.ppnplus'¶
-
reduction: str¶
-
forward(result, segment_label, particles_label)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.