yaghi27 commited on
Commit
e69d1ae
·
1 Parent(s): 099b4aa

Update model/utils.py

Browse files
Files changed (1) hide show
  1. model/utils.py +8 -6
model/utils.py CHANGED
@@ -12,8 +12,8 @@ def plot_bev_detections(
12
  ):
13
 
14
  class_names = [
15
- 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', 'car',
16
- 'motorcycle', 'bicycle', 'traffic_cone', 'pedestrian'
17
  ]
18
 
19
  # 1) Create figure & axes
@@ -36,7 +36,8 @@ def plot_bev_detections(
36
  cmap = plt.get_cmap('tab10') # up to 10 distinct colors
37
  num_classes = len(class_names)
38
  colors = {i: cmap(i % 10) for i in range(num_classes)}
39
-
 
40
  # 5) Draw each box
41
  seen_labels = set()
42
  for box, score, label in zip(boxes, scores, labels):
@@ -65,9 +66,10 @@ def plot_bev_detections(
65
  # 6) Legend only for seen classes
66
  legend_handles = []
67
  for cls_idx in sorted(seen_labels):
68
- legend_handles.append(
69
- patches.Patch(color=colors[cls_idx], label=class_names[cls_idx])
70
- )
 
71
  ax.legend(handles=legend_handles, loc='upper right')
72
 
73
  # 7) Axes limits and labels
 
12
  ):
13
 
14
  class_names = [
15
+ 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', 'pedestrian',
16
+ 'motorcycle', 'bicycle', 'traffic_cone', 'car'
17
  ]
18
 
19
  # 1) Create figure & axes
 
36
  cmap = plt.get_cmap('tab10') # up to 10 distinct colors
37
  num_classes = len(class_names)
38
  colors = {i: cmap(i % 10) for i in range(num_classes)}
39
+ colors[1] = 'white'
40
+
41
  # 5) Draw each box
42
  seen_labels = set()
43
  for box, score, label in zip(boxes, scores, labels):
 
66
  # 6) Legend only for seen classes
67
  legend_handles = []
68
  for cls_idx in sorted(seen_labels):
69
+ if cls_idx != 1:
70
+ legend_handles.append(
71
+ patches.Patch(color=colors[cls_idx], label=class_names[cls_idx])
72
+ )
73
  ax.legend(handles=legend_handles, loc='upper right')
74
 
75
  # 7) Axes limits and labels