iaa_od.visualisation
- iaa_od.visualisation.build_save_path(filepath, extension)[source]
Utility function that constructs a save path for an image with a timestamp, ensuring the filepath ends with a forward slash.
- Parameters:
filepath (str) – The base filepath where the image will be saved.
extension (str) – The file extension for the saved image (e.g., ‘.png’, ‘.jpg’).
- Returns:
The constructed save path for the image.
- Return type:
str
- iaa_od.visualisation.compare_images_with_macrocategories(result, filename, filepath, collapsed_categories, /, *, enable_labels=False, show_image_filename=False, sc_data=None, save_path=None, save_extension=None)[source]
Displays the specified image with bounding box annotations from all ground truths in the provided Result object, comparing both the original categories (top row) and the collapsed macro-categories (bottom row).
- Parameters:
result (Result) – The Result object containing the ground truths and annotations.
filename (str) – The filename of the image to display.
filepath (str) – The filepath where the image is located.
collapsed_categories (dict[str, list[int]]) – A dictionary mapping macro-category names to lists of category IDs that belong to that macro-category.
enable_labels (bool, optional) – Whether to display category labels above bounding boxes. Defaults to False.
show_image_filename (bool, optional) – Whether to include the image filename in the title above the image. Defaults to False.
sc_data (ScaleComplexity | None) – Optional ScaleComplexity object containing Scale Complexity data for the images, which will be displayed in the title of the bottom row if provided. Defaults to None.
save_path (str | None, optional) – If provided, the figure will be saved to this path instead of being displayed. Defaults to None.
save_extension (str | None, optional) – The file extension to use when saving the figure. If not provided, defaults to “.png”. Defaults to None.
- Return type:
None
- iaa_od.visualisation.get_image_path(filename, filepath)[source]
Utility function that simply constructs the entire path for a given image filename. If necessary, the function also adds the ending forwards slash to the filepath.
- Parameters:
filename (str) – The image filename.
filepath (str) – The filepath where the image is located.
- Returns:
The full path to the image.
- Return type:
str
- iaa_od.visualisation.show_fatigue_data_with_agreement(sessions)[source]
Visualise the fatigue evaluation of annotators by plotting Alpha values against normalised timestamps for each GT. The graph also shows a mean Alpha value across all GTs to provide an overall trend of annotator fatigue over time. :type sessions:
dict[str,dict[int,list[AnnotationTimestamp]]] :param sessions: A dictionary where keys are GT names and values are dictionaries mapping session IDs to lists of AnnotationTimestamp objects. :type sessions: dict[str, dict[int, list[AnnotationTimestamp]]]- Return type:
None
- iaa_od.visualisation.show_fatigue_data_with_granularity(sessions, granularities)[source]
Visualise annotator fatigue through per-image granularity instead of Krippendorff’s alpha.
For each GT, this plots the per-image count granularity (top) and size granularity (bottom) against the normalised timestamps, one line per annotation session, together with a mean trend line across all sessions. Under the dataset-wide benchmark normalisation used by per_image_fatigue_granularities, a value of 1.0 is the benchmark (median) annotator; values drifting above or below 1.0 over the course of a session indicate the annotator shifting their granularity strategy (e.g. toward larger, group-level boxes as fatigue sets in: lower count granularity, higher size granularity).
- Parameters:
sessions (dict[str, dict[int, list[AnnotationTimestamp]]]) – A dictionary where keys are GT names and values are dictionaries mapping session IDs to lists of AnnotationTimestamp objects, as returned by evaluate_annotator_fatigue.
granularities (dict[str, Granularities]) – A mapping from image filename to that image’s Granularities, as returned by per_image_fatigue_granularities.
- Return type:
None
- iaa_od.visualisation.show_gts_with_annotations(result, filepath, /, *, enable_labels=False, full_legend=False, show_image_filename=False, save_path=None, save_extension=None)[source]
A wrapper for the function “show_image_with_annotations” that runs it for all images in a given ground truth set.
- Parameters:
result (Result) – The Result object containing the ground truths and annotations.
filepath (str) – The filepath where the images are located.
enable_labels (bool, optional) – Whether to display category labels above bounding boxes. Defaults to False.
full_legend (bool, optional) – Whether to include all categories in the legend, even if not present in the image. Defaults to False.
show_image_filename (bool, optional) – Whether to include the image filename in the title above the image. Defaults to False.
save_path (str | None, optional) – If provided, the figures will be saved to this path instead of being displayed. Defaults to None.
save_extension (str | None, optional) – The file extension to use when saving the figures (e.g., “.png”, “.jpg”). If not provided, defaults to “.png”. Defaults to None.
- Return type:
None
- iaa_od.visualisation.show_gts_with_disagreements(result, filepath, /, *, compare_categories=False, show_image_filename=False, save_path=None, save_extension=None)[source]
A wrapper for the function “show_image_with_disagreements_new” that runs it for all images in a given ground truth set.
- Parameters:
result (Result) – The Result object containing the ground truths and units.
filepath (str) – The filepath where the images are located.
compare_categories (bool) – Whether to compare categories for agreement status, or just localisation.
show_image_filename (bool) – Whether to show the image filename in the title of the plot. Defaults to False.
save_path (Optional[str]) – If provided, the path where the plots will be saved. If None, the plots will be shown interactively. Defaults to None.
save_extension (Optional[str]) – If provided, the extension for the saved plots (e.g., ‘.png’, ‘.jpg’). If None, defaults to ‘.png’. Defaults to None.
- Return type:
None
- iaa_od.visualisation.show_image_with_annotations(result, filename, filepath, /, *, enable_labels=False, full_legend=False, show_image_filename=False, save_path=None, save_extension=None)[source]
Displays the specified image with bounding box annotations from all ground truths in the provided Result object.
- Parameters:
result (Result) – The Result object containing the ground truths and annotations.
filename (str) – The filename of the image to display.
filepath (str) – The filepath where the image is located.
enable_labels (bool, optional) – Whether to display category labels above bounding boxes. Defaults to False.
full_legend (bool, optional) – Whether to include all categories in the legend, even if not present in the image. Defaults to False.
show_image_filename (bool, optional) – Whether to include the image filename in the title above the image. Defaults to False.
save_path (str | None, optional) – If provided, the figure will be saved to this path instead of being displayed. Defaults to None.
save_extension (str | None, optional) – The file extension to use when saving the figure. If not provided, defaults to “.png”. Defaults to None.
- Return type:
None
- iaa_od.visualisation.show_image_with_annotations_macrocategories(result, filename, filepath, collapsed_categories, /, *, enable_labels=False, full_legend=False, show_image_filename=False, save_path=None, save_extension=None)[source]
Displays the specified image with bounding box annotations from all ground truths in the provided Result object.
- Parameters:
result (Result) – The Result object containing the ground truths and annotations.
filename (str) – The filename of the image to display.
filepath (str) – The filepath where the image is located.
collapsed_categories (dict[str, list[int]]) – A dictionary mapping macro-category names to lists of category IDs that belong to that macro-category.
enable_labels (bool, optional) – Whether to display category labels above bounding boxes. Defaults to False.
full_legend (bool, optional) – Whether to include all macro-categories in the legend, even if not present in the image. Defaults to False.
show_image_filename (bool, optional) – Whether to include the image filename in the title above the image. Defaults to False.
save_path (str | None, optional) – If provided, the figure will be saved to this path instead of being displayed. Defaults to None.
save_extension (str | None, optional) – The file extension to use when saving the figure. If not provided, defaults to “.png”. Defaults to None.
- Return type:
None
- iaa_od.visualisation.show_image_with_disagreements(result, filename, filepath, /, *, compare_categories=False, show_image_filename=False, save_path=None, save_extension=None)[source]
Shows which bounding boxes on a given image contribute to agreement (in green) and which don’t (in red).
- Parameters:
result (Result) – The Result object containing the ground truths and units.
filename (str) – The filename of the image to display.
filepath (str) – The filepath where the image is located.
compare_categories (bool) – Whether to compare categories for agreement status, or just localisation.
show_image_filename (bool) – Whether to show the image filename in the title of the plot. Defaults to False.
save_path (Optional[str]) – If provided, the path where the plot will be saved. If None, the plot will be shown interactively. Defaults to None.
save_extension (Optional[str]) – If provided, the extension for the saved plot (e.g., ‘png’, ‘jpg’). If None, defaults to ‘png’. Defaults to None.
- Return type:
None
- iaa_od.visualisation.show_iou_sweep(results)[source]
Function which plots Alpha values against IoU thresholds from a list of Result objects.
- Parameters:
results (list[Result]) – The list of Result objects containing Kappa and Alpha values for different IoU thresholds.
- Return type:
None
- iaa_od.visualisation.show_units(result, filename, filepath, /)[source]
Function which shows all units found for a given image in the provided Result object.
- Parameters:
result (Result) – The Result object containing the ground truths and units.
filename (str) – The filename of the image to display.
filepath (str) – The filepath where the image is located.
- Return type:
None
- iaa_od.visualisation.upsert_handle(handles, new_handle)[source]
Utility function that adds a new legend handle to the list of handles if it does not already exist.
- Parameters:
handles (list[Patch]) – The list of existing legend handles.
new_handle (Patch) – The new legend handle to add.
- Return type:
None
- iaa_od.visualisation.validate_filepath(filepath)[source]
Utility function that validates the provided filepath.
- Parameters:
filepath (str) – The filepath to validate.
- Returns:
The validated filepath, ensuring it ends with a forward slash.
- Return type:
str
Modules
|
Function which plots Alpha values against IoU thresholds from a list of Result objects. |
|
Function which shows all units found for a given image in the provided Result object. |