Giter VIP home page Giter VIP logo

monolanemapping's Introduction

MonoLaM

Introduction

overview This is the official code repository of "Online Monocular Lane Mapping Using Catmull-Rom Spline", which is accepted by IROS'23.

MonoLaM (Monocular Lane Mapping) is an online lane mapping algorithm based on a monocular camera. It takes real-time images and odometry (such as from VIO), and estimates its own pose as well as the lane map.

Its main features are:

  • MonoLaM uses a monocular 3D lane detection network to obtain 3D lane marking measurements.
  • Lane association using a combination of Chamfer distance, pose uncertainty, and lateral sequence consistency.
  • The lane marking is parameterized by the Catmull-Rom Spline, which saves the map memory.
  • Initializing control points for unordered lane line point clouds.
  • Incrementally extending and optimizing the lane map.
example

Prerequisites

ROS

Follow the official guide to install ROS1.

Python Dependencies

pip install -r requirements.txt

GTSAM

Follow the official guide to install GTSAM with Python Bindings.

OpenLane ROS Package

mkdir -p catkin_ws/src
cd catkin_ws/src
git clone https://github.com/qiaozhijian/openlane_bag.git

Build

git clone https://github.com/HKUST-Aerial-Robotics/MonoLaneMapping.git
cd ..
catkin_make

OpenLane Example

We validate the method based on the OpenLane dataset. Users need to download this dataset and the rosbags we provide after preprocessing with openlane_bag.

