MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / _draw_2d_bbs

Method _draw_2d_bbs

leaderboard/team_code/base_agent.py:493–522  ·  view source on GitHub ↗

For debugging only Args: seg_img ([type]): [description] bbs ([type]): [description]

(self, seg_img, bbs)

Source from the content-addressed store, hash-verified

491 return bounding_boxes
492
493 def _draw_2d_bbs(self, seg_img, bbs):
494 """For debugging only
495
496 Args:
497 seg_img ([type]): [description]
498 bbs ([type]): [description]
499 """
500
501 for bb_type in bbs:
502
503 _region = np.zeros(seg_img.shape)
504
505 if bb_type == "traffic_light":
506 for bb in bbs[bb_type]:
507 _region = np.zeros(seg_img.shape)
508 box = bb['bb']
509 _region[box[0][1]:box[1][1],box[0][0]:box[1][0]] = 1
510 seg_img[(_region == 1)] = 23
511 else:
512
513 for bb in bbs[bb_type]:
514
515 _region[bb[0][1]:bb[1][1],bb[0][0]:bb[1][0]] = 1
516
517 if bb_type == "stop_sign":
518 seg_img[(_region == 1)] = 26
519 elif bb_type == "vehicles":
520 seg_img[(_region == 1)] = 10
521 elif bb_type == "pedestrians":
522 seg_img[(_region == 1)] = 4
523
524 def _find_obstacle_3dbb(self, obstacle_type, max_distance=50):
525 """Returns a list of 3d bounding boxes of type obstacle_type.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected