matrice 1.0.99287__py3-none-any.whl → 1.0.99288__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.
@@ -109,6 +109,7 @@ class FireSmokeUseCase(BaseProcessor):
109
109
  self.id_hit_counter = 0
110
110
  self.latest_stack:str = None
111
111
  self.id_timing_list = []
112
+ self.return_id_counter = 1
112
113
 
113
114
  def process(
114
115
  self,
@@ -244,11 +245,11 @@ class FireSmokeUseCase(BaseProcessor):
244
245
  print('FRAME_NUMBER',str(frame_number))
245
246
  print("-----------------------------------------------------########-------------")
246
247
 
247
- business_analytics = business_analytics_list[0] if business_analytics_list else {}
248
+ business_analytics = business_analytics_list[0] if business_analytics_list else []
248
249
  summary = summary_list[0] if summary_list else {}
249
250
  agg_summary = {str(frame_number): {
250
- "incidents": incidents,
251
- "tracking_stats": tracking_stats,
251
+ "incidents": [incidents],
252
+ "tracking_stats": [tracking_stats],
252
253
  "business_analytics": business_analytics,
253
254
  "alerts": alerts,
254
255
  "human_text": summary}
@@ -313,21 +314,22 @@ class FireSmokeUseCase(BaseProcessor):
313
314
  if hasattr(config.alert_config, 'count_thresholds') and config.alert_config.count_thresholds:
314
315
  # Safely fetch the last recorded severity level as a **string** (empty if no history yet)
315
316
  last_level = self._ascending_alert_list[-1] if self._ascending_alert_list else "low"
316
- alert_id = self._get_alert_incident_ids(last_level, stream_info)
317
- if alert_id not in [1,2,3,4,5]:
318
- alert_id = 4
317
+ rank_ids, alert_id = self._get_alert_incident_ids(last_level, stream_info)
318
+ if rank_ids not in [1,2,3,4,5]:
319
+ alert_id = 1
319
320
 
320
321
  count_thresholds = {}
321
322
  if config.alert_config and hasattr(config.alert_config, "count_thresholds"):
322
323
  count_thresholds = config.alert_config.count_thresholds or {}
323
324
 
324
325
  for category, threshold in count_thresholds.items():
325
- alert_id = 1
326
+ alert_serial = getattr(config.alert_config, 'alert_type', ['Default']) if hasattr(config.alert_config, 'alert_type') else ['Default']
327
+ alert_serial = alert_serial[0]
326
328
  if category == "all" and total > threshold:
327
329
 
328
330
  alerts.append({
329
331
  "alert_type": getattr(config.alert_config, 'alert_type', ['Default']) if hasattr(config.alert_config, 'alert_type') else ['Default'],
330
- "alert_id": "alert_"+category+'_'+str(alert_id),
332
+ "alert_id": "alert_"+category+'_'+alert_serial+'_'+str(alert_id),
331
333
  "incident_category": self.CASE_TYPE,
332
334
  "threshold_level": threshold,
333
335
  "ascending": get_trend(self._ascending_alert_list, lookback=23, prior=14),
@@ -480,14 +482,14 @@ class FireSmokeUseCase(BaseProcessor):
480
482
 
481
483
  # Pass the last severity level **value** instead of a single-element list
482
484
  last_level = level if level else self._ascending_alert_list[-1]
483
- incident_id = self._get_alert_incident_ids(last_level, stream_info)
484
- if incident_id not in [1,2,3,4,5]:
485
- incident_id = 4
486
- if len(self.id_timing_list)>0 and len(self.id_timing_list)==incident_id:
485
+ rank_ids, incident_id = self._get_alert_incident_ids(last_level, stream_info)
486
+ if rank_ids not in [1,2,3,4,5]:
487
+ incident_id = 1
488
+ if len(self.id_timing_list)>0 and len(self.id_timing_list)==rank_ids:
487
489
  start_timestamp = self.id_timing_list[-1]
488
490
  if len(self.id_timing_list)>0 and len(self.id_timing_list)>4 and level=='critical':
489
491
  start_timestamp = self.id_timing_list[-1]
490
- incident_id = 1
492
+
491
493
  alert_settings=[]
492
494
  if config.alert_config and hasattr(config.alert_config, 'alert_type'):
493
495
  alert_settings.append({
@@ -500,7 +502,7 @@ class FireSmokeUseCase(BaseProcessor):
500
502
  }
501
503
  })
502
504
 
503
- event= self.create_incident(incident_id=self.CASE_TYPE+'_'+str(incident_id), incident_type=self.CASE_TYPE,
505
+ event= self.create_incident(incident_id='incident_'+self.CASE_TYPE+'_'+str(incident_id), incident_type=self.CASE_TYPE,
504
506
  severity_level=level, human_text=human_text, camera_info=camera_info, alerts=alerts, alert_settings=alert_settings,
505
507
  start_time=start_timestamp, end_time=self.current_incident_end_timestamp,
506
508
  level_settings= {"low": 3, "medium": 5, "significant":15, "critical": 30})
@@ -641,7 +643,7 @@ class FireSmokeUseCase(BaseProcessor):
641
643
  tracking_stats.append(tracking_stat)
642
644
 
643
645
  if len(self.id_hit_list)==1:
644
- last_ending_id = self._get_alert_incident_ids("",stream_info)
646
+ last_ending_id, incident_id = self._get_alert_incident_ids("",stream_info)
645
647
  print('last_ending_id',last_ending_id)
646
648
  if len(self.id_timing_list)>0 and len(self.id_timing_list)>=5:
647
649
  start_timestamp = self.id_timing_list[-1]
@@ -657,7 +659,7 @@ class FireSmokeUseCase(BaseProcessor):
657
659
  }
658
660
  }]
659
661
  tracking_stats.append(alerts)
660
- tracking_stats.append(self.create_incident(incident_id=self.CASE_TYPE+'_'+str(1), incident_type=self.CASE_TYPE,
662
+ tracking_stats.append(self.create_incident(incident_id=self.CASE_TYPE+'_'+str(incident_id), incident_type=self.CASE_TYPE,
661
663
  severity_level='info', human_text='Event Over', camera_info=camera_info, alerts=alerts, alert_settings=alert_settings,
662
664
  start_time=start_timestamp, end_time='Incident still active',
663
665
  level_settings= {"low": 3, "medium": 5, "significant":15, "critical": 30}))
@@ -671,20 +673,20 @@ class FireSmokeUseCase(BaseProcessor):
671
673
  """
672
674
  Generate a human_text string for the tracking_stat, incident, business analytics and alerts.
673
675
  """
674
- lines = {}
675
- lines["Application Name"] = self.CASE_TYPE
676
- lines["Application Version"] = self.CASE_VERSION
676
+ lines = []
677
+ lines.append("Application Name: "+self.CASE_TYPE)
678
+ lines.append("Application Version: "+self.CASE_VERSION)
677
679
  if len(incidents) > 0:
678
- lines["Incidents:"]=f"\n\t{incidents[0].get('human_text', 'No incidents detected')}\n"
680
+ lines.append("Incidents: "+f"\n\t{incidents[0].get('human_text', 'No incidents detected')}")
679
681
  if len(tracking_stats) > 0:
680
- lines["Tracking Statistics:"]=f"\t{tracking_stats[0].get('human_text', 'No tracking statistics detected')}\n"
682
+ lines.append("Tracking Statistics: "+f"\t{tracking_stats[0].get('human_text', 'No tracking statistics detected')}")
681
683
  if len(business_analytics) > 0:
682
- lines["Business Analytics:"]=f"\t{business_analytics[0].get('human_text', 'No business analytics detected')}\n"
684
+ lines.append("Business Analytics: "+f"\t{business_analytics[0].get('human_text', 'No business analytics detected')}")
683
685
 
684
686
  if len(incidents) == 0 and len(tracking_stats) == 0 and len(business_analytics) == 0:
685
- lines["Summary"] = "No Summary Data"
687
+ lines.append("Summary: "+"No Summary Data")
686
688
 
687
- return [lines]
689
+ return ["\n".join(lines)]
688
690
 
689
691
  def _calculate_fire_smoke_summary(
690
692
  self, data: Any, config: FireSmokeConfig
@@ -1017,7 +1019,7 @@ class FireSmokeUseCase(BaseProcessor):
1017
1019
  self.id_hit_list.pop(0)
1018
1020
  self.id_hit_counter=0
1019
1021
  self.id_timing_list.append(self._get_current_timestamp_str(stream_info))
1020
- return int(5-len(self.id_hit_list))
1022
+ return (5-len(self.id_hit_list),self.return_id_counter)
1021
1023
 
1022
1024
  elif self.id_hit_counter>0:
1023
1025
  self.id_hit_counter-=1
@@ -1026,27 +1028,28 @@ class FireSmokeUseCase(BaseProcessor):
1026
1028
 
1027
1029
  if len(self.id_hit_list) > 1:
1028
1030
  if sev_level==self.latest_stack:
1029
- return int(5-len(self.id_hit_list))
1031
+ return (5-len(self.id_hit_list),self.return_id_counter)
1030
1032
  else:
1031
- return 0
1033
+ return (0,0)
1032
1034
  else:
1033
1035
  if len(self.id_hit_list)==1:
1034
1036
  self.id_hit_counter+=1
1035
1037
  if self.id_hit_counter>130:
1036
1038
  self.id_hit_list = ["low","medium","significant","critical","low"]
1039
+ self.return_id_counter+=1
1037
1040
  self.id_hit_counter = 0
1038
1041
  self.latest_stack = None
1039
1042
  self.id_timing_list.append(self._get_current_timestamp_str(stream_info))
1040
- return int(5)
1043
+ return (int(5),self.return_id_counter-1)
1041
1044
  if sev_level==self.latest_stack:
1042
- return int(5-len(self.id_hit_list))
1045
+ return (5-len(self.id_hit_list),self.return_id_counter)
1043
1046
  else:
1044
- return 0
1047
+ return (0,0)
1045
1048
  elif self.id_hit_counter>0:
1046
1049
  self.id_hit_counter-=1
1047
1050
  elif self.id_hit_counter<0:
1048
1051
  self.id_hit_counter=0
1049
- return ""
1052
+ return (1,1)
1050
1053
 
1051
1054
 
1052
1055
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice
3
- Version: 1.0.99287
3
+ Version: 1.0.99288
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
@@ -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=G1aB4trwc-nnMxBsg34jkFU70QmTQAuxK1mY6nuTabs,49664
186
+ matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=WL-SxVGHum7Pw6S_LzEQe_UE5ohhVpHcD-U19CKlpXo,50096
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.99287.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
248
- matrice-1.0.99287.dist-info/METADATA,sha256=U7NyO0Ia_YH0saRsGMknFF5DmQ6xJzy50kI7d69joFg,14624
249
- matrice-1.0.99287.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
250
- matrice-1.0.99287.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
251
- matrice-1.0.99287.dist-info/RECORD,,
247
+ matrice-1.0.99288.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
248
+ matrice-1.0.99288.dist-info/METADATA,sha256=aiw_WI8kYB5shpfV7viqMBdY7vql6EF2V6bjOLMWQhg,14624
249
+ matrice-1.0.99288.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
250
+ matrice-1.0.99288.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
251
+ matrice-1.0.99288.dist-info/RECORD,,