main package

Submodules

main.main module

main.main.main(rootdir='')

The main entry point that governs the main branch that must be called.

Parameters:

rootdir (path) – Path to the directory where the vl3d.py script is located.

main.main.main_vl3d(subtype, rootdir='')

Execute the logic of the virtualearn3d application covering the entire training loop and the application of a trained model.

Parameters:

subtype (str) – The string specifying the type of VL3D branch, i.e., mine, train, predict, eval, or pipeline.

main.main.main_test()

Execute the tests.

main.main_args module

class main.main_args.ArgsParser

Bases: object

Author:

Alberto M. Esmoris Pena

Class with util static methods to parse the input arguments often given by command line.

static parse_main_type(argv)

Find the main type of the requested execution branch.

Parameters:

argv – The input arguments.

Returns:

(“vl3d”, x) for the virtualearn3d branch, (“test”, None) for the test branch. In the case of the virtualearn3d branch, the x element is another string specifying the type of branch, i.e., mine, train, predict, eval, or pipeline.

Return type:

tuple

main.main_clustering module

class main.main_clustering.MainClustering

Bases: object

Author:

Alberto M. Esmoris Pena

Class handling the entry point for clustering tasks.

static main(spec)

Entry point logic for clustering tasks.

Parameters:

spec – Key-word specification.

static extract_input_path(spec)

See MainMine and main_mine.MainMine.extract_input_path().

static extract_output_path(spec)

Extract the output path from the key-word specification.

Parameters:

spec – The key-word specification.

Returns:

Output path as string.

Return type:

str

static extract_clusterer_class(spec)

Extract the clusterer’s class from the key-word specification.

Parameters:

spec – The key-word specification.

Returns:

Class representing/realizing a clusterer.

Return type:

Clusterer

main.main_config module

main.main_config.main_config_init(rootdir='')

Initialize the main config (global variable VL3DCFG). The main config defines the default values for many components in the framework. Some values are just defaults that can be overridden by JSON specifications (e.g., pipelines). Other values define the internal mechanics of the framework (e.g., what ratio of system memory must be occupied for the automatic mem-to-file proxy to be triggered).

Parameters:

rootdir (str) – Path to the directory where the vl3d.py script is located.

Returns:

Nothing.

main.main_config.main_config_subdict_init(dirpath, subpath, subkey)

Assist the main_config.main_config_init() method to load each subdictionary.

Parameters:
  • dirpath (str) – The path where the vl3d.py script is located.

  • subpath (str) – The path, relative to the vl3d.py script path, where the YAML config file is located.

  • subkey (str) – The key of the dictionary inside the main VL3DCFG dictionary.

Returns:

Nothing, but the VL3DCFG global dictionary is updated.

main.main_eval module

class main.main_eval.MainEval

Bases: object

Author:

Alberto M. Esmoris Pena

Class handling the entry point for evaluation tasks

static main(spec)

Entry point logic for evaluation tasks

Parameters:

spec – Key-word specification

static extract_eval_class(spec)

Extract the evaluator’s class from the key-word specification.

Parameters:

spec – The key-word specification.

Returns:

Class representing/realizing an evaluator.

Return type:

Evaluator

main.main_logger module

main.main_logger.main_logger_init(rootdir='')

Initialize the main logger (global variable LOGGER).

Parameters:

rootdir (str) – Path to the directory where the vl3d.py script is located.

Returns:

Nothing.

main.main_memcheck module

author:

Alberto M. Esmoris Pena

brief:

Stand-alone script to check C++ memory handling of pyvl3dpp library.

Note that this script must be called straight forward and not called from through vl3d.py. The rationale behind this is that loading the framework implies loading joblib, tensorflow, and many other libraries that generate entries in memory profilers and sanitizers (e.g., valgrind, ASAN, etc.). The purpose of this script is to provide a clean environment to analyze the memory management of pyvl3dpp.

WARNING! This script requires to manually set the PYTHONPATH to include the cpp/build directory because it is a raw script that does not load the framework. Consequently, it does not load the vl3dpp loader neither.

main.main_mine module

class main.main_mine.MainMine

Bases: object

Author:

Alberto M. Esmoris Pena

Class handling the entry point for data mining tasks.

