Skip to content

Commit 6d89ff6

Browse files
authored
Merge pull request #1007 from mapswipe/fix-drop-duplicates
fix: remove duplicates after spatial sampling
2 parents 514ccb8 + a7319e4 commit 6d89ff6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

mapswipe_workers/mapswipe_workers/utils/process_mapillary.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,14 @@ def get_image_metadata(
229229
raise CustomError(
230230
"No Mapillary Features in the AoI or no Features match the filter criteria."
231231
)
232-
downloaded_metadata = downloaded_metadata.drop_duplicates(subset=["geometry"])
233232
if sampling_threshold is not None:
234233
downloaded_metadata = spatial_sampling(downloaded_metadata, sampling_threshold)
235234

236235
if randomize_order is True:
237236
downloaded_metadata = downloaded_metadata.sample(frac=1).reset_index(drop=True)
238237

238+
downloaded_metadata = downloaded_metadata.drop_duplicates(subset=["geometry"])
239+
239240
total_images = len(downloaded_metadata)
240241
if total_images > 100000:
241242
raise CustomError(

mapswipe_workers/mapswipe_workers/utils/spatial_sampling.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ def spatial_sampling(df, interval_length):
143143

144144
if interval_length:
145145
sequence_df = filter_points(sequence_df, interval_length)
146+
if "is_pano" in sequence_df.columns:
147+
# below line prevents FutureWarning
148+
# (https://stackoverflow.com/questions/73800841/add-series-as-a-new-row-into-dataframe-triggers-futurewarning)
149+
sequence_df["is_pano"] = sequence_df["is_pano"].astype(bool)
146150
sampled_sequence_df = pd.concat([sampled_sequence_df, sequence_df], axis=0)
147151

148152
# reverse order such that sequence are in direction of travel

0 commit comments

Comments
 (0)