def _viz_tracklets(self): print("viz tracklets frame", self._time_idx) import matplotlib.pyplot as plt from matplotlib.patches import Rectangle if self._ax is None: fig, self._ax = plt.subplots(1) colors = generate_colors() t = self._time_idx img = self._imgs_for_viz[-1] self._ax.clear() self._ax.imshow(img[..., ::-1]) for idx, tracklet in enumerate(self._all_tracklets): # probably filter by confidence and tracklet length if tracklet.end_time - tracklet.start_time < 2: continue if max(tracklet.ff_gt_scores) < 0.2: continue if tracklet.start_time <= t < tracklet.end_time: color = colors[idx % len(colors)] box = tracklet.boxes[t - tracklet.start_time] width = box[2] - box[0] height = box[3] - box[1] rect = Rectangle((box[0], box[1]), width, height, color=color, fill=False) self._ax.add_patch(rect)
def _viz_tracklets(self): print("viz tracklets frame", self._time_idx) import cv2 self._cv_img = self._imgs_for_viz[-1].copy() colors = generate_colors() t = self._time_idx for idx, tracklet in enumerate(self._all_tracklets): # probably filter by confidence and tracklet length #if tracklet.end_time - tracklet.start_time < 2: # continue if max(tracklet.ff_gt_scores) < 0.2: continue if tracklet.start_time <= t < tracklet.end_time: color = colors[idx % len(colors)] box = tracklet.boxes[t - tracklet.start_time]