# visual-mellow/youtube_dataset_generation_pipeline architecture

> Architecture diagram of the GitHub repository visual-mellow/youtube_dataset_generation_pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/visual-mellow/youtube_dataset_generation_pipeline
- Repository: https://github.com/visual-mellow/youtube_dataset_generation_pipeline

## Overview

This is a YouTube video dataset-generation pipeline. A user supplies links through the CLI or link CSV; the batch runner acquires and segments videos, publishes clips, then extracts VideoMAE features, computes DSP perception anchors, and generates Gemini cue annotations. Results include per-clip artifacts and merged grounding queries. The graph preserves documented high-level stages and sampled module relationships; some implementation details are based on README descriptions because their source was not excerpted.

Main entry points: [`dataset_generating_pipepline/build_dataset.py`](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/build_dataset.py) (Feature builder), [`dataset_generating_pipepline/orchestrator.py`](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/orchestrator.py) (Video orchestrator), [`dataset_generating_pipepline/perception/anchors.py`](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/perception/anchors.py) (Anchor fusion), [`dataset_generating_pipepline/annotate/orchestrator.py`](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/annotate/orchestrator.py) (Annotation orchestrator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Intake and segmentation"]
  node_batch["Link batch runner"]
  node_pipeline["Video orchestrator<br/>[orchestrator.py]"]
  node_acquire["Download and clip"]
end

subgraph group_extraction["Feature extraction"]
  node_extraction_entry["Clip extraction"]
  node_builder["Feature builder<br/>[build_dataset.py]"]
  node_config["Pipeline configuration<br/>[config.py]"]
end

subgraph group_perception["DSP perception"]
  node_anchors["Anchor fusion<br/>[anchors.py]"]
  node_audio_dsp["Audio onset DSP<br/>[onsets_v2.py]"]
  node_sed["Sound event detection<br/>[infer.py]"]
  node_video_cues["Video cues<br/>[video_cues.py]"]
end

subgraph group_annotation["Cue annotation"]
  node_annotation_flow["Annotation orchestrator<br/>[orchestrator.py]"]
  node_proposer["Cue proposer<br/>[proposer.py]"]
  node_verifier["Cue verifier<br/>[verifier.py]"]
  node_snap["DSP timestamp snap<br/>[snap.py]"]
  node_llm["LLM client<br/>[llm.py]"]
end

subgraph group_outputs["Dataset outputs"]
  node_clip_store["Published clips<br/>[loaders.py]"]
  node_feature_store["Clip feature artifacts<br/>[build_dataset.py]"]
  node_query_export["Grounding query export"]
  node_query_store["Grounding queries<br/>[constants.py]"]
  node_eval["Gold labels and metrics"]
end

node_user(("Dataset user"))
node_cli["Pipeline CLI<br/>[run.py]"]
node_gemini{{"Gemini API"}}

node_user -->|"supplies links"| node_cli
node_cli -->|"starts batch"| node_batch
node_batch -->|"processes links"| node_pipeline
node_pipeline -->|"acquires video"| node_acquire
node_pipeline -->|"publishes clips"| node_clip_store
node_pipeline -->|"extracts clips"| node_extraction_entry
node_extraction_entry -->|"runs builder"| node_builder
node_builder -->|"loads settings"| node_config
node_builder -->|"writes features"| node_feature_store
node_builder -->|"computes anchors"| node_anchors
node_builder -->|"runs annotation"| node_annotation_flow
node_anchors -->|"detects onsets"| node_audio_dsp
node_anchors -->|"infers sound events"| node_sed
node_anchors -->|"collects visual cues"| node_video_cues
node_annotation_flow -->|"requests proposals"| node_proposer
node_annotation_flow -->|"verifies cues"| node_verifier
node_verifier -->|"snaps timestamps"| node_snap
node_annotation_flow -->|"calls client"| node_llm
node_llm -->|"sends requests"| node_gemini
node_extraction_entry -->|"exports queries"| node_query_export
node_query_export -->|"writes queries"| node_query_store

click node_cli "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/run.py"
click node_batch "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/run_youtube_links.py"
click node_pipeline "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/orchestrator.py"
click node_acquire "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/video_helpers/download_and_clip.py"
click node_clip_store "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/utils/loaders.py"
click node_extraction_entry "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/video_helpers/video_extraction.py"
click node_builder "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/build_dataset.py"
click node_config "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/core/config.py"
click node_feature_store "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/build_dataset.py"
click node_anchors "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/perception/anchors.py"
click node_audio_dsp "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/perception/onsets_v2.py"
click node_sed "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/perception/sed/infer.py"
click node_video_cues "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/perception/video_cues.py"
click node_annotation_flow "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/annotate/orchestrator.py"
click node_proposer "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/annotate/proposer.py"
click node_verifier "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/annotate/verifier.py"
click node_snap "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/annotate/snap.py"
click node_llm "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/Utils/llm.py"
click node_query_export "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/video_helpers/video_extraction.py"
click node_query_store "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/core/constants.py"
click node_eval "https://github.com/visual-mellow/youtube_dataset_generation_pipeline/tree/main/dataset_generating_pipepline/eval"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_batch,node_pipeline,node_acquire,node_user toneBlue
class node_extraction_entry,node_builder,node_config toneAmber
class node_anchors,node_audio_dsp,node_sed,node_video_cues,node_gemini toneMint
class node_annotation_flow,node_proposer,node_verifier,node_snap,node_llm toneRose
class node_clip_store,node_feature_store,node_query_export,node_query_store,node_eval toneIndigo
class node_cli toneTeal
```

## Components

### Intake and segmentation

- [Link batch runner](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/run_youtube_links.py): `dataset_generating_pipepline/run_youtube_links.py`
- [Video orchestrator](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/orchestrator.py): `dataset_generating_pipepline/orchestrator.py`
- [Download and clip](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/video_helpers/download_and_clip.py): `dataset_generating_pipepline/video_helpers/download_and_clip.py`

### Feature extraction

- [Clip extraction](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/video_helpers/video_extraction.py): `dataset_generating_pipepline/video_helpers/video_extraction.py`
- [Feature builder](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/build_dataset.py): `dataset_generating_pipepline/build_dataset.py`
- [Pipeline configuration](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/core/config.py): `dataset_generating_pipepline/core/config.py`

### DSP perception

- [Anchor fusion](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/perception/anchors.py): `dataset_generating_pipepline/perception/anchors.py`
- [Audio onset DSP](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/perception/onsets_v2.py): `dataset_generating_pipepline/perception/onsets_v2.py`
- [Sound event detection](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/perception/sed/infer.py): `dataset_generating_pipepline/perception/sed/infer.py`
- [Video cues](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/perception/video_cues.py): `dataset_generating_pipepline/perception/video_cues.py`

### Cue annotation

- [Annotation orchestrator](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/annotate/orchestrator.py): `dataset_generating_pipepline/annotate/orchestrator.py`
- [Cue proposer](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/annotate/proposer.py): `dataset_generating_pipepline/annotate/proposer.py`
- [Cue verifier](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/annotate/verifier.py): `dataset_generating_pipepline/annotate/verifier.py`
- [DSP timestamp snap](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/annotate/snap.py): `dataset_generating_pipepline/annotate/snap.py`
- [LLM client](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/Utils/llm.py): `Utils/llm.py`

### Dataset outputs

- [Published clips](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/utils/loaders.py): `dataset_generating_pipepline/utils/loaders.py`
- [Clip feature artifacts](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/build_dataset.py): `dataset_generating_pipepline/build_dataset.py`
- [Grounding query export](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/video_helpers/video_extraction.py): `dataset_generating_pipepline/video_helpers/video_extraction.py`
- [Grounding queries](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/dataset_generating_pipepline/core/constants.py): `dataset_generating_pipepline/core/constants.py`
- [Gold labels and metrics](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/tree/main/dataset_generating_pipepline/eval): `dataset_generating_pipepline/eval`

### Other components

- **Dataset user**
- [Pipeline CLI](https://github.com/visual-mellow/youtube_dataset_generation_pipeline/blob/main/run.py): `run.py`
- **Gemini API**

## Connections

- Dataset user → Pipeline CLI: supplies links
- Pipeline CLI → Link batch runner: starts batch
- Link batch runner → Video orchestrator: processes links (evidence: `dataset_generating_pipepline/run_youtube_links.py`)
- Video orchestrator → Download and clip: acquires video (evidence: `dataset_generating_pipepline/orchestrator.py`)
- Video orchestrator → Published clips: publishes clips (evidence: `dataset_generating_pipepline/orchestrator.py`)
- Video orchestrator → Clip extraction: extracts clips (evidence: `dataset_generating_pipepline/orchestrator.py`)
- Clip extraction → Feature builder: runs builder (evidence: `dataset_generating_pipepline/video_helpers/video_extraction.py`)
- Feature builder → Pipeline configuration: loads settings (evidence: `dataset_generating_pipepline/build_dataset.py`)
- Feature builder → Clip feature artifacts: writes features (evidence: `dataset_generating_pipepline/build_dataset.py`)
- Feature builder → Anchor fusion: computes anchors (evidence: `dataset_generating_pipepline/build_dataset.py`)
- Feature builder → Annotation orchestrator: runs annotation (evidence: `dataset_generating_pipepline/build_dataset.py`)
- Anchor fusion → Audio onset DSP: detects onsets (evidence: `dataset_generating_pipepline/perception/anchors.py`)
- Anchor fusion → Sound event detection: infers sound events (evidence: `dataset_generating_pipepline/perception/anchors.py`)
- Anchor fusion → Video cues: collects visual cues (evidence: `dataset_generating_pipepline/perception/anchors.py`)
- Annotation orchestrator → Cue proposer: requests proposals (evidence: `dataset_generating_pipepline/annotate/orchestrator.py`)
- Annotation orchestrator → Cue verifier: verifies cues (evidence: `dataset_generating_pipepline/annotate/orchestrator.py`)
- Cue verifier → DSP timestamp snap: snaps timestamps (evidence: `dataset_generating_pipepline/annotate/verifier.py`)
- Annotation orchestrator → LLM client: calls client (evidence: `dataset_generating_pipepline/annotate/orchestrator.py`)
- LLM client → Gemini API: sends requests
- Clip extraction → Grounding query export: exports queries (evidence: `dataset_generating_pipepline/video_helpers/video_extraction.py`)
- Grounding query export → Grounding queries: writes queries (evidence: `dataset_generating_pipepline/video_helpers/video_extraction.py`)
