Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mapswipe_workers/mapswipe_workers/utils/process_mapillary.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,14 @@ def get_image_metadata(
raise CustomError(
"No Mapillary Features in the AoI or no Features match the filter criteria."
)
downloaded_metadata = downloaded_metadata.drop_duplicates(subset=["geometry"])
if sampling_threshold is not None:
downloaded_metadata = spatial_sampling(downloaded_metadata, sampling_threshold)

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

downloaded_metadata = downloaded_metadata.drop_duplicates(subset=["geometry"])

total_images = len(downloaded_metadata)
if total_images > 100000:
raise CustomError(
Expand Down
4 changes: 4 additions & 0 deletions mapswipe_workers/mapswipe_workers/utils/spatial_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ def spatial_sampling(df, interval_length):

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

# reverse order such that sequence are in direction of travel
Expand Down