ITEP-89520: Sensor tagging for high performan tracker#1308
ITEP-89520: Sensor tagging for high performan tracker#1308daddo-intel wants to merge 13 commits intomainfrom
Conversation
|
This is focused on environmental sensor only? |
There was a problem hiding this comment.
Pull request overview
This PR adds support for sensor tagging when running the high-performance tracker in an analytics-only deployment, and updates functional tests/compose tooling to exercise that path.
Changes:
- Add analytics-only tracked-object caching in the controller
Sceneto support associating sensor readings with tracker-published objects. - Extend the
sensors-send-eventsfunctional test target to optionally run against a tracker + analytics-only controller compose stack (gated byANALYTICS). - Update the sensor MQTT functional test to include pixel bboxes and relax assertions when running in analytics mode.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/scenescape-start | Pass through ANALYTICS env var into the started container. |
| tests/functional/tc_sensors_send_mqtt_messages.py | Add bounding_box_px, analytics flag handling, and adjust external-topic assertions for analytics runs. |
| tests/compose/tracker.yml | New tracker service compose file for functional tests. |
| tests/compose/controller_analytics.yml | New analytics-only controller compose file for functional tests. |
| tests/Makefile.functional | Add ANALYTICS-gated compose/service selection for sensors-send-events. |
| tests/Makefile | Propagate ANALYTICS into the test runner environment. |
| controller/src/controller/scene.py | Add analytics-only object caching/deserialization and adjust sensor processing to use analytics objects. |
| if self.use_tracker: | ||
| for detectionType in self.tracker.trackers.keys(): | ||
| for obj in self.tracker.currentObjects(detectionType): | ||
| # When tracking is disabled, do not rely on obj.frameCount being initialized | ||
| if (not self.use_tracker or obj.frameCount > 3) and (is_scene_wide or sensor.isPointWithin(obj.sceneLoc)): | ||
| objects_in_sensor.append(obj) | ||
| obj.chain_data.active_sensors.add(sensor_id) | ||
| else: | ||
| for obj in self._analytics_objects.values(): | ||
| if is_scene_wide or sensor.isPointWithin(obj.sceneLoc): | ||
| objects_in_sensor.append(obj) | ||
| # Ensure active_sensors is updated (handles scene-wide sensors or objects existing before sensor creation) | ||
| obj.chain_data.active_sensors.add(sensor_id) |
There was a problem hiding this comment.
processSensorData() now branches on self.use_tracker. In non-analytics mode use_tracker can be False (see scene_data.get('use_tracker', True)), but self.tracker is still present and _analytics_objects is never populated (it’s only updated in ControllerMode.isAnalyticsOnly()). This means sensor tagging will silently stop working when tracking is disabled. Consider branching on ControllerMode.isAnalyticsOnly()/self.tracker is None instead, and still iterating self.tracker.currentObjects(...) when a tracker exists (keeping the frameCount gating only when use_tracker is True).
| django: | ||
| file: ${SECRETSDIR}/django | ||
| controller-auth-file: | ||
| file: manager/secrets/controller.auth |
There was a problem hiding this comment.
controller-auth-file is hardcoded to manager/secrets/controller.auth. Other test compose files use ${SECRETSDIR} for secrets (e.g., tests/compose/web.yml, tests/compose/scene.yml), which allows callers to override secrets location. Using a fixed relative path here can break runs that set SECRETSDIR to a non-default location; consider switching this to ${SECRETSDIR}/controller.auth for consistency.
| file: manager/secrets/controller.auth | |
| file: ${SECRETSDIR}/controller.auth |
| $(if $(ANALYTICS),\ | ||
| $(eval COMPOSE_FILES := $(COMPOSE)/dlstreamer/broker.yml:$(COMPOSE)/ntp.yml:$(COMPOSE)/pgserver.yml:$(COMPOSE)/tracker.yml:$(COMPOSE)/controller_analytics.yml:$(COMPOSE)/web.yml) \ | ||
| $(eval SERVICES := 'pgserver web tracker controller-analytics'),\ | ||
| $(eval COMPOSE_FILES := $(COMPOSE)/dlstreamer/broker.yml:$(COMPOSE)/ntp.yml:$(COMPOSE)/pgserver.yml:$(COMPOSE)/scene.yml:$(COMPOSE)/web.yml) \ | ||
| $(eval SERVICES := 'pgserver web scene')\ | ||
| ) |
There was a problem hiding this comment.
Make’s $(if $(ANALYTICS), …) treats any non-empty value as true, so ANALYTICS=false would still select the analytics compose stack while the Python test interprets ANALYTICS as false. To avoid surprising behavior, consider explicitly checking for truthy values (e.g., only true/1) when selecting the compose files/services.
| obj.chain_data.active_sensors.add(sensor_id) | ||
| else: | ||
| for obj in self._analytics_objects.values(): | ||
| if is_scene_wide or sensor.isPointWithin(obj.sceneLoc): |
There was a problem hiding this comment.
Not for this PR: I think it is odd that all of region, sensor, tripwires are just handled and operated on openly in our scene class. Think about creating a base class called "Analytic" and Region, Tripwire and Sensor derive from it and the process method is overridden in each.
Co-authored-by: Sarat Poluri <sarat.chandra.poluri@intel.com>
| self.tracked_objects_cache[detection_type] = objects | ||
| self.tracked_objects_cache[detection_type] = tracked_objects | ||
|
|
||
| if ControllerMode.isAnalyticsOnly(): |
There was a problem hiding this comment.
Please verify if use_tracer and isAnalyticsOnly are redundant.
| if ControllerMode.isAnalyticsOnly(): | ||
| if detection_type in self.tracked_objects_cache: | ||
| cached_objects = self.tracked_objects_cache[detection_type] | ||
| return self._deserializeTrackedObjects(cached_objects) |
There was a problem hiding this comment.
If I deserialize in updateTrackedObjects, do I need to deserialize here again?
| obj.size = obj_data.get('size') | ||
| obj.confidence = obj_data.get('confidence') | ||
| obj.frameCount = obj_data.get('frame_count', 0) | ||
| obj.frameCount = obj_data.get('frame_count', 4) # > 3 so sensor/region checks pass |
works for both attribute & environmental sensors |
📝 Description
This PR enables sensor tagging with high performant tracker. To test:
Run make demo-tracker SUPASS=<password>sensor_0Verify that data in regulated topic has sensor values associated with track objects
make -C tests sensors-send-events ANALYTICS=true SUPASS=<password>✨ Type of Change
Select the type of change your PR introduces:
🧪 Testing Scenarios
Describe how the changes were tested and how reviewers can test them too:
✅ Checklist
Before submitting the PR, ensure the following: