@@ -34,31 +34,9 @@ Alternatively, see how to [Build from Source](./get-started/build-from-source.md
3434
3535## Architecture
3636
37- > ** Note:** Diagrams are currently best viewed in light color mode.
38-
3937### Data Flow Diagram
4038
41- ``` mermaid
42- sequenceDiagram
43-
44- participant APP as Applications
45- participant CA as Cluster Analytics
46- participant MQTT as MQTT Broker
47- participant SC as Scene Controller
48-
49-
50- MQTT->>SC: Detections metadata
51- Note over SC: Base analytics
52- SC->>MQTT: Objects metadata
53- MQTT->>CA: Objects metadata
54-
55- Note over CA: User-configurable DBSCAN clustering
56- Note over CA: Cluster's shape and velocity analysis
57-
58- CA->>MQTT: Optimized clusters metadata
59- Note over APP: Real-time cluster insights
60- MQTT->>APP:
61- ```
39+ ![ Data Flow] ( ../../_assets/microservices/microsvc-cluster-analytics-dataflow.svg " cluster analytics data flow ")
6240
6341### ** DBSCAN Clustering Configuration**
6442
@@ -135,45 +113,7 @@ The service uses a `config.json` file located in the `config/` directory:
135113
136114#### Shape Detection Logic
137115
138- ``` mermaid
139- flowchart TD
140- A[Cluster Points Input] --> B{Sufficient Points?}
141- B -->|< 3 points| C[Insufficient Points]
142- B -->|≥ 3 points| D[Calculate Features]
143-
144- D --> E[Extract Distance and Angle Features]
145- E --> F[Calculate Centroid]
146- F --> G[Measure Distance Variance]
147-
148- G --> H{Distance Variance < 0.5?}
149- H -->|Yes| I[Circle Formation]
150- H -->|No| J{Exactly 4 Points?}
151-
152- J -->|Yes| K[Check Quadrant Distribution]
153- K --> L{≥ 3 Quadrants?}
154- L -->|Yes| M[Rectangle Formation]
155- L -->|No| N[Continue Analysis]
156-
157- J -->|No| O{≥ 5 Points?}
158- O -->|Yes| P[Analyze Angle Distribution]
159- P --> Q{Uniform Distribution?}
160- Q -->|Yes| R[Large Circle Formation]
161- Q -->|No| S[Check Linear Formation]
162-
163- S --> T{Low Triangle Areas?}
164- T -->|Yes| U[Line Formation]
165- T -->|No| V[Irregular Shape]
166-
167- O -->|No| N
168- N --> S
169-
170- %% Shape calculations
171- I --> I1[Calculate: radius, diameter, area, circumference]
172- M --> M1[Calculate: width, height, area, perimeter, corners]
173- R --> R1[Calculate: radius, diameter, area, circumference]
174- U --> U1[Calculate: length, endpoints, width spread]
175- V --> V1[Calculate: bounding box, point spread]
176- ```
116+ ![ Shape Detection Logic] ( ../../_assets/microservices/microsvc-cluster-analytics-shape-det-logic.svg " shape detection logic ")
177117
178118### Velocity Analysis and Movement Patterns
179119
@@ -189,21 +129,11 @@ flowchart TD
189129
190130#### Velocity Analysis Logic
191131
192- ``` mermaid
193- graph TD
194- A[Velocity Analysis] --> B{Speed Check}
195- B -->|< 0.1 m/s| C[Stationary]
196- B -->|> 0.1 m/s| D{Coherence Check}
197- D -->|High Coherence| E[Coordinated Parallel]
198- D -->|Low Coherence| F{Direction Analysis}
199- F -->|Toward Center| G[Converging]
200- F -->|Away from Center| H[Diverging]
201- F -->|Mixed| I[Chaotic]
202- ```
132+ ![ Velocity Analysis Logic] ( ../../_assets/microservices/microsvc-cluster-analytics-velocity-logic.svg " velocity analysis logic ")
203133
204134## Category-Specific Clustering
205135
206- The serviceoptimizes DBSCAN parameters based on object categories, providing more accurate clustering for different object types:
136+ The service optimizes DBSCAN parameters based on object categories, providing more accurate clustering for different object types.
207137
208138### Benefits
209139
@@ -701,26 +631,7 @@ The Cluster Analytics service implements cluster tracking system to maintain clu
701631
702632### Tracking Pipeline
703633
704- ``` mermaid
705- graph TD
706- A[New Frame Detection] --> B[Group by Category]
707- B --> C[Get Existing Clusters]
708- C --> D[Hungarian Matching]
709- D --> E{Match Found?}
710- E -->|Yes| F[Update Cluster]
711- E -->|No| G[Create New Cluster]
712- F --> H[Update Confidence]
713- G --> I[Initialize with NEW state]
714- H --> J[Update State Machine]
715- I --> J
716- J --> K[Update History]
717- K --> L[Predict Next Position]
718- L --> M{Check Unmatched Clusters}
719- M --> N[Mark as Missed]
720- N --> O[Reduce Confidence]
721- O --> P[Update State]
722- P --> Q[Archive if LOST]
723- ```
634+ ![ Tracking Pipeline] ( ../../_assets/microservices/microsvc-cluster-analytics-tracking-pipeline.svg " tracking pipeline ")
724635
725636### Hungarian Matching Algorithm
726637
@@ -751,17 +662,7 @@ total_cost = position_cost + velocity_cost + size_cost + shape_cost
751662
752663### State Machine Transitions
753664
754- ``` mermaid
755- stateDiagram-v2
756- [*] --> NEW: Detection
757- NEW --> ACTIVE: 3+ frames detected<br/>confidence > 0.6
758- ACTIVE --> STABLE: 20+ frames detected<br/>stability > 0.7
759- ACTIVE --> FADING: 15+ frames missed
760- STABLE --> FADING: 15+ frames missed
761- FADING --> ACTIVE: Redetected
762- FADING --> LOST: 10+ frames missed
763- LOST --> [*]: Archive after 5s
764- ```
665+ ![ State Machine Transitions] ( ../../_assets/microservices/microsvc-cluster-analytics-state-transitions.svg " state machine transitions ")
765666
766667### Confidence Metrics
767668
0 commit comments