matrice 1.0.98848__py3-none-any.whl → 1.0.98849__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/deploy/utils/post_processing/usecases/ppe_compliance.py +27 -13
- matrice/deploy/utils/post_processing/usecases/vehicle_monitoring.py +19 -12
- {matrice-1.0.98848.dist-info → matrice-1.0.98849.dist-info}/METADATA +1 -1
- {matrice-1.0.98848.dist-info → matrice-1.0.98849.dist-info}/RECORD +7 -7
- {matrice-1.0.98848.dist-info → matrice-1.0.98849.dist-info}/WHEEL +0 -0
- {matrice-1.0.98848.dist-info → matrice-1.0.98849.dist-info}/licenses/LICENSE.txt +0 -0
- {matrice-1.0.98848.dist-info → matrice-1.0.98849.dist-info}/top_level.txt +0 -0
@@ -399,44 +399,59 @@ class PPEComplianceUseCase(BaseProcessor):
|
|
399
399
|
frame_events.append(alert_event)
|
400
400
|
return events
|
401
401
|
|
402
|
-
|
403
|
-
|
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
|
+
from datetime import datetime, timezone
|
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
|
-
|
422
|
+
|
413
423
|
track_ids_info = self._get_track_ids_info(counting_summary.get("detections", []))
|
414
|
-
|
424
|
+
|
415
425
|
current_timestamp = self._get_current_timestamp_str(stream_info)
|
416
426
|
start_timestamp = self._get_start_timestamp_str(stream_info)
|
417
|
-
|
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"
|
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"
|
438
|
+
human_text_lines.append(f"\t\t- {label}: {count}")
|
428
439
|
else:
|
429
|
-
human_text_lines.append("
|
430
|
-
|
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"
|
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"
|
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(
|
551
|
-
|
552
|
-
|
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
|
+
from datetime import datetime, timezone
|
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
|
-
|
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"
|
580
|
+
human_text_lines.append(f"\t- Vehicles Detected: {total_vehicles}")
|
574
581
|
else:
|
575
|
-
human_text_lines.append("
|
582
|
+
human_text_lines.append(f"\t- No vehicles detected")
|
576
583
|
|
577
|
-
human_text_lines.append("") #
|
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"
|
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"
|
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:
|
@@ -122,8 +122,8 @@ matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=rLaUvU5yg
|
|
122
122
|
matrice/deploy/utils/post_processing/usecases/flare_analysis.py,sha256=_pPKa16ax4-V-iOHkdLp2-sYA6uJNAm7Z-75Fnv6vro,48674
|
123
123
|
matrice/deploy/utils/post_processing/usecases/license_plate_detection.py,sha256=zxFI8iakFUCBm64P83l380CEiuGGOPNzhZhHNpAaxIc,26902
|
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=
|
126
|
-
matrice/deploy/utils/post_processing/usecases/vehicle_monitoring.py,sha256=
|
125
|
+
matrice/deploy/utils/post_processing/usecases/ppe_compliance.py,sha256=4CsmjEbwmYlvQgC0kEhjEQlkwkgwuD4AG2NKwvfWqSs,27646
|
126
|
+
matrice/deploy/utils/post_processing/usecases/vehicle_monitoring.py,sha256=C6vLwxyjGKxuLQ9N2oaFCwQnoxKV1YsgqMA7hNflTR4,39324
|
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.
|
141
|
-
matrice-1.0.
|
142
|
-
matrice-1.0.
|
143
|
-
matrice-1.0.
|
144
|
-
matrice-1.0.
|
140
|
+
matrice-1.0.98849.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
|
141
|
+
matrice-1.0.98849.dist-info/METADATA,sha256=pBRtfgYqdmoS4hZ6RtJoGcjRrQlxJxtw1V0lreQhIzI,14624
|
142
|
+
matrice-1.0.98849.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
143
|
+
matrice-1.0.98849.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
|
144
|
+
matrice-1.0.98849.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|