You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This directory contains the business logic of the **SoccerNet Pro Annotation Tool**. following the **MVC (Model-View-Controller)** architecture, these scripts act as the bridge between the data (`models.py`) and the interface (`ui/`). They handle user input, data processing, file I/O, and application state management.
3
+
This directory contains the business logic of the **SoccerNet Pro Annotation Tool**. Following the **MVC (Model-View-Controller)** architecture, these scripts act as the bridge between the central data (`models.py`) and the user interface (`ui/`). They handle user input, data processing, file I/O, application state management, and the newly integrated **AI Model Inference & Training**.
4
4
5
5
## 📂 Directory Structure
6
6
7
7
```text
8
8
controllers/
9
-
├── media_controller.py # [NEW] Unified Video Playback Manager
├── media_controller.py # Unified Video Playback Manager (Anti-freeze logic)
10
+
├── history_manager.py # Universal Undo/Redo logic (Supports Batch AI Actions)
11
11
├── router.py # Application routing and mode switching
12
-
├── classification/ # Logic specific to Whole-Video Classification
13
-
├── localization/ # Logic specific to Action Spotting (Timestamps)
12
+
├── classification/ # Logic specific to Whole-Video Classification & AI
13
+
├── localization/ # Logic specific to Action Spotting (Timestamps) & AI
14
14
├── description/ # Logic specific to Global Captioning (Text)
15
15
└── dense_description/ # Logic specific to Dense Captioning (Timestamped Text)
16
-
17
16
```
18
17
19
18
---
@@ -25,82 +24,74 @@ controllers/
25
24
These controllers provide foundational functionality used across the entire application to ensure stability and consistency.
26
25
27
26
***`media_controller.py`**
28
-
***Role**: The centralized video playback engine used by all modes.
29
-
***Responsibilities**:
30
-
***Robust State Management**: Implements a strict `Stop -> Clear -> Load -> Delay -> Play` sequence to prevent black screens and buffer artifacts.
31
-
***Race Condition Prevention**: Uses an internal `QTimer` that is explicitly cancelled upon stop, preventing videos from starting in the background after a user has closed a project.
32
-
***Visual Clearing**: Forces the `QVideoWidget` to repaint/update on stop, ensuring no "stuck frames" remain visible.
33
-
34
-
35
-
27
+
***Role**: The centralized video playback engine used by all modes.
28
+
***Responsibilities**:
29
+
***Robust State Management**: Implements a strict `Stop -> Clear -> Load -> Delay -> Play` sequence to prevent black screens and buffer artifacts.
30
+
***Race Condition Prevention**: Uses an internal `QTimer` that is explicitly cancelled upon stop, preventing videos from starting in the background after a user has closed a project.
31
+
***Visual Clearing**: Forces the `QVideoWidget` to repaint/update on stop, ensuring no "stuck frames" remain visible.
36
32
37
33
***`router.py`**
38
-
***Role**: The "Traffic Cop" of the application.
39
-
***Responsibilities**:
40
-
* Handles the "Create Project" and "Load Project" flows.
41
-
* Analyzes input JSON files (keys like `events`, `captions`, `labels`) to automatically detect the project mode.
42
-
* Initializes the appropriate specific managers and switches the UI view.
43
-
44
-
45
-
34
+
***Role**: The "Traffic Cop" of the application.
35
+
***Responsibilities**:
36
+
* Handles the "Create Project" and "Load Project" flows.
37
+
* Analyzes input JSON files (keys like `events`, `captions`, `labels`, `smart_labels`) to automatically detect the project mode.
38
+
* Initializes the appropriate specific managers and switches the UI view.
46
39
47
40
***`history_manager.py`**
48
-
***Role**: The "Time Machine" (Undo/Redo System).
49
-
***Responsibilities**:
50
-
* Implements the **Command Pattern** to manage the Undo/Redo stacks in `AppStateModel`.
51
-
* Executes operations and triggers the necessary UI refreshes (`_refresh_active_view`) for all four modes.
52
-
53
-
54
-
41
+
***Role**: The "Time Machine" (Undo/Redo System).
42
+
***Responsibilities**:
43
+
* Implements the **Command Pattern** to manage the Undo/Redo stacks in `AppStateModel`.
44
+
***[NEW] AI Batch Support**: Handles complex state reversions for massive batch smart annotations across multiple videos simultaneously.
45
+
* Executes operations and triggers the necessary UI refreshes (`_refresh_active_view`) for all four modes.
Logic dedicated to the **Whole-Video Classification** task (assigning attributes to an entire video clip).
51
+
Logic dedicated to the **Whole-Video Classification** task, now supercharged with AI workflows.
60
52
61
-
***`class_file_manager.py`**: Handles JSON I/O and relative path calculations.
62
-
***`navigation_manager.py`**: Manages the "Action List" (Left Panel), auto-play logic, and filtering.
63
-
***`annotation_manager.py`**: Manages dynamic schema logic (Radio/Checkbox generation) and saves class selections.
53
+
***`inference_manager.py`[NEW]**: Orchestrates AI predictions via `soccernetpro`. Dynamically parses `config.yaml`, handles background threading (`QThread`), and manages both Single and Batch video inference without freezing the UI.
54
+
***`train_manager.py`[NEW]**: Manages the background training loop. Injects user-defined UI hyperparameters into a runtime config, runs `myModel.train()`, and intercepts PyTorch logs to drive the UI progress bar and console.
55
+
***`class_file_manager.py`**: Handles JSON I/O, relative path calculations, and the seamless preservation of `smart_labels` and confidence scores.
56
+
***`class_navigation_manager.py`**: Manages the dataset tree, playback synchronization, and advanced 4-state AI visibility filtering (All / Hand Labelled / Smart Labelled / No Labelled).
57
+
***`class_annotation_manager.py`**: Manages dynamic schema logic, saves manual class selections, and handles the confirmation workflow for AI-generated batch predictions.
***`loc_file_manager.py`**: Handles JSON I/O with path fallback logic (checking local directories if absolute paths fail).
70
-
***`localization_manager.py`**:
71
-
* Synchronizes the **Video Player**, **Timeline Widget**, and **Event Table**.
72
-
* Captures timestamps for spotting events and manages the multi-tab interface.
63
+
Logic dedicated to the **Action Spotting** task, utilizing temporal AI models.
73
64
65
+
***`loc_inference.py`[NEW]**: Runs the heavy OpenSportsLib AI localization models in the background. Features dynamic FFmpeg sub-clipping to speed up targeted inference, automatic CPU fallback configuration, and absolute timestamp compensation.
66
+
***`loc_file_manager.py`**: Handles JSON I/O with path fallback logic (checking local directories if absolute paths fail) and preserves `smart_localization_events` during export.
67
+
***`localization_manager.py`**:
68
+
* Synchronizes the Video Player, Timeline Widget, and Event Table.
69
+
***[NEW] Smart Spotting Flow**: Manages the dual-state UI of unconfirmed AI predictions (Gold markers) vs. confirmed/manual events (Blue markers), including batch confirmations.
Logic dedicated to the **Dense Captioning** task (text descriptions anchored to specific timestamps).
98
91
99
92
***`dense_manager.py`**:
100
-
***Editor-Timeline Sync**: Continuously synchronizes the text input field with the video playback position. If the video hits an event, the text loads automatically.
101
-
***CRUD**: Handles creating, updating, and deleting timestamped text events.
102
-
103
-
93
+
***Editor-Timeline Sync**: Continuously synchronizes the text input field with the video playback position. If the video hits an event, the text loads automatically.
94
+
***CRUD**: Handles creating, updating, and deleting timestamped text events.
104
95
***`dense_file_manager.py`**:
105
-
***Metadata Preservation**: Ensures global and item-level metadata is retained during Load/Save cycles.
106
-
***Data Mapping**: Maps the flat `dense_captions` JSON list to the internal application model.
96
+
***Metadata Preservation**: Ensures global and item-level metadata is retained during Load/Save cycles.
97
+
***Data Mapping**: Maps the flat `dense_captions` JSON list to the internal application model.
0 commit comments