tests package

Submodules

tests.contextual_point_layer_test module

class tests.contextual_point_layer_test.ContextualPointLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Contextual point layer test that checks the operations of a contextual point layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run contextual point layer test.

Returns:

True if ContextualPointLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate(inputs, Dout, DH, cpl, cpl_out)

Check whether the ContextualPointLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • Dout – The output dimensionality.

  • DH – The dimensionality of the hidden feature space.

  • cpl (ContextualPointLayer) – The layer.

  • cpl_out – The output of the layer.

Returns:

True if the output is okay, False otherwise.

tests.dl_offline_sequencer_test module

class tests.dl_offline_sequencer_test.DLOfflineSequencerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Test to check that the DLOfflineSequencer works as expected.

class MockArchitecture(pre_runnable, fnames)

Bases: object

__init__(pre_runnable, fnames)
run_pre(inputs, **kwargs)
pre_processor_to_temporary_file()
pre_processor_from_temporary_file()
__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run DL offline sequencer test.

Returns:

True if the DL offline sequencer works as expectec for the test cases, False otherwise.

Return type:

bool

run_test_case1(nc, X, F, y)

Run the test case 1.

Parameters:
  • nc (int) – The number of classes in the dataset.

  • X (np.ndarray`) – The input structure space matrix representing the original input point cloud.

  • F (np.ndarray) – The input feature space matrix representing the original input point cloud.

  • y (np.ndarray) – The vector of reference classes.

Returns:

True if the test case ran successfully, False otherwise.

Return type:

bool

run_test_case2(nc, X, F, y)

Run the test case 2.

See DLOfflineSequencerTest.run_test_case1() for the documentation of the input arguments.

run_test_case3(nc, X, F, y)

Run the test case 3.

See DLOfflineSequencerTest.run_test_case1() for the documentation of the input arguments.

run_test_case4(nc, X, F, y)

Run the test case 4.

See DLOfflineSequencerTest.run_test_case1() for the documentation of the input arguments.

run_test_case5(nc, X, F, y)

Run the test case 5.

See DLOfflineSequencerTest.run_test_case1() for the documentation of the input arguments.

run_test_case6(nc, X, F, y)

Run the test case 6.

See DLOfflineSequencerTest.run_test_case1() for the documentation of the input arguments.

run_test_case7(nc, X, F, y)

Run the test case 7.

See DLOfflineSequencerTest.run_test_case1() for the documentation of the input arguments.

run_test_case8(nc, X, F, y)

Run the test case 8.

See DLOfflineSequencerTest.run_test_case1() for the documentation of the input arguments.

run_test_case9(nc, X, F, y)

Run the test case 9.

See DLOfflineSequencerTest.run_test_case1() for the documentation of the input arguments.

run_test_case10(nc, X, F, y)

Run the test case 10.

See DLOfflineSequencerTest.run_test_case1() for the documentation of the input arguments.

binarize_labels(y_rf, nc, to_array=True)

Binarize the labels in the receptive field, i.e., apply one-hot-encoding to the labels of each receptive field.

Parameters:
  • y_rf – The receptive field whose labels must be binarized.

  • nc (int) – The number of classes.

  • to_array (bool) – Whether to convert the labels of the receptive field to an array (True, default) or not (False).

Returns:

The one-hot-encoded receptive field-wise labels.

validate(offseq, osp)

Validate the given offline sequencer.

Parameters:
  • offseq (DLOfflineSequencer) – The offline sequencer to be validated.

  • osp (str) – The path to the offline storage file.

Returns:

True if the offline sequencer works as expected, False otherwise.

Return type:

bool

validate_many_point_clouds(offseq, osp, mh, offline_pcloud)

Alternative version of DLOfflineSequencerTest.validate() for the case where the DLOfflineSequencer has a list with extra point clouds (offline_pcloud).

Parameters:
  • mh (MockModelHandler) – The mock model handler.

  • offline_pcloud (list of PointCloud) – List with point clouds.

validate_outputs(off_batch_X, off_batch_y, bck_batch_X, bck_batch_y, osp)

Check whether the given outputs match. More concretely, the batches generated by the offline sequencer must match those generated by the backbone.

If the batches do not match, the offline storage file at the given offline storage path (path) will be removed from disk. Note it is a temporary file that only needs to exists in the context of the DLOfflineSequencerTest test.

Parameters:
  • off_batch_X – The batch of training data as generated by the offline sequencer.

  • off_batch_y – The batch of training references as generated by the offline sequencer.

  • bck_batch_X – The batch of training data as generated by the backbone.

  • bck_batch_y – The batch of training references as generated by the backbone.

  • osp – The path to the offline storage file.

Returns:

True if the outputs of the offline sequencer and the backbone match, False otherwise.

Return type:

bool

tests.dl_sparse_shadow_sequencer_test module

class tests.dl_sparse_shadow_sequencer_test.DLSparseShadowSequencerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Test to check that the DLSparseShadowSequencer works as expected.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run DL sparse shadow sequencer test.

Returns:

True if the DL sparse shadow sequencer works as expected for the test cases, False otherwise.

Return type:

bool

tests.downsampling_spconv3d_layer_test module

class tests.downsampling_spconv3d_layer_test.DownsamplingSpConv3DLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Downsampling 3D sparse convolution layer test that checks the operations of a DownsamplingSpConv3DLayer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run downsampling 3D sparse convolution layer test.

Returns:

True if DownsamplingSpConv3DLayer works as expected for the test cases, False otherwise.

Return type:

bool

tests.features_downsampling_layer_test module

class tests.features_downsampling_layer_test.FeaturesDownsamplingLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Features downsampling layer test that checks the operations of a features downsampling layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run features downsampling layer test.

Returns:

True if FeaturesDownsamplingLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate_mean_downsampling(inputs, nneighs, fdl_mean_out)

Check whether the mean-based downsampling layer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of encoding neighbors.

  • fdl_mean_out – The output generated by the layer.

Returns:

True if the output is okay, False otherwise.

validate_max_downsampling(inputs, nneighs, fdl_max_out)

Check whether the max-based downsampling layer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of encoding neighbors.

  • fdl_max_out – The output generated by the layer.

Returns:

True if the output is okay, False otherwise.

validate_gaussian_downsampling(inputs, nneighs, fdl_gauss_out)

Check whether the gaussian-based downsampling layer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of encoding neighbors.

  • fdl_gaussian_out – The output generated by the layer.

Returns:

True if the output is okay, False otherwise.

validate_exponential_downsampling(inputs, nneighs, fdl_exp_out)

Check whether the exponential-based downsampling layer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of encoding neighbors.

  • fdl_exp_out – The output generated by the layer.

Returns:

True if the output is okay, False otherwise.

validate_nearest_downsampling(inputs, nneighs, fdl_nearest_out)

Check whether the nearest neighbor downsampling layer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of encoding neighbors (IGNORED).

  • fdl_nearest_out – The output generated by the layer.

Returns:

True if the output is okay, False otherwise.

tests.features_structuring_layer_test module

class tests.features_structuring_layer_test.FeaturesStructuringLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Features structuring layer test that checks the operations of a features structuring layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run features structuring layer test.

Returns:

True if FeaturesStructuringLayer works as expected for the test cases, False otherwise.

Return type:

bool

compute_expected_output(X, F, omegaF, omegaD, QX, QW, m, nf, K)

Compute the expected output to compare it against what is generated by the features structuring layer.

Returns:

The expected output.

Return type:

np.ndarray

tf_compute_output(X, F, omegaF, omegaD, QX, QW)

The tensorflow operations defining the layer but outside the layer.

Returns:

The structured features.

validate_output(fsl, expected)

Check whether the feature structuring layer yields the expected results or not.

Returns:

True if the FSL output is not different in more than a given decimal tolerance (eps) wrt the expected output.

tests.features_upsampling_layer_test module

class tests.features_upsampling_layer_test.FeaturesUpsamplingLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Features upsampling layer test that checks the operations of a features upsampling layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run features upsampling layer test.

Returns:

True if FeaturesUpsamplingLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate_mean_upsampling(inputs, nneighs, ful_mean_out)

Check whether the mean-based upsampling layer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of encoding neighbors.

  • ful_mean_out – The output generated by the layer.

Returns:

True if the output is okay, False otherwise.

validate_max_upsampling(inputs, nneighs, ful_max_out)

Check whether the max-based upsampling layer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of encoding neighbors.

  • ful_max_out – The output generated by the layer.

Returns:

True if the output is okay, False otherwise.

validate_gaussian_upsampling(inputs, nneighs, ful_gauss_out)

Check whether the gaussian-based upsampling layer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of encoding neighbors.

  • ful_gaussian_out – The output generated by the layer.

Returns:

True if the output is okay, False otherwise.

validate_exponential_upsampling(inputs, nneighs, ful_exp_out)

Check whether the exponential-based upsampling layer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of encoding neighbors.

  • ful_exp_out – The output generated by the layer.

Returns:

True if the output is okay, False otherwise.

validate_nearest_upsampling(inputs, nneighs, ful_nearest_out)

Check whether the nearest neighbor upsampling layer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of encoding neighbors (IGNORED).

  • ful_nearest_out – The output generated by the layer.

Returns:

True if the output is okay, False otherwise.

tests.fps_decorator_test module

class tests.fps_decorator_test.FPSDecoratorTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

FPS decorator test that checks the FPS representation of point clouds is correctly computed.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run FPS decorator test.

Returns:

True if the FPS decorator works as expected for the test cases, False otherwise.

Return type:

bool

static validate_transformer(fpsdt, X, F, ErepF, EproF)

Check whether the given FPSDecoratorTransformer yields the expected output.

Parameters:
  • fpsdt (FPSDecoratorTransformer) – The FPSDecoratorTransformer to be validated.

  • X (np.ndarray) – The input structure space matrix (i.e., matrix of point-wise coordinates).

  • F (np.ndarray) – The input feature space matrix (i.e., matrix of point-wise features).

  • ErepF (np.ndarray) – The expected features in the FPS representation space.

  • EproF (np.ndarray) – The expected features after propagating the features in the representation space back to the original space.

Returns:

True if the FPSDecoratorTransformer yielded the expected output, False otherwise.

Return type:

bool

tests.fps_pre_processing_test module

class tests.fps_pre_processing_test.FPSPreProcessingTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

FPS pre-processing test that checks the FPS-based preprocessing of a point cloud is correct, especially regarding feature and label encoding.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run FPS pre-processing test.

Returns:

True if the FPS pre-processor works as expected for the test cases, False otherwise.

Rtype bool:

testFPSPreProc(X, F, y, neighborhood, fps_pre_proc, unit_sphere=False)

Check whether the given FPS pre-processor is correct.

Parameters:
  • X (np.ndarray) – The test structure space.

  • y (np.ndarray) – The test labels.

  • neighborhood (dict) – The neighborhood specification.

  • fps_pre_proc (dict) – The FPS pre-processor specification.

  • unit_sphere (bool) – Flag governing whether the structure space of the receptive fields must be checked to fit a unit sphere (True) or not (False).

tests.freeze_training_test module

class tests.freeze_training_test.FreezeTrainingTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Freeze training test that checks freeze training specifications are correctly handled.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run freeze training test.

Returns:

True if the freeze training specification are handled as expected, False otherwise.

Return type:

bool

check_test_case1()

Check that freeze training works as expected for a test case.

Returns:

True if the test case is passed, False otherwise.

Return type:

bool

check_test_case2()

See FreezeTrainingTest.check_test_case1().

check_test_case3()

See FreezeTrainingTest.check_test_case1().

check_test_case4()

See FreezeTrainingTest.check_test_case1().

check_test_case5()

See FreezeTrainingTest.check_test_case1().

check_test_case6()

See FreezeTrainingTest.check_test_case1().

check_test_case7()

See FreezeTrainingTest.check_test_case1().

static build_mock_model_handler(training_epochs)

Build a mock model handler to test the freeze training preparation logic.

Returns:

A named tuple providing a mock model handler with the attributes needed by the freeze training preparation method, i.e., the number of epochs.

Return type:

namedtuple

static validate(epochs, ops, lrs, expected_epochs, expected_ops, expected_lrs)

Validate that the given results match the expected ones.

Parameters:
  • epochs – Extracted epochs for freeze training.

  • ops – Extracted operations for freeze training.

  • lrs – Extracted initial learning rates for freeze training.

  • expected_epochs – Expected epochs for freeze training.

  • expected_ops – Expected operations for freeze training.

  • expected_lrs – Expected learning rates for freeze training.

Returns:

True if the given results match the expected ones, False otherwise.

Return type:

bool

static validate_random(epochs, ops, lrs, expected_epochs, expected_ops, expected_lrs)

Adapted FreezeTrainingTest.validate() for the case of random strategy.

tests.geometric_affine_layer_test module

class tests.geometric_affine_layer_test.GeometricAffineLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Geometric affine layer test that checks the operations of a geometric affine layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run geometric affine layer test.

Returns:

True if GeometricAffineLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate(inputs, gal, gal_out)

Check whether the GeometricAffineLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • gal (GeometricAffineLayer) – The layer.

  • gal_out – The output of the layer.

Returns:

True if the output is okay, False otherwise.

tests.grouped_point_transformer_layer_test module

class tests.grouped_point_transformer_layer_test.GroupedPointTransformerLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Grouped point transformer layer test that checks the operations of a grouped point transformer layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run grouped point transformer layer test.

Returns:

True if PointTraansformerLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate(inputs, groups, gptl, gptl_out)

Check whether the GroupedPointTransformerLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • groups – The groups for the vector-based grouped attention transformer.

  • gptl (GroupedPointTransformerLayer.) – The layer.

  • gptl_out – The output of the layer.

Returns:

True if the output is okay, False otherwise.

tests.grouping_point_net_layer_test module

class tests.grouping_point_net_layer_test.GroupingPointNetLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Grouping PointNet layer test that checks the operations of a grouping PointNet layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run grouping PointNet layer test.

Returns:

True if GroupingPointNetLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate_no_activation(inputs, nneighs, Dout, gpnl, gpnl_out)

Check whether the no-activated GroupingPointNetLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of neighbors per group.

  • Dout – The output dimensionality.

  • gpnl (GroupingPointNetLayer) – The layer.

  • gpnl_out – The output of the layer.

Returns:

True if the output is okay, False otherwise.

tests.hierarchical_receptive_field_test module

class tests.hierarchical_receptive_field_test.HierarchicalReceptiveFieldTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Hierarchical receptive field test that checks the receptive field at each depth of the hierarchy.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run receptive field test.

Returns:

True if ReceptiveField works as expected for the test cases, False otherwise.

Return type:

bool

tests.hourglass_layer_test module

class tests.hourglass_layer_test.HourglassLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris PEna

Hourglass layer test that checks the operations of a Hourglass layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run Hourglass layer test.

Returns:

True if HourglassLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate_hourglass(F, mid_features, out_features, hl, hl_out)

Check whether the HourglassLayer yielded the expected output (True) or not (False). It also checks that the regularization computation is correct.

Parameters:
  • f – The inputs to the layer.

  • mid_features – The number of features in the internal representation.

  • out_features – The number of output features.

  • hl (HourglassLayer) – The layer

  • hl_out – The output of the layer.

Returns:

True if the output is okay, False otherwise.

tests.hsv_from_rgb_test module

class tests.hsv_from_rgb_test.HSVFromRGBTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

HSV from RGB test that checks the HSV color representation is correctly derived from given RGB color components.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run HSV from RGB test.

Returns:

True if HSVFromRGB works as expected for the test cases, False otherwise.

Return type:

bool

tests.interdimensional_point_transformer_layer_test module

class tests.interdimensional_point_transformer_layer_test.InterdimensionalPointTransformerLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Interdimensional point transformer layer test that checks the operations of an interdimensional point transfomer layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run interdimensional point transformer layer test.

Returns:

True if InterdimensionalPointTransformerLayerTest works as expected for the test cases, False otherwise.

Return type:

bool

validate(inputs, Dout, ptl, ptl_out)

Check whether the PointTransformerLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • Dout – The output dimensionality.

  • ptl (PointTransformerLayer.) – The layer.

  • ptl_out – The output of the layer.

Returns:

True if the output is okay, False otherwise.

tests.keras_test module

class tests.keras_test.KerasTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Keras test that checks TensorFlow can be used and there is an accessible GPU.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run Keras test.

Returns:

True if Keras can be used in GPU mode with TensorFlow background, False otherwise.

Return type:

bool

tests.kpconv_layer_test module

class tests.kpconv_layer_test.KPConvLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Kernel point convolution (KPConv) layer test that checks the operations of a KPConv layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run KPConv layer test.

Returns:

True if KPConvLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate_no_activation(inputs, nneighs, Dout, kpcl, kpcl_out)

Check whether the KPConvLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of neighbors per group.

  • Dout – The output dimensionality.

  • kpcl (KPConvLayer) – The layer.

  • kpcl_out – The output of the layer.

Returns:

True if the output is okay, False otherwise.

tests.kpconvx_layer_test module

class tests.kpconvx_layer_test.KPConvXLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Kernel point convolution with attention (KPConvX) layer test that checks the operations of a KPConvX layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run KPConvX layer test.

Returns:

True if KPConvXLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate(inputs, kpcxl, kpcxl_out)

Check whether the KPConvXLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • kpcxl – The layer.

  • kpcxl_out – The output of the layer.

Class kpcxl:

KPConvXLayer

Returns:

True if the output is okay, False otherwise.

tests.las_inout_test module

class tests.las_inout_test.LASInoutTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

LAS input/output test that checks that a LAS (or LAZ) file can be written and read such that the read information matches the one before writing.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run LAS/LAZ input/output test.

Returns:

True if LASInoutTest works as expected for the test cases, False otherwise.

Return type:

bool

tests.light_kpconv_layer_test module

class tests.light_kpconv_layer_test.LightKPConvLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Light kernel point convolution (LightKPConv) layer test that checks the operations of a light KPConv layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run light KPConv layer test.

Returns:

True if LightKPConvLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate_no_activation(inputs, nneighs, Dout, lkpcl, lkpcl_out)

Check whether the LightKPConvLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of neighbors per group.

  • Dout – The output dimensionality.

  • lkpcl (LightKPConvLayer) – The layer.

  • lkpcl_out – The output of the layer.

Returns:

True if the output is okay, False otherwise.

tests.min_dist_decimator_test module

class tests.min_dist_decimator_test.MinDistDecimatorTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Minimum distance decimator test that checks the minimum distance decimated representation of point clouds is correctly computed.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run minimum distance decimator test.

Returns:

True if the minimum distance decimator works as expected for the test cases, False otherwise.

Return type:

bool

static validate_decimator(mdd, min_distance, X, F, y, eF, ey)

Check whether the given MinDistDecimatorDecorator yields the expected output.

Parameters:
  • mdd (MinDistDecimatorDecorator) – The MinDistDecimatorDecorator to be validated.

  • min_distance (float) – The minimum distance parameter.

  • X (np.ndarray) – The input structure space matrix (i.e., matrix of point-wise coordinates).

  • F (np.ndarray) – The feature space matrix (i.e., matrix of point-wise features).

  • y (np.ndarray) – The input vector of point-wise classes.

  • eF (np.ndarray) – The expected feature space after decimation.

  • ey (np.ndarray) – The expected point-wise classes after decimation.

Returns:

True if the MinDistDecimatorDecorator yielded the expected output, False otherwise.

Return type:

bool

tests.model_serialization_test module

class tests.model_serialization_test.ModelSerializationTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Serialization test that checks the serialization (and deserialization) of models.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run model serialization test.

Returns:

True if model serialization works as expected for the test cases, False otherwise.

Rtype bool:

test_random_forest_classifier()

Test the serialization of the random forest classification model.

See RandomForestClassificationModel.

Returns:

True if model serialization works as expected, False otherwise.

test_point_net_pwise_classifier()

Test the serialization of the PointNet point-wise classification model.

See PointNetPwiseClassifModel.

Returns:

True if model serialization works as expected, False otherwise.

test_rbf_net_pwise_classifier()

Test the serialization of the RBFNet point-wise classification model.

See RBFNetPwiseClassificationModel.

Returns:

True if model serialization works as expected, False otherwise.

test_point_netpp_pwise_classifier()

Test the serialization of the PointNet++ point-wise classification model.

See ConvAutoencPwiseClassifModel.

Returns:

True if model serialization works as expected, False otherwise.

test_kpconv_pwise_classifier()

Test the serialization of the Kernel Point Convolutiona point-wise classification model.

See ConvAutoencPwiseClassifModel.

Returns:

True if model serialization works as expected, False otherwise.

test_light_kpconv_pwise_classifier()

Test the serialization of the Light Kernel Point Convolutional point-wise classification model.

See ConvAutoencPwiseClassifModel.

Returns:

True if model serialization works as expected, False otherwise.

test_sflnet_pwise_classifier()

Test the serialization of the Slight Filter Network point-wise classification model.

See ConvAutoencPwiseClassifModel.

Returns:

True if model serialization works as expected, False otherwise.

test_pttransf_pwise_classifier()

Test the serialization of the PointTransformer point-wise classification model.

See ConvAutoencPwiseClassifModel.

Returns:

True if model serialization works as expected, False otherwise.

test_gpttransf_pwise_classifier()

Test the serialization of the GroupedPointTransformer point-wise classification model.

See ConvAutoencPwiseClassifModel.

Returns:

True if model serialization works as expected, False otherwise.

test_spconv_pwise_classifier()

Test the serialization of the Sparse Convolutional point-wise classification model.

See ConvAutoencPwiseClassifModel.

Returns:

True if model serialization works as expected, False otherwise.

validate_deserialized_model(original, deserial, original_y=None, deserial_y=None)

Check that the attributes of the deserialized model (deserial) match those of the model before the serialization.

Parameters:
  • original – The original model, i.e., before serialization.

  • deserial – The deserialized model.

Returns:

True if the deserialized model is valid, False otherwise.

static model_weights_validation(oriobj, desobj)

Recursively compare given objects in an attribute-wise way.

Parameters:
  • oriobj (object) – The original object.

  • desobj (object) – The deserialized object.

Returns:

True if the objects match (i.e., are equal), false otherwise.

static model_output_validation(original_y, deserial_y)

Determine whether the outputs are equal or not.

Parameters:
  • original_y (np.ndarray) – The output (predictions) of the original model.

  • deserial_y (np.ndarray) – The output (predictions) of the deserialized model.

Returns:

True if the outputs are valid (equal), False otherwise.

Return type:

bool

tests.point_mlp_layer_test module

class tests.point_mlp_layer_test.PointMLPLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Point NLP layer test that checks the operations of a Point MLP alyer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run Point MLP layer test.

Returns:

True if PointMLPLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate(inputs, pml, pml_out)

Check whether the PointMLPLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • pml (PointMLPLayer) – The layer.

  • pml_out – The output of the layer.

Returns:

True if the output is okay, False otherwise.

tests.point_transformer_layer_test module

class tests.point_transformer_layer_test.PointTransformerLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Point transformer layer test that checks the operations of a point transformer layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run point transformer layer test.

Returns:

True if PointTransformerLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate(inputs, Dout, ptl, ptl_out)

Check whether the PointTransformerLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • Dout – The output dimensionality.

  • ptl (PointTransformerLayer.) – The layer.

  • ptl_out – The output of the layer.

Returns:

True if the output is okay, False otherwise.

tests.prediction_reducer_test module

class tests.prediction_reducer_test.PredictionReducerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Prediction reducer test that checks the different strategies work correctly.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run prediction reducer test

Returns:

True if PredictionReducer works as expected for the test cases, False otherwise.

Return type:

bool

check_pr(pr, num_points, num_vals, Z, I, Z_ref, Y_ref)

Check that the prediction reducer yields the expected output.

Parameters:
  • pr – The prediction reducer itself.

  • num_points – The number of output points.

  • num_vals – The number of point-wise variables.

  • Z – The input values.

  • I – The input neighborhoods.

  • Z_ref – The expected reduced values.

  • Y_ref – The expected selected values.

Returns:

True if the output is as expected, False otherwise.

tests.ragged_losses_test module

class tests.ragged_losses_test.RaggedLossesTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Ragged losses test that checks the operations of loss functions work with ragged tensors and yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run ragged losses test.

Returns:

True if ragged losses work as expected for the test cases, False otherwise.

Return type:

bool

static test_classification_losses(eps)
static test_ragged_classification_losses(eps)

tests.rbf_feat_extract_layer_test module

class tests.rbf_feat_extract_layer_test.RBFFeatExtractLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Radial basis function feature extraction layer test checks that the operations of a radial basis function feature extraction layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run RBF feature extraction layer test.

Returns:

True if RBFFeatExtractLayer works as expected for the test cases, False otherwise.

Return type:

bool

compute_expected_output(X, Q, omega)

Compute the expected output to compare it against what is generated by the RBF feature extraction layer.

Parameters:
  • X – The input.

  • Q – The kernel’s structure.

  • omega – The kernel’s sizes.

Returns:

The expected output.

Return type:

np.ndarray

validate_output(rfel, expected)

Check whether the RBF feature extraction layer yields the expected results or not.

Returns:

True if the RBFEL output is not different in more than a given decimal tolerance (eps) wrt the expected output.

tests.rbf_feat_processing_layer_test module

class tests.rbf_feat_processing_layer_test.RBFFeatProcessingLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Radial basis function feature processing layer test checks that the operations of a radial basis function feature processing layer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run RBF feature processing test.

Returns:

True if RBFFeatProcessingLayer works as expected for the test cases, False otherwise.

Return type:

bool

compute_expected_output(F, M, Omega)

Compute the expected output to compare it against what is generated by the RBF feature processing layer.

Parameters:
  • F – The input.

  • M – The kernel’s centers.

  • Omega – The kernel’s sizes.

Returns:

The expected output.

Return type:

np.ndarray

validate_output(rfpl, expected)

Check whether the RBF feature processing layer yields the expected results or not.

Returns:

TRUE if the RBFPL output is not different in more than a given decimal tolerance (eps) wrt the expected output.

tests.receptive_field_test module

class tests.receptive_field_test.ReceptiveFieldTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Receptive field test that checks the indexing matrix, the centroids, and the propagation work as expected for some use cases.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run receptive field test.

Returns:

True if ReceptiveField works as expected for the test cases, False otherwise.

Return type:

bool

test_grid_receptive_fields()

Run grid receptive field tests.

Returns:

True if RepcetiveFieldGS works as expected for the test cases, False otherwise.

Return type:

bool

test_fps_receptive_fields()

Run FPS receptive field tests.

Returns:

True if ReceptiveFieldFPS works as expected for the test cases, False otherwise.

static test_grid_receptive_field(bounding_radii, cell_size, center_point, input_points, values_to_propagate, expected_num_cells, expected_centroid_nointerp, expected_centroid_interp, expected_propagated_values, eps=1e-06)

Build a grid receptive field with the input points and propagate the given values. Then, the results are compared with the expected outputs to validate the implementation.

Parameters:
  • bounding_radii – The bounding radii to build the receptive field.

  • cell_size (np.ndarray) – The cell size to build the receptive field.

  • center_point (np.ndarray) – The center point for the receptive field.

  • input_points – The input points to build the receptive field.

  • values_to_propagate (np.ndarray) – The values to propagate through the receptive field.

  • expected_num_cells (int) – The expected number of cells composing the receptive field.

  • expected_centroid_nointerp (np.ndarray) – The expected centroids (without interpolation).

  • expected_centroid_interp (np.ndarray) – The expected centroids (with interpolation).

  • expected_propagated_values (np.ndarray) – The expected propagated values.

  • eps (float) – The decimal tolerance for numerical validation.

Returns:

True if the receptive field behaves as expected, False otherwise.

static test_fps_receptive_field(X, F, y, rfArgs, eps)

Build a FPS receptive field with the input points and check that the features and labels are encoded as expected.

Parameters:
  • X (np.ndarray) – The structure space for the test.

  • F (np.ndarray) – The feature space for the test.

  • y (np.ndarray) – The point-wise labels for the test.

  • rfArgs (dict) – The key-word arguments to build the FPS receptive field. See ReceptiveFieldFPS.

  • eps (float) – The decimal tolerance threshold.

tests.shadow_activation_layer_test module

class tests.shadow_activation_layer_test.ShadowActivationLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Shadow activation layer test that checks the operations of a ShadowActivationLayer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run shadow activation layer test.

Returns:

True if ShadowActivationLayer works as expected for the test cases, False otherwise.

Return type:

bool

tests.shadow_batch_normalization_layer_test module

class tests.shadow_batch_normalization_layer_test.ShadowBatchNormalizationLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Shadow batch normalization layer test that checks the operations of a ShadowBatchNormalizationLayer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run shadow batch normalization layer test.

Returns:

True if ShadowBatchNormalizationLayer works as expected for the test cases, False otherwise.

Return type:

bool

tests.shadow_conv1d_layer_test module

class tests.shadow_conv1d_layer_test.ShadowConv1DLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Shadow Conv1D layer test that checks the operations of a ShadowConv1DLayer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run shadow 1-dimensional convolution layer test.

Returns:

True if ShadowConv1DLayer works as expected for the test cases, False otherwise.

Return type:

bool

static validate(filters, kernel_size, spec, X, rag_X, rag_X_nopad, start, eps)

tests.shadow_dense_layer_test module

class tests.shadow_dense_layer_test.ShadowDenseLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Shadow dense layer test that checks the operations of a ShadowDenseLayer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run shadow dense layer test.

Returns:

True if ShadowDenseLayer works as expected for the test cases, False otherwise.

Return type:

bool

tests.simple_smoother_decorator_test module

class tests.simple_smoother_decorator_test.SimpleSmootherDecoratorTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Simple smoother decorator test that checks the simple smooth representation

of a point cloud’s structure space is correctly computed.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run simple smoother decorator test.

Returns:

True if the simple smoother decorator works as expected for the test cases, False otherwise.

Return type:

bool

tests.spconv3d_arch_test module

class tests.spconv3d_arch_test.SpConv3DArchTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Test to check that the sparse 3D convolutional neural network architecture (e.g., SpConv3DPwiseClassif) works as expected. The main focus of this test is to compare that the layer-by-layer approach (which is typically slower) yields the same result as its corresponding encoder/decoder layers approach (which is typically faster).

MAX_DEPTH = 3
__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run the sparse 3D convolutional neural network architecture test.

Returns:

True if the sparse 3D convolutional neural network architecture works as expected, False otherwise.

Return type:

bool

synchronize_models(ma: SpConv3DPwiseClassif, mb: SpConv3DPwiseClassif)

Synchronize the given models so model b has the same weights than model b.

Parameters:
Returns:

Nothing at all, but the model b is updated in place.

replica_test(ma, mb, X, F)

tests.spconv3d_decoding_layer_test module

class tests.spconv3d_decoding_layer_test.SpConv3DDecodingLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Sparse convolutional 3D decoding layer test that checks the operations of a SpConv3DDecodingLayer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run sparse convolutional 3D decoding layer test.

Returns:

True if SpConv3DDecodingLayer works as expected for the test cases, False otherwise.

Return type:

bool

compute_encoding(x, hk, hD, n, start, start_next, siml, hp)

Compute a sparse convolutional 3D encoder layer that will be later decoded to validate the SpConv3DDecodingLayer.

Parameters:
  • x (tf.Tensor) – Input for the model.

  • hk (np.ndarray or tf.Tensor) – The keys of active cells.

  • hD (np.ndarray or tf.Tensor) – The keys of active cells involved in the downsampling convolution.

  • n (np.ndarray) – The number of partitions along each axis.

  • start (np.ndarray or tf.Tensor) – The start row-indices for each element in the input batch.

  • start_next (np.ndarray or tf.Tensor) – The start row-indices for each element in the input batch at the next depht.

  • siml (SparseIndexingMapLayer) – The sparse indexing map layer to build the SubmanifoldSpConv3DLayer layers.

  • hp (dict) – The hyperparameters governing the encoder.

Returns:

The result of the sparse convolutional 3D encoder, and the skip link for the corresponding decoder.

Return type:

tuple of tf.Tensor

compute_layer_by_layer_decoder(x, skip_link, hk, hU, n, start, start_prev, siml, hp)

Compute a sparse convolutional 3D decoder with many layers to validate the single-layer approach against it.

Parameters:
  • x (tf.Tensor) – Input for the model.

  • skip_link (tf.Tensor) – The skip link for the model.

  • hk (np.ndarray or tf.Tensor) – The keys of active cells.

  • hU (np.ndarray or tf.Tensor) – The keys of active upsampling cells.

  • n (np.ndarray) – The number of partitions along each axis.

  • start (np.ndarray or tf.Tensor) – The start row-indices for each element in the input batch.

  • start_prev (np.ndarray or tf.Tensor) – The start row-indicex for each element in the input batch at the previous depth.

  • siml (SparseIndexingMapLayer) – The sparse indexing map layer to handle the lookup of indices involved in convolutions.

  • hp (dict) – The hyperparameters governing te decoder.

Returns:

The result of the sparse convolutional 3D decoder, represented by the final tensor after all the computations. Also, the dictionary with all the involved layers.

Return type:

tuple of tf.Tensor and dict

compute_spconv3d_decoding_layer(x, skip_link, hk, hU, n, start, start_prev, siml, hp, layers)

Compute a sparse convolutional 3D decoder layer that will be later validated against a layer-by-layer approach.

Parameters:
  • x (tf.Tensor) – Input for the model.

  • skip_link (tf.Tensor) – The skip link for the model.

  • hk (np.ndarray or tf.Tensor) – The keys of active cells.

  • hU (np.ndarray or tf.Tensor) – The keys of active cells involved in the upsampling convolution.

  • n (np.ndarray) – The number of partitions along each axis.

  • start (np.ndarray or tf.Tensor) – The start row-indices for each element in the input batch.

  • start_prev (np.ndarray or tf.Tensor) – The start row-indices for each element in the input batch at the next depth.

  • siml (SparseIndexingMapLayer) – The sparse indexing map layer to build the SubmanifoldSpConv3DLayer and UpsamplingSpConv3DLayer layers.

  • hp (dict) – The hyperparameters governing the decoder.

  • layers (dict) – The layers of the layer-by-layer approach. They are necessary to synchronize the stochastic initialization of both approaches so the single-layer approach can be validated correctly.

Returns:

The result of the sparse convolutional 3D decoder, represented by the final tensor after all the computations.

Return type:

tuple of tf.Tensor

tests.spconv3d_encoding_layer_test module

class tests.spconv3d_encoding_layer_test.SpConv3DEncodingLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Sparse convolutional 3D encoding layer test that checks the operations of a SpConv3DEncodingLayer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run sparse convolutional 3D encoding layer test.

Returns:

True if SpConv3DEncodingLayer works as expected for the test cases, False otherwise.

Return type:

bool

compute_layer_by_layer_encoder(x, hk, hD, n, start, start_next, siml, hp)

Compute a sparse convolutional 3D encoder with many layers to validate the single-layer approach against it.

Parameters:
  • x (tf.Tensor) – Input for the model.

  • hk (np.ndarray or tf.Tensor) – The keys of active cells.

  • hDk (np.ndarray or tf.Tensor) – The keys of active cells involved in the downsampling convolution.

  • n (np.ndarray) – The number of partitions along each axis.

  • start (np.ndarray or tf.Tensor) – The start row-indices for each element in the input batch.

  • start_next (np.ndarray or tf.Tensor) – The start row-indices for each element in the input batch at the next depth.

  • siml (SparseIndexingMapLayer) – The sparse indexing map layer to build the SubmanifoldSpConv3DLayer layers.

  • hp (dict) – The hyperparameters governing the encoder.

Returns:

The result of the sparse convolutional 3D encoder, represented by the final tensor after all the computations. Also, the dictionary with all the involved layers.

Return type:

tuple of tf.Tensor and dict

compute_spconv3d_encoding_layer(x, hk, hD, n, start, start_next, siml, hp, layers)

Compute a sparse convolutional 3D encoder layer that will be later validated against a layer-by-layer approach.

Parameters:
  • x (tf.Tensor) – Input for the model.

  • hk (np.ndarray or tf.Tensor) – The keys of active cells.

  • hDk (np.ndarray or tf.Tensor) – The keys of active cells involved in the downsampling convolution.

  • n (np.ndarray) – The number of partitions along each axis.

  • start (np.ndarray or tf.Tensor) – The start row-indices for each element in the input batch.

  • start_next (np.ndarray or tf.Tensor) – The start row-indices for each element in the input batch at the next depth.

  • siml (SparseIndexingMapLayer) – The sparse indexing map layer to build the SubmanifoldSpConv3DLayer and DownsamplingSpConv3DLayer layers.

  • hp (dict) – The hyperparameters governing the encoder.

  • layers (dict) – The layers of the layer-by-layer approach. They are necessary to synchronize the stochastic initialization of both approaches so the single-layer approach can be validated correctly.

Returns:

The result of the sparse convolutional 3D encoder, represented by the final tensor after all the computations.

Return type:

tuple of tf.Tensor

tests.strided_kpconv_layer_test module

class tests.strided_kpconv_layer_test.StridedKPConvLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris PEna

Strided kernel point convolution (Strided KPConv) layer test that checks the operation of a strided KPConv layer yields the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run Strided KPConv layer test.

Returns:

True if StridedKPConvLayer works as expected for the test cases, False otherwise.

Return type:

bool

validate_no_activation(inputs, nneighs, Dout, skpcl, skpcl_out)

Check whether the StridedKPConvLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of neighbors per group.

  • Dout – The output dimensionality.

  • skpcl (StridedKPConvLayer) – The layer.

  • skpcl_out – The output of the layer.

Returns:

True if the output is okay, False otherwise

Return type:

bool

tests.strided_light_kpconv_layer_test module

class tests.strided_light_kpconv_layer_test.StridedLightKPConvLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Strided light kernel point convolution (Strided Light KPConv) layer test that checks the operation of a strided light KPConv yields the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run Strided Light KPConv layer test.

Returns:

True if StridedLightKPConvLayer works as expected for the test cases, False otherwise.

Rtype bool:

validate_no_activation(inputs, nneighs, Dout, slkpcl, slkpcl_out)

Check whether the StridedLightKPConvLayer yielded the expected output (True) or not (False).

Parameters:
  • inputs – The inputs to the layer.

  • nneighs – The number of neighbors per group.

  • Dout – The output dimensionality.

  • slkpcl (StridedLightKPConvLayer) – The layer.

  • slkpcl_out – The output of the layer.

Returns:

True if the output is okay, False otherwise

Return type:

bool

tests.submanifold_spconv3d_layer_test module

class tests.submanifold_spconv3d_layer_test.SubmanifoldSpConv3DLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Submanifold 3D sparse convolution layer test that checks the operations of a SubmanifoldSpConv3DLayer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run submanifold 3D sparse convolution layer test.

Returns:

True if SubmanifoldSpConv3DLayer works as expected for the test cases, False otherwise.

Return type:

bool

tests.upsampling_spconv3d_layer_test module

class tests.upsampling_spconv3d_layer_test.UpsamplingSpConv3DLayerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Upsampling 3D sparse convolution layer test that checks the operations of a UpsamplingSpConv3DLayer yield the expected results.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run upsampling 3D sparse convolution layer test.

Returns:

True if UpsamplingSpConv3DLayer works as expected for the test cases, False otherwise.

Return type:

bool

tests.vl3d_test module

exception tests.vl3d_test.VL3DTestException(message='')

Bases: VL3DException

Author:

Alberto M. Esmoris Pena

Class for exceptions related to tests. See VL3DException.

__init__(message='')
class tests.vl3d_test.VL3DTest(name='VL3D test')

Bases: object

Author:

Alberto M. Esmoris Pena

Base implementation for any VL3D test. It must be extended by classes aiming to provide runnable tests. Each derived class must overload the run method to implement the test’s logic.

Variables:

name (str) – The name of the test.

__init__(name='VL3D test')

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run the test.

Returns:

True if test is successfully passed, False otherwise.

Return type:

bool

start()

Run the test and report its final status.

Returns:

True when the test has been passed, Fase otherwise.

Return type:

bool

tests.vl3dpp_backend_test module

class tests.vl3dpp_backend_test.VL3DPPBackendTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

C++ backend test.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ backend test.

Returns:

True if C++ backend is working, False otherwise.

Return type:

bool

tests.vl3dpp_binding_test module

class tests.vl3dpp_binding_test.VL3DPPBindingTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

C++ link test.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ link test.

Returns:

True if C++ binding is working, False otherwise.

Return type:

bool

tests.vl3dpp_dl_fps_pre_proc_test module

class tests.vl3dpp_dl_fps_pre_proc_test.VL3DPPDLFPSPreProcTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Deep learning pre-processor test that checks the C++ implementation of the FPS pre-processors for deep learning models.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ deep learning FPS pre-processors test.

Returns:

True if the C++ pre-processors work as expected for the test cases, False otherwise.

Return type:

bool

testDLPreProc(dlpre, dlprepp, inputs, eps=None)

Check that the C++ deep learning pre-processor works as the python reference pre-processor.

Parameters:
  • dlpre – The object representing the Python-side pre-processor.

  • dlprepp – The object representing the C++-side pre-processor.

  • inputs (dict) – The inputs for the pre-processor.

  • eps (float or None) – The decimal tolerance threshold. If not given, it will be taken from self.eps. It must be given as self.unit_eps when doing tests on receptive fields transformed to the unit sphere.

Returns:

True if the C++ pre-processor matches the results of the Python pre-processor, False otherwise.

Return type:

bool

tests.vl3dpp_dl_hierarchical_fps_pre_proc_test module

class tests.vl3dpp_dl_hierarchical_fps_pre_proc_test.VL3DPPDLHierarchicalFPSPreProcTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Deep learning pre-processor test that checks the C++ implementation of the hierarchical FPS pre-processors for deep learning models.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ deep learning hierarchical FPS pre-processors test.

Returns:

True if the C++ pre-processors work as expected for the test cases, False otherwise.

Return type:

bool

testDLPreProc(dlpre, dlprepp, inputs, eps=None)

Check that the C++ deep learning pre-processor works as the python reference pre-processor.

Parameters:
  • dlpre – The object representing the Python-side pre-processor.

  • dlprepp – The object representing the C++-side pre-processor.

  • inputs (dict) – The inputs for the pre-processor.

  • eps (float or None) – The decimal tolerance threshold. If not given, it will be taken from self.eps. It must be given as self.unit_eps when doing tests on receptive fields transformed to the unit sphere.

Returns:

True if the C++ pre-processor matches the results of the Python pre-processor, False otherwise.

Return type:

bool

tests.vl3dpp_dl_hierarchical_sg_post_proc_test module

class tests.vl3dpp_dl_hierarchical_sg_post_proc_test.VL3DPPDLHierarchicalSGPostProcTest

Bases: VL3DTest

Author:

Alberto M. Esmrois Pena

Deep learning post-processor test that checks the C++ implementation of the hierarchical sparse-grid post-processing logic for deep learning models.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ deep learning hierarchical post-processors test.

Returns:

True if the C++ hierarchical sparse grid post-processor works as expected, False otherwise.

Return type:

bool

static z_from_y(y, ny)

Generate probabilities from labels.

Parameters:
  • y – The labels from which the probabilities must be derived.

  • ny – The number of different classes.

Returns:

The matrix of probabilities for each receptive field.

Return type:

list of np.ndarray

static testSparseDLPostProc(hsgpre, inputspre, X, y, ny)

Check whether the HierarchicalSGPostProcessorPP yields the expected output or not.

Parameters:
  • hsgpre – The HierarchicalSGPreProcessorPP associated to the HierarchicalSGPostProcessorPP.

  • inputspre – The input dictionary for the pre-processor.

  • X – The structure space representing the original input point cloud.

  • y – The point-wise labels for the original input point cloud.

  • ny – The number of classes.

Returns:

True if the test is passed, False otherwise.

Return type:

bool

tests.vl3dpp_dl_hierarchical_sg_pre_proc_test module

class tests.vl3dpp_dl_hierarchical_sg_pre_proc_test.VL3DPPDLHierarchicalSGPreProcTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Deep learning pre-processor test that checks the C++ implementation of the hierarchical sparse grid (SG) pre-processors for deep learning models.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ deep learning hierarchical SG pre-processors test.

Returns:

True if the C++ pre-processors work as expected for the test cases, False otherwise.

Return type:

bool

validateHSGPreProc(hsgpre, hsgpre_ref, inputs)

Check that the hierarchical sparse grid pre-processor works as expected.

Parameters:
  • hsgpre – The object representing the Python-side pre-processor.

  • hsgpre_ref – The object representing the reference values.

  • inputs (dict) – The inputs for the pre-processor.

Returns:

True if the hierarchical sparse grid pre-processor worked as expected, False otherwise.

Return type:

bool

tests.vl3dpp_dl_label_reduction_test module

class tests.vl3dpp_dl_label_reduction_test.VL3DPPDLLabelReductionTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Deep learning label reduction test that checks the C++ implementation for label reduction for deep learning models.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ deep learning label reduction test.

Returns:

True if the C++ label reduction works as expected for the test cases, False otherwise.

Return type:

bool

testLabelReduction(dlprepp, inputs)

Checks that the C++ deep learning label reduction works as the python reference label reduction.

Parameters:
  • dlprepp – The object representing the C++ receptive field pre-processor.

  • inputs (dict) – The inputs for the label reduction.

tests.vl3dpp_dl_post_proc_test module

class tests.vl3dpp_dl_post_proc_test.VL3DPPDLPostProcTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Deep learning post processor test that checks the C++ implementation of the post processors for deep learning models.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ deep learning post-processors test.

Returns:

True if the C++ post-processors work as expected for the test cases, False otherwise.

Return type:

bool

testDLPostProc(dlpost, dlpostpp, inputs, reducer=None)

Check that the C++ deep learning post-processor works as the python reference post-processor.

Parameters:
  • dlpost – The object representing the Python-side post-processor.

  • dlpostpp – The object representing the C++-side post-processor that corresponds with the Python-side post-processor (dlpost).

  • inputs (dict) – The inputs for the post-processor.

  • reducer (PredictionReducer) – The prediction reducer for the post-processor, if any.

Returns:

True if the C++ post-processor matches the results of the Python post-processor, False otherwise.

Return type:

bool

tests.vl3dpp_hierarchical_sparse_grid_test module

class tests.vl3dpp_hierarchical_sparse_grid_test.VL3DPPHierarchicalSparseGridTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Deep learning pre-processor test that checks the C++ implementation of the hierarchical sparse grid (SG) pre-processors for deep learning models.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ deep learning hierarchical sparse grid test.

Returns:

True if the C++ hierarchical sparse grid works as expected for the test cases, False otherwise.

Return type:

bool

tests.vl3dpp_oversampler_test module

class tests.vl3dpp_oversampler_test.VL3DPPOversamplerTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Oversampling test that checks the C++ oversampling implementations.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ oversampling tests.

Returns:

True if the C++ oversampling works as expected for the test cases, False otherwise.

Return type:

bool

testOversample(X, target_points, nearest_spec, max_discrepancy_ratio=0.0)

Check that the C++ oversampling works as the Python reference oversampling.

Parameters:
  • X (np.ndarray) – The test structure space that must be oversampled.

  • target_points (int) – How many points must be obtained through oversampling (provided it is needed).

  • nearest_spec (dict) – The key-word arguments governing the oversampling.

  • max_discrepancy_ratio (float) – The ratio in \([0, 1]\) of points that can be different between the Python and C++ implementations.

Returns:

True if the C++ oversampling works as expected, False otherwise.

Return type:

bool

tests.vl3dpp_support_neighborhoods_test module

class tests.vl3dpp_support_neighborhoods_test.VL3DPPSupportNeighborhoodsTest

Bases: VL3DTest

Author:

Alberto M. Esmoris Pena

Deep learning pre-processor tests that checks the C++ implementation of the support neighborhood-generation algorithms.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run C++ support neighborhoods test.

Returns:

True if the C++ support neighborhoods are generated as expected for the test cases, False otherwise.

Return type:

bool

testSupport(neigh_spec, sup_spec, X, y)

Check that the C++ support neighborhoods work as the python reference support neighborhoods in the general case.

Parameters:
  • neigh_spec (dict) – The neighborhood specification.

  • sup_spec (dict) – The support specification.

Returns:

True if the C++ support neighborhoods match the Python-side support neighborhoods.

Return type:

bool

testSupportByDistr(neigh_spec, sup_spec, X, y)

Check that the C++ support neighborhoods work as the python reference support neighborhoods for the training class distribution strategy.

Parameters:
  • neigh_spec (dict) – The neighborhood specification.

  • sup_spec (dict) – The support specification.

Returns:

True if the C++ support neighborhoods match the Python-side support neighborhoods.

Return type:

bool

testSupportByFPS(neigh_spec, sup_spec, X, y)

Check that the C++ support neighborhoods work as the python reference support neighborhoods for the furthest point subsampling (FPS) strategy.

Parameters:
  • neigh_spec (dict) – The neighborhood specification.

  • sup_spec (dict) – The support specification.

Returns:

True if the C++ support neighborhoods match the Python-side support neighborhoods.

Return type:

bool

Module contents

author:

Alberto M. Esmoris Pena

The tests package contains the logic to test that the many components involved in the software work as expected.