matrice-analytics 0.1.60__py3-none-any.whl → 0.1.89__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.
Files changed (21) hide show
  1. matrice_analytics/post_processing/config.py +2 -2
  2. matrice_analytics/post_processing/core/base.py +1 -1
  3. matrice_analytics/post_processing/face_reg/embedding_manager.py +8 -8
  4. matrice_analytics/post_processing/face_reg/face_recognition.py +886 -201
  5. matrice_analytics/post_processing/face_reg/face_recognition_client.py +68 -2
  6. matrice_analytics/post_processing/usecases/advanced_customer_service.py +908 -498
  7. matrice_analytics/post_processing/usecases/color_detection.py +18 -18
  8. matrice_analytics/post_processing/usecases/customer_service.py +356 -9
  9. matrice_analytics/post_processing/usecases/fire_detection.py +149 -11
  10. matrice_analytics/post_processing/usecases/license_plate_monitoring.py +548 -40
  11. matrice_analytics/post_processing/usecases/people_counting.py +11 -11
  12. matrice_analytics/post_processing/usecases/vehicle_monitoring.py +34 -34
  13. matrice_analytics/post_processing/usecases/weapon_detection.py +98 -22
  14. matrice_analytics/post_processing/utils/alert_instance_utils.py +950 -0
  15. matrice_analytics/post_processing/utils/business_metrics_manager_utils.py +1245 -0
  16. matrice_analytics/post_processing/utils/incident_manager_utils.py +1657 -0
  17. {matrice_analytics-0.1.60.dist-info → matrice_analytics-0.1.89.dist-info}/METADATA +1 -1
  18. {matrice_analytics-0.1.60.dist-info → matrice_analytics-0.1.89.dist-info}/RECORD +21 -18
  19. {matrice_analytics-0.1.60.dist-info → matrice_analytics-0.1.89.dist-info}/WHEEL +0 -0
  20. {matrice_analytics-0.1.60.dist-info → matrice_analytics-0.1.89.dist-info}/licenses/LICENSE.txt +0 -0
  21. {matrice_analytics-0.1.60.dist-info → matrice_analytics-0.1.89.dist-info}/top_level.txt +0 -0
@@ -11,7 +11,7 @@ APP_NAME_TO_USECASE = {
11
11
  "traffic_sign_monitoring": "traffic_sign_monitoring",
12
12
  "flare_analysis": "flare_analysis",
13
13
  "ppe_compliance": "ppe_compliance",
14
- "advanced_customer_service": "advanced_customer_service",
14
+ "Customer Activity Analysis": "advanced_customer_service",
15
15
  "assembly_line_detection": "assembly_line_detection",
16
16
  "crop_weed_detection" : "crop_weed_detection",
17
17
  "emergency_vehicle_detection": "emergency_vehicle_detection",
@@ -80,7 +80,7 @@ APP_NAME_TO_CATEGORY = {
80
80
  "traffic_sign_monitoring": "traffic",
81
81
  "flare_analysis": "flare_detection",
82
82
  "ppe_compliance": "security",
83
- "advanced_customer_service": "sales",
83
+ "Customer Activity Analysis": "sales",
84
84
  "assembly_line_detection": "manufacturing",
85
85
  "crop_weed_detection": "agriculture",
86
86
  "emergency_vehicle_detection": "traffic",
@@ -286,7 +286,7 @@ class BaseProcessor(ABC):
286
286
  "incident_id": incident_id,
287
287
  "incident_type": incident_type,
288
288
  "severity_level": severity_level,
289
- "human_text": human_text or f"{incident_type} detected @ {timestamp} [Severity Level: {severity_level}]",
289
+ "human_text": human_text or f"{incident_type} detected. [Severity Level: {severity_level}]",
290
290
  "start_time": timestamp,
291
291
  "end_time": end_time or timestamp,
292
292
  "camera_info": camera_info or self.get_default_camera_info(),
@@ -234,10 +234,10 @@ class EmbeddingManager:
234
234
  return False
235
235
 
236
236
  try:
237
- self.logger.info("Loading staff embeddings from API...")
238
- print("=============== LOADING STAFF EMBEDDINGS FROM API ===============")
237
+ #self.logger.info("Loading staff embeddings from API...")
238
+ #print("=============== LOADING STAFF EMBEDDINGS FROM API ===============")
239
239
  response = await self.face_client.get_all_staff_embeddings()
240
- print(f"API RESPONSE TYPE: {type(response)}, IS_LIST: {isinstance(response, list)}, LEN: {len(response) if isinstance(response, list) else 'N/A'}")
240
+ #print(f"API RESPONSE TYPE: {type(response)}, IS_LIST: {isinstance(response, list)}, LEN: {len(response) if isinstance(response, list) else 'N/A'}")
241
241
 
242
242
  # Robust response handling: accept dict with data or raw list
243
243
  embeddings_data: List[Dict[str, Any]] = []
@@ -330,13 +330,13 @@ class EmbeddingManager:
330
330
  self._embeddings_loaded = True # Mark as successfully loaded
331
331
 
332
332
  self.logger.info(f"Successfully loaded and cached {len(self.staff_embeddings)} staff embeddings (dim={self.embeddings_matrix.shape[1]})")
333
- print(f"=============== SUCCESS: LOADED {len(self.staff_embeddings)} EMBEDDINGS, MATRIX SHAPE: {self.embeddings_matrix.shape} ===============")
333
+ #print(f"=============== SUCCESS: LOADED {len(self.staff_embeddings)} EMBEDDINGS, MATRIX SHAPE: {self.embeddings_matrix.shape} ===============")
334
334
  try:
335
335
  # Quick sanity metrics
336
336
  row0_sum = float(np.sum(self.embeddings_matrix[0])) if self.embeddings_matrix.shape[0] > 0 else 0.0
337
337
  row0_norm = float(np.linalg.norm(self.embeddings_matrix[0])) if self.embeddings_matrix.shape[0] > 0 else 0.0
338
- print(f"SANITY CHECK: row0_sum={row0_sum:.4f}, row0_norm={row0_norm:.4f} (should be ~1.0 after normalization)")
339
- self.logger.debug(f"Embeddings matrix shape: {self.embeddings_matrix.shape}, dtype={self.embeddings_matrix.dtype}, row0_sum={row0_sum:.4f}")
338
+ #print(f"SANITY CHECK: row0_sum={row0_sum:.4f}, row0_norm={row0_norm:.4f} (should be ~1.0 after normalization)")
339
+ #self.logger.debug(f"Embeddings matrix shape: {self.embeddings_matrix.shape}, dtype={self.embeddings_matrix.dtype}, row0_sum={row0_sum:.4f}")
340
340
  except Exception as e:
341
341
  print(f"ERROR in sanity check: {e}")
342
342
  return True
@@ -395,13 +395,13 @@ class EmbeddingManager:
395
395
  """Find best matching staff member using optimized matrix operations (thread-safe)."""
396
396
  # Check if embeddings are loaded at all
397
397
  if not self._embeddings_loaded:
398
- print(f"ERROR: _find_best_local_match called but embeddings not loaded yet (_embeddings_loaded={self._embeddings_loaded})")
398
+ #print(f"ERROR: _find_best_local_match called but embeddings not loaded yet (_embeddings_loaded={self._embeddings_loaded})")
399
399
  self.logger.error("Embeddings not loaded - _find_best_local_match cannot proceed")
400
400
  return None
401
401
 
402
402
  with self._embeddings_lock:
403
403
  if self.embeddings_matrix is None or len(self.embedding_metadata) == 0:
404
- print(f"ERROR: _find_best_local_match - embeddings_matrix is None={self.embeddings_matrix is None}, metadata_len={len(self.embedding_metadata)}, _embeddings_loaded={self._embeddings_loaded}")
404
+ #print(f"ERROR: _find_best_local_match - embeddings_matrix is None={self.embeddings_matrix is None}, metadata_len={len(self.embedding_metadata)}, _embeddings_loaded={self._embeddings_loaded}")
405
405
  self.logger.error(f"Embeddings matrix is None despite _embeddings_loaded={self._embeddings_loaded}")
406
406
  return None
407
407