Skip to content

Commit c9987ea

Browse files
Copilotsaratpoluri
andauthored
Merge remote-tracking branch 'origin/main' into feature/support-cosine
# Conflicts: # controller/config/reid-config.json # controller/src/controller/uuid_manager.py # docs/user-guide/microservices/controller/Extended-ReID.md # docs/user-guide/microservices/controller/data_formats.md # docs/user-guide/other-topics/how-to-enable-reidentification.md # tests/Makefile # tests/Makefile.functional # tests/Makefile.sscape # tests/functional/config/reid-threshold-scenario.json # tests/functional/tc_reid_unique_count.py # tests/sscape_tests/scenescape/test_scene_controller.py Co-authored-by: saratpoluri <1325325+saratpoluri@users.noreply.github.com>
2 parents 2821224 + fb8e3d8 commit c9987ea

11 files changed

Lines changed: 32 additions & 125 deletions

File tree

controller/config/reid-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"feature_accumulation_threshold": 12,
66
"minimum_bbox_area": 5000,
77
"feature_slice_size": 10,
8-
"similarity_threshold": 30
8+
"similarity_threshold": 30.0
99
}

docs/user-guide/_assets/microservices/microsvc-cluster-analytics-dataflow.svg

Lines changed: 4 additions & 0 deletions
Loading

docs/user-guide/_assets/microservices/microsvc-cluster-analytics-shape-det-logic.svg

Lines changed: 4 additions & 0 deletions
Loading

docs/user-guide/_assets/microservices/microsvc-cluster-analytics-state-transitions.svg

Lines changed: 4 additions & 0 deletions
Loading

docs/user-guide/_assets/microservices/microsvc-cluster-analytics-tracking-pipeline.svg

Lines changed: 4 additions & 0 deletions
Loading

docs/user-guide/_assets/microservices/microsvc-cluster-analytics-velocity-logic.svg

Lines changed: 4 additions & 0 deletions
Loading

docs/user-guide/microservices/cluster-analytics/cluster-analytics.md

Lines changed: 6 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -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

kubernetes/scenescape-chart/templates/ntp/deployment.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ spec:
3838
- name: healthy-file
3939
mountPath: /tmp
4040
containers:
41-
- image: {{ .Values.ntpserv.image.repository }}/{{ .Values.ntpserv.image.name }}:{{ .Values.ntpserv.image.tag }}
41+
- image: {{ .Values.ntpserv.image.repository }}/{{ .Values.ntpserv.image.name }}:{{ .Values.ntpserv.image.tag }}{{- if .Values.ntpserv.image.digest }}@{{ .Values.ntpserv.image.digest }}{{- end }}
4242
imagePullPolicy: {{ .Values.ntpserv.image.pullPolicy }}
4343
name: {{ .Release.Name }}-ntpserv
4444
env:
@@ -85,8 +85,7 @@ spec:
8585
- name: healthy-file
8686
emptyDir: {}
8787
- name: etc-chrony
88-
emptyDir:
89-
medium: Memory
88+
emptyDir: {}
9089
- name: run-chrony
9190
emptyDir:
9291
medium: Memory

kubernetes/scenescape-chart/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ntpserv:
3232
image:
3333
repository: docker.io
3434
name: dockurr/chrony
35-
tag: 4.8
35+
tag: 4.8@sha256:3f26c43b64744e57f09a7816ba04c3ba8de1e4c4992cec677101c5225a005947
3636
pullPolicy: IfNotPresent
3737
ntpServers: "0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org"
3838

tests/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ _ui-tests: \
237237

238238
unit-tests:
239239
$(eval OLDSECRETSDIR := $(SECRETSDIR))
240-
$(eval SECRETSDIR := $(if $(SECRETSDIR),$(SECRETSDIR),$(CURDIR)/../manager/secrets))
240+
$(eval SECRETSDIR := $(if $(SECRETSDIR),$(SECRETSDIR),$(PWD)/../manager/secrets))
241241
$(MAKE) -Otarget -j $(NPROCS) _$@ SECRETSDIR=$(SECRETSDIR) SUPASS=$(SUPASS) -k
242242
$(eval SECRETSDIR := $(OLDSECRETSDIR))
243243

0 commit comments

Comments
 (0)