Skip to content

JABS Core Enums

Module for defining enums used in JABS

CacheFormat

Bases: str, Enum

Storage format for a project's feature cache.

Inheriting from str allows for easy serialization to/from JSON (the enum will automatically be serialized using the enum value).

ClassifierMode

Bases: str, Enum

Classifier mode for the project.

Inheriting from str allows for easy serialization to/from JSON (the enum will automatically be serialized using the enum value).

ClassifierType

Bases: str, Enum

Classifier type for the project.

ConfidenceMetric

Bases: Enum

How inference confidence was computed.

CrossValidationGroupingStrategy

Bases: str, Enum

Cross-validation grouping type for the project.

Inheriting from str allows for easy serialization to/from JSON (the enum will automatically be serialized using the enum value).

Method

Bases: Enum

The Aggregation method for how per-frame outputs are aggregated.

PredictionType

Bases: IntEnum

Enum describing a prediction type.

RAW: Raw model output. POSTPROCESSED: Post-processed model output.

ProjectDistanceUnit

Bases: IntEnum

Distance unit for the project.

SamplingStrategy

Bases: Enum

The strategy used for sampling frames for inference.

StorageFormat

Bases: Enum

Supported storage formats.

compile_grouping_regex(regex)

Compile a filename-pattern cross-validation grouping regular expression.

Parameters:

Name Type Description Default
regex str

Regular expression used to extract a grouping key from a video filename.

required

Returns:

Type Description
Pattern[str]

The compiled regular expression pattern.

Raises:

Type Description
ValueError

If regex is empty or not a valid regular expression.

filename_group_key(video_name, pattern)

Extract a cross-validation grouping key from a video filename.

The pattern is applied with :meth:re.Pattern.search, so it matches anywhere in video_name. If the pattern defines a capturing group and it matched, the first captured group is used as the key (so a pattern that captures the digits in cage_1234.mp4 yields "1234"); otherwise the full matched text is used (a pattern matching the whole cage_1234 token yields "cage_1234"). Videos that do not match the pattern are placed in their own group, keyed by the filename itself.

Parameters:

Name Type Description Default
video_name str

Video filename to extract a grouping key from.

required
pattern Pattern[str]

Compiled regular expression (see :func:compile_grouping_regex).

required

Returns:

Type Description
str

The grouping key string. All videos that yield the same key are placed in

str

the same cross-validation group.