11# Copyright 2021 Toyota Research Institute. All rights reserved.
22import argparse
3- import logging
4- import time
5- from collections import Counter
6- from copy import deepcopy
7- from pathlib import Path
83
94import cv2
105import matplotlib .pyplot as plt
116import numpy as np
127import seaborn as sns
13- from IPython .display import Image , Video
148from moviepy .editor import ImageSequenceClip
159from tqdm import tqdm
1610
1711from dgp .constants import (vehicle_applanix_origin_to_r_bumper , vehicle_height , vehicle_length , vehicle_width )
18- from dgp .datasets .agent_dataset import AgentDataset , AgentDatasetLite
19- from dgp .datasets .synchronized_dataset import (SynchronizedScene , SynchronizedSceneDataset )
12+ from dgp .datasets .agent_dataset import AgentDatasetLite
2013from dgp .utils .pose import Pose
2114from dgp .utils .structures .bounding_box_3d import BoundingBox3D
2215from dgp .utils .visualization_utils import visualize_bev
@@ -44,8 +37,6 @@ def render_agent_bev(
4437 # Drawing code, create a pallet
4538 pallet = list (sns .color_palette ("hls" , 32 ))
4639 pallet = [[np .int (255 * a ), np .int (255 * b ), np .int (255 * c )] for a , b , c in pallet ]
47- # draw unmatched in a dark gray color
48- unmatched = [50 , 50 , 50 ]
4940
5041 def get_random_color ():
5142 idx = np .random .choice (len (pallet ))
@@ -57,9 +48,6 @@ def get_random_color():
5748 prior_pose = None
5849 max_path_len = 15
5950
60- agent_frames = []
61- agent_idx = None
62-
6351 for k in tqdm (range (0 , len (agent_dataset ))):
6452 context = agent_dataset [k ]
6553 lidar = context [0 ]["datums" ][1 ]
@@ -162,9 +150,9 @@ def get_random_color():
162150 batch_per_agent = True
163151 )
164152
165- ontology = agent_dataset_lite .Agent_dataset_metadata .ontology_table .get ('bounding_box_3d' , None )
153+ ont = agent_dataset_lite .Agent_dataset_metadata .ontology_table .get ('bounding_box_3d' , None )
166154
167- frames = render_agent_bev (agent_dataset_frame , ontology )
155+ bev_frames = render_agent_bev (agent_dataset_frame , ont )
168156
169157 a = [agent_dataset_frame .dataset_item_index [k ][0 ] for k in range (len (agent_dataset_frame ))]
170158
@@ -174,7 +162,7 @@ def get_random_color():
174162
175163 plt .figure (figsize = (20 , 20 ))
176164
177- clip = ImageSequenceClip (frames [frame_num :frame_num + a .count (i )], fps = 10 )
165+ clip = ImageSequenceClip (bev_frames [frame_num :frame_num + a .count (i )], fps = 10 )
178166 clip .write_gif ('test_scene' + str (i ) + '.gif' , fps = 10 )
179167 frame_num += a .count (i )
180168 print (frame_num )
0 commit comments