src.model.deeplearn.dlrun.hierarchical_fps_pre_processor

Classes

HierarchicalFPSPreProcessor(**kwargs)

class src.model.deeplearn.dlrun.hierarchical_fps_pre_processor.HierarchicalFPSPreProcessor(**kwargs)
Author:

Alberto M. Esmoris Pena

Preprocess the input dictionary of X (coordinates), F (features), and y (expected values) so it can be feed to hierarchical neural networks such as hierarchical autoencoders.

See ReceptiveFieldHierarchicalFPS. See ReceptiveFieldPreProcessor.

Variables:
  • num_downsampling_neighbors (list) – List with the number of neighbors involved in the downsampling at a given depth, i.e., [i] corresponds to depth i.

  • num_pwise_neighbors (list) – List with the number of k nearest neighbors for the point-wise feature extraction at a given depth, i.e., [i] gives the point-wise knn neighborhoods at depth i.

  • num_upsampling_neighbors (list) – List with the number of neighbors involved in the upsampling at a given depth, i.e., [i] corresponds to depth i.

  • num_points_per_depth (list) – List with the number of points per depth level, i.e., the number of points per receptive field.

  • depth (int) – The depth of the hierarchical receptive fields. At building time it is taken as the length of the number of points per depth level.

  • fast_flag_per_depth (list) – List of boolean flags specifying whether the corresponding receptive field must be computed using a stochastic approximation (faster) or the exhaustive furthest point sampling computation (slower).

__init__(**kwargs)

Initialization/instantiation of a Hierarchical Furthest Point Subsampling pre-processor.

Parameters:

kwargs – The key-word arguments for the Hierarchical Furthest Point Subsampling pre-processor.

__call__(inputs)

Executes the pre-processing logic. It also updates the cache-like variables of the preprocessor.

The pre-processing logic transforms the input structure space matrix \(\pmb{X_{\mathrm{IN}}} \in \mathbb{R}^{m_{\mathrm{IN}} \times n_x}\) (typically \(n_x=3\)), the feature space matrix \(\pmb{F_{\mathrm{IN}}} \in \mathbb{R}^{m_{\mathrm{IN}} \times n_f}\), and potentially the reference values \(\pmb{y} \in \mathbb^{R}{m_{\mathrm{IN}}}\) into many receptive fields. Where \(m_{\mathrm{IN}}\) is the number of input points.

Now, a given receptive field can be represented by a structure space matrix \(\pmb{X} \in \mathbb{R}^{m \times n_x}\), a feature space matrix \(\pmb{F} \in \mathbb{R}^{m \times n_f}, the downsampling indexing matrices :math:\)pmb{N}^{D}_{i} in mathbb{Z}^{m_i}`, the neighborhood indexing matrices \(\pmb{N}_{i} \in \mathbb{Z}^{m_i \times R}\), and the upsampling indexing matrices \(\pmb{N}^{U}_{i} \in \mathbb{Z}^{m_i}\), Where \(i = 1, \ldots, \text{max depth}\), \(m\) is the number of points, \(m_i\) is the number of points at depth i, and \(R in \mathbb{Z}_{>0}\) the number of nearest neighbors defining each point-wise neighborhood.

Parameters:

inputs (dict) – A key-word input where the key “X” gives the input dataset and the “y” (OPTIONALLY) gives the reference values that can be used to fit/train a hierarchical model. If “X” is a list, then the first element is assumed to be the matrix \(\pmb{X_{\mathrm{IN}}}\) of coordinates and the second the matrix \(\pmb{F_{\mathrm{IN}}}\) of features. If “X” is a matrix (array), then the matrix of features is assumed to be a column vector of ones.

Returns:

Either (X, F, …NDi…, …Ni…, …NUi…, y) or (X, F, …NDi…, …Ni…, …NUi…). Where X are the input points, F are the input features, NDi are point-wise downsamlping neighborhoods at depth i, Ni are the point-wise neighborhoods at depth i, and NUi are the point-wise upsampling neighborhoods at depth i.

static clean_support_neighborhoods(sup_X, I, num_points, oversampling=None)

See FurthestPointSubsamplingPreProcessor and furthest_point_subsampling_pre_processor.FurthestPointSubsamplingPreProcessor.clean_support_neighborhoods().

reduce_labels(X_rf, y, I=None)

Reduce the given labels \(\pmb{y} \in \mathbb{Z}_{\geq 0}^{m}\) to the receptive field labels \(\pmb{y}_{\mathrm{rf}} \in \mathbb{Z}_{\geq 0}^{R}\).

Parameters:
  • X_rf (np.ndarray) – The matrices of coordinates representing the receptive fields.

  • y (np.ndarray) – The labels of the original point cloud that must be reduced to the receptive fields.

  • I (list) – The list of neighborhoods. Each element of I is itself a list of indices that represents the neighborhood in the point cloud that corresponds to the point in the receptive field.

Returns:

The reduced labels for each receptive field.

find_neighborhood(X, y=None)

See FurthestPointSubsamplingPreProcessor and furthest_point_subsampling_pre_processor.FurthestPointSubsamplingPreProcessor.find_neighborhood().

overwrite_pretrained_model(spec)

See hierarchical_pre_processor.HierarchicalPreProcessor.overwrite_pretrained_model() method and receptive_field_pre_processor.ReceptiveFieldPreProcessor.overwrite_pretrained_model().