From e20167182f30ee3b7551eb6d86905866eee51ca9 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Mon, 22 Jul 2019 16:32:47 +0200 Subject: [PATCH] Added measurement of usable frames Signed-off-by: Jim Martens --- src/twomartens/masterthesis/cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/twomartens/masterthesis/cli.py b/src/twomartens/masterthesis/cli.py index a922d51..b8531b1 100644 --- a/src/twomartens/masterthesis/cli.py +++ b/src/twomartens/masterthesis/cli.py @@ -114,12 +114,16 @@ def _measure(instances: Sequence[Sequence[Sequence[dict]]], for i, trajectory in enumerate(instances): counts = {cat_id: 0 for cat_id in cats_to_classes.keys()} + usable_frames = 0 for labels in trajectory: + if labels: + usable_frames += 1 for instance in labels: counts[instance['coco_id']] += 1 + pickle_content = {"usable_frames": usable_frames, "instance_counts": counts} with open(f"{output_path}/{str(i).zfill(nr_digits)}.bin", "wb") as file: - pickle.dump(counts, file) + pickle.dump(pickle_content, file) def _config_execute_action(args: argparse.Namespace, on_get: callable,