PointInterp is a lightweight and efficient non-2D-projection solution for LiDAR point cloud super-resolution. Through interpolation methods and a PointNet-based neural network model, it enhances sparse scan lines in point clouds, such as upgrading from 16 lines to 32 lines or from 32 lines to 64 lines, significantly improving point cloud resolution and detail.
This project provides the following main functionalities:
- Data Conversion Pipeline: Converts raw KITTI
.binpoint clouds into structured HDF5 format. - Traditional Interpolation Methods: Provides stable interpolation baselines for comparison.
- PointNet-SR-Mini Neural Network: A lightweight network specifically designed for point cloud super-resolution.
- Chamfer Distance Calculation Tools: For evaluating the accuracy of point cloud predictions.
- Quantitative Analysis and Visualization Scripts: Assists in analyzing point cloud processing results.
-
Multi-Scan Line HDF5 Converter (
dataset_to_h5.py): Splits 64-line original point clouds into 32-line and 16-line versions, saving them as HDF5 files. -
Chamfer Distance Implementation: Provides both NumPy and KD-Tree efficient calculation methods (
metrics.py). -
Interpolation Baseline Method: Provides bi-directional interpolation based on angle and azimuth (
interpolation.py). -
PointNet-SR-Mini Model (
pointnet_sr_mini.py):- Supports 16→32 and 32→64 scan line enhancement.
- Can resume training from checkpoints, with built-in EarlyStopping and learning rate adjustment mechanisms.
-
Analysis Scripts (
analyze.py,main.py):- Quantitatively evaluates the effectiveness of interpolation and neural network predictions.
- Provides real-time visualization comparison for single-frame point clouds.
This project proposes a "difference set-point completion" super-resolution algorithm for sparse LiDAR scan lines, with a workflow divided into interpolation baseline and deep enhancement layers.
1. Interpolation Baseline
First, divide the N-line point cloud into bins based on elevation angle
Then, evenly supplement at azimuth angle
2. Difference Set Extraction
For the original low-resolution point cloud
3. PointNet-SR-Mini
For
4. Loss Function
Adopts squared Chamfer distance:
where G is the ground truth high-resolution point cloud. Adam optimizer is used; ReduceLROnPlateau dynamically reduces learning rate combined with Early-Stopping.
5. Deep Learning Model
Input (B, N, 3)
↓
MLP1 (Conv1D 3→64→128→256)
↓
MaxPool (Global Feature 256)
↓
FC Layers (256→512→1024)
↓
Expand & Concatenate (256+1024=1280)
↓
Decoder (Conv1D 1280→512→256→128→3)
↓
Output: Predicted Offsets + Input
6. Results On the KITTI dataset, the 16→32 line average CD improves by about 10% compared to interpolation, while the 32→64 line improves by over 60%. Real-time inference is possible on an RTX 3080. The algorithm is lightweight and easy to train, and can also be replaced with deeper models such as PointNet++, PU-Net, etc. for further quality improvement.
The figure below shows the error visualization result for a random frame from the KITTI Dataset, where cyan represents the Ground Truth, and red represents the difference set between the inference result and GT:

.
├── dataset_to_h5.py # Converts KITTI original .bin files to HDF5 format (16/32/64 scan lines)
├── io.py # HDF5 point cloud data loading tools
├── metrics.py # Chamfer Distance and difference set calculation tools
├── interpolation.py # Point cloud interpolation tools
├── pointnet_sr_mini.py # PointNet-SR-Mini model definition and training
├── analyze.py # Interpolation baseline analysis script
├── main.py # Single-frame point cloud inference and Open3D visualization script
├── dataset/ # Storage for training and testing HDF5 data
├── ckpt_srmini/ # Model checkpoint storage folder
└── figures/ # Chamfer Distance analysis curve charts
/train.h5
├── 16/ (16-line point clouds)
│ ├── 2011_09_26_0001_0000000000 → (N, 4) (includes x, y, z, intensity)
│ ├── 2011_09_26_0001_0000000001 → (M, 4)
│ └── ...(more frames)
│
├── 32/ (32-line point clouds)
│ ├── 2011_09_26_0001_0000000000 → (N, 4)
│ ├── 2011_09_26_0001_0000000001 → (M, 4)
│ └── ...(more frames)
│
└── 64/ (64-line point clouds, Ground Truth)
├── 2011_09_26_0001_0000000000 → (N, 4)
├── 2011_09_26_0001_0000000001 → (M, 4)
└── ...(more frames)
This project is compatible with Python 3.8+ and requires the following third-party packages:
Installation command:
pip install torch torchvision open3d scipy h5py tqdm matplotlib numpy-
Modify the
bin_folder_listvariable indataset_to_h5.pyto specify the directory containing your KITTI original.binfiles. -
Execute the following command for data conversion:
python dataset_to_h5.py
This will generate an HDF5 file (default name
verify_data.h5) containing 16, 32, and 64-line point clouds. -
Move the generated file to the
dataset/folder:mv verify_data.h5 dataset/train_sample148.h5
Example:
python pointnet_sr_mini.py \
--train_h5 dataset/train_sample148.h5 \
--val_h5 dataset/verify340.h5 \
--orig 16 \
--tgt 32 \
--epochs 100 \
--bs 8 \
--out ckpt_srminiParameter description:
--train_h5: Path to the HDF5 file for training.--val_h5: Path to the HDF5 file for validation (optional).--orig/--tgt: Original and target scan line numbers.--epochs: Number of training epochs.--bs: Batch size.--out: Path for checkpoint and record storage.
Contents of the folder after training:
ckpt_srmini/
├── best_pointnet_sr_16to32.pth
├── loss_history.json
└── loss_curve.png
Use the neural network model for inference and calculate Chamfer Distance:
python analyze.py --filepath dataset/test_sample148.h5 --interpolation dlpython analyze.py --filepath dataset/test_sample148.h5 --interpolation linearRandomly select a frame for real-time visual comparison:
python main.pyThe following information uses the test_sample148.h5 test set
- 16 lines→32 lines: Limited by the sparsity of the original data, the average Chamfer Distance is about 0.34, improving by about 10% compared to the interpolation method.
=== 16->32 PointNet-SR-mini Analysis Report === Total Frames: 148 Average Chamfer Distance: 0.345550 Standard Deviation: 0.262420 Maximum Chamfer Distance: 2.427180 (Frame 141) Minimum Chamfer Distance: 0.112630 (Frame 36) - 32 lines→64 lines: The average Chamfer Distance is about 0.054, significantly optimized by over 60% compared to the interpolation method.
=== 32->64 PointNet-SR-mini Analysis Report === Total Frames: 148 Average Chamfer Distance: 0.054512 Standard Deviation: 0.029365 Maximum Chamfer Distance: 0.191678 (Frame 25) Minimum Chamfer Distance: 0.009076 (Frame 36) - All analysis curve charts are saved in the
figures/folder.
- Try using more powerful models such as PointNet++, PU-Net, EdgeConv, etc.
- Add Earth Mover's Distance (EMD), Repulsion Loss, multi-scale feature fusion, and post-processing techniques (such as Voxel filtering, kNN smoothing).
- Can be expanded to larger-scale datasets such as NuScenes, and apply mixed precision training, One-Cycle LR, and other techniques.
This project is licensed under the MIT License, allowing free modification and application in research or product development.
Feedback, issues, or code contributions are welcome.
