You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def sort_lanes_based_on_point_in_polygon_score(
self,
lane_seqs: List[List[int]],
xy_seq: np.ndarray,
city_name: str,
avm: ArgoverseMap,
) -> List[List[int]]:
"""Filter lane_seqs based on the number of coordinates inside the bounding polygon of lanes.
Args:
lane_seqs: Sequence of lane sequences
xy_seq: Trajectory coordinates
city_name: City name (PITT/MIA)
avm: Argoverse map_api instance
Returns:
sorted_lane_seqs: Sequences of lane sequences sorted based on the point_in_polygon score
"""
point_in_polygon_scores = []
for lane_seq in lane_seqs:
point_in_polygon_scores.append(
self.get_point_in_polygon_score(lane_seq, xy_seq, city_name,
avm))
randomized_tiebreaker = np.random.random(len(point_in_polygon_scores))
sorted_point_in_polygon_scores_idx = np.lexsort(
(randomized_tiebreaker, np.array(point_in_polygon_scores)))[::-1]
sorted_lane_seqs = [
lane_seqs[i] for i in sorted_point_in_polygon_scores_idx
]
sorted_scores = [
point_in_polygon_scores[i]
for i in sorted_point_in_polygon_scores_idx
]
return sorted_lane_seqs, sorted_scores
why using the randomized_tiebreaker in the function?
sort by point_in_polygon_scores first and then sort by the random value?
The text was updated successfully, but these errors were encountered:
That's a good question. Point in polygon score is likely to sort the lane sequences such that similar lane sequences will be nearby in the order. Randomized tie-breaker helps in complementing those with diverse lane sequences.
For eg. Consider an actor approaching an intersection. There are multiple straight through lane sequences because of the branching at the next intersection. If we have to select 3 lane sequences, we'd prefer left, right and straight ones.
The point in polygon score will not be able to account for the overlap in the straight-through ones.
Randomized tie-breaker on top of point in polygon will improve the chances of choosing our preferred 3 lane sequences.
thanks for sharing.
why using the randomized_tiebreaker in the function?
sort by point_in_polygon_scores first and then sort by the random value?
The text was updated successfully, but these errors were encountered: