matrice 1.0.99215__py3-none-any.whl → 1.0.99217__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.
@@ -46,6 +46,7 @@ APP_NAME_TO_USECASE = {
46
46
  "litter_detection" : "litter_detection",
47
47
  "human_activity_recognition": "human_activity_recognition",
48
48
  "leak_detection": "leak_detection",
49
+ "fire_smoke_detection": "fire_smoke_detection",
49
50
  }
50
51
 
51
52
  APP_NAME_TO_CATEGORY = {
@@ -96,6 +97,7 @@ APP_NAME_TO_CATEGORY = {
96
97
  "litter_detection" : "litter_detection",
97
98
  "human_activity_recognition": "general",
98
99
  "leak_detection": "oil_gas",
100
+ "fire_smoke_detection": "hazard",
99
101
  }
100
102
 
101
103
  def get_usecase_from_app_name(app_name: str) -> str:
@@ -97,7 +97,9 @@ class FireSmokeUseCase(BaseProcessor):
97
97
 
98
98
  self._ascending_alert_list: List[str] = []
99
99
  self.current_incident_end_timestamp: str = "N/A"
100
- #self.fire_smoke_stack:List[int] = []
100
+ self.id_hit_list = ["low","medium","significant","critical","low"]
101
+ self.id_hit_counter = 0
102
+ self.latest_stack:str = None
101
103
 
102
104
  def process(
103
105
  self,
@@ -254,7 +256,7 @@ class FireSmokeUseCase(BaseProcessor):
254
256
  if len(data) < lookback:
255
257
  return True
256
258
  post=lookback-prior-1
257
- levels_list = ["low","medium","significant","critical"]
259
+ levels_list = ["low","medium","significant","critical","low"]
258
260
 
259
261
  current_dominant_incident = Counter(data[-lookback:][:-prior]).most_common(1)[0][0] #from LAST 23 elements fetch FIRST 15 elements
260
262
  potential_dominant_incident = Counter(data[-post:]).most_common(1)[0][0] #fetch LAST 8 elements
@@ -276,16 +278,16 @@ class FireSmokeUseCase(BaseProcessor):
276
278
  return []
277
279
  if not config.alert_config:
278
280
  return alerts
279
-
280
281
 
281
282
  if hasattr(config.alert_config, 'count_thresholds') and config.alert_config.count_thresholds:
283
+ alert_id = self._get_alert_incident_ids(self._ascending_alert_list[-1:])
282
284
 
283
285
  for category, threshold in config.alert_config.count_thresholds.items():
284
286
  if category == "all" and total > threshold:
285
287
 
286
288
  alerts.append({
287
289
  "alert_type": getattr(config.alert_config, 'alert_type', ['Default']) if hasattr(config.alert_config, 'alert_type') else ['Default'],
288
- "alert_id": "alert_"+category+'_'+frame_key,
290
+ "alert_id": "alert_"+category+'_'+str(alert_id),
289
291
  "incident_category": self.CASE_TYPE,
290
292
  "threshold_level": threshold,
291
293
  "ascending": get_trend(self._ascending_alert_list, lookback=23, prior=14),
@@ -299,7 +301,7 @@ class FireSmokeUseCase(BaseProcessor):
299
301
  if count > threshold: # Fixed logic: alert when EXCEEDING threshold
300
302
  alerts.append({
301
303
  "alert_type": getattr(config.alert_config, 'alert_type', ['Default']) if hasattr(config.alert_config, 'alert_type') else ['Default'],
302
- "alert_id": "alert_"+category+'_'+frame_key,
304
+ "alert_id": "alert_"+category+'_'+str(alert_id),
303
305
  "incident_category": self.CASE_TYPE,
304
306
  "threshold_level": threshold,
305
307
  "ascending": get_trend(self._ascending_alert_list, lookback=23, prior=14),
@@ -358,7 +360,7 @@ class FireSmokeUseCase(BaseProcessor):
358
360
  if total > 0:
359
361
  # Calculate total bbox area
360
362
  total_area = 0.0
361
-
363
+
362
364
  for category, threshold in config.alert_config.count_thresholds.items():
363
365
  if category in summary.get("per_category_count", {}):
364
366
 
@@ -428,6 +430,8 @@ class FireSmokeUseCase(BaseProcessor):
428
430
  human_text_lines.append(f"\tSeverity Level: {(self.CASE_TYPE,level)}")
429
431
  human_text = "\n".join(human_text_lines)
430
432
 
433
+ incident_id = self._get_alert_incident_ids(self._ascending_alert_list[-1:])
434
+
431
435
  alert_settings=[]
432
436
  if config.alert_config and hasattr(config.alert_config, 'alert_type'):
433
437
  alert_settings.append({
@@ -440,7 +444,7 @@ class FireSmokeUseCase(BaseProcessor):
440
444
  }
441
445
  })
442
446
 
443
- event= self.create_incident(incident_id=self.CASE_TYPE+'_'+str(frame_number), incident_type=self.CASE_TYPE,
447
+ event= self.create_incident(incident_id=self.CASE_TYPE+'_'+str(incident_id), incident_type=self.CASE_TYPE,
444
448
  severity_level=level, human_text=human_text, camera_info=camera_info, alerts=alerts, alert_settings=alert_settings,
445
449
  start_time=start_timestamp, end_time=self.current_incident_end_timestamp,
446
450
  level_settings= {"low": 3, "medium": 5, "significant":15, "critical": 30})
@@ -923,5 +927,41 @@ class FireSmokeUseCase(BaseProcessor):
923
927
 
924
928
  return delta.total_seconds()
925
929
 
930
+ def _get_alert_incident_ids(self, sev_level):
931
+
932
+ if sev_level!="":
933
+ if sev_level==self.id_hit_list[0] and len(self.id_hit_list)>=2:
934
+ self.id_hit_counter+=1
935
+ if self.id_hit_counter>7:
936
+ self.latest_stack = self.id_hit_list[0]
937
+ self.id_hit_list.pop(0)
938
+ self.id_hit_counter=0
939
+ return int(5-len(self.id_hit_list))
940
+
941
+ elif self.id_hit_counter>0:
942
+ self.id_hit_counter-=1
943
+ elif self.id_hit_counter<0:
944
+ self.id_hit_counter=0
945
+
946
+ if len(self.id_hit_list) > 1:
947
+ if sev_level==self.latest_stack:
948
+ return int(5-len(self.id_hit_list))
949
+ else:
950
+ return 0
951
+ else:
952
+ if len(self.id_hit_list)==1:
953
+ self.id_hit_counter+=1
954
+ if self.id_hit_counter>120:
955
+ return int(5)
956
+ if sev_level==self.latest_stack:
957
+ return int(5-len(self.id_hit_list))
958
+ else:
959
+ return 0
960
+ elif self.id_hit_counter>0:
961
+ self.id_hit_counter-=1
962
+ elif self.id_hit_counter<0:
963
+ self.id_hit_counter=0
964
+ return ""
965
+
926
966
 
927
967
 
@@ -393,7 +393,7 @@ class LeakDetectionUseCase(BaseProcessor):
393
393
  self,
394
394
  counting_summary: Dict,
395
395
  alerts: List,
396
- config: LeakdetectionConfig,
396
+ config: LeakDetectionConfig,
397
397
  frame_number: Optional[int] = None,
398
398
  stream_info: Optional[Dict[str, Any]] = None
399
399
  ) -> List[Dict]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice
3
- Version: 1.0.99215
3
+ Version: 1.0.99217
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
@@ -129,7 +129,7 @@ matrice/deploy/utils/boundary_drawing_internal/boundary_drawing_internal.py,sha2
129
129
  matrice/deploy/utils/boundary_drawing_internal/boundary_drawing_tool.py,sha256=eY0VQGZ8BfTmR4_ThIAXaumBjh8_c7w69w-d3kta8p0,15421
130
130
  matrice/deploy/utils/boundary_drawing_internal/example_usage.py,sha256=cUBhxxsVdTQWIPvIOjCUGrhqon7ZBr5N6qNewjrTIuk,6434
131
131
  matrice/deploy/utils/post_processing/__init__.py,sha256=Z4Hr-GVsk55UEo2J7zmYAXPS-a9lAh1PlVrUdnRkiZE,24591
132
- matrice/deploy/utils/post_processing/config.py,sha256=z0u0IaXf8BbV-ilNvdjfWosJdgoYUVINws8umxoH85k,4882
132
+ matrice/deploy/utils/post_processing/config.py,sha256=FmZb7phtss9Vh-8_b311WcGazpa15wpbRCcX-KCG20M,4972
133
133
  matrice/deploy/utils/post_processing/processor.py,sha256=rwV5fMz1B_0qErOfEs1MDsqGeil4uBipBlHzWn85Sto,33842
134
134
  matrice/deploy/utils/post_processing/advanced_tracker/__init__.py,sha256=tAPFzI_Yep5TLX60FDwKqBqppc-EbxSr0wNsQ9DGI1o,423
135
135
  matrice/deploy/utils/post_processing/advanced_tracker/base.py,sha256=VqWy4dd5th5LK-JfueTt2_GSEoOi5QQfQxjTNhmQoLc,3580
@@ -181,14 +181,14 @@ matrice/deploy/utils/post_processing/usecases/face_emotion.py,sha256=eRfqBdryB0u
181
181
  matrice/deploy/utils/post_processing/usecases/face_recognition.py,sha256=T5xAuv6b9OrkmTmoXgZs4LZ5XUsbvp9xCpeLBwdu7eI,40231
182
182
  matrice/deploy/utils/post_processing/usecases/fashion_detection.py,sha256=f9gpzMDhIW-gyn46k9jgf8nY7YeoqAnTxGOzksabFbE,40457
183
183
  matrice/deploy/utils/post_processing/usecases/field_mapping.py,sha256=JDwYX8pd2W-waDvBh98Y_o_uchJu7wEYbFxOliA4Iq4,39822
184
- matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=M1kKFl_L22U9MVdcnwRWKV-OVk7sNy3ZphxUofPDRxo,42852
184
+ matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=RBm23nrtVHAOk49Yjb06d-xF8mGvHO_0yW9hDxQtX6k,44457
185
185
  matrice/deploy/utils/post_processing/usecases/flare_analysis.py,sha256=-egmS3Hs_iGOLeCMfapbkfQ04EWtZx97QRuUcDa-jMU,45340
186
186
  matrice/deploy/utils/post_processing/usecases/flower_segmentation.py,sha256=4I7qMx9Ztxg_hy9KTVX-3qBhAN-QwDt_Yigf9fFjLus,52017
187
187
  matrice/deploy/utils/post_processing/usecases/gender_detection.py,sha256=DEnCTRew6B7DtPcBQVCTtpd_IQMvMusBcu6nadUg2oM,40107
188
188
  matrice/deploy/utils/post_processing/usecases/human_activity_recognition.py,sha256=5a-akti7tRR1epuagEycGHrRRG2FTs0r8vesPuCqiJI,94827
189
189
  matrice/deploy/utils/post_processing/usecases/leaf.py,sha256=cwgB1ZNxkQFtkk-thSJrkXOGou1ghJr1kqtopb3sLD4,37036
190
190
  matrice/deploy/utils/post_processing/usecases/leaf_disease.py,sha256=bkiLccTdf4KUq3he4eCpBlKXb5exr-WBhQ_oWQ7os68,36225
191
- matrice/deploy/utils/post_processing/usecases/leak_detection.py,sha256=KSrL7PnpAGO_VyBUtCW2boOm5hBkgdm7ONmytcmP8Wo,40531
191
+ matrice/deploy/utils/post_processing/usecases/leak_detection.py,sha256=oOCLLVMuXVeXPHyN8FUrD3U9JYJJwIz-5fcEMgvLdls,40531
192
192
  matrice/deploy/utils/post_processing/usecases/license_plate_detection.py,sha256=WmVmtp-GLUSNtBxjZHUtUk_M9lPp_8gA0rdzFXVL1SY,44961
193
193
  matrice/deploy/utils/post_processing/usecases/litter_monitoring.py,sha256=XaHAUGRBDJg_iVbu8hRMjTR-5TqrLj6ZNCRkInbzZTY,33255
194
194
  matrice/deploy/utils/post_processing/usecases/mask_detection.py,sha256=MNpCcuefOdW7C8g_x_mNuWYA4mbyg8UNwomwBPoKtr0,39684
@@ -239,8 +239,8 @@ matrice/deployment/camera_manager.py,sha256=MEluadz_I3k10GqwFb_w5w_HhuHcEu2vA7oh
239
239
  matrice/deployment/deployment.py,sha256=HFt151eWq6iqIAMsQvurpV2WNxW6Cx_gIUVfnVy5SWE,48093
240
240
  matrice/deployment/inference_pipeline.py,sha256=6b4Mm3-qt-Zy0BeiJfFQdImOn3FzdNCY-7ET7Rp8PMk,37911
241
241
  matrice/deployment/streaming_gateway_manager.py,sha256=90O_SvR4RtBJxR6dy43uHNRTRdgxQE09KzhzHzVqq3E,20939
242
- matrice-1.0.99215.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
243
- matrice-1.0.99215.dist-info/METADATA,sha256=UWEHNO19E6iKQqq5L0p9elR0JRjDlMXGxNBbSj7Pbi8,14624
244
- matrice-1.0.99215.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
245
- matrice-1.0.99215.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
246
- matrice-1.0.99215.dist-info/RECORD,,
242
+ matrice-1.0.99217.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
243
+ matrice-1.0.99217.dist-info/METADATA,sha256=R3KMcop9KCXFcD_RCB8SoOjcf6I3WADmxoenM4l5JPo,14624
244
+ matrice-1.0.99217.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
245
+ matrice-1.0.99217.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
246
+ matrice-1.0.99217.dist-info/RECORD,,