DUFOMap Dynamic Awareness Mapping Framework

repository·main·Indexed 43 days ago

https://github.com/kth-rpl/dufomap

An efficient dynamic awareness mapping framework for dynamic point removal in 3D point cloud maps. It supports various LiDAR sensors, including 16, 32, 64, 128-channel systems and Livox-series (e.g., Mid360). DUFOMap provides a Python API for Python >= 3.8 on Windows and Linux, a C++ implementation buildable via CMake, and Docker support.

Tokens
1.4K
Snippets
7
Records
8
Agent score
6%

What's inside DUFOMap

  1. Install and run DUFOMap via C++ source

    main

    If you require the C++ implementation, you must first install the necessary system dependencies and then build the project using CMake.

    1. Install Dependencies

    On Ubuntu/Debian systems, install the following:

    • gcc-10 and g++-10
    • libtbb-dev
    • liblz4-dev

    2. Build the Project

    Use CMake to configure the build directory with g++-10 as the compiler and then build.

    3. Run the Executable

    Run the compiled dufomap_run binary by providing the path to your data directory and a configuration file (.toml).

    # Install dependencies
    sudo apt update && sudo apt install gcc-10 g++-10
    sudo apt install libtbb-dev liblz4-dev
    
    # Build
    cmake -B build -D CMAKE_CXX_COMPILER=g++-10 && cmake --build build
    
    # Run
    ./build/dufomap_run data/00 assets/config.toml
  2. Install and run DUFOMap via Python API

    main

    The easiest way to use DUFOMap is through its Python API. This method supports Python >= 3.8 on both Windows and Linux and allows you to obtain a cleaned map directly from your data.

    Before running, ensure your data is in the unified format. For instructions on converting custom datasets to this format, refer to the DynamicMap_Benchmark wiki.

    To install and run with the provided teaser data:

    1. Install the package via pip.
    2. Run the main.py script pointing to your data directory.
    pip install dufomap
    python main.py --data_dir data/00
  3. Prepare teaser data for testing

    main

    To test the implementation with the KITTI 00 dataset (approx. 384.4Mb), download and unzip the files into a data directory.

    wget https://zenodo.org/records/8160051/files/00.zip -p data
    unzip data/00.zip -d data
  4. Initialize and run the DUFOMap pipeline

    main

    To use the DUFOMap mapping pipeline, follow these steps:

    1. Initialize: Create a dufomap instance by specifying resolution, d_s, d_p, and the number of threads.
    2. Integrate: For each frame in your sequence, call .run() with the point cloud and the sensor pose. Set cloud_transform=False if you are providing points in the correct coordinate frame.
    3. Propagate: After all frames are integrated, call .oncePropagateCluster(if_propagate=True, if_cluster=False) to propagate clusters.
    4. Output: Call .outputMap() to generate the final map. You can pass an accumulated point cloud and choose whether to output a voxel-level map via voxel_map=True or a raw point-level map via voxel_map=False.
    5. Timing: Use .printDetailTiming() to see performance metrics.
    from dufomap import dufomap
    
    # 1. Initialize (resolution, d_s, d_p, num_threads)
    mydufo = dufomap(0.1, 0.2, 2, num_threads=12)
    
    # 2. Integrate (loop through your data)
    for pc, pose in data_sequence:
        mydufo.run(pc, pose, cloud_transform=False)
    
    # 3. Propagate
    mydufo.oncePropagateCluster(if_propagate=True, if_cluster=False)
    
    # 4. Output Map
    mydufo.outputMap(accumulated_pc, voxel_map=True)
    
    # 5. Print timing
    mydufo.printDetailTiming()
  5. DUFOMap API Reference

    main

    The following methods are available on the dufomap object:

    • dufomap(resolution, d_s, d_p, num_threads): Constructor.
    • run(pc, pose, cloud_transform=False): Integrates a single point cloud frame into the map.
    • oncePropagateCluster(if_propagate=True, if_cluster=False): Performs the propagation step for clusters.
    • outputMap(cloud_acc, voxel_map=True): Generates the final map output using the provided accumulated point cloud.
    • printDetailTiming(): Prints execution timing details for the pipeline steps.
  6. Use DynamicMapData to load point cloud datasets

    main

    The DynamicMapData class is a data loader for point cloud sequences stored in a directory structure. It expects a directory containing a pcd subdirectory where .pcd files are stored. Each file's name is treated as its timestamp.

    When iterating over a DynamicMapData instance, each item returns a dictionary containing:

    • scene_id: The name of the parent directory.
    • timestamp: The filename (without extension).
    • pc: The point cloud data as a numpy.float32 array of shape (N, 3).
    • pose: The viewpoint/pose of the sensor as a list.
    from dufomap import DynamicMapData
    
    dataset = DynamicMapData("/path/to/data_dir")
    for i in range(len(dataset)):
        data = dataset[i]
        points = data['pc']
        pose = data['pose']