matrice 1.0.98848__py3-none-any.whl → 1.0.98850__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.
@@ -413,7 +413,7 @@ class LicensePlateUseCase(BaseProcessor):
413
413
  stream_info: Optional[Dict[str, Any]] = None
414
414
  ) -> List[Dict]:
415
415
  """Generate structured tracking stats with frame-based keys, including per-frame and cumulative counts."""
416
- from datetime import datetime, timezone
416
+
417
417
 
418
418
  frame_key = str(frame_number) if frame_number is not None else "current_frame"
419
419
  tracking_stats = [{frame_key: []}]
@@ -399,44 +399,59 @@ class PPEComplianceUseCase(BaseProcessor):
399
399
  frame_events.append(alert_event)
400
400
  return events
401
401
 
402
-
403
- def _generate_tracking_stats(self, counting_summary: Dict, insights: List[str], summary: str, config: PPEComplianceConfig, frame_number: Optional[int] = None, stream_info: Optional[Dict[str, Any]] = None) -> List[Dict]:
402
+ def _generate_tracking_stats(
403
+ self,
404
+ counting_summary: Dict,
405
+ insights: List[str],
406
+ summary: str,
407
+ config: PPEComplianceConfig,
408
+ frame_number: Optional[int] = None,
409
+ stream_info: Optional[Dict[str, Any]] = None
410
+ ) -> List[Dict]:
404
411
  """Generate structured tracking stats for the output format with frame-based keys, including track_ids_info."""
412
+
413
+
405
414
  frame_key = str(frame_number) if frame_number is not None else "current_frame"
406
415
  tracking_stats = [{frame_key: []}]
407
416
  frame_tracking_stats = tracking_stats[0][frame_key]
417
+
408
418
  total_violations = counting_summary.get("total_count", 0)
409
419
  per_cat = counting_summary.get("per_category_count", {})
410
420
  cumulative = counting_summary.get("total_violation_counts", {})
411
421
  cumulative_total = sum(cumulative.values()) if cumulative else 0
412
- # Always get track ID info even if 0 detections — to ensure consistency
422
+
413
423
  track_ids_info = self._get_track_ids_info(counting_summary.get("detections", []))
414
- # Get formatted timestamps
424
+
415
425
  current_timestamp = self._get_current_timestamp_str(stream_info)
416
426
  start_timestamp = self._get_start_timestamp_str(stream_info)
417
- # Build human-readable summary string in requested format
427
+
418
428
  human_text_lines = []
429
+
419
430
  # CURRENT FRAME section
420
431
  human_text_lines.append(f"CURRENT FRAME @ {current_timestamp}:")
421
432
  if total_violations > 0:
422
- human_text_lines.append(f" - PPE Violations Detected: {total_violations}")
433
+ human_text_lines.append(f"\t- PPE Violations Detected: {total_violations}")
423
434
  for cat in ["NO-Hardhat", "NO-Mask", "NO-Safety Vest"]:
424
435
  count = per_cat.get(cat, 0)
425
436
  if count > 0:
426
437
  label = self.CATEGORY_DISPLAY.get(cat, cat).replace(" Violations", "")
427
- human_text_lines.append(f" - {label}: {count}")
438
+ human_text_lines.append(f"\t\t- {label}: {count}")
428
439
  else:
429
- human_text_lines.append(" - No PPE violations detected")
430
- human_text_lines.append("") # Empty line for spacing
440
+ human_text_lines.append("\t- No PPE violations detected")
441
+
442
+ human_text_lines.append("") # spacing
443
+
431
444
  # TOTAL SINCE section
432
445
  human_text_lines.append(f"TOTAL SINCE {start_timestamp}:")
433
- human_text_lines.append(f" - Total PPE Violations Detected: {cumulative_total}")
446
+ human_text_lines.append(f"\t- Total PPE Violations Detected: {cumulative_total}")
434
447
  for cat in ["NO-Hardhat", "NO-Mask", "NO-Safety Vest"]:
435
448
  count = cumulative.get(cat, 0)
436
449
  if count > 0:
437
450
  label = self.CATEGORY_DISPLAY.get(cat, cat).replace(" Violations", "")
438
- human_text_lines.append(f" - {label}: {count}")
451
+ human_text_lines.append(f"\t\t- {label}: {count}")
452
+
439
453
  human_text = "\n".join(human_text_lines)
