Skip to content

Commit

Permalink
Merge branch 'final_data_collection' of https://github.com/Cubevoid/a…
Browse files Browse the repository at this point in the history
…tari-obj-pred into final_data_collection
  • Loading branch information
quajak committed Apr 17, 2024
2 parents 6e22aa2 + b3ee2b5 commit 359fc8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scripts/dataset_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def calculate_iou(boxes1, boxes2):
boxes2_area = (x2_2 - x1_2) * (y2_2 - y1_2)
union_area = boxes1_area + boxes2_area - intersection_area
iou = np.where(union_area > 0, intersection_area / union_area, 0)
return iou
return np.clip(iou, 0, 1)


def main(game: str) -> None:
Expand All @@ -41,7 +41,7 @@ def main(game: str) -> None:
num_frames = min(len(dl_sam.frames), len(dl_fastsam.frames))
print(f"Number of frames: {num_frames}")
objects_sam = dl_sam.object_bounding_boxes[:num_frames] # [T, O, 4]
objects_fastsam = dl_sam.object_bounding_boxes[:num_frames] # [T, O, 4]
objects_fastsam = dl_fastsam.object_bounding_boxes[:num_frames] # [T, O, 4]
obj_per_frame_sam = np.count_nonzero(objects_sam[:, :, :2].sum(-1), axis=-1)
obj_per_frame_fastsam = np.count_nonzero(objects_fastsam[:, :, :2].sum(-1), axis=-1)
print(f"Average number of objects per frame for SAM: {np.mean(obj_per_frame_sam)}")
Expand Down

0 comments on commit 359fc8c

Please sign in to comment.