Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring #107

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions logreplay/sensors/semantic_lidar.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,10 @@ def tick(self):
vehicle_idx = self.obj_idx[self.obj_tag == 10]
# each individual instance id
vehicle_unique_id = list(np.unique(vehicle_idx))
vehicle_id_filter = []

for veh_id in vehicle_unique_id:
if vehicle_idx[vehicle_idx == veh_id].shape[0] > self.thresh:
vehicle_id_filter.append(veh_id)

vehicle_id_filter = [
veh_id for veh_id in vehicle_unique_id
if vehicle_idx[vehicle_idx == veh_id].shape[0] > self.thresh
]

# these are the ids that are visible
return vehicle_id_filter
24 changes: 6 additions & 18 deletions opencood/utils/eval_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,9 @@ def voc_ap(rec, prec):
for i in range(len(mpre) - 2, -1, -1):
mpre[i] = max(mpre[i], mpre[i + 1])

i_list = []
for i in range(1, len(mrec)):
if mrec[i] != mrec[i - 1]:
i_list.append(i)

ap = 0.0
for i in i_list:
ap += ((mrec[i] - mrec[i - 1]) * mpre[i])
i_list = [i for i in range(1, len(mrec)) if mrec[i] != mrec[i - 1]]

ap = np.dot([mrec[i] - mrec[i - 1] for i in i_list], [mrec[i] for i in i_list])
return ap, mrec, mpre


Expand Down Expand Up @@ -110,16 +105,9 @@ def calculate_ap(result_stat, iou):

gt_total = iou_5['gt']

cumsum = 0
for idx, val in enumerate(fp):
fp[idx] += cumsum
cumsum += val

cumsum = 0
for idx, val in enumerate(tp):
tp[idx] += cumsum
cumsum += val

fp = np.cumsum(fp)
tp = np.cumsum(tp)

rec = tp[:]
for idx, val in enumerate(tp):
rec[idx] = float(tp[idx]) / gt_total
Expand Down