# gangheejo/redred architecture

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

- Interactive diagram: https://gitdiagram.com/gangheejo/redred
- Repository: https://github.com/gangheejo/redred

## Overview

REDRED processes multi-camera shelf video into product inventory changes and a submission CSV. The main workflow is frame inference, camera-level tracking (when enabled), multi-view count fusion, temporal event confirmation, and CSV generation; an alternate event-triggered runner detects interactions before comparing inventory snapshots. The README is only a title, so the product purpose is inferred from source descriptions. Training and spatial-filter modules are represented, but their runtime connections are not established by the excerpts.

Main entry points: [`src/run_pipeline.py`](https://github.com/gangheejo/redred/blob/main/src/run_pipeline.py) (Frame pipeline), [`src/run_event_triggered.py`](https://github.com/gangheejo/redred/blob/main/src/run_event_triggered.py) (Event-triggered runner), [`src/csv_generator.py`](https://github.com/gangheejo/redred/blob/main/src/csv_generator.py) (CSV generator), [`src/multi_view_fusion.py`](https://github.com/gangheejo/redred/blob/main/src/multi_view_fusion.py) (View fusion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Video analysis"]
  node_pipeline["Frame pipeline<br/>[run_pipeline.py]"]
  node_tracker["Multi-camera tracker<br/>[tracker.py]"]
  node_fusion["View fusion"]
  node_spatial["Spatial filter<br/>[spatial_filter.py]"]
end

subgraph group_events["Inventory events"]
  node_eventrunner["Event-triggered runner"]
  node_detector["Inventory event detector<br/>[event_detector.py]"]
end

subgraph group_output["Submission output"]
  node_csvgen["CSV generator<br/>[csv_generator.py]"]
  node_submission["Submission CSV"]
end

subgraph group_model["Model components"]
  node_trainer["KD trainer<br/>[kd_trainer.py]"]
end

node_operator(("Operator"))
node_videos["Camera videos"]

node_operator -->|"runs"| node_pipeline
node_videos -->|"provides frames"| node_pipeline
node_pipeline -->|"updates tracks"| node_tracker
node_pipeline -->|"fuses detections"| node_fusion
node_pipeline -->|"confirms events"| node_detector
node_pipeline -->|"generates CSV"| node_csvgen
node_csvgen -->|"writes"| node_submission
node_operator -->|"runs"| node_eventrunner
node_videos -->|"provides frames"| node_eventrunner
node_eventrunner -->|"fuses detections"| node_fusion
node_eventrunner -->|"constructs events"| node_detector
node_eventrunner -->|"generates CSV"| node_csvgen

click node_pipeline "https://github.com/gangheejo/redred/blob/main/src/run_pipeline.py"
click node_tracker "https://github.com/gangheejo/redred/blob/main/src/tracker.py"
click node_fusion "https://github.com/gangheejo/redred/blob/main/src/multi_view_fusion.py"
click node_spatial "https://github.com/gangheejo/redred/blob/main/src/spatial_filter.py"
click node_eventrunner "https://github.com/gangheejo/redred/blob/main/src/run_event_triggered.py"
click node_detector "https://github.com/gangheejo/redred/blob/main/src/event_detector.py"
click node_csvgen "https://github.com/gangheejo/redred/blob/main/src/csv_generator.py"
click node_trainer "https://github.com/gangheejo/redred/blob/main/src/kd_trainer.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_pipeline,node_tracker,node_fusion,node_spatial toneBlue
class node_eventrunner,node_detector toneAmber
class node_csvgen,node_submission toneMint
class node_trainer toneRose
class node_operator,node_videos toneIndigo
```

## Components

### Video analysis

- [Frame pipeline](https://github.com/gangheejo/redred/blob/main/src/run_pipeline.py): `src/run_pipeline.py`
- [Multi-camera tracker](https://github.com/gangheejo/redred/blob/main/src/tracker.py): `src/tracker.py`
- [View fusion](https://github.com/gangheejo/redred/blob/main/src/multi_view_fusion.py): `src/multi_view_fusion.py`
- [Spatial filter](https://github.com/gangheejo/redred/blob/main/src/spatial_filter.py): `src/spatial_filter.py`

### Inventory events

- [Event-triggered runner](https://github.com/gangheejo/redred/blob/main/src/run_event_triggered.py): `src/run_event_triggered.py`
- [Inventory event detector](https://github.com/gangheejo/redred/blob/main/src/event_detector.py): `src/event_detector.py`

### Submission output

- [CSV generator](https://github.com/gangheejo/redred/blob/main/src/csv_generator.py): `src/csv_generator.py`
- **Submission CSV**

### Model components

- [KD trainer](https://github.com/gangheejo/redred/blob/main/src/kd_trainer.py): `src/kd_trainer.py`

### Other components

- **Operator**
- **Camera videos**

## Connections

- Operator → Frame pipeline: runs (evidence: `src/run_pipeline.py`)
- Camera videos → Frame pipeline: provides frames (evidence: `src/run_pipeline.py`)
- Frame pipeline → Multi-camera tracker: updates tracks (evidence: `src/run_pipeline.py`)
- Frame pipeline → View fusion: fuses detections (evidence: `src/run_pipeline.py`)
- Frame pipeline → Inventory event detector: confirms events (evidence: `src/run_pipeline.py`)
- Frame pipeline → CSV generator: generates CSV (evidence: `src/run_pipeline.py`)
- CSV generator → Submission CSV: writes (evidence: `src/csv_generator.py`)
- Operator → Event-triggered runner: runs (evidence: `src/run_event_triggered.py`)
- Camera videos → Event-triggered runner: provides frames (evidence: `src/run_event_triggered.py`)
- Event-triggered runner → View fusion: fuses detections (evidence: `src/run_event_triggered.py`)
- Event-triggered runner → Inventory event detector: constructs events (evidence: `src/run_event_triggered.py`)
- Event-triggered runner → CSV generator: generates CSV (evidence: `src/run_event_triggered.py`)