Specifically, we use PersFormer to predict 3D lane markings and save them along with GT and calibration parameters (Details). The camera coord sys (OpenLane) is x-front, y-left, z-up. However, you may feel confused if you want preprocess by yourself using PersFormer. Because its camera coord sys is different from OpenLane (please refer to issue 24.

Rosbag download link [OneDrive][Baidu Cloud]

Unzip the downloaded file and put it in the OpenLane dataset folder.

├── OpenLane
│   └── lane3d_1000
│       ├── rosbag
│       └── test
│       └── validation
│       └── training

Modify the config/lane_mapping.yaml file to change the dataset path.

dataset:
    name: "openlane"
    dataset_dir: "/media/qzj/Document/datasets/OpenLane/"

Quick Start

python examples/demo_mapping.py --cfg_file=config/lane_mapping.yaml

Reproduce the results in the paper

#In this step, users need to download the original [OpenLane](https://github.com/OpenDriveLab/OpenLane) dataset and merge it with our provided dataset.
cd src/MonoLaneMapping
# lane mapping and save the results
python examples/mapping_bm.py --cfg_file=config/lane_mapping.yaml
# evaluation of lane recall and precision
python examples/openlane_eval3d.py --cfg_file=config/lane_mapping.yaml
# lane association evaluation
python examples/lane_association.py --cfg_file config/lane_association.yaml --bm

Toy example for curve fitting

python examples/demo_curve_fitting.py

Citation

If you find this work useful in your research, please consider citing:

@inproceedings{qiao2023online,
  title={Online monocular lane mapping using catmull-rom spline},
  author={Qiao, Zhijian and Yu, Zehuan and Yin, Huan and Shen, Shaojie},
  booktitle={2023 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)},
  pages={7179--7186},
  year={2023},
  organization={IEEE}
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

monolanemapping's People

Contributors

qiaozhijian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monolanemapping's Issues

what is the "annotation_dir" filed points to?

I found that there is a “annotation_dir” field in "lane_association.yaml" and "lane_mapping.yaml", which points to some data.

Is the data provided in the link [OneDrive][Baidu Cloud]? or do I need to generate it by some other method?

This field does not seem to be required to be modified in the readme, please check.

控制点选择的一些问题 (the points beyond these two normal planes)

image
作者您好,您在论文里提出对控制点进行扩展时,选取的是the points beyond these two normal planes,从这个示意图中没有理解您的意思,请问这个条件是如何判断的,谢谢!
Hello author, in your paper, you mentioned that when extending the control points, you select "the points beyond these two normal planes." I did not understand your meaning from the diagram provided. Could you please explain how this condition is determined? Thank you!

请教运行mapping_bm.py时出现的error

乔博您好!我是SLAM方向的一名研一新生。
我有一个关于运行mapping_bm.py时出现的错误的问题(python examples/mapping_bm.py--cfg_file=config/lane_mapping.yaml)。
代码报错如下:
File "/home/liu/anaconda3/envs/pytorch/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "examples/mapping_bm.py", line 23, in run_segments
lane_mapper = LaneMapping(bag_path)
File "/home/liu/catkin_ws/src/MonoLaneMapping/lane_slam/system/lane_mapping.py", line 17, in init
self.load_data()
File "/home/liu/catkin_ws/src/MonoLaneMapping/lane_slam/system/lane_ui.py", line 215, in load_data
lanes_predict = self.preprocess_lanes(lanes_predict)
File "/home/liu/catkin_ws/src/MonoLaneMapping/lane_slam/system/lane_ui.py", line 230, in preprocess_lanes
xyz = points_downsample(xyz, self.pp_ds)
File "/home/liu/catkin_ws/src/MonoLaneMapping/lane_slam/lane_utils.py", line 77, in points_downsample
has_points = np.zeros((math.ceil((max_x - min_x) / size) + 1,
numpy.core._exceptions._ArrayMemoryError: Unable to allocate 47.3 GiB for an array with shape (187, 4737, 7162) and data type float64
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "examples/mapping_bm.py", line 105, in
main(bag_files)
File "examples/mapping_bm.py", line 49, in main
result = run_all_segments(bag_paths, multi_process=not cfg.visualization)
File "examples/mapping_bm.py", line 42, in run_all_segments
result.update(res.get())
File "/home/liu/anaconda3/envs/pytorch/lib/python3.8/multiprocessing/pool.py", line 771, in get
raise self._value
numpy.core._exceptions.MemoryError: Unable to allocate 47.3 GiB for an array with shape (187, 4737, 7162) and data type float64

这似乎是numpy数组出现了问题。
我想问一下您,我该如何解决这个问题?
无意打扰,望您回复!
issue

assert self.n <= self.m

你好,有个关于kmmatcher实现的问题想请教一下,这个断言n<=m,即landmark要小于当前的detection,

  1. 为何要特殊指定这个size判断呢,如果出现遮挡可能会有landmark对应不到detection
  2. 如果出现了实例大于观测的情况,需要怎么特殊处理么

#max weight assignment
class KMMatcher:

## weights : nxm weight matrix (numpy , float), n <= m
def __init__(self, weights):
    weights = np.array(weights).astype(np.float32)
    self.weights = weights
    self.n, self.m = weights.shape
    assert self.n <= self.m

Error running mapping_bm.py

Hello,
Thank you for your great work.

I have a question about the error I've got running the mapping_bm.py.
I can get results without errors for some segments, but the code returns error for the other segments.

For example, when I run the code with segment-10289507859301986274_4200_000_4220_000_with_camera_labels, I got an error:

Traceback (most recent call last):
File "examples/mapping_bm.py", line 108, in
main(bag_files)
File "examples/mapping_bm.py", line 52, in main
result = run_all_segments(bag_paths, multi_process=False)
File "examples/mapping_bm.py", line 47, in run_all_segments
result = run_segments(bag_paths)
File "examples/mapping_bm.py", line 27, in run_segments
stats = lane_mapper.process()
File "/host/monolane/lane_slam/system/lane_mapping.py", line 51, in process
self.save_lanes_to_json(self.cur_frame)
File "/host/monolane/lane_slam/system/lane_ui.py", line 283, in save_lanes_to_json
lane_lm = self.lanes_in_map[lane.id]
KeyError: 9

It seems the lanes_in_map dictionary doesn't have the lane id as the key.
How can I solve this problem?

Thank you.

请教一下控制点初值的设置是否过于复杂?

按论文中设计主要能解决那些case?
如果直接根据弦长法(chord length),例如先对车道线长度进行计算(可以先用三次曲线拟合,再采样,完成长度计算),然后等间距(例如3m),选择控制点初值;考虑到感知误差和定位的飘移,要求选择控制点的初值周围,原始点足够密集,以这种方式,又会有什么问题呢 ?

Error when importing clipperpy

Hello, thank you for the excellent work:

I try to run the demo_mapping but I'm getting this import error:
ModuleNotFoundError: No module named 'clipperpy.clipperpy'

I have already installed it according to the official instructions of Clipper.
I am using the Python 3.7 environment from Anaconda.

Thank you so much!

No results due to merge_lane operation

When I set merge_lane of lane_mapping to true, it seems that the system doesn't produce any results.
Should the condition lm.obs_num < 10 be removed in the post_merge_lane function because initially the observation count won't satisfy this condition, causing lane_in_map to be continuously deleted?

demo

你好,我是这方面的小白,请问readme中的demo是怎么跑出来的?我使用demo_mapping 得到的结果是一张静态的图

AttributeError: module 'gtsam' has no attribute 'CustomFactor'

Hi, Thank you for your excellent work! A question have happened when i tried to run "python examples/demo_mapping.py --cfg_file=config/lane_mapping.yaml". More details like follows:

Traceback (most recent call last):
  File "examples/demo_mapping.py", line 14, in <module>
    from lane_slam.system.lane_mapping import LaneMapping
  File "xxx/monolane/MonoLaneMapping/lane_slam/system/lane_mapping.py", line 9, in <module>
    from lane_slam.system.lane_opt import LaneOptimizer
  File "xxx/monolane/MonoLaneMapping/lane_slam/system/lane_opt.py", line 17, in <module>
    from lane_slam.factors import error_catmull_rom, p2tan_catmull_rom, chord_factor, p2tan_factor, \
  File "xxx/monolane/MonoLaneMapping/lane_slam/factors.py", line 7, in <module>
    def error_catmull_rom(measurement: np.ndarray, this: gtsam.CustomFactor,
AttributeError: module 'gtsam' has no attribute 'CustomFactor'

When I treid to solve the problem, I noticed when i used "print(help(gtsam.gtsam))", it worked. When i used "help(gtsam.CustomFactor)", the output as follows:

>>> print(help(gtsam.CustomFactor))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'gtsam' has no attribute 'CustomFactor

Could you please tell me how to solve this problem? Thanks!

ModuleNotFoundError: No module named 'clipperpy.clipperpy'

When i run "python examples/demo_mapping.py --cfg_file=config/lane_mapping.yaml", I get the following issue:

python examples/demo_mapping.py --cfg_file=config/lane_mapping.yaml
Traceback (most recent call last):
File "examples/demo_mapping.py", line 14, in
from lane_slam.system.lane_mapping import LaneMapping
File "/home/w/catkin_ws/src/MonoLaneMapping/lane_slam/system/lane_mapping.py", line 9, in
from lane_slam.system.lane_opt import LaneOptimizer
File "/home/w/catkin_ws/src/MonoLaneMapping/lane_slam/system/lane_opt.py", line 19, in
from lane_slam.system.lane_tracker import LaneTracker
File "/home/w/catkin_ws/src/MonoLaneMapping/lane_slam/system/lane_tracker.py", line 9, in
from lane_slam.system.lane_ui import LaneUI
File "/home/w/catkin_ws/src/MonoLaneMapping/lane_slam/system/lane_ui.py", line 14, in
from lane_slam.assoc_utils import draw_correspondences, draw_lines
File "/home/w/catkin_ws/src/MonoLaneMapping/lane_slam/assoc_utils.py", line 6, in
import clipperpy
File "/home/w/Software/anaconda3/envs/lanemapping/lib/python3.8/site-packages/clipperpy/init.py", line 1, in
from .clipperpy import *
ModuleNotFoundError: No module named 'clipperpy.clipperpy'

I have followed the modified version to install CLIPPER with Python Bindings.

how I can fix this problem? thx a lot!

missing validation folder in dataset

i download dataset from BaiduYun or OneDrive, after uncompress the dataset, here is what i got :
图片

At the same time i run the demo script:
python3 examples/demo_mapping.py --cfg_file=config/lane_mapping.yaml

i got:
图片

Also for demo_curve_fitting.py,after excute python3 examples/demo_curve_fitting.py :
图片

GTSAM version

Hi, Thank you for your excellent work again! When I tried to run "python examples/demo_curve_fitting.py", some error happened. More details as follows:

Load config file:  config/lane_mapping.yaml
Traceback (most recent call last):                                                                                
  File "examples/demo_mapping.py", line 65, in <module>
    main(bag_file)
  File "examples/demo_mapping.py", line 25, in main
    stats = lane_mapper.process()
  File "/catkin_ws/src/MonoLaneMapping/lane_slam/system/lane_mapping.py", line 41, in process
    self.map_update()
  File "/catkin_ws/src/MonoLaneMapping/lane_slam/system/lane_opt.py", line 32, in map_update
    self.build_graph()
  File "/catkin_ws/src/MonoLaneMapping/lane_slam/system/lane_opt.py", line 128, in build_graph
    self.initial_estimate.insert_or_assign(key, gtsam.Point3(ctrl_pt.item))
AttributeError: 'gtsam.gtsam.Values' object has no attribute 'insert_or_assign'

I have read some doc about GTSAM, some version have 'insert_or_assign' such as https://gtsam-jlblanco-docs.readthedocs.io/en/latest/_static/doxygen/html/classgtsam_1_1Values.html, but some not such as https://gtsam.org/doxygen/4.0.0/a03871.html.
So could you tell me your GTSAM version so that I could reproduce your great result? Thanks!
I am using "https://github.com/borglab/gtsam" branch called "4.1", which is 4.1.1 version

question about rosbag

Hello! Thank you for your work!

I feel confused when i use the rosbag, the msg lists are:

/gt_pose_wc
/lanes_gt
/lanes_predict

I print the /lanes_predict and noticed that the points in each detected lane are sparse. The distance between first few points is 5 meters, and the rear is 10 meters, or even 20 meters.

I know little about Persformer (っ °Д °;)っ, are these points sampled? Can i test my data directly with Persformer's results?

About OpenLane Datesets

Is the provided dataset missing? Upon downloading the provided dataset, I noticed that there are only two subdirectories inside the folder, 'rosbag' and 'test', and the 'training' and 'validation' directories are missing, resulting in the following error:
ileNotFoundError: [Errno 2] No such file or directory: '/home/ly/LaneMapping/catkin_ws/src/MonoLaneMapping/datasets/OpenLane/lane3d_1000/validation/segment-10203656353524179475_7625_000_7645_000_with_camera_labels/152268801497018700.json'
INFO - 2023-09-23 22:21:51,005 - core - signal_shutdown [atexit]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.