Assignment localization - MetricsReloaded.utility.assignment_localization¶
This module provides classes for performing the assignment and localization required in instance segmentation and object detection tasks .
Performing the process associated with instance segmentation¶
- class MetricsReloaded.utility.assignment_localization.AssignmentMapping(pred_loc, ref_loc, pred_prob, localization='box_iou', thresh=0.5, assignment='greedy_matching', pixdim=[], flag_fp_in=True)[source]¶
Class allowing the assignment and localization of individual objects of interests. The localization strategies are either based on box characteristics: - box_iou - box_ior - box_com or on the masks - mask_iou - mask_ior - mask_com - boundary_iou or using only centre of mass - com_dist or a mix of mask and box - point_in_box or of point and mask - point_in_mask where iou refers to Intersection over Union, IoR to Intersection over Reference, and CoM to Centre of Mass Options to solve assignment ambiguities are one of the following: - hungarian: minimising assignment cost - greedy_matching: based on best matching - greedy_performance: based on probability score flag_fp_in indicates whether or not to consider the double detection of reference objects as false positives or not :param pred_loc: :param ref_loc: :param pred_prob: :param localization: :param assignment: :param pixdim: :param flag_fp_in:
- pairwise_pointcomdist()[source]¶
Creates a matrix of size numb_prediction elements x number of reference elements indicating the pairwise distance of the centre of mass of the location boxes
- pairwise_pointinbox()[source]¶
Creates a matrix of size number of prediction elements x number of reference elements indicating binarily whether the point representing the prediction element is in the reference box
- pairwise_pointinmask()[source]¶
Creates a matrix of size number of prediction elements x number of reference elements indicating binarily whether the point representing the prediction element is in the reference mask
- pairwise_boxiou()[source]¶
Creates a matrix of size number of prediction elements x number of reference elements indicating the pairwise box iou
- pairwise_maskior()[source]¶
Creates a matrix of size number of prediction elements x number of reference elements indicating the pairwise mask ior
- pairwise_boundaryiou()[source]¶
Creates a matrix of size number of prediction elements x number of reference elements indicating the pairwise boundary iou
- pairwise_maskcom()[source]¶
Creates a matrix of size number of prediction elements x number of reference elements indicating the pairwise distance between mask centre of mass
- pairwise_maskiou()[source]¶
Creates a matrix of size number of prediction elements x number of reference elements indicating the pairwise mask iou.
- pairwise_boxior()[source]¶
Creates a matrix of size number of prediction elements x number of reference elements indicating the pairwise box ior
- initial_mapping()[source]¶
Identifies an original ideal mapping between references and prediction element for all those when there is no ambiguity in the assignment (only one to one matching available). Creates the list of possible options when multiple are possible and populates the relevant dataframes with performance of the localization metrics and the assigned score probability.
- resolve_ambiguities_matching()[source]¶
Finalise the mapping based on the initial guess by deciding on the possible ambiguities Returns a final pandas dataframe with all attribution and erroneous detection / non detections.
- matching_ref_predseg()[source]¶
In case mask of individual elements are available (Instance segmentation task) provides the list of true positive prediction, associated list of reference segmentation, list of false positive masks and of false negative masks as returns: list_pred, list_ref, list_fp, list_fn