IoUWith
- class hybrid_learning.fuzzy_logic.predicates.custom_ops.IoUWith(*in_keys, logical_and=None, logical_or=None, mask_dims=(- 2, - 1), keep_dims=False, **kwargs)[source]
 Bases:
AbstractFuzzyIntersectCalculate the intersection over union between two masks. The value calculates for masks \(A, B\) and fuzzy set membership function \(\in\) as:
\[\min(1, \frac{\sum_c c\in A \wedge c\in B}{(\sum_c c \in A \vee c \in B)})\]Public Data Attributes:
The string symbol of this class (override for sub-classes).
Whether instances are equivalent to ones with permuted
in_keys.Inherited from : py: class:AbstractFuzzyIntersect
ARITYThe arity of the operation.
settingsSettings to reproduce the instance.
setting_defaultsDefaults used for
settings.Inherited from : py: class:Merge
The string symbol of this class (override for sub-classes).
ARITYThe arity of the operation.
Whether instances are equivalent to ones with permuted
in_keys.is_variadicWhether the instance is variadic.
settingsSettings to reproduce the instance.
setting_defaultsDefaults used for
settings.pretty_op_symbName of the operation symbol suitable for filenames etc.
childrenThe input keys which are child operations.
all_childrenAll children operations in the flattened computational tree, sorted depth first.
constsThe constant string keys in the input keys.
operation_keysThe list of keys used for this parent operation in original order (constants and children output keys).
all_in_keysAll string input keys both of self and of all child operations.
all_out_keysOutput keys of self and all child operations.
Inherited from : py: class:DictTransform
settingsSettings to reproduce the instance.
Inherited from : py: class:Transform
IDENTITY_CLASSThe identity class or classes for composition / addition.
settingsSettings to reproduce the instance.
Public Methods:
torch_operation(mask_a, mask_b)Calculate set intersection over union between
mask_aandmask_b.Inherited from : py: class:AbstractFuzzyIntersect
torch_intersect(*masks)torch_union(*masks)torch_intersect_proportion(*masks[, iou, ...])Calculate to what degree
mask_ais covered bymask_b.Inherited from : py: class:TorchOperation
operation(annotation_vals)Calculate the predicate output.
Inherited from : py: class:Merge
to_infix_notation([sort_key, ...])Return an infix str encoding equal for differently sorted operations.
to_str(**infix_notation_kwargs)Alias for
to_infix_notation().to_pretty_str(**infix_notation_kwargs)Same as
to_str()but using pretty operation names suitable for filenames etc.to_repr([settings, defaults, sort_key, ...])Return str representation which can be used to reproduce and compare the instance.
treerecurse_replace_keys(**replace_map)Return a new formula with all occurences of variables in
replace_mapreplaced and else identical settings.treerecurse(fun)Apply the given function recursively to this and all children instances.
apply_to(annotations[, keep_keys])Apply this operation to the
annotationsdict.variadic_apply_to(annotations)Return the result of operation on the values/items of a mapping or sequence of arbitrary length.
operation(annotation_vals)Calculate the predicate output.
Inherited from : py: class:DictTransform
apply_to(annotations[, keep_keys])Apply this operation to the
annotationsdict.Inherited from : py: class:Transform
apply_to(annotations[, keep_keys])Apply this operation to the
annotationsdict.Special Methods:
Inherited from : py: class:AbstractFuzzyIntersect
__init__(*in_keys[, logical_and, ...])Init.
Inherited from : py: class:Merge
__init__(*in_keys[, logical_and, ...])Init.
__str__()Return str(self).
__repr__()Call
to_repr()without sorting.__eq__(other)Two merge operations are considered equal, if their normalized representations coincide.
__copy__()Return a deep copy of self using settings.
__call__(annotations[, keep_keys])Call method modifying a given dictionary.
Inherited from : py: class:DictTransform
__call__(annotations[, keep_keys])Call method modifying a given dictionary.
Inherited from : py: class:Transform
__repr__()Call
to_repr()without sorting.__eq__(other)Two merge operations are considered equal, if their normalized representations coincide.
__copy__()Return a deep copy of self using settings.
__add__(other)Return a flat composition of
selfwithother.__radd__(other)Return a flat composition of
otherandself.__call__(annotations[, keep_keys])Call method modifying a given dictionary.
- Parameters