nutonomy / nuscenes-devkit

The devkit of the nuScenes dataset.
https://www.nuScenes.org
Other
2.25k stars 624 forks source link

About lane_divider and road_divider #1024

Closed admyxs closed 1 week ago

admyxs commented 8 months ago

I have two questions:

Q1. Why are there no lane_divider and road_divider in the six pictures, but they are rendered by the nuscnens devkit tool? (Too many annotations)

Q2. Why are the double yellow lines (road_divider) in the middle connected, but separated during rendering? (Too few annotations)

Thanks for your answer! ! ! image

admyxs commented 8 months ago

id is 1c9a906c40f6417bbe1cea06d6e55501

admyxs commented 8 months ago

thank your repley

I want to render 'lane_divider' and 'road_divider' by test, but it can`t render 'line'

the dataset is mini

this is my code

`

import matplotlib.pyplot as plt
import numpy as np

from nuscenes.eval.common.utils import quaternion_yaw, Quaternion
from nuscenes.map_expansion.map_api import NuScenesMap
from nuscenes.nuscenes import NuScenes

dataroot = './data/nuscenes'
nusc_map = NuScenesMap(dataroot=dataroot, map_name='boston-seaport')
nusc = NuScenes(version='v1.0-mini', dataroot=dataroot, verbose=False)

def my_render(patch_box, patch_angle):
    layer_names = ['drivable_area', 'road_divider', 'lane_divider']
    canvas_size = (500, 1000)
    map_mask = nusc_map.get_map_mask(patch_box, patch_angle, layer_names, canvas_size)
    map_mask[0]
    figsize = (12, 4)
    fig, ax = nusc_map.render_map_mask(patch_box, patch_angle, layer_names, canvas_size, figsize=figsize, n_row=1)
    plt.show()

def translation(ego2global_translation, ego2global_rotation):
    map_pose = ego2global_translation[:2]
    rotation = Quaternion(ego2global_rotation)

    patch_box = (map_pose[0], map_pose[1],
                 25.2, 51.6)
    patch_angle = quaternion_yaw(rotation) / np.pi * 180
    return patch_box, patch_angle

def render_image():
    sample_token = nusc.sample[73]['token']  # 73 is problem

    layer_names = ['road_segment', 'lane', 'ped_crossing', 'walkway', 'stop_line', 'carpark_area']
    camera_channel = 'CAM_FRONT'
    fix, ax = nusc_map.render_map_in_image(nusc, sample_token, layer_names=layer_names, camera_channel=camera_channel)
    plt.show()

if __name__ == '__main__':
    box, angle = translation([676.175869003755, 1586.7201573082466, 0.0],
        [-0.9364269899583694, -0.005800302847902614, 0.007008675859712403, 0.3507445329967024])

    my_render(box, angle)
    render_image()

` image

whyekit-motional commented 1 month ago

Why are there no lane_divider and road_divider in the six pictures, but they are rendered by the nuscnens devkit tool?

A lane divider demarcates a separation between lanes - it is not necessary that there is a painted line on the road (same reasoning for road dividers)

Why are the double yellow lines (road_divider) in the middle connected, but separated during rendering?

During annotation, a very long line could be broken up into shorter lines

I want to render 'lane_divider' and 'road_divider' by test, but it can`t render 'line'

render_map_in_image only works polygon layers (e.g. drivable_area, lane, ped_crossing) - pls see the following for more details: https://github.com/nutonomy/nuscenes-devkit/blob/4df2701feb3436ae49edaf70128488865a3f6ff9/python-sdk/nuscenes/map_expansion/map_api.py#L1058

admyxs commented 2 weeks ago

Why are there no lane_divider and road_divider in the six pictures, but they are rendered by the nuscnens devkit tool?

A lane divider demarcates a separation between lanes - it is not necessary that there is a painted line on the road (same reasoning for road dividers)

Why are the double yellow lines (road_divider) in the middle connected, but separated during rendering?

During annotation, a very long line could be broken up into shorter lines

I want to render 'lane_divider' and 'road_divider' by test, but it can`t render 'line'

render_map_in_image only works polygon layers (e.g. drivable_area, lane, ped_crossing) - pls see the following for more details:

https://github.com/nutonomy/nuscenes-devkit/blob/4df2701feb3436ae49edaf70128488865a3f6ff9/python-sdk/nuscenes/map_expansion/map_api.py#L1058

I think i have got it, thanks for your great work and reply!!!