Thinklab-SJTU / Bench2Drive

Closed-loop multi-ability evaluation of end-to-end autonomous driving algorithms
Apache License 2.0
327 stars 18 forks source link

About static vehicle's bounding box #13

Open zhanghui75 opened 1 week ago

zhanghui75 commented 1 week ago

In you data_collect.py, I found that the bbox of static vehicles are determined by two API calls, and the match between them are set up, like the following (line 1254, data_collect.py).

I found that a quite loose threshold 20 is used (i.e. 'if min_dis > 20:' as below), implying that the two bbox results (i.e. vehicles.static, and vehicles_static_bbox) are quite different. Do you know why the bbox locations between these two results are quite different? Should some transformation be applied to align them?

Furthermore, it seems that get_level_bbs API can't obtain bounding boxes for all vehicles.statc, in my experiments (i.e. the number of returned bboxes from get_level_bbs is much less than the number of vehicles.static). Do you also have such observations? Is there some solution to this problem?


here is your code in data_collect.py

vehicles.static

    car_bbox_list = self.world.get_level_bbs(carla.CityObjectLabel.Car) 
    ......
    vehicles_static_bbox = car_bbox_list + bicycle_list + bus_list + motorcycle_list + train_list + truck_list
    vehicles_static_bbox_nearby = []
    for v_s in vehicles_static_bbox:
        if compute_2d_distance(v_s.location, self.manager.ego_vehicles[0].get_transform().location) < (DIS_LIGHT_SAVE + 20):
            vehicles_static_bbox_nearby.append(v_s)
    for npc in vehicles.static:  
        if not npc.is_alive: continue
        new_bbox = None
        min_dis = 50
        for vehicle_bbox in vehicles_static_bbox_nearby:
            dis = compute_2d_distance(npc.get_transform().location, vehicle_bbox.location)
            if dis < min_dis:
                new_bbox = vehicle_bbox
                min_dis = dis
        if min_dis > 20:   #quite loose threshold here.
            continue
        if not new_bbox:
            raise Exception('new_bbox is None')
        if new_bbox not in vehicles_static_bbox_nearby:
            raise Exception('new_bbox not in vehicles_static_bbox_nearby')
        vehicles_static_bbox_nearby.remove(new_bbox)
        npc_id = str(npc.id)
        # location = new_bbox.location
        # rotation = new_bbox.rotation
        # center = new_bbox.location
        extent = new_bbox.extent
jayyoung0802 commented 1 week ago

Hi, here are several key points:

  1. vehicles.static is not a vehicle actor (line 1022). Instead, we retrieve it using the API CarlaDataProvider.get_world().get_actors('static.prop.mesh') (line 1031).

  2. The bounding boxes for vehicles.static obtained with get_actors('static.prop.mesh') were found to be inaccurate after visualization.

  3. We used the API get_level_bbs to get bounding boxes. However, this API only returns bounding boxes and cannot provide other information about the vehicles, nor can it achieve one-to-one correspondence.

  4. Therefore, we implemented simple distance matching to establish a one-to-one correspondence.