nowangry / 3d-object-vis

制作3d检测视频

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repository is based on 3D-Detection-Tracking-Viewer. But modified slightly for 2 purposes:

  1. Easier to save visualization pictures with configurable scale
    • Add offscreen param in Viewer
    • Add save_name & scale in Viewer.show_3D
  2. Set the camera position at my own preferences
    • Change self.vi.show(camera) settings in Viewer.show_3D

Usage

Requirement

  1. You need topip install vedo to visualize your prediction. For more details, please refere to 3D-Detection-Tracking-Viewer.
  2. You need to pip install tqdm to show the progress bar.
  3. You need to pip install opencv-python to concat 3D & 2D images.

Data

You can organize your data like this, just like KITTI

- data_root
  - velodyne
  - image_2

Scripts

Main function is in vis.py. Most of the funcionalities are commented, and some were written in Chinese, but overall it's easy to read. Please check the scripts in vis.py after if __name__ == '__main__': to see the basic usage.

You can also easily start with the codes below

from viewer.viewer import Viewer

def build_viewer(box_type="OpenPCDet", bg=(255,255,255), offscreen=False):
    return Viewer(box_type=box_type, bg=bg, offscreen=offscreen)

vi = build_viewer()
vi.add_points(points)   # (N, 3), (x, y, z)
vi.add_3D_boxes(boxes)  # (N, 7), (x, y, z, w, h, l, theta)
vi.show_3D()

If you want to visualize your prediction results, you can get your inference results result.pkl by running with OpenPCDet project. OR you can try inference.py provided in this repo, which is also built on OpenPCDet demo.py.

python inference.py --cfg_file {CONFIG_FILE} \
    --ckpt {CKPT} \
    --data_path {POINT_CLOUD_DATA}

Demo

I've made some demo videos to show the results:

  1. 3D Object Detection Visualization Demo
  2. 3D Object Segmentation (Car) Demo

About

制作3d检测视频


Languages

Language:Python 100.0%