OpenPCDet Documentation
repository·master·Indexed 26 days ago
https://github.com/open-mmlab/openpcdetA comprehensive, PyTorch-based open-source toolbox for LiDAR-based 3D object detection. It provides a unified framework for one-stage and two-stage detection models, supporting large-scale datasets including KITTI, Waymo, NuScenes, ONCE, and Argoverse2. Key features include distributed training, multi-scale detection, GPU-accelerated 3D IoU calculation, and rotated NMS.
What's inside OpenPCDet
- OpenPCDet is an open-source, PyTorch-based toolbox designed for LiDAR-based 3D object detection. It provides a unified framework for both one-stage and two-stage 3D detection methods. The project is designed for extensibility, featuring data-model separation and a unified 3D box definition (x, y, z, dx, dy, dz, heading).
Key Features of OpenPCDet
masterOpenPCDet supports several advanced features for 3D object detection:
- Frameworks: Both one-stage and two-stage 3D object detection frameworks.
- Distributed Computing: Distributed training and testing across multiple GPUs and multiple machines.
- Multi-scale Detection: Support for multiple heads on different scales to detect various classes.
- Point Abstraction: Stacked version set abstraction to encode varying point densities.
- Target Assignment: Adaptive Training Sample Selection (ATSS).
- Pooling Operations: RoI-aware point cloud pooling and RoI-grid point cloud pooling.
- Optimization: GPU-accelerated 3D IoU calculation and rotated NMS.
OpenPCDet Design Patterns
masterThe toolbox follows specific design patterns to facilitate development and extension:
- Data-Model Separation: Uses a unified point cloud coordinate system to allow easy extension to custom datasets.
- Unified 3D Box Definition: All models use the format
(x, y, z, dx, dy, dz, heading). - Flexible Model Structure: A clear architecture that supports various 3D detection models within a single framework.
Set point cloud range and voxel sizes for voxel/pillar detectors
masterWhen using voxel-based detectors (e.g., SECOND, PV-RCNN, CenterPoint) or pillar-based detectors (e.g., PointPillar), ensure your configuration adheres to these constraints:
- Z-axis:
Point cloud range along z-axis / voxel_sizemust equal 40. - X & Y axes:
Point cloud range along x&y-axis / voxel_sizemust be a multiple of 16.
- Z-axis:
Train the full BEVFusion model
masterTo train the full BEVFusion model, you must first download the pretrained parameters for the image backbone. Specify the path to these parameters in the configuration file atcfgs/nuscenes_models/bevfusion.yaml(line 88). Then, run the training script providing the path to your pretrained lidar branch checkpoint.Evaluate MPPNet models
masterYou can evaluate MPPNet using a pretrained checkpoint. To avoid Out-of-Memory (OOM) errors, it is recommended to set
batch_sizeto 1.Single GPU Evaluation:
python test.py --cfg_file cfgs/waymo_models/mppnet_4frames.yaml --batch_size 1 --ckpt ../output/waymo_models/mppnet_4frames/default/ckpt/checkpoint_epoch_6.pthMulti-GPU Evaluation:
bash scripts/dist_test.sh ${NUM_GPUS} --cfg_file cfgs/waymo_models/mppnet_4frames.yaml --batch_size 1 --ckpt ../output/waymo_models/mppnet_4frames/default/ckpt/checkpoint_epoch_6.pthInstall visualization tools for OpenPCDet demo
masterTo visualize the predicted results during the demo, you must have either
Open3D(recommended for speed) ormayaviinstalled. You can install them using pip:pip install open3d # or pip install mayaviPrepare label files for a custom dataset
masterAnnotations for the custom dataset must be stored in
.txtfiles. Each line in the text file represents one bounding box in a scene using the following format:[x y z dx dy dz heading_angle category_name]Ensure the boxes follow the unified 3D box definition used by OpenPCDet. Example lines:
1.50 1.46 0.10 5.12 1.85 4.13 1.56 Vehicle 5.54 0.57 0.41 1.08 0.74 1.95 1.57 Pedestrian1.50 1.46 0.10 5.12 1.85 4.13 1.56 VehicleTest and Evaluate Pretrained Models
masterUse
test.pyto evaluate models. You can specify the configuration file, batch size, and checkpoint path.Options:
--eval_all: Test all saved checkpoints of a specific training setting and draw performance curves on Tensorboard.- Multi-GPU Testing: Use
scripts/dist_test.shorscripts/slurm_test_mgpu.sh.
Train Models
masterTrain models usingtrain.py(single GPU) or distributed scripts (multiple GPUs/machines). You can optionally pass--batch_sizeand--epochsto override defaults.Install OpenPCDet v0.5
masterFollow these steps to install OpenPCDet. If you have a previous version installed, you must re-install by running
python setup.py developto ensure the v0.5 components are correctly linked.- Clone the repository:
git clone https://github.com/open-mmlab/OpenPCDet.git - Install dependencies:
Install the required Python libraries listed in
requirements.txtusing pip. - Install
spconv: Choose the version ofspconvcompatible with your PyTorch version (see requirements for details). - Install OpenPCDet in development mode: Run the setup script to install the library and its dependencies.
git clone https://github.com/open-mmlab/OpenPCDet.git # (Install requirements.txt and spconv first) python setup.py develop- Clone the repository:
Run a Quick Demo with OpenPCDet
masterTo test OpenPCDet using a pretrained model and visualize predicted results on either custom data or original KITTI data, follow the steps provided inDEMO.md.