Git Product home page Git Product logo

vectormapnet_code's Introduction

VectorMapNet_code

VectorMapNet: End-to-end Vectorized HD Map Learning ICML 2023

This is the official codebase of VectorMapNet

Yicheng Liu, Yuantian Yuan, Yue Wang, Yilun Wang, Hang Zhao

[Paper] [Project Page]

Abstract: Autonomous driving systems require High-Definition (HD) semantic maps to navigate around urban roads. Existing solutions approach the semantic mapping problem by offline manual annotation, which suffers from serious scalability issues. Recent learning-based methods produce dense rasterized segmentation predictions to construct maps. However, these predictions do not include instance information of individual map elements and require heuristic post-processing to obtain vectorized maps. To tackle these challenges, we introduce an end-to-end vectorized HD map learning pipeline, termed VectorMapNet. VectorMapNet takes onboard sensor observations and predicts a sparse set of polylines in the bird's-eye view. This pipeline can explicitly model the spatial relation between map elements and generate vectorized maps that are friendly to downstream autonomous driving tasks. Extensive experiments show that VectorMapNet achieve strong map learning performance on both nuScenes and Argoverse2 dataset, surpassing previous state-of-the-art methods by 14.2 mAP and 14.6mAP. Qualitatively, VectorMapNet is capable of generating comprehensive maps and capturing fine-grained details of road geometry. To the best of our knowledge, VectorMapNet is the first work designed towards end-to-end vectorized map learning from onboard observations.

Questions/Requests: Please file an issue or send an email to Yicheng.

Bibtex

If you found this paper or codebase useful, please cite our paper:

@inproceedings{liu2022vectormapnet,
        title={VectorMapNet: End-to-end Vectorized HD Map Learning},
        author={Liu, Yicheng and Yuantian, Yuan and Wang, Yue and Wang, Yilun and Zhao, Hang},
        booktitle={International conference on machine learning},
        year={2023},
        organization={PMLR}
    }

Run VectorMapNet

Note

0. Environment

Set up environment by following this script

1. Prepare your dataset

Store your data with following structure:

    root
        |--datasets
            |--nuScenes
            |--Argoverse2(optional)

1.1 Generate annotation files

Preprocess nuScenes

python tools/data_converter/nuscenes_converter.py --data-root your/dataset/nuScenes/

2. Evaluate VectorMapNet

Download Checkpoint

Method Modality Config Checkpoint
VectorMapNet Camera only config model link

Train VectorMapNet

In single GPU

python tools/train.py configs/vectormapnet.py

For multi GPUs

bash tools/dist_train.sh configs/vectormapnet.py $num_gpu

Do Evaluation

In single GPU

python tools/test.py configs/vectormapnet.py /path/to/ckpt --eval name

For multi GPUs

bash tools/dist_test.sh configs/vectormapnet.py /path/to/ckpt $num_gpu --eval name

Expected Results

$AP_{ped}$ $AP_{divider}$ $AP_{boundary}$ mAP
39.8 47.7 38.8 42.1

vectormapnet_code's People

Contributors

mrmoore98 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vectormapnet_code's Issues

Bad performance on nuScenes v1.0-mini

Hi! Thanks for making your code open! I tried use this code to test its performance on nuScenes v1.0 mini, but I got a bad performance about only 1% map after 130 epochs. My steps are as follows:

  1. Data process. I downloaded nuScenes v1.0 mini (3.88G) and the map expansion(0.38G). And I run python tools/data_converter/nuscenes_converter.py --data-root your/dataset/nuScenes/ --version v1.0-mini, getting two .pkl file successfully. My datasets directory is as follows:
    image

  2. Training. I set samples_per_gpu as 2 and works_per_gpu as 8. No other changes about the configs. And I run python tools/train.py configs/vectormapnet.py. There is no mistake during training, but the mAP is low.
    image

Here is the log file: https://naniko.obs.cn-central-221.ovaijisuan.com/VectorMap/result.zip

