# bkuroko/parkfinder_yolo architecture

> Architecture diagram of the GitHub repository bkuroko/parkfinder_yolo, 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/bkuroko/parkfinder_yolo
- Repository: https://github.com/bkuroko/parkfinder_yolo

## Overview

ParkFinder processes video or camera frames to detect vehicles, match them to configured parking spaces, smooth occupancy over time, and display or record annotated output. A separate selector creates parking-space polygons; additional scripts capture CCTV frames, run basic live vehicle detection, and extract video frames. The README is empty, and the excerpts do not show all of main.py’s setup or data-path wiring, so those relationships are omitted where they cannot be confirmed.

Main entry points: [`main.py`](https://github.com/bkuroko/parkfinder_yolo/blob/main/main.py) (Parking runner), [`capture_frame.py`](https://github.com/bkuroko/parkfinder_yolo/blob/main/capture_frame.py) (CCTV frame capture), [`extract_frames.py`](https://github.com/bkuroko/parkfinder_yolo/blob/main/extract_frames.py) (Video frame extractor), [`select_parking.py`](https://github.com/bkuroko/parkfinder_yolo/blob/main/select_parking.py) (Space selector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Space setup"]
  node_space_selector["Space selector<br/>[select_parking.py]"]
  node_space_config["Space polygons"]
end

subgraph group_runtime["Occupancy runtime"]
  node_runner["Parking runner<br/>[main.py]"]
  node_occupancy_logic["Matching and tracking<br/>[parking_logic.py]"]
  node_annotated_output["Display or video output<br/>[main.py]"]
end

subgraph group_live["Live camera tools"]
  node_live_runner["CCTV parking runner<br/>[live_parking.py]"]
  node_live_detector["Live vehicle detector<br/>[live_yolo.py]"]
end

subgraph group_prep["Frame preparation"]
  node_frame_capture["CCTV frame capture<br/>[capture_frame.py]"]
  node_reference_image["Reference image"]
  node_frame_extractor["Video frame extractor<br/>[extract_frames.py]"]
  node_extracted_frames["Extracted frames"]
end

node_operator(("Operator"))
node_video_source(("Video or camera"))
node_yolo{{"YOLO model"}}

node_operator -->|"selects spaces"| node_space_selector
node_space_selector -->|"saves polygons"| node_space_config
node_operator -->|"starts processing"| node_runner
node_video_source -->|"provides frames"| node_runner
node_runner -->|"loads and detects"| node_yolo
node_runner -->|"updates tracker"| node_occupancy_logic
node_runner -->|"displays or writes"| node_annotated_output
node_operator -->|"starts live run"| node_live_runner
node_live_runner -->|"calls run"| node_runner
node_video_source -->|"provides frames"| node_live_detector
node_live_detector -->|"runs detection"| node_yolo
node_operator -->|"captures frame"| node_frame_capture
node_video_source -->|"provides frame"| node_frame_capture
node_frame_capture -->|"writes image"| node_reference_image
node_operator -->|"extracts frames"| node_frame_extractor
node_video_source -->|"provides frames"| node_frame_extractor
node_frame_extractor -->|"writes frames"| node_extracted_frames

click node_space_selector "https://github.com/bkuroko/parkfinder_yolo/blob/main/select_parking.py"
click node_space_config "https://github.com/bkuroko/parkfinder_yolo/blob/main/data/parking_spaces.json"
click node_runner "https://github.com/bkuroko/parkfinder_yolo/blob/main/main.py"
click node_occupancy_logic "https://github.com/bkuroko/parkfinder_yolo/blob/main/parking_logic.py"
click node_annotated_output "https://github.com/bkuroko/parkfinder_yolo/blob/main/main.py"
click node_live_runner "https://github.com/bkuroko/parkfinder_yolo/blob/main/live_parking.py"
click node_live_detector "https://github.com/bkuroko/parkfinder_yolo/blob/main/live_yolo.py"
click node_frame_capture "https://github.com/bkuroko/parkfinder_yolo/blob/main/capture_frame.py"
click node_reference_image "https://github.com/bkuroko/parkfinder_yolo/tree/main/images"
click node_frame_extractor "https://github.com/bkuroko/parkfinder_yolo/blob/main/extract_frames.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_space_selector,node_space_config toneBlue
class node_runner,node_occupancy_logic,node_annotated_output toneAmber
class node_live_runner,node_live_detector toneMint
class node_frame_capture,node_reference_image,node_frame_extractor,node_extracted_frames toneRose
class node_operator,node_video_source,node_yolo toneIndigo
```

## Components

### Space setup

- [Space selector](https://github.com/bkuroko/parkfinder_yolo/blob/main/select_parking.py): `select_parking.py`
- [Space polygons](https://github.com/bkuroko/parkfinder_yolo/blob/main/data/parking_spaces.json): `data/parking_spaces.json`

### Occupancy runtime

- [Parking runner](https://github.com/bkuroko/parkfinder_yolo/blob/main/main.py): `main.py`
- [Matching and tracking](https://github.com/bkuroko/parkfinder_yolo/blob/main/parking_logic.py): `parking_logic.py`
- [Display or video output](https://github.com/bkuroko/parkfinder_yolo/blob/main/main.py): `main.py`

### Live camera tools

- [CCTV parking runner](https://github.com/bkuroko/parkfinder_yolo/blob/main/live_parking.py): `live_parking.py`
- [Live vehicle detector](https://github.com/bkuroko/parkfinder_yolo/blob/main/live_yolo.py): `live_yolo.py`

### Frame preparation

- [CCTV frame capture](https://github.com/bkuroko/parkfinder_yolo/blob/main/capture_frame.py): `capture_frame.py`
- [Reference image](https://github.com/bkuroko/parkfinder_yolo/tree/main/images): `images`
- [Video frame extractor](https://github.com/bkuroko/parkfinder_yolo/blob/main/extract_frames.py): `extract_frames.py`
- **Extracted frames**

### Other components

- **Operator**
- **Video or camera**
- **YOLO model**

## Connections

- Operator → Space selector: selects spaces (evidence: `select_parking.py`)
- Space selector → Space polygons: saves polygons (evidence: `select_parking.py`)
- Operator → Parking runner: starts processing (evidence: `main.py`)
- Video or camera → Parking runner: provides frames (evidence: `main.py`)
- Parking runner → YOLO model: loads and detects (evidence: `main.py`)
- Parking runner → Matching and tracking: updates tracker (evidence: `main.py`)
- Parking runner → Display or video output: displays or writes (evidence: `main.py`)
- Operator → CCTV parking runner: starts live run (evidence: `live_parking.py`)
- CCTV parking runner → Parking runner: calls run (evidence: `live_parking.py`)
- Video or camera → Live vehicle detector: provides frames (evidence: `live_yolo.py`)
- Live vehicle detector → YOLO model: runs detection (evidence: `live_yolo.py`)
- Operator → CCTV frame capture: captures frame (evidence: `capture_frame.py`)
- Video or camera → CCTV frame capture: provides frame (evidence: `capture_frame.py`)
- CCTV frame capture → Reference image: writes image (evidence: `capture_frame.py`)
- Operator → Video frame extractor: extracts frames (evidence: `extract_frames.py`)
- Video or camera → Video frame extractor: provides frames (evidence: `extract_frames.py`)
- Video frame extractor → Extracted frames: writes frames (evidence: `extract_frames.py`)
