From 8c31794aadc35826c5a0ccc542fbab352401e3fb Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Thu, 25 Jul 2019 13:30:01 +0200 Subject: [PATCH] Make sure trajectories are sorted before preparing them for Python Signed-off-by: Jim Martens --- src/twomartens/masterthesis/data.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/twomartens/masterthesis/data.py b/src/twomartens/masterthesis/data.py index 1742c0f..fbee9f2 100644 --- a/src/twomartens/masterthesis/data.py +++ b/src/twomartens/masterthesis/data.py @@ -604,11 +604,12 @@ def prepare_scenenet_data(data_path: str, protobuf_path: str) -> Tuple[List[List trajectories = scenenet_pb2.Trajectories() with open(protobuf_path, 'rb') as file: trajectories.ParseFromString(file.read()) - + + sorted_trajectories = sorted(trajectories.trajectories, key=lambda k: k.render_path) file_names_photos = [] file_names_instances = [] instances = [] - for trajectory in tqdm.tqdm(trajectories.trajectories, desc="preparing trajectories"): + for trajectory in tqdm.tqdm(sorted_trajectories, desc="preparing trajectories"): path = f"{data_path}/{trajectory.render_path}" file_names_photos_traj = [] file_names_instances_traj = []