Did I do something wrong ?

replace backbone network

hi, dear authors, i tried to replace the backbone from IPM_encoder to the BEVDepth's LSS style, however, the gen_loss seems not converge after 2 epoch. Do you think it's ok to replace some network ?

Question about the train and results

Hello, I attempted to replicate your work, but the accuracy I obtained was significantly lower than the model accuracy that you provided. My mAP was only around 23. I am wondering if the config file that I used differs from the one that you actually used, as I noticed that the code defaults to using the gt input of bbox for the gen_net, rather than the output of det_net as reported in the paper.

Additionally, while debugging the program, I encountered instances where the batch size of some of the input queries was 0,

sequential_context_embeddings = image_embeddings.reshape(

which caused the program to crash. I have currently implemented a try statement to filter out this issue. Have you encountered this problem before?

MMDetection3D

I am currently trying to install MMDetection3D. Unfortunately I encountered a few issues while building the package from source. I've managed to work through most of the issues. Now the build process fails with the following error message:

/root/anaconda3/envs/compiler_compat/ld: cannot find /root/mmdetection3d-0.17.3/build/temp.linux-x86_64-cpython-38/mmdet3d/ops/spconv/src/reordering_cuda.o: No such file or directory

I have already checked that the CUDA_HOME and LD_LIBRARY_PATH environment variables are correctly set, and I have also verified that I have the correct version of CUDA installed (11.1). I also revised torch/utils/cpp_extension.py to work with the current ninja version.

If I don't plan to use lidar can I do without this package? It's already taken a long time to troubleshoot compile errors and I'm stumped by this one.

environment

mmdet3d 0.17.3 requires numpy<1.20.0, but av2 0.2.1 requires numpy>=1.21.5, how can I handle this conflict?

About IPM bev_plane heights setting

heights=[-1.1, 0, 0.5, 1.1],

Hi, we find that your model using [-1.1, 0, 0.5, 1.1] as the bev_planes' presetting heights. And your former work HDMapNet using only height 0.
But by our visualization, we find that using raw camera images as input to get BEV results with height -2 can get better BEV results(when height as -2, we can get clean BEV image with strong road semantic information, heights as yours setting the BEV image can't be found road information by eyes).
So we are curious about that there are better heights setting for IPM(for nuscenes data)?

The fluctuation problem of model training

When I reproduced the program file in vectormapnet.py, I found that the result fluctuated to a certain extent during multiple training with the same configuration. Up to 0.8 mAP (evaluated by chamfer distance) discrepancy occurs in two trainings under the very same configuration. Is this randomness normal in anyone else's reproduction? Will fixing random seeds in train.py helps in solving it?

Vectorization

Good morning, thank you for sharing your work. I would like to know how you implement the vectorization of the lane points or which methods you used to derive yours and if this method could work with lanes with a particular slope for example in a hill or mountains.

Thank you

More info about fine-tuning in experiments

Thanks for sharing the great work!

I noticed that you mentioned "using fine-tuning to handle the exposure bias" at the end of section 2. But you did not provide any additional info about how to fine-tune the predicted keypoints. Are there any details about the implementation?

Thanks for your consideration.

How to remove the bad result(low confidence) items?

@Mrmoore98 As you didn't provide the visualization code, so I generated the result for mini nuScenes dataset. But the result was not good enough for some cases. As I know you output the confidence for each item accordingly, so I was wondering how to use the confidence value to filter the bad result.
image

Problem with Checkpoint

work_dir: ./work_dirs/vectormapnet
collecting samples...
collected 81 samples in 0.00s
2023-07-05 14:38:13,830 - mmcv - INFO - load model from: open-mmlab://detectron2/resnet50_caffe
2023-07-05 14:38:13,830 - mmcv - INFO - Use load_from_openmmlab loader
2023-07-05 14:38:13,878 - mmcv - WARNING - The model and loaded state dict do not match exactly

unexpected key in source state_dict: conv1.bias

missing keys in source state_dict: layer3.0.conv2.conv_offset.weight, layer3.0.conv2.conv_offset.bias, layer3.1.conv2.conv_offset.weight, layer3.1.conv2.conv_offset.bias, layer3.2.conv2.conv_offset.weight, layer3.2.conv2.conv_offset.bias, layer3.3.conv2.conv_offset.weight, layer3.3.conv2.conv_offset.bias, layer3.4.conv2.conv_offset.weight, layer3.4.conv2.conv_offset.bias, layer3.5.conv2.conv_offset.weight, layer3.5.conv2.conv_offset.bias, layer4.0.conv2.conv_offset.weight, layer4.0.conv2.conv_offset.bias, layer4.1.conv2.conv_offset.weight, layer4.1.conv2.conv_offset.bias, layer4.2.conv2.conv_offset.weight, layer4.2.conv2.conv_offset.bias

Use load_from_local loader
The model and loaded state dict do not match exactly

unexpected key in source state_dict: conv1x1.weight

[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 81/81, 7.6 task/s, elapsed: 11s, ETA: 0sstart evaluation!
len of the results 81
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 81/81, 11455.6 task/s, elapsed: 0s, ETA: 0s
Done!
----------thershold:0.5----------
results path: ./work_dirs/vectormapnet/results_nuscence.pkl
metric: chamfer
threshold: -0.5
update: True
fix_interval: False
class_num: ['ped_crossing', 'divider', 'contours']
Formatting ...
Data formatting done in 1.658856s!!
cls:ped_crossing done in 0.008414s!!
cls:divider done in 0.015380s!!
cls:contours done in 0.020888s!!

+--------------+-----+------+--------+-------+
| class | gts | dets | recall | ap |
+--------------+-----+------+--------+-------+
| ped_crossing | 76 | 656 | 0.605 | 0.435 |
| divider | 460 | 1149 | 0.617 | 0.425 |
| contours | 282 | 1030 | 0.245 | 0.093 |
+--------------+-----+------+--------+-------+
| mAP | | | | 0.318 |
+--------------+-----+------+--------+-------+
----------thershold:1----------
results path: ./work_dirs/vectormapnet/results_nuscence.pkl
metric: chamfer
threshold: -1
update: False
fix_interval: False
class_num: ['ped_crossing', 'divider', 'contours']
Formatting ...
Data formatting done in 1.180227s!!
cls:ped_crossing done in 0.011127s!!
cls:divider done in 0.016809s!!
cls:contours done in 0.020043s!!

+--------------+-----+------+--------+-------+
| class | gts | dets | recall | ap |
+--------------+-----+------+--------+-------+
| ped_crossing | 76 | 656 | 0.934 | 0.887 |
| divider | 460 | 1149 | 0.876 | 0.806 |
| contours | 282 | 1030 | 0.628 | 0.459 |
+--------------+-----+------+--------+-------+
| mAP | | | | 0.717 |
+--------------+-----+------+--------+-------+
----------thershold:1.5----------
results path: ./work_dirs/vectormapnet/results_nuscence.pkl
metric: chamfer
threshold: -1.5
update: False
fix_interval: False
class_num: ['ped_crossing', 'divider', 'contours']
Formatting ...
Data formatting done in 1.196037s!!
cls:ped_crossing done in 0.013920s!!
cls:divider done in 0.015027s!!
cls:contours done in 0.022493s!!

+--------------+-----+------+--------+-------+
| class | gts | dets | recall | ap |
+--------------+-----+------+--------+-------+
| ped_crossing | 76 | 656 | 0.974 | 0.956 |
| divider | 460 | 1149 | 0.946 | 0.892 |
| contours | 282 | 1030 | 0.794 | 0.669 |
+--------------+-----+------+--------+-------+
| mAP | | | | 0.839 |
+--------------+-----+------+--------+-------+
ped_crossing: 0.7592802941799164
divider: 0.7075984378655752
contours: 0.40709205220143
map: 0.6246569280823072
VectormapNet Evaluation Results:
{'mAP': 0.6246569280823072}
{'mAP': 0.6246569280823072}

environment

How can I solve this problem? I have seen many blogs, but still doesn't solve.
image

Problems found during running the code using nuScenses 1.0-mini

Hi developers!

I just want to try the code using v1.0-mini dataet, but after I successfully ran the nuscenses_convertor.py, I met with problems while running python tools/train.py configs/vectormapnet.py, the log is as below:

Traceback (most recent call last):
  File "D:\Miniconda3\envs\vectormapnet\lib\site-packages\mmcv\utils\registry.py", line 69, in build_from_cfg
    return obj_cls(**args)
  File "E:\ZJU_Research\EXPLORE\VectorMapNet\plugin\datasets\nusc_dataset.py", line 35, in __init__
    super().__init__(
  File "E:\ZJU_Research\EXPLORE\VectorMapNet\plugin\datasets\base_dataset.py", line 57, in __init__
    self.pipeline = Compose(pipeline)
  File "e:\zju_research\explore\vectormapnet\mmdetection3d\mmdet3d\datasets\pipelines\compose.py", line 31, in __init__
    transform = build_from_cfg(transform, MMDET_PIPELINES)
  File "D:\Miniconda3\envs\vectormapnet\lib\site-packages\mmcv\utils\registry.py", line 72, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
FileNotFoundError: VectorizeLocalMap: [Errno 2] No such file or directory: './datasets/nuScenes\\maps\\expansion\\boston-seaport.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tools/train.py", line 261, in <module>
    main()
  File "tools/train.py", line 224, in main
    datasets = [build_dataset(cfg.data.train)]
  File "e:\zju_research\explore\vectormapnet\mmdetection3d\mmdet3d\datasets\builder.py", line 46, in build_dataset
    dataset = build_from_cfg(cfg, MMDET_DATASETS, default_args)
  File "D:\Miniconda3\envs\vectormapnet\lib\site-packages\mmcv\utils\registry.py", line 72, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
FileNotFoundError: NuscDataset: VectorizeLocalMap: [Errno 2] No such file or directory: './datasets/nuScenes\\maps\\expansion\\boston-seaport.json'

I found that in map_transform.py, you wrote:

        self.MAPS = ['boston-seaport', 'singapore-hollandvillage',
                     'singapore-onenorth', 'singapore-queenstown']

and I am wondering whether we can use the v1.0-mini to execute the code and if yes, how to solve the problem? Should I manually download this map files to corrsponding positions?

Thanks!

the problem in map_transform.py

in
def poly_geoms_to_vectors(self, polygon_geoms: list):
for geom in polygon_geoms:
for poly in geom:
exteriors.append(poly.exterior)

show that
'MultiPolygon' object has no attribute 'exterior'

i check the gorms:
[<MULTIPOLYGON (((5.806 -12.166, 6.497 -12.139, 16.382 -11.565, 19.506 -11.43...>]
[<MULTIPOLYGON (((15.928 -12.742, 16.621 -15, 12.609 -15, 8.42 -15, 8.306 -15...>]
[<MULTIPOLYGON (((-30 -6.392, -30 -4.398, -29.721 -4.36, -26.824 -3.96, -24.6...>]
[<MULTIPOLYGON (((-27.27 -8.146, -26.997 -8.141, -26.404 -8.041, -25.868 -7.7...>]

whether this problem arise for my use the mini-data(nuscenes) or not

hope for some reply

Effect of large sampling rate on features

hello, dear author , do you have vertified that if downsample the rate from 4 to 16, the model has a drop on performance ?
like this one
in_channels=[256, 512, 1024, 2048],
upsample_strides=[0.25, 0.5, 1, 2],
out_channels=[128, 128, 128, 128],

为什么不用bevformer检测地图元素

bevformer代码在去年五月左右开源。
作者为什么先采用IPM生成bev特征,然后使用类似于Deter-head检测地图元素,而不是使用bevformer直接检测出地图元素呢,请问是因为效果不好,还是没有尝试过呢?

Trajectory Prediction

Hi, thanks for your great work! I am wondering would you provide any code that can verify the result with the downstream prediction that you presented in your paper. Thanks!

config file for camera + lidar

Hello VectorMapNet team,

I'm trying to train this model with camera + lidar (fusion) and facing some issues. I modified the config file to:

input_modality = dict(
    use_lidar=True,
    use_camera=True,
    use_radar=False,
    use_map=False,
    use_external=False)

and added use_lidar=True inside model/backbone in config. After the following changes, I got this error:

  File "vector_map_net/plugin/models/mapers/base_mapper.py", line 91, in forward
    return self.forward_train(*args, **kwargs)
  File "vector_map_net/plugin/models/mapers/vectormapnet.py", line 109, in forward_train
    _bev_feats = self.backbone(img, img_metas=img_metas, points=points)
  File "/home/ubuntu/venv_lane_line_gt/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "vector_map_net/plugin/models/backbones/ipm_backbone.py", line 230, in forward
    lidar_feat = self.get_lidar_feature(points)
  File "vector_map_net/plugin/models/backbones/ipm_backbone.py", line 286, in get_lidar_feature
    ptensor, pmask = points
TypeError: cannot unpack non-iterable NoneType object

Looks like points is None, Can you help in fixing this issue.

About thresholds of Chamfer distance

hi,
{0.5, 1.0, 1.5} are the predefined thresholds of Chamfer distance in paper, Are they physical distances on the BEV? Do they need to be converted to pixel distances for evaluation?

why CD thresholds set are [2, 4, 6] in hdmapnet code?

thanks!

the output of the network

Hello:
I have a question about network output.
I see that the description of the output of the detection layer in the paper is the key point of the output. But I see that there is a bbox item in the output of the network, and I don't quite understand what this item refers to?

output:
{'bboxes': array([[6.78633928e-01, 6.01761818e+01, 1.93001175e+02, 6.79676743e+01],
[1.08551838e-01, 4.70667648e+01, 1.86040192e+02, 5.29992828e+01],
[6.80525422e-01, 2.62875919e+01, 1.92955597e+02, 3.81990242e+01],
[1.02617390e-01, 3.25979652e+01, 1.84140854e+02, 4.01845512e+01],
[1.05492517e-01, 5.98437958e+01, 1.91393829e+02, 6.87072525e+01],
[1.81369720e+02, 2.33432560e+01, 1.93190247e+02, 5.72784538e+01],
[1.88910370e+02, 4.01633382e-01, 1.93277222e+02, 8.93388557e+00],
[1.79586243e+02, 2.42032280e+01, 1.93305893e+02, 4.72062874e+01],
[1.91144730e+02, 2.27989311e+01, 1.93756271e+02, 2.95024147e+01],
[6.78633928e-01, 6.01761818e+01, 1.93001175e+02, 6.79676743e+01],
[1.90761978e+02, 2.59762257e-01, 1.94180695e+02, 5.82593441e+00],
[1.90761978e+02, 2.59762257e-01, 1.94180695e+02, 5.82593441e+00],
[6.80525422e-01, 2.62875919e+01, 1.92955597e+02, 3.81990242e+01],
[1.85216492e+02, 2.65239029e+01, 1.93401489e+02, 3.85059166e+01],
[1.02617390e-01, 3.25979652e+01, 1.84140854e+02, 4.01845512e+01],
[2.76825070e-01, 3.56894493e+01, 7.70324850e+00, 6.78138351e+01],
[1.85932480e+02, 3.02446365e+01, 1.94091919e+02, 5.06113396e+01],
[1.39293045e-01, 3.63400269e+01, 4.07710886e+00, 3.95115547e+01],
[1.15843095e-01, 4.77807922e+01, 6.45543623e+00, 5.14295387e+01],
[3.00876260e-01, 3.58237915e+01, 1.86568237e+02, 4.11329613e+01],
[5.80193043e-01, 6.37207260e+01, 1.93202469e+02, 8.26292801e+01],
[1.39293045e-01, 3.63400269e+01, 4.07710886e+00, 3.95115547e+01],
[6.78633928e-01, 6.01761818e+01, 1.93001175e+02, 6.79676743e+01],
[1.81008484e+02, 8.73821945e+01, 1.94158020e+02, 9.38624649e+01],
[1.81397156e+02, 6.52198868e+01, 1.93095413e+02, 9.34513397e+01],
[1.81397156e+02, 6.52198868e+01, 1.93095413e+02, 9.34513397e+01],
[1.90826172e+02, 1.05982714e+01, 1.93410660e+02, 2.62504349e+01],
[1.88526321e+02, 5.90005226e+01, 1.94155319e+02, 6.37259140e+01],
[1.79007812e+02, 2.92288876e+01, 1.92638367e+02, 3.67737999e+01],
[1.08551838e-01, 4.70667648e+01, 1.86040192e+02, 5.29992828e+01],
[2.93112993e-01, 5.80386937e-01, 4.47237730e+00, 2.74098625e+01],
[2.76825070e-01, 3.56894493e+01, 7.70324850e+00, 6.78138351e+01],
[1.81008484e+02, 8.73821945e+01, 1.94158020e+02, 9.38624649e+01],
[1.81369720e+02, 2.33432560e+01, 1.93190247e+02, 5.72784538e+01],
[1.81008484e+02, 8.73821945e+01, 1.94158020e+02, 9.38624649e+01]],
dtype=float32),
'det_gt': {'labels': array([2, 2, 0, 1, 1, 1]), 'bboxes': array([[6.45161280e-01, 2.52892107e+01, 1.92903221e+02, 3.84038806e+01],
[6.45161280e-01, 5.85715175e+01, 1.92903221e+02, 6.65090799e+01],
[1.83304691e+02, 2.39421144e+01, 1.92903221e+02, 6.25449777e+01],
[1.00000000e-01, 3.21644127e+01, 1.79604363e+02, 3.84038806e+01],
[1.00000000e-01, 5.85715175e+01, 1.85901928e+02, 6.65090799e+01],
[1.00000000e-01, 4.58673418e+01, 1.82653165e+02, 5.14953911e+01]])},

Vectorized map problem

Can you provide an instruction document explaining the general process of converting a raster map to a vector map? There is a lot of code involved and it would be easier to understand with the help of documentation. It is also convenient to use other datasets for training

When is the code open source?

Hey, I pay attention to your work, which is very excellent. When is the code open source? Look forward to your reply.

Different types of key points

In paper, you use bbox, sme and extreme pts as 3 types of key-points and predict them in map element detector.
In code, it seems map element detector only uses bbox, is my observation wrong? or just the last 2 types of key-points unnecessary?

Looking forward to your reply.
Thx for your good work.

problems about nuScenes datasets

Hi developers!

I just want to try the code using v1.0-mini dataet, but after I successfully ran the nuscenses_convertor.py, I met with problems while running python tools/train.py configs/vectormapnet.py, the log is as below:

collecting samples...
collected 323 samples in 0.01s
Traceback (most recent call last):
  File "/home/long/anaconda3/envs/vechdmap/lib/python3.8/site-packages/mmcv/utils/registry.py", line 51, in build_from_cfg
    return obj_cls(**args)
  File "/home/long/VectorMapNet_code-mian/plugin/datasets/pipelines/map_transform.py", line 65, in __init__
    self.nusc_maps[loc] = NuScenesMap(
  File "/home/long/anaconda3/envs/vechdmap/lib/python3.8/site-packages/nuscenes/map_expansion/map_api.py", line 100, in __init__
    raise Exception('Error: You are using an outdated map version (%s)! '
Exception: Error: You are using an outdated map version (%s)! Please go to https://www.nuscenes.org/download to download the latest map!

But i did download the map from the official website. Do you have a better solution?
Thanks!

Some question about training

Were Map Element Detector and Polyline Generator trained simultaneously?Or Map Element Detector should be trained first?Looking forward to your kindly reply

Export model to ONNX

Hello I tried to export VectorMapNet loaded with the given checkpoint to ONNX, but I can't figure up how to pass the input to the export call:

# model is init like in tools/test.py
model = build_model(cfg.model, test_cfg=cfg.get('test_cfg'))
...

mm = MMDataParallel(model, device_ids=[0])

dataset = build_dataset(cfg.data.test)
data_loader = build_dataloader(
        dataset,
        samples_per_gpu=1,
        workers_per_gpu=1,
        dist=False,
        shuffle=False)

for i, data in enumerate(data_loader):
    torch.onnx.export(mm.module, args=data, f='VectorMapNet.onnx')
    break

But this fails with: RuntimeError: Only tuples, lists and Variables are supported as JIT inputs/outputs. Dictionaries and strings are also accepted, but their usage is not recommended. Here, received an input of unsupported type: DataContainer I don't exactly know what are the input and output tensors of the model.

I also tried to use:

from torchviz import make_dot

for i, data in enumerate(data_loader):
        with torch.no_grad():
            yhat = mm(return_loss=False, rescale=True, **data)
            break

make_dot(yhat, params=dict(list(mm.module.named_parameters()))).render("VectorMapNet", format="png")

to just plot the model, to get a better insight, but this fails with TypeError: unhashable type: 'list' I think because make_dot() can't handle the post processed yhat prediction from the mm() call.

So how could you export the VectorMapNet to ONNX? I'm really new to torch.

Checkpoint state_dict doesn't match. unexpected key. missing keys.

Hi, the state_dict checkpoint doesn't match the current model.
I'm wondering how to obtain a matching one.
This was also pointed out as a sub-issue in #14.

$ python tools/test.py configs/vectormapnet.py /home/me/vectormapnet.pth  --eval name
<frozen importlib._bootstrap>:219: RuntimeWarning: scipy._lib.messagestream.MessageStream size changed, may indicate binary incompatibility. Expected 56 from C header, got 64 from PyObject
plugin
work_dir:  ./work_dirs/vectormapnet
collecting samples...
collected 6019 samples in 0.30s
2023-12-13 01:44:03,157 - mmcv - INFO - load model from: open-mmlab://detectron2/resnet50_caffe
2023-12-13 01:44:03,158 - mmcv - INFO - Use load_from_openmmlab loader
Downloading: "https://download.openmmlab.com/pretrain/third_party/resnet50_msra-5891d200.pth" to /root/.cache/torch/hub/checkpoints/resnet50_msra-5891d200.pth
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 89.9M/89.9M [00:04<00:00, 20.0MB/s]
2023-12-13 01:44:13,163 - mmcv - WARNING - The model and loaded state dict do not match exactly

unexpected key in source state_dict: conv1.bias

missing keys in source state_dict: layer3.0.conv2.conv_offset.weight, layer3.0.conv2.conv_offset.bias, layer3.1.conv2.conv_offset.weight, layer3.1.conv2.conv_offset.bias, layer3.2.conv2.conv_offset.weight, layer3.2.conv2.conv_offset.bias, layer3.3.conv2.conv_offset.weight, layer3.3.conv2.conv_offset.bias, layer3.4.conv2.conv_offset.weight, layer3.4.conv2.conv_offset.bias, layer3.5.conv2.conv_offset.weight, layer3.5.conv2.conv_offset.bias, layer4.0.conv2.conv_offset.weight, layer4.0.conv2.conv_offset.bias, layer4.1.conv2.conv_offset.weight, layer4.1.conv2.conv_offset.bias, layer4.2.conv2.conv_offset.weight, layer4.2.conv2.conv_offset.bias

Use load_from_local loader
The model and loaded state dict do not match exactly

unexpected key in source state_dict: conv1x1.weight

Result visualization

Hi, I managed to run your evaluation script and got the same result.
In the next step I would like to visualize the predicted map as BEV figures which are shown in the paper.
Can you tell me which scripts do you use for this task?

Thank you a lot

Doubt regading prediction with VectorMapNet model

I crop this snippet in dghead.py which is used to perform prediction. It checked and see that batch seems to contain the ground-truth detection (class labels and bounding boxes in batch['det']). Since VectorMapNet supposes to be an end-to-end map learning model, I don't understand why ground truth is require to perform inference here . Did I understand something wrong here?

I want to use your model make prediction with my custom camera data, can you suggest on how to do it?

    @torch.no_grad()
    def inference(self, batch: dict, context: dict, gt_condition=False, **kwargs):
        '''
            num_samples_batch: number of sample per batch (batch size)
        '''
        outs = {}
        bbox_dict = self.det_net(batch['det'], context=context)
        bbox_dict = self.det_net.post_process(bbox_dict)
        

map visualization

when i gonna to visualize the map, i cann't find the cfg file? could you release it, please?
2022-11-07 10-45-52 的屏幕截图

mmdetection3d-0.17.3/mmdet3d/ops/roiaware_pool3d/roiaware_pool3d_ext.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c1015SmallVectorBaseIjE8grow_podEPvmm

hello, it's a good job and thanks for you sharing.
when i prepare the data and run the command "python tools/data_converter/nuscenes_converter.py --data-root /data/public/datasets/nuscenes", i met the error like this:
from . import roiaware_pool3d_ext
ImportError: /home/engineers/maoruiwang/codes/code_map/VectorMapNet_code/mmdetection3d-0.17.3/mmdet3d/ops/roiaware_pool3d/roiaware_pool3d_ext.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c1015SmallVectorBaseIjE8grow_podEPvmm

it seems that the pytorch and cuda version doesn't match, and my envs are:

import torch as t
t.version
'1.10.0+cu113'
import mmdet
import mmcv
mmdet.version
'2.27.0'
mmcv.version
'1.4.0'
hope for reply, thanks.

Evaluation error

Hi, when i evaluate this network, i got this error, ( RuntimeError: CUDA out of memory. Tried to allocate 1.05 GiB (GPU 0; 5.80 GiB total capacity; 2.91 GiB already allocated; 686.94 MiB free; 3.72 GiB reserved in total by PyTorch)), do you have some suggestions?

How to test with Argoverse2 ?

Hi, thanks for this great work.

Is there config and model for Argoverse2 dataset available? Do we need to train a new model with Argoverse2 dataset or can use the given model ?

Best regards

Visualization

Hi author, thanks for posting the code. I noticed that there is a visualization folder, but is there any specific instructions about how to run it? As 'data' appears to have three keys only ['img_metas', 'img', 'polys'] and the rendering would not work.

Really appreciate for your help and looking forward to your reply!

Some question in paper

  1. Does 1 query be responsible for 1 instance lane?
  2. How to predict all points of a lane in parallel?
  3. In key points detection stage, is output shape like (N, k, 2), (N, cls_num), where N is num_query, k is num_key_point ?
  4. After hungarian matching, will only matched query be used for polyline generation?

data preparation

I want to know how to prepare my training test data and get a data structure that is exactly the same as your data tree and can be used for training, can you help me?

R50 pretrain model

Hi!Could you provide the r50 pretrain model used in the config? I use a r50 with ImageNet pretrain, but I got a bad result with mAP 0.34.

Eval error on test-data

hi, first of all I would like to express my admiration about the good work you have here. wenn i use nuscees-test data to evaluate this model, i got this error! could you give me some advice?
Screenshot from 2023-09-11 14-44-30

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.