mlreco.utils.ppn module¶
-
mlreco.utils.ppn.contains(meta, point, point_type='3d')[source]¶ Decides whether a point is contained in the box defined by meta.
- Parameters
meta (larcv::Voxel3DMeta or larcv::ImageMeta) –
point (larcv::Point3D or larcv::Point2D) –
point_type (str, optional) – Has to be “3d” for 3D, otherwise anything else works for 2D.
- Returns
- Return type
bool
-
mlreco.utils.ppn.pass_particle(gt_type, start, end, energy_deposit, vox_count)[source]¶ Filters particles based on their type, voxel count and energy deposit.
- Parameters
gt_type (int) –
start (larcv::Point3D) –
end (larcv::Point3D) –
energy_deposit (float) –
vox_count (int) –
- Returns
- Return type
bool
Notes
Made during DUNE Pi0 workshop (?), do we need to keep it here? Assumes 3D
-
mlreco.utils.ppn.get_ppn_info(particle_v, meta, point_type='3d', min_voxel_count=5, min_energy_deposit=0, use_particle_shape=True)[source]¶ Gets particle points coordinates and informations for running PPN.
- Parameters
particle_v –
meta (larcv::Voxel3DMeta or larcv::ImageMeta) –
point_type (str, optional) –
min_voxel_count (int, optional) –
min_energy_deposit (float, optional) –
- Returns
Array of points of shape (N, 11) where 11 = x,y,z + point type + pdg code + energy deposit + num voxels + energy_init + particle index + start (0) or end (1) point tagging
- Return type
np.array
Notes
We skip some particles under specific conditions (e.g. low energy deposit, low voxel count, nucleus track, etc.) For now in 2D we assume a specific 2d projection (plane).
-
mlreco.utils.ppn.nms_numpy(im_proposals, im_scores, threshold, size)[source]¶ Runs NMS algorithm on a list of predicted points and scores.
- Parameters
im_proposals (np.array) – Shape (N, data_dim). Predicted points.
im_scores (np.array) – Shape (N, 2). Predicted scores.
threshold (float) – Threshold for overlap
size (int) – Half side of square window defined around each point
- Returns
boolean array of same length as points/scores
- Return type
np.array
-
mlreco.utils.ppn.group_points(ppn_pts, batch, label)[source]¶ if there are multiple ppn points in a very similar location, return the average pos
- Parameters
ppn_pts (np.array) –
batch (np.array) –
label (np.array) –
- Returns
- Return type
np.array
-
mlreco.utils.ppn.uresnet_ppn_type_point_selector(data, out, score_threshold=0.5, type_score_threshold=0.5, type_threshold=1.999, entry=0, score_pool='max', enforce_type=True, batch_col=0, coords_col=(1, 4), type_col=(3, 8), score_col=(8, 10), selection=None, num_classes=5, apply_deghosting=True, **kwargs)[source]¶ Postprocessing of PPN points.
- Parameters
- 5-types sparse tensor (data) –
- output dictionary of the full chain (out) –
- minimal detection score (score_threshold) –
- minimal score for a point type prediction to be considered (type_score_threshold) –
- distance threshold for matching w/ semantic type prediction (type_threshold) –
- which index to look at (within a batch of events) (entry) –
- which operation to use to pool PPN points scores (max/min/mean) (score_pool) –
- whether to force PPN points predicted of type X (enforce_type) – to be within N voxels of a voxel with same predicted semantic
- list of list of indices to consider exclusively (eg to get PPN predictions (selection) – within a cluster). Shape Batch size x N_voxels (not square)
- Returns
[bid,x,y,z,score softmax values (2 columns), occupancy,
type softmax scores (5 columns), predicted type,
(optional) endpoint type]
1 row per ppn-predicted points
-
mlreco.utils.ppn.uresnet_ppn_point_selector(data, out, nms_score_threshold=0.8, entry=0, window_size=4, score_threshold=0.9, **kwargs)[source]¶ Basic selection of PPN points.
- Parameters
- 5-types sparse tensor (data) –
- ppn output (out) –
- Returns
- Return type
[x,y,z,bid,label] of ppn-predicted points
-
mlreco.utils.ppn.get_track_endpoints_geo(data, f, points_tensor=None, use_numpy=False)[source]¶ Compute endpoints of a track-like cluster f based on PPN point predictions (coordinates and scores) and geometry (voxels farthest apart from each other in the cluster).
If points_tensor is left unspecified, the endpoints will be purely based on geometry.
Input: - data is the input data tensor, which can be indexed by f. - points_tensor is the output of PPN ‘points’ (optional) - f is a list of voxel indices for voxels that belong to the track.
Output: - array of shape (2, 3) (2 endpoints, 3 coordinates each)