matrice 1.0.99264__py3-none-any.whl → 1.0.99265__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.
@@ -422,7 +422,7 @@ class IntrusionUseCase(BaseProcessor):
422
422
  self._ascending_alert_list.append(0)
423
423
 
424
424
  human_text_lines.append(f"\t\t- Zone name: {zone_name}")
425
- human_text_lines.append(f"\t\t\t- Total count in Prohibited Boarding Gate: {zone_total-1}")
425
+ human_text_lines.append(f"\t\t\t- Total count in Prohibited Boarding Gate: {zone_total}")
426
426
  # Main people counting incident
427
427
  human_text = "\n".join(human_text_lines)
428
428
  event = self.create_incident(incident_id=self.CASE_TYPE+'_'+'zone_'+zone_name+str(frame_id), incident_type=self.CASE_TYPE,
@@ -62,6 +62,10 @@ class ProximityUseCase(BaseProcessor):
62
62
 
63
63
  # Track start time for "TOTAL SINCE" calculation
64
64
  self._tracking_start_time = None
65
+
66
+ # Proximity counting
67
+ self._total_proximity_count = 0 # Total proximity events across all calls
68
+
65
69
 
66
70
  # --------------------------------------------------------------------- #
67
71
  # Tracking aliasing structures to merge fragmented IDs #
@@ -276,7 +280,12 @@ class ProximityUseCase(BaseProcessor):
276
280
  # Count by category
277
281
  for detection in frame_detections:
278
282
  category = detection.get("category", "unknown")
279
- counting_summary["categories"][category] = counting_summary["categories"].get(category, 0) + 1
283
+ current_count = counting_summary["categories"].get(category, 0)
284
+ counting_summary["categories"][category] = current_count + 1
285
+
286
+ proximity_count = self._count_proximity_events(frame_detections)
287
+ counting_summary["proximity_events"] = proximity_count
288
+ counting_summary["total_proximity_count"] = self._total_proximity_count + proximity_count
280
289
 
281
290
  # Step 5: Zone analysis for this frame
282
291
  zone_analysis = {}
@@ -574,43 +583,59 @@ class ProximityUseCase(BaseProcessor):
574
583
  print(tracking_stat)
575
584
  return [tracking_stat]
576
585
 
577
- def _check_proximity(self, detections):
578
- """Check if any two detections are within proximity threshold."""
579
- proximity_threshold = 400
580
- for i in range(len(detections)):
581
- for j in range(i + 1, len(detections)):
582
- bbox1 = detections[i].get("bounding_box", {})
583
- bbox2 = detections[j].get("bounding_box", {})
584
-
586
+ def _count_proximity_events(self, detections):
587
+ """Count proximity events between detections."""
588
+ proximity_threshold = 400 # pixels
589
+ proximity_count = 0
590
+
591
+ for i, detection1 in enumerate(detections):
592
+ for j, detection2 in enumerate(detections[i+1:], i+1):
593
+ bbox1 = detection1.get("bounding_box", {})
594
+ bbox2 = detection2.get("bounding_box", {})
595
+
585
596
  if not bbox1 or not bbox2:
586
597
  continue
587
-
598
+
588
599
  center1 = get_bbox_center(bbox1)
589
600
  center2 = get_bbox_center(bbox2)
590
-
601
+
591
602
  if center1 and center2:
592
603
  distance = abs((center1[0] - center2[0]) + (center1[1] - center2[1]))
593
604
  if distance < proximity_threshold:
594
- return True
595
- return False
605
+ proximity_count += 1
606
+
607
+ return proximity_count
596
608
 
597
- def _generate_human_text_for_tracking(self, total_people: int, detections, total_unique_count: int, config: ProximityConfig, frame_id: str, alerts:Any=[], stream_info: Optional[Dict[str, Any]] = None) -> str:
609
+ def _generate_human_text_for_tracking(
610
+ self,
611
+ total_people: int,
612
+ detections,
613
+ total_unique_count: int,
614
+ config: ProximityConfig,
615
+ frame_id: str,
616
+ alerts:Any=[],
617
+ stream_info: Optional[Dict[str, Any]] = None) -> str:
598
618
  """Generate human-readable text for tracking stats in old format."""
599
619
  from datetime import datetime, timezone
600
620
 
601
621
  human_text_lines=[]
602
622
  current_timestamp = self._get_current_timestamp_str(stream_info, precision=True, frame_id=frame_id)
603
623
  start_timestamp = self._get_start_timestamp_str(stream_info, precision=True)
604
-
624
+
605
625
  human_text_lines.append(f"CURRENT FRAME @ {current_timestamp}:")
606
- if self._check_proximity(detections):
607
- human_text_lines.append("\t- Proximity Alert: People are within proximity threshold!")
626
+
627
+ # Add proximity count to human text
628
+ proximity_count = self._count_proximity_events(detections)
629
+ if proximity_count > 0:
630
+ human_text_lines.append(f"\t- Proximity Events Detected: {proximity_count}")
631
+ else:
632
+ human_text_lines.append("\t- No Proximity Events Detected")
608
633
  # human_text_lines.append(f"\t- People Detected: {total_people}")
609
634
 
610
635
  human_text_lines.append("")
611
- if total_unique_count > 0:
636
+ if proximity_count > 0:
612
637
  human_text_lines.append(f"TOTAL SINCE @ {start_timestamp}:")
613
- human_text_lines.append(f"\t- Total unique people count: {total_unique_count}")
638
+ human_text_lines.append(f"\t- Total Proximity Count: {self._total_proximity_count + proximity_count}")
614
639
 
615
640
  if alerts:
616
641
  for alert in alerts:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice
3
- Version: 1.0.99264
3
+ Version: 1.0.99265
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
@@ -188,7 +188,7 @@ matrice/deploy/utils/post_processing/usecases/flower_segmentation.py,sha256=4I7q
188
188
  matrice/deploy/utils/post_processing/usecases/gas_leak_detection.py,sha256=KL2ft7fXvjTas-65-QgcJm3W8KBsrwF44qibSXjfaLc,40557
189
189
  matrice/deploy/utils/post_processing/usecases/gender_detection.py,sha256=DEnCTRew6B7DtPcBQVCTtpd_IQMvMusBcu6nadUg2oM,40107
190
190
  matrice/deploy/utils/post_processing/usecases/human_activity_recognition.py,sha256=SLyvbw1y_nEQ0AlT-ErpeSydjA8U5yfRPrjMx1t3Yz0,42226
191
- matrice/deploy/utils/post_processing/usecases/intrusion_detection.py,sha256=_n9K1RKFWTm9hBqtu1VfXlW_CV7M2rNhoj3ZRH9o7CY,77441
191
+ matrice/deploy/utils/post_processing/usecases/intrusion_detection.py,sha256=Aa2wX-rq_S5aC5JDh7O_hCFPyHGPxWRDG2LIvOKZeHY,77439
192
192
  matrice/deploy/utils/post_processing/usecases/leaf.py,sha256=cwgB1ZNxkQFtkk-thSJrkXOGou1ghJr1kqtopb3sLD4,37036
193
193
  matrice/deploy/utils/post_processing/usecases/leaf_disease.py,sha256=bkiLccTdf4KUq3he4eCpBlKXb5exr-WBhQ_oWQ7os68,36225
194
194
  matrice/deploy/utils/post_processing/usecases/leak_detection.py,sha256=oOCLLVMuXVeXPHyN8FUrD3U9JYJJwIz-5fcEMgvLdls,40531
@@ -204,7 +204,7 @@ matrice/deploy/utils/post_processing/usecases/plaque_segmentation_img.py,sha256=
204
204
  matrice/deploy/utils/post_processing/usecases/pothole_segmentation.py,sha256=jXTb8ZqInp5xJ-O3Zp3zQBiryFVD0-WBbhW6Kux_NDo,44905
205
205
  matrice/deploy/utils/post_processing/usecases/ppe_compliance.py,sha256=G9P9j9E9nfNJInHJxmK1Lb4daFBlG5hq0aqotTLvFFE,30146
206
206
  matrice/deploy/utils/post_processing/usecases/price_tag_detection.py,sha256=09Tp6MGAHh95s-NSAp-4WC9iCc20sajWApuUBAvgXiQ,39880
207
- matrice/deploy/utils/post_processing/usecases/proximity_detection.py,sha256=yOIDAP8B484cvHIiLUNqwDBDsu3eZIV_61FAMD2opAo,77640
207
+ matrice/deploy/utils/post_processing/usecases/proximity_detection.py,sha256=YySgDaIFY-CEqaRkPJoI8HXTNxwe-XGFYmemPoaenJ8,78430
208
208
  matrice/deploy/utils/post_processing/usecases/road_lane_detection.py,sha256=V_KxwBtAHSNkyoH8sXw-U-P3J8ToXtX3ncc69gn6Tds,31591
209
209
  matrice/deploy/utils/post_processing/usecases/road_traffic_density.py,sha256=YiHQ0kKhXglagHPvygywxMqZAw8s0WharrBQqLQj2q4,40311
210
210
  matrice/deploy/utils/post_processing/usecases/road_view_segmentation.py,sha256=BcBbOOg5622KuvzKrzs9cJW1wkRoIIcOab0N7BONQKQ,44986
@@ -243,8 +243,8 @@ matrice/deployment/camera_manager.py,sha256=e1Lc81RJP5wUWRdTgHO6tMWF9BkBdHOSVyx3
243
243
  matrice/deployment/deployment.py,sha256=HFt151eWq6iqIAMsQvurpV2WNxW6Cx_gIUVfnVy5SWE,48093
244
244
  matrice/deployment/inference_pipeline.py,sha256=6b4Mm3-qt-Zy0BeiJfFQdImOn3FzdNCY-7ET7Rp8PMk,37911
245
245
  matrice/deployment/streaming_gateway_manager.py,sha256=ifYGl3g25wyU39HwhPQyI2OgF3M6oIqKMWt8RXtMxY8,21401
246
- matrice-1.0.99264.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
247
- matrice-1.0.99264.dist-info/METADATA,sha256=_2o9NOe0Kq4cwjZzBR0PnXGW1_Alh0OTTUYeIJgmdBc,14624
248
- matrice-1.0.99264.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
249
- matrice-1.0.99264.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
250
- matrice-1.0.99264.dist-info/RECORD,,
246
+ matrice-1.0.99265.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
247
+ matrice-1.0.99265.dist-info/METADATA,sha256=HfDECYWS5i_0EPFnpwUuQbCJkjtgFfmJkHrq-MMpo-M,14624
248
+ matrice-1.0.99265.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
249
+ matrice-1.0.99265.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
250
+ matrice-1.0.99265.dist-info/RECORD,,