to_custom_displayable_masks
- hybrid_learning.experimentation.fuzzy_exp.fuzzy_exp_vis.to_custom_displayable_masks(out, person_key='pedestrian', skip_if_max_lower_than=None, mark_if_score_higher_than=None, scores_to_add_to_key=None, reduce_masks=None, compare_masks=None, mask_union=None)[source]
Custom post-process of a formula calculation output dict for easy display with
compare_orig_with_masks
. Modifications applied:stacked masks are unstacked or reduced via mask union
the person mask(s) potentially get scores added to their keys according to
scores_to_add_to_key
the person mask(s) potentially get marked with color if condition
mark_if_score_higher_than
is metin case conditions are not met (
skip_if_max_lower_than
),None
is returned
Assumptions:
tensor of
len(shape)==1
is a list of scores (one per prediction)tensor of
len(shape)==2
is a standard maskstensor of
len(shape)==3
are standard masks stacked in dim 0
- Parameters
out (Dict[str, Tensor]) – the dict output of a formula evaluation; only tensors values therein are used
person_key (str) – the key of the (stacked) person mask(s)
skip_if_max_lower_than (Optional[Dict[str, float]]) – dict of the form
{tensor_key: minimum_value_of_max}
; returnNone
if the max value of tensors inout
at keys are lower than theminimum_value_of_max
scores_to_add_to_key (Optional[Sequence[Sequence[str]]]) – add values of given scores to the string key(s) of the (unstacked) person mask(s)
reduce_masks (Optional[Sequence[str]]) – reduce the masks at given keys if they are stacked; defaults to all stacked masks except for the person mask(s)
compare_masks (Optional[Sequence[Sequence[str]]]) – each item is a list of keys; for each item add a comparison image to the output comparing the masks at keys in that item; if the key of a later unstacked mask is given, the unstacked masks are merged via union for comparison
mask_union (Optional[Callable[[Sequence[Tensor]], Tensor]]) –
- Returns
dict of
{title: mask}
of 2D and 3D tensors representing masks and images for plotting- Return type