How njuvision/pcgcv2 works
Project Type and Purpose
• This is a research-oriented, end-to-end machine-learning (PyTorch) tool for 3D point-cloud geometry compression.
• It implements both training and inference pipelines, featuring a sparse-convolution autoencoder, entropy model, and practical coding back-ends (torchac, tmc3).
File Structure
• Top-level scripts:
• data_loader.py, data_utils.py, generate_dataset.py → data ingestion & preprocessing
• autoencoder.py, pcc_model.py, entropy_model.py, loss.py → neural-network definitions
• trainer.py, train.py → training orchestration
• coder.py, test.py, gpcc.py, pc_error.py, pc_error_d → inference & evaluation
• tmc3 (binary) → lossless coordinate compressor
• Directories:
• ckpts.zip → pretrained model checkpoints
• results/ → evaluation outputs
• Configuration is code-driven (no separate YAML), dependencies indicated in README.
Key Insights from the README
• Core approach: multiscale sparse convolution autoencoder with hierarchical reconstruction.
• External libs: MinkowskiEngine (sparse convolutions), torchac (arithmetic coding), tmc3 (MPEG PCC).
• Two modes: lossless (via tmc3) and lossy (via entropy model + arithmetic coder).
Main Components and Their Interactions
A. Data Ingestion & Preprocessing
• Input: raw .ply point-cloud files
• Tools: data_loader.py, data_utils.py, generate_dataset.py
• Output: multi-scale sparse tensors suitable for MinkowskiEngine
B. Neural Autoencoder
• Modules: autoencoder.py (encoder & decoder), pcc_model.py (model wrapper)
• Framework: PyTorch + MinkowskiEngine
• Loss: defined in loss.py
C. Entropy Model & Arithmetic Coding
• EntropyModel (entropy_model.py) estimates probability distributions
• torchac library performs arithmetic encode/decode
• Coordinate compressor: tmc3 binary invoked by gpcc.py or within coder.py
D. Training Pipeline
• Entry point: train.py → calls trainer.py
• Steps: load data, forward pass through autoencoder, compute loss, backprop, checkpoint
E. Inference / Testing Pipeline
• Entry points: coder.py (encode+decode), test.py (benchmark + error metrics)
• Steps: load checkpoint, run encoder, compress bits, run decoder, compute metrics via pc_error.py / pc_error_d
F. Evaluation & Results
• Compressed bitstreams and reconstructed point clouds → error reports in results/
Architectural Patterns & Design Principles
• Modular pipeline: clear separation of data, model, coding, and evaluation
• Plug-in back-ends: torchac vs tmc3 can be swapped with minimal change
• Reusable components: pcc_model wraps encoder/decoder for both training & inference