remap_from_csv#

Dataset.remap_from_csv(csv: Path, remove_not_mapped: bool = True, remove_emptied_images: bool = False) Self[source]#

Same as class remap, but instead of taking a dictionary, you give the path to a csv file.

csv file must have at least these two columns :

  • input_category_id

  • output_category_id

Optional columns for category names :

  • input_category_name

  • output_category_name

Parameters:
  • csv – path to csv file, to be read by pandas

  • remove_not_mapped – If set to True, will remove classes that are not in class mapping. Otherwise, keep them as is (with potential class fusion). Defaults to True.

  • remove_emptied_images – If set to True, will remove from self.images the images that are now empty of annotation. Note that it will keep the images that were empty before the remapping. Defaults to False.

Returns:

New dataset object with remapped classes according to the given table in the csv file