How zhanggang001/hednet works
Project Type & Purpose
• This is an open-source, research-grade 3D object-detection codebase (HEDNet & SAFDNet) built atop OpenPCDet.
• It provides end-to-end pipelines for loading point-cloud datasets (Waymo, KITTI, Lyft, etc.), preprocessing (voxelization, augmentation), sparse-convolutional model training (hierarchical encoder-decoder, fully sparse), evaluation, and submission.
High-Level Components
a. Data Layer
• “data/…” directories for raw dataset splits and ImageSets
• pcdet/datasets package: dataset interfaces, augmentors, samplers, custom dataset support
b. Preprocessing & Feature Engineering
• Voxelization, point-feature encoders (VFE) in pcdet/models/backbones_3d/vfe and pcdet/datasets/processor
• 2D BEV mapping modules in pcdet/models/backbones_2d
c. Model Core
• Backbones (2D & 3D), attention modules, sparse conv in pcdet/models/backbones_*
• Dense heads (anchor, center, transfusion) in pcdet/models/dense_heads
• ROI heads (PartA2, PointRCNN, PV-RCNN) in pcdet/models/roi_heads
• Detector wrappers (HEDNet, SAFDNet, CenterPoint, etc.) in pcdet/models/detectors
d. Low-Level Ops
• Custom C++/CUDA operators under pcdet/ops (bev_pool, iou3d_nms, pointnet2, roipoint_pool3d, etc.)
e. Training & Evaluation Engine
• tools/train.py, tools/test.py orchestrate distributed training/testing
• tools/scripts for Slurm, torch.distributed launch
• tools/eval_utils for metric computation and submission creation
f. Configuration & Orchestration
• YAML configs in tools/cfgs drive dataset, model, optimizer, scheduler settings
• pcdet/config.py reads and merges configs at runtime
g. Deployment & Reproducibility
• Dockerfile in docker/ for uniform environment (PyTorch, CUDA, spconv)
• requirements.txt, setup.py for pip installable package
• docs/ for install, dataset tutorial, getting started
Component Relationships & Data-Flow
• Data (raw point clouds) → Dataset loader (pcdet/datasets) → Augmentor & Sampler → DataProcessor (voxelization, VFE)
→ Model Backbone → Detection Heads → Loss & Post-processing → Checkpoint & Metrics
• Config files feed into both Data loader and Model builder
• Training scripts (tools/train.py) dispatch jobs to GPUs, link with custom ops and return checkpoints
• Evaluation scripts load checkpoints, run inference on test splits, compute metrics via eval_utils
Architectural Patterns & Principles
• Modular plugin design: adding new dataset or detector only requires implementing a subclass in the appropriate package
• Config-driven: decouples code from hyperparameters, fosters reproducibility
• Separation of concerns: data ingestion, preprocessing, model definition, and training loops are cleanly separated
• High-performance: custom CUDA kernels for bottleneck ops, distributed data parallel training
b. Next, Preprocessing block (pcdet/datasets/processor, VFE modules).
c. Center: Model Core subdivided into Backbone, Heads, Detectors.
d. Underneath Model Core: Custom ops layer (pcdet/ops) feeding into Backbone/Heads.
f. At the top or bottom: Config manager (tools/cfgs + pcdet/config.py) feeding into Data Layer and Model Core.
g. External services off to one side: Docker, Slurm, Output storage (checkpoints, submission files).