matrice 1.0.99251__py3-none-any.whl → 1.0.99253__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.
@@ -38,14 +38,14 @@ class CropWeedDetectionConfig(BaseConfig):
38
38
  smoothing_confidence_range_factor: float = 0.5
39
39
 
40
40
  # confidence thresholds
41
- confidence_threshold: float = 0.6
41
+ confidence_threshold: float = 0.5
42
42
 
43
43
  usecase_categories: List[str] = field(
44
44
  default_factory=lambda: ['plants', 'BroWeed', 'Maize', 'NarWeed']
45
45
  )
46
46
 
47
47
  target_categories: List[str] = field(
48
- default_factory=lambda: ['BroWeed', 'Maize', 'NarWeed']
48
+ default_factory=lambda: ['plants', 'BroWeed', 'Maize', 'NarWeed']
49
49
  )
50
50
 
51
51
  alert_config: Optional[AlertConfig] = None
@@ -75,7 +75,7 @@ class CropWeedDetectionUseCase(BaseProcessor):
75
75
  self.CASE_VERSION: Optional[str] = '1.2'
76
76
 
77
77
  # List of categories to track
78
- self.target_categories = ['BroWeed', 'Maize', 'NarWeed']
78
+ self.target_categories = ['plants', 'BroWeed', 'Maize', 'NarWeed']
79
79
 
80
80
  # Initialize smoothing tracker
81
81
  self.smoothing_tracker = None
@@ -191,6 +191,18 @@ class FireSmokeUseCase(BaseProcessor):
191
191
  frame_number = start_frame
192
192
 
193
193
  # Step 7: alerts
194
+ print("-----------------------------------------------")
195
+ print(config.confidence_threshold)
196
+ print(config.fire_smoke_categories)
197
+ print(config.index_to_category)
198
+ print(config.target_categories)
199
+ print(config.threshold_area)
200
+ print(config.alert_config)
201
+ print(config.alert_config.count_thresholds)
202
+ print(config.alert_config.alert_type)
203
+ print(config.alert_config.alert_value)
204
+ print(config.alert_config.alert_incident_category)
205
+ print("-----------------------------------------------")
194
206
 
195
207
  alerts = self._check_alerts(fire_smoke_summary, frame_number, config, stream_info)
196
208
 
@@ -282,7 +294,11 @@ class FireSmokeUseCase(BaseProcessor):
282
294
  if hasattr(config.alert_config, 'count_thresholds') and config.alert_config.count_thresholds:
283
295
  alert_id = self._get_alert_incident_ids(self._ascending_alert_list[-1:])
284
296
 
285
- for category, threshold in config.alert_config.count_thresholds.items():
297
+ count_thresholds = {}
298
+ if config.alert_config and hasattr(config.alert_config, "count_thresholds"):
299
+ count_thresholds = config.alert_config.count_thresholds or {}
300
+
301
+ for category, threshold in count_thresholds.items():
286
302
  if category == "all" and total > threshold:
287
303
 
