|
pcod-common v1.0.0
Shared preprocessing and postprocessing for point-cloud object detection
|
Shared Preprocessing and Postprocessing Library for Point Cloud Object Detection
This repository provides shared C++ and Python components for point cloud object detection training, model export, and ROS 2 inference. Using the same geometry, decoding, non-maximum suppression (NMS), and model-manifest implementations keeps the training and inference pipelines consistent.
The library includes PBOD decoding, rotated NMS, point filtering, CUDA kernels for pillarization and rotated NMS, and a model-manifest schema shared by the C++ and Python APIs.
🚀 Quick Start • 💻 Development • 📝 Documentation
Clone, build, and install the C++ library:
After installation, link your CMake target to the package:
When using a custom installation prefix, add it to CMAKE_PREFIX_PATH when configuring the consuming project, for example with -DCMAKE_PREFIX_PATH=/path/to/prefix.
Alternatively, add this repository directly to your CMake project:
Install the Python package from the repository root:
include/pcod_common/: public C++ headerssrc/: C++ implementationscsrc/: CUDA/C++ kernels for PyTorch extensionspython/pcod_common/: Python package sourcesschemas/: JSON schema for the model manifesttests/: C++ testspython/tests/: Python testsOn Debian or Ubuntu, install the required build dependencies and run the test suite:
Some C++ tests compare the Python and C++ contracts and require python3 to be available on PATH.
Install the package in editable mode with its development dependencies and run the test suite:
python/tests/test_postprocess.py requires PyTorch and TorchVision. Tests whose optional dependencies or CUDA extensions are unavailable are skipped; the manifest tests still run.
Build and validate the wheel and source distribution from the repository root:
Published distributions include the model-manifest schema and the C++/CUDA sources required to build the optional PyTorch extensions at runtime. Validating a distribution does not require a GPU. Compiling the extensions requires Ninja and a CUDA toolkit compatible with the installed PyTorch build; running them requires a CUDA-capable GPU.
A basic development container configuration is provided in .devcontainer/. In the container, install the system and Python dependencies, including PyTorch, and run:
CUDA kernels are built on demand by the PyTorch extension loaders in python/pcod_common/torch_extensions/.
This example demonstrates point filtering and PBOD decoding with the C++ API. It uses four pillars and two classes to keep the control flow easy to follow.
Each exported model bundle contains a model_manifest.yml file with three sections:
artifact: bundle metadata and references to files within the bundlefrozen_contract: model settings that inference applications cannot override and that must match the exported modelruntime_defaults: default inference settings that applications may overrideThe ROS 2 inference node uses frozen_contract as the authoritative model configuration and initializes overridable ROS parameters, such as preprocessing.point_feature.value_threshold and the NMS thresholds, from runtime_defaults. The schema is defined in schemas/model_manifest.schema.json.
pcod-common as a Git submodule and add it to the Python environment, for example with pip install -e pcod-common.pcod-common as a Git submodule and link against the C++ library.For a complete ROS 2 integration example, see point_cloud_object_detection, which includes pcod-common as a Git submodule and links against its C++ library.
Implementation details are available in the Source Code Documentation.
The source code in this repository is licensed under Apache-2.0, see [LICENSE](LICENSE).
Development and maintenance of this repository are supported by the following projects. We acknowledge the funding of the respective institutions.
| Project | Funding Institution | Grant Number |
|---|---|---|
| AIGGREGATE | 🇪🇺 European Union | 101202457 |
Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Climate, Infrastructure and Environment Executive Agency (CINEA). Neither the European Union nor CINEA can be held responsible for them.