ResultsIterator
- class hybrid_learning.experimentation.fuzzy_exp.fuzzy_exp_eval.ResultsIterator(conf, root='..', load_images=True, device=None, only_filenames=None, raise_on_missing=False, recalc='necessary', additional_formulas=None, additional_formula_mods=None, changed_constants=None, verbose=False, use_pretty_names=True)[source]
 Bases:
objectAllow to get all output infos and potentially additionally calculated values for one sample.
Public Methods:
from_cache(img_fn)recalc_predicate_masks(img_t)recalc_formula_masks(masks_t, recalc_formulas)get_all_masks(img_fn)Special Methods:
__init__(conf[, root, load_images, device, ...])Given a sacred experiment
confdict, yield pairs of image file name, original image, and dict of output masks for that experiment.__len__()__getitem__(i)
- Parameters
 
- __init__(conf, root='..', load_images=True, device=None, only_filenames=None, raise_on_missing=False, recalc='necessary', additional_formulas=None, additional_formula_mods=None, changed_constants=None, verbose=False, use_pretty_names=True)[source]
 Given a sacred experiment
confdict, yield pairs of image file name, original image, and dict of output masks for that experiment. This is a convenience wrapper aroundload_orig_and_masks()andrecalc_formula_masks(). Included pairs can be restricted by setting theonly_filenameslist. Included masks are the concept model outputs and the fuzzy logic formula output. Formula masks may be recalculated or further ones calculated and added viaadditional_formula_modsargument.- Parameters
 conf (dict) – the experiment config dict (loaded using
get_exp_config)root (str) – the root folder in which the experiment was run
load_images (bool) – whether to also load the original images; else set to
Nonerecalc (Union[bool, str]) – whether to recalculate missing
'formula'mask; set toTrueor'always'to always recalculate the formula mask, set toFalseorNoneto never calculate masks (also disable calculation ofadditional_formula_mods), set to"necessary"to calculateadditional_formula_modsand only recalculate missing formula masks.additional_formula_mods (Optional[Dict[str, Callable[[Merge, Merge], Merge]]]) – dict of callables that accept the original formula object and the ground truth formula object of the experiment, and return a new formula object that shall be calculated (cf.
recalc). Recalculated formulas are added to the output masks using the keys from theadditional_formula_modsdict. This can also be used to overwrite the original formula(s) by using the keys'formula'and'gt_formula'. Example application: For a monitor formula, add its underlying formula body{'body': lambda f, gt_f: f.in_keys[0]}(assumingf=NOT(some_body)).verbose (bool) – in case of recalculation, print some recalcuation information
use_pretty_names (bool) – whether to transform mask names using
formula_to_display_name()raise_on_missing (bool) – see
load_orig_and_masks()
- Yields
 tuples of
(image_filename, (original_image_or_none, dict_of_masks)); for the format of the second tuple entry have a look atload_orig_and_masks.