detectors
Shape detectors: interrogate a cached frame to decide which pipeline it needs.
Selection is by shape — the wide columns (the keys of each packed
inferences_json dict) and their value structure — not by matching on the
producing model's ref/version. A mock model that emits the same output shape as
the real model it stands in for therefore resolves to the same pipeline with no
special-casing. Each detector pairs with a pipeline in
bitfount.preprocessing.pipelines.
Module
Functions
matches_fovea_v7_output
def matches_fovea_v7_output( df: pd.DataFrame, inferences_column: str = 'inferences_json',) ‑> bool:Whether df holds raw fovea v7 landmark output.
Fingerprint: an integer-"0" wide column whose value is a dict carrying the
v7 landmark fields (fovea_pit_coordinates).
matches_pathology_output
def matches_pathology_output(df: pd.DataFrame) ‑> bool:Whether df holds pathology model output (segmentation-per-B-scan).
Fingerprint: a wide column matching Pixel_Data_\d+_prediction whose
element dict carries a classes key OR a cnv_probability key. Both are
absent from retinal-layers output, which shares the wide-column shape — so
this value-structure test is what disambiguates the two (see
matches_retinal_layers_output).
matches_retinal_layers_output
def matches_retinal_layers_output(df: pd.DataFrame) ‑> bool:Whether df holds retinal-layers model output (layer segmentation).
Fingerprint: a wide column matching Pixel_Data_\d+_prediction whose
element dict carries instances — either at the top level
(element['instances'], Heidelberg) or nested under mask
(element['mask']['instances'], Altris) — AND carries NEITHER classes
NOR cnv_probability. The classes/cnv exclusion is the primary
disambiguator from pathology output (see matches_pathology_output).
wide_columns
def wide_columns( df: pd.DataFrame, inferences_column: str = 'inferences_json',) ‑> set[str]:Return the wide column names encoded in the packed inference frame.
Each row's inferences_json is a dict whose keys are the wide prediction
columns (see apply_preprocessing). Returns the keys of the first
non-null dict, or an empty set if the frame carries no inference dicts.