mlreco.models.layers.common.dbscan module

class mlreco.models.layers.common.dbscan.DBSCANFragmenter(cfg, name='dbscan_frag', batch_col=0, coords_col=(1, 4))[source]

Bases: torch.nn.modules.module.Module

DBSCAN Layer that uses sklearn’s DBSCAN implementation to fragment each of the particle classes into dense instances. Runs DBSCAN on each requested class separately, in one of three ways: - Run pure DBSCAN on all the voxels in that class - Runs DBSCAN on PPN point-masked voxels, associates leftovers based on proximity - Use a graph-based method to cluster tracks based on PPN vertices (track only)

Parameters
  • data ([np.array]) – (N,5) [x, y, z, batchid, sem_type]

  • output (dict) – Dictionary that contains the UResNet+PPN output

Returns

[(C_0^0, C_0^1, …, C_0^N_0), …] List of list of clusters (one per class)

Return type

(torch.tensor)

__init__(cfg, name='dbscan_frag', batch_col=0, coords_col=(1, 4))[source]

Initializes internal Module state, shared by both nn.Module and ScriptModule.

__module__ = 'mlreco.models.layers.common.dbscan'
training: bool
get_clusts(data, bids, segmentation, break_points=None)[source]
forward(data, output=None, points=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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.