maudzung / Complex-YOLOv4-Pytorch

The PyTorch Implementation based on YOLOv4 of the paper: "Complex-YOLO: Real-time 3D Object Detection on Point Clouds"
https://arxiv.org/pdf/1803.06199.pdf
GNU General Public License v3.0
1.21k stars 260 forks source link

Add new point cloud augmentation - Random Translation #36

Open phuccuongngo99 opened 2 years ago

phuccuongngo99 commented 2 years ago

What

The current repo doesn't support Random Translation augmentation methods.

This PR adds Random Translation methods here: https://github.com/maudzung/Complex-YOLOv4-Pytorch/blob/ffb67cd38ee72fd0ad884bcb2f9b11b0cc131f54/src/data_process/transformation.py#L376-L403

Why

It's reasonable since self-driving car requires a fixed view (the car has to be centered bottom of the image)

However, other applications of 3D point clouds object detection may have different settings such as industrial factories and warehouses like what I tried to do. We may need to augment using translation to increase the diversity of our limited dataset.

Testing

We will make changes to train_lidar_transforms here: https://github.com/maudzung/Complex-YOLOv4-Pytorch/blob/a712f52542a35893ddedbd7b782f34f31a0ff796/src/data_process/kitti_dataloader.py#L22-L28

After changing, run

cd src/data_process
python kitti_dataloader.py --show-train-data --output-width 608

1) No Augmentation

image

2) Random_Rotate (Existing augmentation)

train_lidar_transforms = OneOf([
    Random_Rotation(limit_angle=30., p=1.0),
], p=1.0)

image

3) Random_Scaling (Existing augmentation)

train_lidar_transforms = OneOf([
    Random_Scaling(scaling_range=(0.50, 1.50), p=1.0),
], p=1.0)

You can see that's it's zoomed out image

4) Random_Translate (Added in this PR)

train_lidar_transforms = OneOf([
    Random_Translate(translate_range_x=(-0.5, 0.5),
                    translate_range_y=(-0.5, 0.5),
                    p=1.0)
], p=1.0)

You can see the image is translated, the view shifts upwards, no longer starting from the car image