annie.dataset.sources¶
Generic, extensible data-source registry (domain).
Annie is dataset-agnostic: a dataset is described as an ordered list of data sources the user adds on the Dataset tab, rather than four fixed folders. Each source is one of:
SourceKind.VIDEO— a folder of source videos (the mandatory spine; one Browse row per video). Singleton.SourceKind.VDET— a folder of raw-detection.vdetfiles. Singleton.SourceKind.TRACK— a folder of__track{N}.csvfiles. Singleton.SourceKind.CSV— a label/metadata CSV joined to videos by a chosen key column. A CSV plays one of two roles (CsvRole):labels(its selected value columns become Browse tags/filters; many allowed) orprotagonist(one value column is the active-track id; singleton).
This module is pure domain — no NiceGUI, no config, no torch. The registry is the
single source of truth the scanner (annie.scanning) consumes.
Attributes¶
Folder-backed kinds. Each is a singleton in a registry. |
|
Accepted source-video suffixes (lower-case, dotted). |
|
Suffix identifying a raw-detection file. |
|
Glob identifying derived single-track files. |
|
Short human label per kind, for the Dataset source list and the add menu. |
|
Tabler icon per kind for the Dataset cards. |
|
Human label per task, for the Dataset task-wise sections and the Annotator switch. |
Classes¶
The kind of a data source. |
|
How a CSV source is interpreted. |
|
A named start/end column pair defining one segmentation of a clip. |
|
One configured data source. |
|
An ordered set of data sources with singleton rules. |
|
A supervision task the Annotator can offer, driven by the sources present. |
|
One prerequisite for a task, and whether the registry satisfies it. |
|
Whether a task's sources are all present, with the per-requirement detail. |
Functions¶
|
Report, per task, which required sources are present in |
Module Contents¶
- class annie.dataset.sources.SourceKind[source]¶
Bases:
enum.StrEnumThe kind of a data source.
Initialize self. See help(type(self)) for accurate signature.
- class annie.dataset.sources.CsvRole[source]¶
Bases:
enum.StrEnumHow a CSV source is interpreted.
Initialize self. See help(type(self)) for accurate signature.
- class annie.dataset.sources.SegmentationBand[source]¶
A named start/end column pair defining one segmentation of a clip.
A segmentation CSV may carry several competing segmentations of the same clip (e.g. a ground-truth span and a WhisperX forced-alignment span); each is one band, rendered side by side in the Segment-review task for comparison.
- name¶
Human label shown beside the band’s preview (e.g.
"GT","cut").
- start_column¶
CSV column holding the band’s start time, in seconds.
- end_column¶
CSV column holding the band’s end time, in seconds.
- annie.dataset.sources.FOLDER_KINDS: tuple[SourceKind, ...]¶
Folder-backed kinds. Each is a singleton in a registry.
- annie.dataset.sources.VIDEO_SUFFIXES: tuple[str, ...] = ('.mp4',)¶
Accepted source-video suffixes (lower-case, dotted).
- annie.dataset.sources.VDET_SUFFIXES: tuple[str, ...] = ('.vdet',)¶
Suffix identifying a raw-detection file.
- annie.dataset.sources.TRACK_GLOB = '*__track*.csv'¶
Glob identifying derived single-track files.
- annie.dataset.sources.KIND_LABELS: dict[SourceKind, str]¶
Short human label per kind, for the Dataset source list and the add menu.
- annie.dataset.sources.KIND_ICONS: dict[SourceKind, str]¶
Tabler icon per kind for the Dataset cards.
- class annie.dataset.sources.DataSource[source]¶
One configured data source.
- kind¶
The
SourceKind.
- path¶
Folder (for folder kinds) or file (for CSV) the source points at.
- key_column¶
For a CSV source, the column joined to the video id.
- value_columns¶
For a CSV source, the selected value columns (label tags, or a single protagonist track-id column).
- column_types¶
For a CSV source, the chosen data type per value column (
"str"/"int"/"float"); columns absent here default to str.
- segment_column¶
For a
CsvRole.SEGMENTATIONCSV, the column that tells apart the several rows sharing onekey_columnvalue: the two combine into the clip identity{video_id}_{segment_id}that each accept/drop is saved under.Nonefor other roles.
- bands¶
For a
CsvRole.SEGMENTATIONCSV, the ordered start/end column pairs to render and compare (seeSegmentationBand). Empty otherwise.
- layout¶
For a
SourceKind.VIDEOfolder, an optional nestedVideoLayout.Nonemeans a flat folder (one video per file, id = file stem).
- sheet¶
For a table that is an Excel workbook, the worksheet it reads.
Nonefor a CSV.
- match_field¶
For a label table, the nested-layout path field (e.g.
"subject") its key column matches;Nonematches the whole video id.
- match_substring¶
For a label table, link a row to every video whose match target contains the key instead of equalling it.
- column_names¶
For a label table, the short tag name shown for a value column; columns absent here keep their header as the name.
- order_column¶
For a label table whose key repeats, the column whose order decides which row counts (e.g. a timestamp).
Nonewhen keys are unique.
- order_descending¶
Direction for
order_column;Truekeeps the largest / newest row.
- property is_folder: bool¶
Whether this source points at a folder (vs a single CSV file).
- property is_protagonist: bool¶
Whether this is the CSV that assigns each video’s protagonist track.
- property is_segmentation: bool¶
Whether this CSV holds per-clip segments for the Segment-review task.
- property available: bool¶
Whether the source path currently exists (folder for folders, file for CSV).
- property label: str¶
A short label for the Dataset source list.
- class annie.dataset.sources.SourceRegistry[source]¶
An ordered set of data sources with singleton rules.
Folder kinds (video/vdet/track) and the protagonist CSV are singletons: adding one replaces any existing source of that role. Label CSVs are unlimited, keyed by path (re-adding the same file replaces it).
- add(source: DataSource) None[source]¶
Add
source, enforcing the singleton rules in place of duplicates.- Parameters:
source – The source to add.
- remove(source: DataSource) None[source]¶
Remove
sourceif present (identity by path + kind).
- get(kind: SourceKind) DataSource | None[source]¶
Return the first source of
kind, orNone.
- property video: DataSource | None¶
The video-folder source, or
None.
- property vdet: DataSource | None¶
The vdet-folder source, or
None.
- property track: DataSource | None¶
The track-folder source, or
None.
- property protagonist: DataSource | None¶
The protagonist CSV source, or
None.
- property label_sources: list[DataSource]¶
All label CSV sources (excludes the protagonist and segmentation CSVs).
- property segmentation_sources: list[DataSource]¶
All segmentation CSV sources (drive the Segment-review task).
- property has_video: bool¶
Whether a usable (existing) video folder is configured.
- available_kinds_to_add() list[SourceKind][source]¶
Kinds offered by the
+menu (singletons drop out once present).
- class annie.dataset.sources.TaskKind[source]¶
Bases:
enum.StrEnumA supervision task the Annotator can offer, driven by the sources present.
Initialize self. See help(type(self)) for accurate signature.
- annie.dataset.sources.TASK_LABELS: dict[TaskKind, str]¶
Human label per task, for the Dataset task-wise sections and the Annotator switch.
- class annie.dataset.sources.TaskRequirement[source]¶
One prerequisite for a task, and whether the registry satisfies it.
- label¶
Human name of the required source (e.g.
"videos").
- present¶
Whether an available source satisfying it is configured.
- class annie.dataset.sources.TaskReadiness[source]¶
Whether a task’s sources are all present, with the per-requirement detail.
- requirements¶
Each prerequisite and its present/absent state, in order.
- property ready: bool¶
Whether every requirement is satisfied (the Annotator may offer the task).
- annie.dataset.sources.task_readiness(registry: SourceRegistry) list[TaskReadiness][source]¶
Report, per task, which required sources are present in
registry.This is the single source of truth behind both the Dataset tab’s task-wise readiness sections and the Annotator’s decision of which tasks to offer.
- Parameters:
registry – The configured sources.
- Returns:
One
TaskReadinessperTaskKind, requirements in order.