Skip to content

Commit 9e666ed

Browse files
Update README.md
Add the auto smart inference part
1 parent eaacb56 commit 9e666ed

1 file changed

Lines changed: 35 additions & 21 deletions

File tree

  • annotation_tool/controllers/classification

annotation_tool/controllers/classification/README.md

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,59 @@
22

33
This module contains the business logic specifically designed for the **Whole-Video Classification** task.
44

5-
In this mode, the goal is to assign global attributes (labels) to an entire video clip (e.g., "Weather: Sunny", "Action: Goal"). These controllers bridge the gap between the Classification UI (`ui/classification/`) and the central data model (`models.py`).
5+
In this mode, the goal is to assign global attributes (labels) to an entire video clip (e.g., "Weather: Sunny", "Action: Goal"). With the latest updates, these controllers now bridge the gap between the Classification UI, the central data model (`models.py`), and the **AI-powered `soccernetpro` framework** for smart inference and model training.
66

77
## 📂 Module Contents
88

99
```text
1010
controllers/classification/
11-
├── annotation_manager.py # Labeling logic & Dynamic Schema handling
12-
├── class_file_manager.py # I/O operations (Save/Load/Create)
13-
└── navigation_manager.py # Video list navigation & Playback flow
14-
11+
├── class_annotation_manager.py # Labeling logic, Dynamic Schema & Smart Annotations
12+
├── class_file_manager.py # I/O operations (Save/Load/Create + Smart Labels)
13+
├── class_navigation_manager.py # Video list navigation, Filtering & Playback flow
14+
├── inference_manager.py # [NEW] AI Inference (Single & Batch Prediction)
15+
└── train_manager.py # [NEW] AI Model Training & Checkpoint logic
1516
```
1617

1718
---
1819

1920
## 📝 File Descriptions
2021

21-
### 1. `annotation_manager.py`
22-
23-
**Responsibility:** Manages the labeling process and schema modifications.
22+
### 1. `class_annotation_manager.py`
23+
**Responsibility:** Manages the labeling process, schema modifications, and AI prediction confirmations.
2424

25+
* **Manual Annotation Management**: Captures the user's selection from the UI (Right Panel), validates it, and commits it to the central State Model.
26+
* **Smart Annotation Confirmation**: **[NEW]** Handles the logic for confirming AI-generated single and batch predictions, safely migrating them into the application's core memory.
2527
* **Dynamic Schema Management**: Handles adding, renaming, or deleting Categories ("Heads") and Labels directly from the UI.
26-
* **Annotation Saving**: Captures the user's selection from the UI (Right Panel), validates it, and commits it to the `AppStateModel`.
27-
* **Undo/Redo Integration**: Pushes commands to the `HistoryManager` when annotations are changed or when the schema structure is modified.
28+
* **Universal Undo/Redo Integration**: Pushes precise commands to the `HistoryManager` when annotations (manual or smart) are changed, or when the schema structure is modified.
2829

2930
### 2. `class_file_manager.py`
31+
**Responsibility:** Handles file input/output, JSON parsing, and project lifecycles.
3032

31-
**Responsibility:** Handles file input/output and project lifecycle for Classification projects.
33+
* **Project Creation**: Orchestrates the "New Project" wizard dialog and initializes the model with default or blank schemas.
34+
* **Robust JSON Handling**: Parses and strictly validates existing Classification JSON files to ensure they match expected dataset structures.
35+
* **Smart Label I/O**: **[NEW]** Seamlessly reads and exports `smart_labels` alongside traditional manual labels, preserving AI-generated confidence scores.
36+
* **Relative Pathing**: Converts absolute file paths to relative paths during export to ensure project portability across different machines.
3237

33-
* **Project Creation**: Orchestrates the "New Project" wizard dialog and initializes the model with the chosen schema.
34-
* **JSON Loading**: Parses existing Classification JSON files, validating that they match the expected format.
35-
* **JSON Saving**: Writes the current state to disk. It handles the critical logic of converting absolute file paths to **relative paths** to ensure portability between different computers.
36-
* **Workspace Management**: Handles clearing the current data when closing a project.
38+
### 3. `class_navigation_manager.py`
39+
**Responsibility:** Manages the dataset list (Left Panel), complex filtering, and playback synchronization.
3740

38-
### 3. `navigation_manager.py`
41+
* **Model/View Navigation**: Connects the custom `ProjectTreeModel` to the unified `MediaController`, ensuring robust, ghost-frame-free video loading when items are clicked.
42+
* **Advanced 4-State Filtering**: **[NEW]** Implements sophisticated visibility logic to filter clips by status: *Show All*, *Hand Labelled*, *Smart Labelled*, or *No Labelled*.
43+
* **Smart Navigation**: Implements logic for "Next Action" (jump to next parent item) and "Next Clip" (jump to next child view), automatically skipping hidden items based on the active filter.
3944

40-
**Responsibility:** Manages the list of video clips and the user's movement through them.
45+
### 4. `inference_manager.py` (⭐ NEW)
46+
**Responsibility:** Orchestrates AI-powered video predictions via the `soccernetpro` inference engine.
4147

42-
* **Tree Interaction**: Connects the `QTreeWidget` (Left Panel) to the media player, ensuring the correct video loads when clicked.
43-
* **Smart Navigation**: Implements logic for "Next Action" (jump to next parent item) and "Next Clip" (jump to next file), skipping items based on filters.
44-
* **Filtering**: Applies logic to show only "Done", "Not Done", or "All" videos in the list.
45-
* **Media Control**: Triggers video playback and synchronizes the player state with the selected item.
48+
* **Dynamic Configurations**: Parses `config.yaml` on-the-fly to automatically map AI output indices to human-readable UI labels (eliminating hardcoded sports classes).
49+
* **Asynchronous Execution**: Uses `QThread` workers (`InferenceWorker` and `BatchInferenceWorker`) to run heavy PyTorch inference without freezing the UI.
50+
* **Single & Batch Processing**: Allows users to infer the current active video or run sweeping batch predictions across a specified range of clips.
51+
* **Temporary Workspaces**: Safely handles the creation and cleanup of isolated hidden workspaces (`~/.soccernet_workspace`) to prevent pipeline conflicts.
4652

53+
### 5. `train_manager.py` (⭐ NEW)
54+
**Responsibility:** Handles the background training loop for fine-tuning models on user-annotated data.
55+
56+
* **Hyperparameter Injection**: Collects variables (Epochs, LR, Batch Size, Device, Workers) from the UI and forcefully injects them into a runtime YAML configuration.
57+
* **Background Training**: Executes the `myModel.train()` process inside a background `QThread` to ensure the application remains responsive.
58+
* **Console Log Interception**: Uses a custom `io.TextIOBase` stream to intercept PyTorch stdout/stderr, parsing progress steps to drive the UI progress bar and displaying human-readable logs in the application console.
59+
* **Checkpointing**: Auto-saves model weights into a dynamically generated `checkpoints/` directory alongside the dataset.
60+
```

0 commit comments

Comments
 (0)