mlreco.models.layers.cluster_cnn.losses.radius_nnloss module¶
-
class
mlreco.models.layers.cluster_cnn.losses.radius_nnloss.DensityBasedNNLoss(cfg, name='density_loss')[source]¶ Bases:
torch.nn.modules.loss._Loss-
__init__(cfg, name='density_loss')[source]¶ Initializes internal Module state, shared by both nn.Module and ScriptModule.
-
radius_neighbor_loss(features, labels, minPoints=5, eps1=1.999, eps2=1.999, compute_accuracy=False)[source]¶
-
combine_multiclass(features, slabels, clabels, **kwargs)[source]¶ Wrapper function for combining different components of the loss, in particular when clustering must be done PER SEMANTIC CLASS.
NOTE: When there are multiple semantic classes, we compute the DLoss by first masking out by each semantic segmentation (ground-truth/prediction) and then compute the clustering loss over each masked point cloud.
- INPUTS:
features (torch.Tensor): pixel embeddings slabels (torch.Tensor): semantic labels clabels (torch.Tensor): group/instance/cluster labels
- OUTPUT
loss_segs (list) – list of computed loss values for each semantic class.
loss[i] = computed DLoss for semantic class <i>.
acc_segs (list) – list of computed clustering accuracy for each semantic class.
-
forward(out, semantic_labels, group_labels)[source]¶ Forward function for the Discriminative Loss Module.
- Inputs:
out: output of UResNet; embedding-space coordinates. semantic_labels: ground-truth semantic labels group_labels: ground-truth instance labels
- Returns
A dictionary containing key-value pairs for loss, accuracy, etc.
- Return type
(dict)
-
__module__= 'mlreco.models.layers.cluster_cnn.losses.radius_nnloss'¶
-
reduction: str¶
-