matrice-analytics 0.1.97__py3-none-any.whl → 0.1.124__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- matrice_analytics/post_processing/__init__.py +22 -0
- matrice_analytics/post_processing/advanced_tracker/config.py +8 -4
- matrice_analytics/post_processing/advanced_tracker/track_class_aggregator.py +128 -0
- matrice_analytics/post_processing/advanced_tracker/tracker.py +22 -1
- matrice_analytics/post_processing/config.py +17 -2
- matrice_analytics/post_processing/core/config.py +107 -1
- matrice_analytics/post_processing/face_reg/face_recognition.py +706 -73
- matrice_analytics/post_processing/face_reg/people_activity_logging.py +25 -14
- matrice_analytics/post_processing/post_processor.py +16 -0
- matrice_analytics/post_processing/usecases/__init__.py +9 -0
- matrice_analytics/post_processing/usecases/crowdflow.py +1088 -0
- matrice_analytics/post_processing/usecases/footfall.py +170 -22
- matrice_analytics/post_processing/usecases/license_plate_monitoring.py +57 -38
- matrice_analytics/post_processing/usecases/parking_lot_analytics.py +1137 -0
- matrice_analytics/post_processing/usecases/vehicle_monitoring.py +30 -4
- matrice_analytics/post_processing/usecases/vehicle_monitoring_drone_view.py +246 -3
- matrice_analytics/post_processing/usecases/vehicle_monitoring_parking_lot.py +36 -3
- matrice_analytics/post_processing/usecases/vehicle_monitoring_wrong_way.py +1021 -0
- matrice_analytics/post_processing/utils/__init__.py +5 -0
- matrice_analytics/post_processing/utils/agnostic_nms.py +759 -0
- matrice_analytics/post_processing/utils/alert_instance_utils.py +55 -7
- matrice_analytics/post_processing/utils/business_metrics_manager_utils.py +25 -2
- matrice_analytics/post_processing/utils/incident_manager_utils.py +12 -1
- matrice_analytics/post_processing/utils/parking_analytics_tracker.py +359 -0
- matrice_analytics/post_processing/utils/wrong_way_tracker.py +670 -0
- {matrice_analytics-0.1.97.dist-info → matrice_analytics-0.1.124.dist-info}/METADATA +1 -1
- {matrice_analytics-0.1.97.dist-info → matrice_analytics-0.1.124.dist-info}/RECORD +30 -23
- {matrice_analytics-0.1.97.dist-info → matrice_analytics-0.1.124.dist-info}/WHEEL +0 -0
- {matrice_analytics-0.1.97.dist-info → matrice_analytics-0.1.124.dist-info}/licenses/LICENSE.txt +0 -0
- {matrice_analytics-0.1.97.dist-info → matrice_analytics-0.1.124.dist-info}/top_level.txt +0 -0
|
@@ -154,33 +154,40 @@ class PeopleActivityLogging:
|
|
|
154
154
|
except Exception as e:
|
|
155
155
|
self.logger.error(f"Error enqueueing detection: {e}", exc_info=True)
|
|
156
156
|
|
|
157
|
-
def _should_log_detection(self, employee_id: str) -> bool:
|
|
157
|
+
def _should_log_detection(self, employee_id: str, camera_id: str = "") -> bool:
|
|
158
158
|
"""
|
|
159
|
-
Check if detection should be logged based on employee ID and time threshold.
|
|
160
|
-
Only log if employee_id was not detected in the past
|
|
159
|
+
Check if detection should be logged based on employee ID (+ camera ID) and time threshold.
|
|
160
|
+
Only log if the same (employee_id, camera_id) was not detected in the past N seconds.
|
|
161
|
+
If camera_id is empty, falls back to global employee_id de-duplication (backward compatible).
|
|
161
162
|
|
|
162
163
|
TODO: Make this use track_id or similarity check instead of just employee_id in 10 secs window
|
|
163
164
|
for better deduplication across different detection sessions.
|
|
164
165
|
"""
|
|
165
166
|
current_time = time.time()
|
|
167
|
+
dedupe_key = f"{employee_id}::{camera_id}" if camera_id else employee_id
|
|
166
168
|
|
|
167
169
|
# Clean up old entries (older than threshold)
|
|
168
170
|
expired_keys = [
|
|
169
|
-
|
|
171
|
+
key for key, timestamp in self.recent_employee_detections.items()
|
|
170
172
|
if current_time - timestamp > self.employee_detection_threshold
|
|
171
173
|
]
|
|
172
|
-
for
|
|
173
|
-
del self.recent_employee_detections[
|
|
174
|
+
for key in expired_keys:
|
|
175
|
+
del self.recent_employee_detections[key]
|
|
174
176
|
|
|
175
|
-
# Check if employee was recently detected
|
|
176
|
-
if
|
|
177
|
-
last_detection = self.recent_employee_detections[
|
|
177
|
+
# Check if employee was recently detected (per camera_id)
|
|
178
|
+
if dedupe_key in self.recent_employee_detections:
|
|
179
|
+
last_detection = self.recent_employee_detections[dedupe_key]
|
|
178
180
|
if current_time - last_detection < self.employee_detection_threshold:
|
|
179
|
-
self.logger.debug(
|
|
181
|
+
self.logger.debug(
|
|
182
|
+
"Skipping logging for employee %s (camera_id=%s) - detected %.1fs ago",
|
|
183
|
+
employee_id,
|
|
184
|
+
camera_id,
|
|
185
|
+
current_time - last_detection,
|
|
186
|
+
)
|
|
180
187
|
return False
|
|
181
188
|
|
|
182
|
-
# Update detection time for this employee
|
|
183
|
-
self.recent_employee_detections[
|
|
189
|
+
# Update detection time for this (employee, camera)
|
|
190
|
+
self.recent_employee_detections[dedupe_key] = current_time
|
|
184
191
|
return True
|
|
185
192
|
|
|
186
193
|
async def _process_activity(self, activity_data: Dict):
|
|
@@ -202,8 +209,12 @@ class PeopleActivityLogging:
|
|
|
202
209
|
return
|
|
203
210
|
|
|
204
211
|
# Check if we should log this detection (avoid duplicates within time window)
|
|
205
|
-
if not self._should_log_detection(employee_id):
|
|
206
|
-
self.logger.debug(
|
|
212
|
+
if not self._should_log_detection(employee_id, camera_id=camera_id):
|
|
213
|
+
self.logger.debug(
|
|
214
|
+
"Skipping activity log for employee_id=%s (camera_id=%s) (within cooldown period)",
|
|
215
|
+
employee_id,
|
|
216
|
+
camera_id,
|
|
217
|
+
)
|
|
207
218
|
return None
|
|
208
219
|
|
|
209
220
|
# Encode frame as base64 JPEG
|
|
@@ -100,8 +100,15 @@ from .usecases import (
|
|
|
100
100
|
SusActivityUseCase,
|
|
101
101
|
NaturalDisasterUseCase,
|
|
102
102
|
FootFallUseCase,
|
|
103
|
+
CrowdflowUseCase,
|
|
103
104
|
VehicleMonitoringParkingLotUseCase,
|
|
104
105
|
VehicleMonitoringDroneViewUseCase,
|
|
106
|
+
ParkingLotAnalyticsUseCase,
|
|
107
|
+
<<<<<<< HEAD
|
|
108
|
+
VehicleMonitoringWrongWayUseCase,
|
|
109
|
+
=======
|
|
110
|
+
|
|
111
|
+
>>>>>>> eaa173c (added new crowdflow usecase)
|
|
105
112
|
# Put all IMAGE based usecases here
|
|
106
113
|
BloodCancerDetectionUseCase,
|
|
107
114
|
SkinCancerClassificationUseCase,
|
|
@@ -581,6 +588,15 @@ class PostProcessor:
|
|
|
581
588
|
registry.register_use_case(
|
|
582
589
|
"traffic", "vehicle_monitoring_drone_view", VehicleMonitoringDroneViewUseCase
|
|
583
590
|
)
|
|
591
|
+
registry.register_use_case(
|
|
592
|
+
"traffic", "parking_lot_analytics", ParkingLotAnalyticsUseCase
|
|
593
|
+
)
|
|
594
|
+
registry.register_use_case(
|
|
595
|
+
"retail", "crowdflow", CrowdflowUseCase
|
|
596
|
+
)
|
|
597
|
+
registry.register_use_case(
|
|
598
|
+
"traffic", "vehicle_monitoring_wrong_way", VehicleMonitoringWrongWayUseCase
|
|
599
|
+
)
|
|
584
600
|
|
|
585
601
|
# Put all IMAGE based usecases here
|
|
586
602
|
registry.register_use_case(
|
|
@@ -88,6 +88,9 @@ from .natural_disaster import NaturalDisasterConfig, NaturalDisasterUseCase
|
|
|
88
88
|
from .footfall import FootFallConfig, FootFallUseCase
|
|
89
89
|
from .vehicle_monitoring_parking_lot import VehicleMonitoringParkingLotUseCase, VehicleMonitoringParkingLotConfig
|
|
90
90
|
from .vehicle_monitoring_drone_view import VehicleMonitoringDroneViewUseCase, VehicleMonitoringDroneViewConfig
|
|
91
|
+
from .parking_lot_analytics import ParkingLotAnalyticsUseCase, ParkingLotAnalyticsConfig
|
|
92
|
+
from .vehicle_monitoring_wrong_way import VehicleMonitoringWrongWayUseCase, VehicleMonitoringWrongWayConfig
|
|
93
|
+
from .crowdflow import CrowdflowUseCase, CrowdflowConfig
|
|
91
94
|
|
|
92
95
|
#Put all IMAGE based usecases here
|
|
93
96
|
from .blood_cancer_detection_img import BloodCancerDetectionConfig, BloodCancerDetectionUseCase
|
|
@@ -178,6 +181,9 @@ __all__ = [
|
|
|
178
181
|
'FootFallUseCase',
|
|
179
182
|
'VehicleMonitoringParkingLotUseCase',
|
|
180
183
|
'VehicleMonitoringDroneViewUseCase',
|
|
184
|
+
'ParkingLotAnalyticsUseCase',
|
|
185
|
+
'VehicleMonitoringWrongWayUseCase',
|
|
186
|
+
'CrowdflowUseCase',
|
|
181
187
|
|
|
182
188
|
#Put all IMAGE based usecases here
|
|
183
189
|
'BloodCancerDetectionUseCase',
|
|
@@ -263,6 +269,9 @@ __all__ = [
|
|
|
263
269
|
'FootFallConfig',
|
|
264
270
|
'VehicleMonitoringParkingLotConfig',
|
|
265
271
|
'VehicleMonitoringDroneViewConfig',
|
|
272
|
+
'ParkingLotAnalyticsConfig',
|
|
273
|
+
'VehicleMonitoringWrongWayConfig',
|
|
274
|
+
'CrowdflowConfig',
|
|
266
275
|
|
|
267
276
|
#Put all IMAGE based usecase CONFIGS here
|
|
268
277
|
'BloodCancerDetectionConfig',
|