Skip to content

Commit 3f09ae7

Browse files
committed
feat: add option to randomize order of images
1 parent 417a5fa commit 3f09ae7

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

mapswipe_workers/mapswipe_workers/project_types/street/project.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def __init__(self, project_draft):
5151
start_time=project_draft.get("startTimestamp", None),
5252
end_time=project_draft.get("endTimestamp", None),
5353
organization_id=project_draft.get("organizationId", None),
54+
randomize_order=project_draft.get("randomizeOrder", None),
5455
sampling_threshold=project_draft.get("samplingThreshold", None),
5556
)
5657

mapswipe_workers/mapswipe_workers/utils/process_mapillary.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def filter_results(
189189
organization_id: str = None,
190190
start_time: str = None,
191191
end_time: str = None,
192+
randomize_order: bool = None,
192193
):
193194
df = results_df.copy()
194195
if creator_id is not None:
@@ -221,6 +222,9 @@ def filter_results(
221222
return None
222223
df = filter_by_timerange(df, start_time, end_time)
223224

225+
if randomize_order is not None:
226+
df.sample(frac=1).reset_index(drop=True)
227+
224228
return df
225229

226230

@@ -233,6 +237,7 @@ def get_image_metadata(
233237
organization_id: str = None,
234238
start_time: str = None,
235239
end_time: str = None,
240+
randomize_order=False,
236241
sampling_threshold=None,
237242
):
238243
aoi_polygon = geojson_to_polygon(aoi_geojson)
@@ -246,7 +251,13 @@ def get_image_metadata(
246251
]
247252

248253
downloaded_metadata = filter_results(
249-
downloaded_metadata, creator_id, is_pano, organization_id, start_time, end_time
254+
downloaded_metadata,
255+
creator_id,
256+
is_pano,
257+
organization_id,
258+
start_time,
259+
end_time,
260+
randomize_order,
250261
)
251262

252263
if (

0 commit comments

Comments
 (0)