# lc1471/ml-csd361 architecture

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

- Interactive diagram: https://gitdiagram.com/lc1471/ml-csd361
- Repository: https://github.com/lc1471/ml-csd361

## Overview

AVCAffe Preprocessing prepares clip-level audio/video data and labels for an Affect-Aware Dynamic UI project. The main workflow builds a manifest, converts audio and face crops into aligned two-second windows, then exposes normalized clips and labels through a reader or PyTorch wrapper. Separate utilities compute normalization statistics and check alignment or audio availability. The README gives little detail beyond the product name; unsampled crop-generation code and other utilities are represented cautiously, and edges are limited to documented or excerpted relationships.

Main entry points: [`src/preprocessing/dataset.py`](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/dataset.py) (Clip reader), [`src/preprocessing/windows.py`](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/windows.py) (Aligned windows), [`src/preprocessing/audio_features.py`](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/audio_features.py) (Audio features), [`src/preprocessing/compute_stats.py`](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/compute_stats.py) (Stats computation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dataset_prep["Dataset preparation"]
  node_dataset_files["Clip manifest<br/>[manifest.py]"]
  node_crop_prep["Crop preparation<br/>[add_crops.py]"]
end

subgraph group_features["Feature extraction"]
  node_audio_features["Audio features<br/>[audio_features.py]"]
  node_video_features["Video features<br/>[video_features.py]"]
  node_aligned_windows["Aligned windows<br/>[windows.py]"]
end

subgraph group_loading["Dataset loading"]
  node_clip_reader["Clip reader<br/>[dataset.py]"]
  node_torch_adapter["PyTorch adapter<br/>[torch_dataset.py]"]
end

subgraph group_analysis["Stats and checks"]
  node_norm_stats["Normalization stats<br/>[norm_stats.json]"]
  node_stats_compute["Stats computation<br/>[compute_stats.py]"]
  node_alignment_check["Alignment check<br/>[check_alignment.py]"]
  node_audio_check["Audio check<br/>[check_no_audio.py]"]
end

node_stats_compute -->|"builds clips"| node_aligned_windows
node_stats_compute -->|"writes stats"| node_norm_stats
node_clip_reader -->|"reads manifest"| node_dataset_files
node_clip_reader -->|"reads stats"| node_norm_stats
node_clip_reader -->|"builds clips"| node_aligned_windows
node_aligned_windows -->|"extracts audio"| node_audio_features
node_aligned_windows -->|"loads crops"| node_video_features
node_torch_adapter -->|"wraps reader"| node_clip_reader
node_alignment_check -->|"checks audio"| node_audio_features
node_alignment_check -->|"checks video"| node_video_features
node_audio_check -->|"loads audio"| node_audio_features

click node_dataset_files "https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/manifest.py"
click node_crop_prep "https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/add_crops.py"
click node_audio_features "https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/audio_features.py"
click node_video_features "https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/video_features.py"
click node_aligned_windows "https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/windows.py"
click node_clip_reader "https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/dataset.py"
click node_torch_adapter "https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/torch_dataset.py"
click node_norm_stats "https://github.com/lc1471/ml-csd361/blob/main/configs/norm_stats.json"
click node_stats_compute "https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/compute_stats.py"
click node_alignment_check "https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/check_alignment.py"
click node_audio_check "https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/check_no_audio.py"

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_dataset_files,node_crop_prep toneBlue
class node_audio_features,node_video_features,node_aligned_windows toneAmber
class node_clip_reader,node_torch_adapter toneMint
class node_norm_stats,node_stats_compute,node_alignment_check,node_audio_check toneRose
```

## Components

### Dataset preparation

- [Clip manifest](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/manifest.py): `src/preprocessing/manifest.py`
- [Crop preparation](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/add_crops.py): `src/preprocessing/add_crops.py`

### Feature extraction

- [Audio features](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/audio_features.py): `src/preprocessing/audio_features.py`
- [Video features](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/video_features.py): `src/preprocessing/video_features.py`
- [Aligned windows](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/windows.py): `src/preprocessing/windows.py`

### Dataset loading

- [Clip reader](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/dataset.py): `src/preprocessing/dataset.py`
- [PyTorch adapter](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/torch_dataset.py): `src/preprocessing/torch_dataset.py`

### Stats and checks

- [Normalization stats](https://github.com/lc1471/ml-csd361/blob/main/configs/norm_stats.json): `configs/norm_stats.json`
- [Stats computation](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/compute_stats.py): `src/preprocessing/compute_stats.py`
- [Alignment check](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/check_alignment.py): `src/preprocessing/check_alignment.py`
- [Audio check](https://github.com/lc1471/ml-csd361/blob/main/src/preprocessing/check_no_audio.py): `src/preprocessing/check_no_audio.py`

## Connections

- Stats computation → Aligned windows: builds clips (evidence: `src/preprocessing/compute_stats.py`)
- Stats computation → Normalization stats: writes stats (evidence: `src/preprocessing/compute_stats.py`)
- Clip reader → Clip manifest: reads manifest (evidence: `src/preprocessing/dataset.py`)
- Clip reader → Normalization stats: reads stats (evidence: `src/preprocessing/dataset.py`)
- Clip reader → Aligned windows: builds clips (evidence: `src/preprocessing/dataset.py`)
- Aligned windows → Audio features: extracts audio (evidence: `src/preprocessing/windows.py`)
- Aligned windows → Video features: loads crops (evidence: `src/preprocessing/windows.py`)
- PyTorch adapter → Clip reader: wraps reader (evidence: `src/preprocessing/torch_dataset.py`)
- Alignment check → Audio features: checks audio (evidence: `src/preprocessing/check_alignment.py`)
- Alignment check → Video features: checks video (evidence: `src/preprocessing/check_alignment.py`)
- Audio check → Audio features: loads audio (evidence: `src/preprocessing/check_no_audio.py`)