288
304
  alerts.append({
@@ -360,8 +376,14 @@ class FireSmokeUseCase(BaseProcessor):
360
376
  if total > 0:
361
377
  # Calculate total bbox area
362
378
  total_area = 0.0
363
-
364
- for category, threshold in config.alert_config.count_thresholds.items():
379
+ # Safely retrieve count thresholds. If alert_config is None (e.g., when it
380
+ # is not provided or failed to parse) we default to an empty mapping so
381
+ # the subsequent logic can still execute without raising an AttributeError.
382
+ count_thresholds = {}
383
+ if config.alert_config and hasattr(config.alert_config, "count_thresholds"):
384
+ count_thresholds = config.alert_config.count_thresholds or {}
385
+
386
+ for category, threshold in count_thresholds.items():
365
387
  if category in summary.get("per_category_count", {}):
366
388
 
367
389
  #count = summary.get("per_category_count", {})[category]
@@ -583,6 +605,26 @@ class FireSmokeUseCase(BaseProcessor):
583
605
 
584
606
 
585
607
  tracking_stats.append(tracking_stat)
608
+
609
+ if len(self.id_hit_list)==1:
610
+ last_ending_id = self._get_alert_incident_ids("")
611
+ if last_ending_id==5:
612
+ tracking_stats.append({
613
+ "alert_type": getattr(config.alert_config, 'alert_type', ['Default']) if hasattr(config.alert_config, 'alert_type') else ['Default'],
614
+ "alert_id": "alert_"+category+'_'+str(last_ending_id),
615
+ "incident_category": self.CASE_TYPE,
616
+ "threshold_level": 0,
617
+ "ascending": False,
618
+ "settings": {t: v for t, v in zip(getattr(config.alert_config, 'alert_type', ['Default']) if hasattr(config.alert_config, 'alert_type') else ['Default'],
619
+ getattr(config.alert_config, 'alert_value', ['JSON']) if hasattr(config.alert_config, 'alert_value') else ['JSON'])
620
+ }
621
+ })
622
+ tracking_stats.append(self.create_incident(incident_id=self.CASE_TYPE+'_'+str(last_ending_id), incident_type=self.CASE_TYPE,
623
+ severity_level='info', human_text='Event Over', camera_info=camera_info, alerts=alerts, alert_settings=alert_settings,
624
+ start_time=start_timestamp, end_time='Incident still active',
625
+ level_settings= {"low": 3, "medium": 5, "significant":15, "critical": 30}))
626
+
627
+
586
628
  return tracking_stats
587
629
 
588
630
  def _generate_summary(
@@ -952,6 +994,9 @@ class FireSmokeUseCase(BaseProcessor):
952
994
  if len(self.id_hit_list)==1:
953
995
  self.id_hit_counter+=1
954
996
  if self.id_hit_counter>120:
997
+ self.id_hit_list = ["low","medium","significant","critical","low"]
998
+ self.id_hit_counter = 0
999
+ self.latest_stack = None
955
1000
  return int(5)
956
1001
  if sev_level==self.latest_stack:
957
1002
  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.99251
3
+ Version: 1.0.99253
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
@@ -172,7 +172,7 @@ matrice/deploy/utils/post_processing/usecases/child_monitoring.py,sha256=z3oymoq
172
172
  matrice/deploy/utils/post_processing/usecases/color_detection.py,sha256=Z8-akjy8a7f8YyiOzXu_Zi1Km30v-TRrymDqQOPpJ_8,43277
173
173
  matrice/deploy/utils/post_processing/usecases/color_map_utils.py,sha256=SP-AEVcjLmL8rxblu-ixqUJC2fqlcr7ab4hWo4Fcr_k,2677
174
174
  matrice/deploy/utils/post_processing/usecases/concrete_crack_detection.py,sha256=pxhOH_hG4hq9yytNepbGMdk2W_lTG8D1_2RAagaPBkg,40252
175
- matrice/deploy/utils/post_processing/usecases/crop_weed_detection.py,sha256=5_Yn40YTZfZWmqUcDUUDvoejtApfDW8qhw4I736uBj4,40498
175
+ matrice/deploy/utils/post_processing/usecases/crop_weed_detection.py,sha256=RtKEDbkejHYeNcsSR8hCzqYinBtlGYtBsEdqaR6Kw0s,40518
176
176
  matrice/deploy/utils/post_processing/usecases/customer_service.py,sha256=UWS83qxguyAyhh8a0JF5QH9DtKxO8I-gI2BPOjLPxBw,44642
177
177
  matrice/deploy/utils/post_processing/usecases/defect_detection_products.py,sha256=blvo4wmak-wlvPSZOcmRsV1FoZSeGX_dUAX5A1WheBE,45949
178
178
  matrice/deploy/utils/post_processing/usecases/distracted_driver_detection.py,sha256=rkyYHbmcYUAfKbmmKyKxHlk47vJ_fogHWKhQjrERsok,40316
@@ -182,7 +182,7 @@ matrice/deploy/utils/post_processing/usecases/face_emotion.py,sha256=eRfqBdryB0u
182
182
  matrice/deploy/utils/post_processing/usecases/face_recognition.py,sha256=T5xAuv6b9OrkmTmoXgZs4LZ5XUsbvp9xCpeLBwdu7eI,40231
183
183
  matrice/deploy/utils/post_processing/usecases/fashion_detection.py,sha256=f9gpzMDhIW-gyn46k9jgf8nY7YeoqAnTxGOzksabFbE,40457
184
184
  matrice/deploy/utils/post_processing/usecases/field_mapping.py,sha256=JDwYX8pd2W-waDvBh98Y_o_uchJu7wEYbFxOliA4Iq4,39822
185
- matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=RBm23nrtVHAOk49Yjb06d-xF8mGvHO_0yW9hDxQtX6k,44457
185
+ matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=uIeV0EJonXTBdgtS6K_Wxooncv3hzX_zajET717WNKs,47365
186
186
  matrice/deploy/utils/post_processing/usecases/flare_analysis.py,sha256=-egmS3Hs_iGOLeCMfapbkfQ04EWtZx97QRuUcDa-jMU,45340
187
187
  matrice/deploy/utils/post_processing/usecases/flower_segmentation.py,sha256=4I7qMx9Ztxg_hy9KTVX-3qBhAN-QwDt_Yigf9fFjLus,52017
188
188
  matrice/deploy/utils/post_processing/usecases/gas_leak_detection.py,sha256=KL2ft7fXvjTas-65-QgcJm3W8KBsrwF44qibSXjfaLc,40557
@@ -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.99251.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
247
- matrice-1.0.99251.dist-info/METADATA,sha256=mbdD3q-rhD4szxy27qDXJXTZx6gMUzqHWIxXHfKB6S4,14624
248
- matrice-1.0.99251.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
249
- matrice-1.0.99251.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
250
- matrice-1.0.99251.dist-info/RECORD,,
246
+ matrice-1.0.99253.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
247
+ matrice-1.0.99253.dist-info/METADATA,sha256=9FdVZ2DcVsy7GKrVOFax7xL9qx3PJr8wZoEw-1D6FrY,14624
248
+ matrice-1.0.99253.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
249
+ matrice-1.0.99253.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
250
+ matrice-1.0.99253.dist-info/RECORD,,