matrice 1.0.99278__py3-none-any.whl → 1.0.99280__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.
@@ -319,7 +319,7 @@ class OutputConfig:
319
319
  class _RealTimeJsonEventPicker:
320
320
  """Stateful helper that replicates the original logic but works one frame at a time."""
321
321
 
322
- def __init__(self, consecutive_threshold: int = 7, end_threshold: int = 129):
322
+ def __init__(self, consecutive_threshold: int = 7, end_threshold: int = 130):
323
323
  # Required sequence of severities
324
324
  self._base_sequence: List[str] = ["low", "medium", "significant", "critical", "low"]
325
325
  self._sequence: deque[str] = deque(self._base_sequence)
@@ -405,7 +405,7 @@ class _RealTimeJsonEventPicker:
405
405
  # No detections in this frame
406
406
  if len(self._sequence) == 1: # Waiting for final idle period
407
407
  self._hit_counter += 1
408
- if self._hit_counter >= self._end_threshold:
408
+ if (self._hit_counter >= self._end_threshold) or (incidents.get("human_text")=="Event Over"):
409
409
  event = {
410
410
  "type": "event_end",
411
411
  "frame_id": frame_id,
@@ -108,6 +108,7 @@ class FireSmokeUseCase(BaseProcessor):
108
108
  self.id_hit_list = ["low","medium","significant","critical","low"]
109
109
  self.id_hit_counter = 0
110
110
  self.latest_stack:str = None
111
+ self.id_timing_list = []
111
112
 
112
113
  def process(
113
114
  self,
@@ -312,7 +313,7 @@ class FireSmokeUseCase(BaseProcessor):
312
313
  if hasattr(config.alert_config, 'count_thresholds') and config.alert_config.count_thresholds:
313
314
  # Safely fetch the last recorded severity level as a **string** (empty if no history yet)
314
315
  last_level = self._ascending_alert_list[-1] if self._ascending_alert_list else "low"
315
- alert_id = self._get_alert_incident_ids(last_level)
316
+ alert_id = self._get_alert_incident_ids(last_level, stream_info)
316
317
  if alert_id not in [1,2,3,4,5]:
317
318
  alert_id = 4
318
319
 
@@ -410,6 +411,7 @@ class FireSmokeUseCase(BaseProcessor):
410
411
 
411
412
  #count = summary.get("per_category_count", {})[category]
412
413
  start_timestamp = self._get_start_timestamp_str(stream_info)
414
+
413
415
  if start_timestamp and self.current_incident_end_timestamp=='N/A':
414
416
  self.current_incident_end_timestamp = 'Incident still active'
415
417
  elif start_timestamp and self.current_incident_end_timestamp=='Incident still active':
@@ -477,9 +479,13 @@ class FireSmokeUseCase(BaseProcessor):
477
479
 
478
480
  # Pass the last severity level **value** instead of a single-element list
479
481
  last_level = level if level else self._ascending_alert_list[-1]
480
- incident_id = self._get_alert_incident_ids(last_level)
482
+ incident_id = self._get_alert_incident_ids(last_level, stream_info)
481
483
  if incident_id not in [1,2,3,4,5]:
482
484
  incident_id = 4
485
+ if len(self.id_timing_list)>0 and len(self.id_timing_list)==incident_id:
486
+ start_timestamp = self.id_timing_list[-1]
487
+ if len(self.id_timing_list)>0 and len(self.id_timing_list)>4 and level=='critical':
488
+ start_timestamp = self.id_timing_list[-1]
483
489
 
484
490
  alert_settings=[]
485
491
  if config.alert_config and hasattr(config.alert_config, 'alert_type'):
@@ -634,8 +640,10 @@ class FireSmokeUseCase(BaseProcessor):
634
640
  tracking_stats.append(tracking_stat)
635
641
 
636
642
  if len(self.id_hit_list)==1:
637
- last_ending_id = self._get_alert_incident_ids("")
643
+ last_ending_id = self._get_alert_incident_ids("",stream_info)
638
644
  print('last_ending_id',last_ending_id)
645
+ if len(self.id_timing_list)>0 and len(self.id_timing_list)>=5:
646
+ start_timestamp = self.id_timing_list[-1]
639
647
  if last_ending_id==5:
640
648
  alerts={
641
649
  "alert_type": getattr(config.alert_config, 'alert_type', ['Default']) if hasattr(config.alert_config, 'alert_type') else ['Default'],
@@ -998,7 +1006,7 @@ class FireSmokeUseCase(BaseProcessor):
998
1006
 
999
1007
  return delta.total_seconds()
1000
1008
 
1001
- def _get_alert_incident_ids(self, sev_level):
1009
+ def _get_alert_incident_ids(self, sev_level, stream_info: Optional[Dict[str, Any]] = None):
1002
1010
 
1003
1011
  if sev_level!="":
1004
1012
  if sev_level==self.id_hit_list[0] and len(self.id_hit_list)>=2:
@@ -1007,6 +1015,7 @@ class FireSmokeUseCase(BaseProcessor):
1007
1015
  self.latest_stack = self.id_hit_list[0]
1008
1016
  self.id_hit_list.pop(0)
1009
1017
  self.id_hit_counter=0
1018
+ self.id_timing_list.append(self._get_current_timestamp_str(stream_info))
1010
1019
  return int(5-len(self.id_hit_list))
1011
1020
 
1012
1021
  elif self.id_hit_counter>0:
@@ -1026,6 +1035,7 @@ class FireSmokeUseCase(BaseProcessor):
1026
1035
  self.id_hit_list = ["low","medium","significant","critical","low"]
1027
1036
  self.id_hit_counter = 0
1028
1037
  self.latest_stack = None
1038
+ self.id_timing_list.append(self._get_current_timestamp_str(stream_info))
1029
1039
  return int(5)
1030
1040
  if sev_level==self.latest_stack:
1031
1041
  return int(5-len(self.id_hit_list))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice
3
- Version: 1.0.99278
3
+ Version: 1.0.99280
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
@@ -109,7 +109,7 @@ matrice/deploy/client/auto_streaming/auto_streaming.py,sha256=VRfy_EBFvhspN-hoN3
109
109
  matrice/deploy/client/auto_streaming/auto_streaming_utils.py,sha256=BuRUokLp3t43yzRF8YSX9p_RHQD94RoBwNEoldXFDQo,14995
110
110
  matrice/deploy/client/streaming_gateway/__init__.py,sha256=hkYC0qszaXZThquMuuI20Qkt_AHCB3pdy7jlJVeqPN4,1203
111
111
  matrice/deploy/client/streaming_gateway/streaming_gateway.py,sha256=r8Z5AXBom89n-8W5RTlB-nOeUaprxK-QBDsAb-E9gl8,19605
112
- matrice/deploy/client/streaming_gateway/streaming_gateway_utils.py,sha256=LC39UFS-ggUFwV-NJFy6sc0cR9YDb32MpeuPdlyM3-Q,42145
112
+ matrice/deploy/client/streaming_gateway/streaming_gateway_utils.py,sha256=vPjp1JDs6hpdbOpMP7ymx7j-PDB85b8W2yrntx79riI,42194
113
113
  matrice/deploy/client/streaming_gateway/streaming_results_handler.py,sha256=OpHkdbnuqVN28tQm9CYwrfgAth3Qz40Uaq5Tg4bbxyo,15813
114
114
  matrice/deploy/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
115
115
  matrice/deploy/server/server.py,sha256=duki4KUU1tvW3Y7wkrlMRVvt7bAP2QqSIsrSogLxC4o,36799
@@ -183,7 +183,7 @@ matrice/deploy/utils/post_processing/usecases/face_emotion.py,sha256=eRfqBdryB0u
183
183
  matrice/deploy/utils/post_processing/usecases/face_recognition.py,sha256=T5xAuv6b9OrkmTmoXgZs4LZ5XUsbvp9xCpeLBwdu7eI,40231
184
184
  matrice/deploy/utils/post_processing/usecases/fashion_detection.py,sha256=f9gpzMDhIW-gyn46k9jgf8nY7YeoqAnTxGOzksabFbE,40457
185
185
  matrice/deploy/utils/post_processing/usecases/field_mapping.py,sha256=JDwYX8pd2W-waDvBh98Y_o_uchJu7wEYbFxOliA4Iq4,39822
186
- matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=xYeVhIKCNJ2g4KvTBjQmsIivTO2zroEkI8u-Ek_51Kc,48834
186
+ matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=EVY8uZ4e1g6XUKsHLtngy82_aXkQlINjrSFRH_AoYA0,49624
187
187
  matrice/deploy/utils/post_processing/usecases/flare_analysis.py,sha256=-egmS3Hs_iGOLeCMfapbkfQ04EWtZx97QRuUcDa-jMU,45340
188
188
  matrice/deploy/utils/post_processing/usecases/flower_segmentation.py,sha256=4I7qMx9Ztxg_hy9KTVX-3qBhAN-QwDt_Yigf9fFjLus,52017
189
189
  matrice/deploy/utils/post_processing/usecases/gas_leak_detection.py,sha256=KL2ft7fXvjTas-65-QgcJm3W8KBsrwF44qibSXjfaLc,40557
@@ -244,8 +244,8 @@ matrice/deployment/camera_manager.py,sha256=e1Lc81RJP5wUWRdTgHO6tMWF9BkBdHOSVyx3
244
244
  matrice/deployment/deployment.py,sha256=HFt151eWq6iqIAMsQvurpV2WNxW6Cx_gIUVfnVy5SWE,48093
245
245
  matrice/deployment/inference_pipeline.py,sha256=6b4Mm3-qt-Zy0BeiJfFQdImOn3FzdNCY-7ET7Rp8PMk,37911
246
246
  matrice/deployment/streaming_gateway_manager.py,sha256=ifYGl3g25wyU39HwhPQyI2OgF3M6oIqKMWt8RXtMxY8,21401
247
- matrice-1.0.99278.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
248
- matrice-1.0.99278.dist-info/METADATA,sha256=axtB0oShC8RN76G1b1qHYLVVWyxNJb106mjUraAQ7pY,14624
249
- matrice-1.0.99278.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
250
- matrice-1.0.99278.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
251
- matrice-1.0.99278.dist-info/RECORD,,
247
+ matrice-1.0.99280.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
248
+ matrice-1.0.99280.dist-info/METADATA,sha256=I25kb62DRgh716aJCQo6-_T-9BYCP6mf-WGqNzRi8TA,14624
249
+ matrice-1.0.99280.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
250
+ matrice-1.0.99280.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
251
+ matrice-1.0.99280.dist-info/RECORD,,