static main(spec)

Entry point logic for data mining tasks

Parameters:

spec – Key-word specification

static extract_input_path(spec, none_path_msg='Mining a point cloud requires an input point cloud. None was given.', invalid_path_msg='Cannot find the input file for datamining.\nGiven path: {path}')

Extract the input path from the key-word specification.

Parameters:
  • spec (dict) – The key-word specification.

  • none_path_msg (str) – The string representing the message to be logged when no input point cloud is given.

  • invalid_path_msg (str) – The string representing the message to be logged when the given input path is not valid. It supports a “{path}” format field that will be replaced by the invalid path in the message.

Returns:

Input path as string.

Return type:

str

static extract_output_path(spec)

Extract the output path from the key-word specification.

Parameters:

spec – The key-word specification.

Returns:

Output path as string.

Return type:

str

static extract_miner_class(spec)

Extract the miner’s class from the key-word specification.

Parameters:

spec – The key-word specification.

Returns:

Class representing/realizing a miner.

Return type:

Miner

main.main_pipeline module

class main.main_pipeline.MainPipeline

Bases: object

Author:

Alberto M. Esmoris Pena

Class handling the entry point for pipelines

static main(spec)

Entry point logic for pipelines.

Parameters:

spec – Key-word specification.

static extract_pipeline_class(spec)

Extract the pipeline’s class from the Key-word specification.

Parameters:

spec – The key-word specification.

Returns:

Class representing/realizing a pipeline.

Return type:

Pipeline

main.main_predict module

class main.main_predict.MainPredict

Bases: object

Author:

Alberto M. Esmoris Pena

Class handling the entry point for predictive tasks

static main(spec)

Entry point logic for predictive tasks.

Parameters:

spec – Key-word specification

static extract_input_path(spec)

See MainMine and main_mine.MainMine.extract_input_path().

static load_model(spec)

Load the model from the specification of a predictive task.

Parameters:

spec – Key-word specification

Returns:

The loaded model.

Return type:

Model

static export_predictions(spec, pcloud, preds)

Export the predictions as requested. There are two potential exports.

  1. Exporting the input point cloud with a new attribute named

    “prediction”.

  2. Exporting the predictions as an ASCII CSV where each row (line)

    represents a point.

Parameters:
  • spec (dict) – The specification on how to export the predictions.

  • pcloud (PointCloud) – The predicted point cloud.

  • preds (np.ndarray) – The predictions themselves.

main.main_test module

class main.main_test.MainTest

Bases: object

Author:

Alberto M. Esmoris Pena

Class handling the entry point for tests.

static main()

Entry point logic for tests.

Returns:

Boolean flag indicating whether all tests passed successfully (True) or not (False).

Return type:

bool

main.main_train module

class main.main_train.MainTrain

Bases: object

Author:

Alberto M. Esmoris Pena

Class handling the entry point for training tasks.

static main(spec)

Entry point logic for training tasks.

Parameters:

spec – Key-word specification

static extract_input_path(spec)

See MainMine and main_mine.MainMine.extract_input_path().

static extract_output_path(spec)

Extract the output path from the key-word specification

Parameters:

spec – The key-word specification.

Returns:

Output path as string.

Return type:

str

static extract_model_class(spec)

Extract the model’s class from the key-word specification.

Parameters:

spec – The key-word specification.

Returns:

Model’s class.

static extract_pretrained_model(spec, expected_class=None, new_nn_path=None)

Extract the path to the pretrained model and load it.

Parameters:
  • spec – The key-word specification.

  • expected_class – The expected model class. It can be None, but then no model class check will be computed.

  • new_nn_path (str or None) – When given (i.e., not None) it will replace the nn_path that was serialized with the Architecture and instead use this new path.

Returns:

The pretrained model or None if there is no pretrained model specification.

Return type:

Model or None

main.vl3d_exception module

exception main.vl3d_exception.VL3DException(message='')

Bases: Exception

Author:

Alberto M. Esmoris Pena

Base class for VirtuaLearn3D custom exceptions.

Variables:

message (str) – The default message providing a string representation of the exception.

__init__(message='')

Module contents

author:

Alberto M. Esmoris Pena

The main package contains the entry point logic.