454
+
440
455
  tracking_stat = {
441
456
  "type": "ppe_tracking",
442
457
  "category": "ppe",
@@ -449,11 +464,10 @@ class PPEComplianceUseCase(BaseProcessor):
449
464
  "global_frame_offset": getattr(self, '_global_frame_offset', 0),
450
465
  "local_frame_id": frame_key
451
466
  }
467
+
452
468
  frame_tracking_stats.append(tracking_stat)
453
469
  return tracking_stats
454
470
 
455
-
456
-
457
471
  def _count_categories(self, detections: list, config: PPEComplianceConfig) -> dict:
458
472
  """
459
473
  Count the number of detections per category and return a summary dict.
@@ -547,40 +547,47 @@ class VehicleMonitoringUseCase(BaseProcessor):
547
547
 
548
548
  return events
549
549
 
550
- def _generate_tracking_stats(self, counting_summary: Dict, insights: List[str], summary: str,
551
- config: VehicleMonitoringConfig, frame_number: Optional[int] = None,
552
- stream_info: Optional[Dict[str, Any]] = None) -> List[Dict]:
550
+ def _generate_tracking_stats(
551
+ self,
552
+ counting_summary: Dict,
553
+ insights: List[str],
554
+ summary: str,
555
+ config: VehicleMonitoringConfig,
556
+ frame_number: Optional[int] = None,
557
+ stream_info: Optional[Dict[str, Any]] = None
558
+ ) -> List[Dict]:
553
559
  """Generate structured tracking stats for the output format with frame-based keys, including track_ids_info."""
560
+
561
+
554
562
  frame_key = str(frame_number) if frame_number is not None else "current_frame"
555
563
  tracking_stats = [{frame_key: []}]
556
564
  frame_tracking_stats = tracking_stats[0][frame_key]
565
+
557
566
  total_vehicles = counting_summary.get("total_count", 0)
558
567
  total_vehicle_counts = counting_summary.get("total_vehicle_counts", {})
559
568
  cumulative_total = sum(total_vehicle_counts.values()) if total_vehicle_counts else 0
560
- # Add detailed track_ids_info (like people_counting)
569
+
561
570
  track_ids_info = self._get_track_ids_info(counting_summary.get("detections", []))
562
571
 
563
- # Get formatted timestamps
564
572
  current_timestamp = self._get_current_timestamp_str(stream_info)
565
573
  start_timestamp = self._get_start_timestamp_str(stream_info)
566
574
 
567
- # Build human-readable summary string in new format
568
575
  human_text_lines = []
569
576
 
570
577
  # CURRENT FRAME section
571
578
  human_text_lines.append(f"CURRENT FRAME @ {current_timestamp}:")
572
579
  if total_vehicles > 0:
573
- human_text_lines.append(f" - Vehicles Detected: {total_vehicles}")
580
+ human_text_lines.append(f"\t- Vehicles Detected: {total_vehicles}")
574
581
  else:
575
- human_text_lines.append(" - No Vehicles detected")
582
+ human_text_lines.append(f"\t- No vehicles detected")
576
583
 
577
- human_text_lines.append("") # Empty line for spacing
584
+ human_text_lines.append("") # spacing
578
585
 
579
586
  # TOTAL SINCE section
580
587
  human_text_lines.append(f"TOTAL SINCE {start_timestamp}:")
581
- human_text_lines.append(f" - Total Vehicles Detected: {cumulative_total}")
588
+ human_text_lines.append(f"\t- Total Vehicles Detected: {cumulative_total}")
582
589
  for cat, count in total_vehicle_counts.items():
583
- human_text_lines.append(f" {cat.capitalize()}: {count}")
590
+ human_text_lines.append(f"\t\t- {cat.capitalize()}: {count}")
584
591
 
585
592
  human_text = "\n".join(human_text_lines)
586
593
 
@@ -596,8 +603,8 @@ class VehicleMonitoringUseCase(BaseProcessor):
596
603
  "global_frame_offset": getattr(self, '_global_frame_offset', 0),
597
604
  "local_frame_id": frame_key
598
605
  }
599
- frame_tracking_stats.append(tracking_stat)
600
606
 
607
+ frame_tracking_stats.append(tracking_stat)
601
608
  return tracking_stats
602
609
 
603
610
  def _count_categories(self, detections: list, config: VehicleMonitoringConfig) -> dict:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice
3
- Version: 1.0.98848
3
+ Version: 1.0.98850
4
4
  Summary: SDK for connecting to matrice.ai services
5
5
  Home-page: https://github.com/matrice-ai/python-sdk
6
6
  Author: Matrice.ai
@@ -120,10 +120,10 @@ matrice/deploy/utils/post_processing/usecases/color_map_utils.py,sha256=SP-AEVcj
120
120
  matrice/deploy/utils/post_processing/usecases/customer_service.py,sha256=UWS83qxguyAyhh8a0JF5QH9DtKxO8I-gI2BPOjLPxBw,44642
121
121
  matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=rLaUvU5ygvjGbOmjncEJCl_Oe52SRycS1Ar23LbRssM,32863
122
122
  matrice/deploy/utils/post_processing/usecases/flare_analysis.py,sha256=_pPKa16ax4-V-iOHkdLp2-sYA6uJNAm7Z-75Fnv6vro,48674
123
- matrice/deploy/utils/post_processing/usecases/license_plate_detection.py,sha256=zxFI8iakFUCBm64P83l380CEiuGGOPNzhZhHNpAaxIc,26902
123
+ matrice/deploy/utils/post_processing/usecases/license_plate_detection.py,sha256=f38mdyAdW2Lopqy2XcT97HzI31_FcxTux-_tIdCm37g,26855
124
124
  matrice/deploy/utils/post_processing/usecases/people_counting.py,sha256=QSvq2zwFotp0o_T15EqFePAkukIyACleBZCf4fy7dHM,77973
125
- matrice/deploy/utils/post_processing/usecases/ppe_compliance.py,sha256=Jg_ZzQ0qzQikqEr-mq-xCX_s10CmACaDGZAOcwaqvjA,27712
126
- matrice/deploy/utils/post_processing/usecases/vehicle_monitoring.py,sha256=ZqwZYY31AZg07OpnnB1bfsS0EkwUfQE_o-tQlbnZJZ4,39431
125
+ matrice/deploy/utils/post_processing/usecases/ppe_compliance.py,sha256=UhFFy7awb3vmBd4eOdFeO43um497J0Xt90Nl9v6reoQ,27599
126
+ matrice/deploy/utils/post_processing/usecases/vehicle_monitoring.py,sha256=EkbZc1yYrb3rtloQQqZLNOTJsFPGPD8dyTG8J1M4ZNQ,39277
127
127
  matrice/deploy/utils/post_processing/utils/__init__.py,sha256=A49ksdXL7gRwBbIUwnU2ueFDGA67qVnEW_9lItOibtk,3626
128
128
  matrice/deploy/utils/post_processing/utils/advanced_counting_utils.py,sha256=D6jlZNRCfPtfG8COv3AMCbCfZf4_DK9rFhwzVJEYjpg,19152
129
129
  matrice/deploy/utils/post_processing/utils/advanced_helper_utils.py,sha256=W8mDqJTpg98YJgWYBod0rZUNbR4bmvYMeWAGASs14_s,11624
@@ -137,8 +137,8 @@ matrice/deploy/utils/post_processing/utils/format_utils.py,sha256=ce2VpQicTYKfxu
137
137
  matrice/deploy/utils/post_processing/utils/geometry_utils.py,sha256=BWfdM6RsdJTTLR1GqkWfdwpjMEjTCJyuBxA4zVGKdfk,9623
138
138
  matrice/deploy/utils/post_processing/utils/smoothing_utils.py,sha256=gQPykV1HGh-IMMz_3fumgtrhpyCRgXMS1hOEDcLRMO0,12542
139
139
  matrice/deploy/utils/post_processing/utils/tracking_utils.py,sha256=rWxuotnJ3VLMHIBOud2KLcu4yZfDp7hVPWUtNAq_2xw,8288
140
- matrice-1.0.98848.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
141
- matrice-1.0.98848.dist-info/METADATA,sha256=r1CvrLyr0z_IDiB2AQEGI6bTrgtMTmyUqj8PZ_ZoIuQ,14624
142
- matrice-1.0.98848.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
143
- matrice-1.0.98848.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
144
- matrice-1.0.98848.dist-info/RECORD,,
140
+ matrice-1.0.98850.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
141
+ matrice-1.0.98850.dist-info/METADATA,sha256=0DEEGtD_S91fmHYOV3wONYu3S94DMa7XHrBOpA4rwTk,14624
142
+ matrice-1.0.98850.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
143
+ matrice-1.0.98850.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
144
+ matrice-1.0.98850.dist-info/RECORD,,