mapreader.process.post_process

Module Contents

Classes

PatchDataFrame

A class for storing patch dataframes.

class mapreader.process.post_process.PatchDataFrame(patch_df, labels_map)

Bases: pandas.DataFrame

A class for storing patch dataframes.

Parameters:
  • patch_df (pd.DataFrame) – the DataFrame containing patches and predictions

  • labels_map (dict) – the dictionary mapping label indices to their labels. e.g. {0: “no”, 1: “railspace”}.

get_context(labels)

Get the context of the patches with the specified labels.

Parameters:

labels (str | list) – The label(s) to get context for.

update_preds(remap, conf=0.7, inplace=False)

Update the predictions of the chosen patches based on their context.

Parameters:
  • remap (dict) – A dictionary mapping the old labels to the new labels.

  • conf (float, optional) – Patches with confidence scores below this value will be relabelled, by default 0.7.

  • inplace (bool, optional) – Whether to relabel inplace or create new dataframe columns, by default False