Skip to content

zamba.images.classifier

infer_model_family(model_name)

Best-effort inference of the preprocessing family from a model/arch name.

Used as a fallback for legacy checkpoints that don't persist model_family. Only SpeciesNet needs special preprocessing (480px bicubic resize, no normalization); everything else uses the lila.science / generic pipeline.

Source code in zamba/images/classifier.py
19
20
21
22
23
24
25
26
27
28
29
def infer_model_family(model_name: Optional[str]) -> str:
    """Best-effort inference of the preprocessing family from a model/arch name.

    Used as a fallback for legacy checkpoints that don't persist ``model_family``.
    Only SpeciesNet needs special preprocessing (480px bicubic resize, no
    normalization); everything else uses the lila.science / generic pipeline.
    """
    name = (model_name or "").lower()
    if name == ImageModelEnum.SPECIESNET.value or name.startswith("tf_efficientnetv2"):
        return ImageModelEnum.SPECIESNET.value
    return ImageModelEnum.LILA_SCIENCE.value