matrice 1.0.99158__py3-none-any.whl → 1.0.99160__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.
- matrice/deploy/utils/post_processing/processor.py +2 -0
- matrice/deploy/utils/post_processing/usecases/fire_detection.py +54 -5
- {matrice-1.0.99158.dist-info → matrice-1.0.99160.dist-info}/METADATA +1 -1
- {matrice-1.0.99158.dist-info → matrice-1.0.99160.dist-info}/RECORD +7 -7
- {matrice-1.0.99158.dist-info → matrice-1.0.99160.dist-info}/WHEEL +0 -0
- {matrice-1.0.99158.dist-info → matrice-1.0.99160.dist-info}/licenses/LICENSE.txt +0 -0
- {matrice-1.0.99158.dist-info → matrice-1.0.99160.dist-info}/top_level.txt +0 -0
@@ -360,6 +360,8 @@ class PostProcessor:
|
|
360
360
|
result = use_case.process(data, parsed_config, context, stream_info)
|
361
361
|
elif isinstance(use_case, SmokerDetectionUseCase):
|
362
362
|
result = use_case.process(data, parsed_config, context, stream_info)
|
363
|
+
elif isinstance(use_case, BottleDefectUseCase):
|
364
|
+
result = use_case.process(data, parsed_config, context, stream_info)
|
363
365
|
|
364
366
|
|
365
367
|
#Put all IMAGE based usecases here
|
@@ -4,10 +4,11 @@ Fire and Smoke Detection use case implementation.
|
|
4
4
|
This module provides a structured implementation of fire and smoke detection
|
5
5
|
with counting, insights generation, alerting, and tracking.
|
6
6
|
"""
|
7
|
-
from datetime import datetime, timezone
|
7
|
+
from datetime import datetime, timezone, timedelta
|
8
8
|
from typing import Any, Dict, List, Optional
|
9
9
|
from dataclasses import dataclass, field
|
10
10
|
import time
|
11
|
+
import re
|
11
12
|
|
12
13
|
from ..core.base import (
|
13
14
|
BaseProcessor,
|
@@ -363,10 +364,10 @@ class FireSmokeUseCase(BaseProcessor):
|
|
363
364
|
intensity_pct = min(100.0, (total_area / threshold_area) * 100)
|
364
365
|
|
365
366
|
if config.alert_config and config.alert_config.count_thresholds:
|
366
|
-
if intensity_pct >=
|
367
|
+
if intensity_pct >= 40:
|
367
368
|
level = "critical"
|
368
369
|
self._ascending_alert_list.append(3)
|
369
|
-
elif intensity_pct >=
|
370
|
+
elif intensity_pct >= 30:
|
370
371
|
level = "significant"
|
371
372
|
self._ascending_alert_list.append(2)
|
372
373
|
elif intensity_pct >= 5:
|
@@ -376,11 +377,11 @@ class FireSmokeUseCase(BaseProcessor):
|
|
376
377
|
level = "low"
|
377
378
|
self._ascending_alert_list.append(0)
|
378
379
|
else:
|
379
|
-
if intensity_pct >
|
380
|
+
if intensity_pct > 40:
|
380
381
|
level = "critical"
|
381
382
|
intensity = 10.0
|
382
383
|
self._ascending_alert_list.append(3)
|
383
|
-
elif intensity_pct >
|
384
|
+
elif intensity_pct > 30:
|
384
385
|
level = "significant"
|
385
386
|
intensity = 9.0
|
386
387
|
self._ascending_alert_list.append(2)
|
@@ -414,6 +415,7 @@ class FireSmokeUseCase(BaseProcessor):
|
|
414
415
|
severity_level=level, human_text=human_text, camera_info=camera_info, alerts=alerts, alert_settings=alert_settings,
|
415
416
|
start_time=start_timestamp, end_time=self.current_incident_end_timestamp,
|
416
417
|
level_settings= {"low": 1, "medium": 5, "significant":40, "critical": 60})
|
418
|
+
event['duration'] = self.get_duration_seconds(start_timestamp, self.current_incident_end_timestamp)
|
417
419
|
incidents.append(event)
|
418
420
|
|
419
421
|
else:
|
@@ -847,5 +849,52 @@ class FireSmokeUseCase(BaseProcessor):
|
|
847
849
|
dt = datetime.fromtimestamp(timestamp, tz=timezone.utc)
|
848
850
|
return dt.strftime('%Y:%m:%d %H:%M:%S')
|
849
851
|
|
852
|
+
def get_duration_seconds(self, start_time, end_time):
|
853
|
+
def parse_relative_time(t):
|
854
|
+
"""Parse HH:MM:SS(.f) manually into timedelta"""
|
855
|
+
try:
|
856
|
+
parts = t.strip().split(":")
|
857
|
+
if len(parts) != 3:
|
858
|
+
return None
|
859
|
+
hours = int(parts[0])
|
860
|
+
minutes = int(parts[1])
|
861
|
+
seconds = float(parts[2]) # works for 7.4
|
862
|
+
return timedelta(hours=hours, minutes=minutes, seconds=seconds)
|
863
|
+
except:
|
864
|
+
return None
|
865
|
+
|
866
|
+
def parse_time(t):
|
867
|
+
# Check for HH:MM:SS(.ms) format
|
868
|
+
if re.match(r'^\d{1,2}:\d{2}:\d{1,2}(\.\d+)?$', t):
|
869
|
+
return parse_relative_time(t)
|
870
|
+
|
871
|
+
# Check for full UTC format like 2025-08-01-14:23:45.123456 UTC
|
872
|
+
if "UTC" in t:
|
873
|
+
try:
|
874
|
+
return datetime.strptime(t, "%Y-%m-%d-%H:%M:%S.%f UTC")
|
875
|
+
except ValueError:
|
876
|
+
return None
|
877
|
+
|
878
|
+
return None
|
879
|
+
|
880
|
+
start_dt = parse_time(start_time)
|
881
|
+
end_dt = parse_time(end_time)
|
882
|
+
|
883
|
+
# Return None if invalid
|
884
|
+
if start_dt is None or end_dt is None:
|
885
|
+
print("Invalid timestamp(s). Ignoring.")
|
886
|
+
return 'N/A'
|
887
|
+
|
888
|
+
# If timedelta (relative time), subtract directly
|
889
|
+
if isinstance(start_dt, timedelta) and isinstance(end_dt, timedelta):
|
890
|
+
delta = end_dt - start_dt
|
891
|
+
elif isinstance(start_dt, datetime) and isinstance(end_dt, datetime):
|
892
|
+
delta = end_dt - start_dt
|
893
|
+
else:
|
894
|
+
print("Mismatched timestamp formats.")
|
895
|
+
return None
|
896
|
+
|
897
|
+
return delta.total_seconds()
|
898
|
+
|
850
899
|
|
851
900
|
|
@@ -128,7 +128,7 @@ matrice/deploy/utils/boundary_drawing_internal/boundary_drawing_tool.py,sha256=e
|
|
128
128
|
matrice/deploy/utils/boundary_drawing_internal/example_usage.py,sha256=cUBhxxsVdTQWIPvIOjCUGrhqon7ZBr5N6qNewjrTIuk,6434
|
129
129
|
matrice/deploy/utils/post_processing/__init__.py,sha256=9wVjSGmFCVYWsgfe2__sXGGSNtnZFKy_DIzeLVzlrwI,23471
|
130
130
|
matrice/deploy/utils/post_processing/config.py,sha256=anKXcN8mD16bNOrErre1gzi17lbKiAAeYc7TEu7ttbk,3476
|
131
|
-
matrice/deploy/utils/post_processing/processor.py,sha256=
|
131
|
+
matrice/deploy/utils/post_processing/processor.py,sha256=fqX8aQZi6JogR5iJmXGLXjqUaH0KS60GqZrCfL_7CTw,31090
|
132
132
|
matrice/deploy/utils/post_processing/advanced_tracker/__init__.py,sha256=tAPFzI_Yep5TLX60FDwKqBqppc-EbxSr0wNsQ9DGI1o,423
|
133
133
|
matrice/deploy/utils/post_processing/advanced_tracker/base.py,sha256=VqWy4dd5th5LK-JfueTt2_GSEoOi5QQfQxjTNhmQoLc,3580
|
134
134
|
matrice/deploy/utils/post_processing/advanced_tracker/config.py,sha256=hEVJVbh4uUrbIynmoq4OhuxF2IZA5AMCBLpixScp5FI,2865
|
@@ -175,7 +175,7 @@ matrice/deploy/utils/post_processing/usecases/emergency_vehicle_detection.py,sha
|
|
175
175
|
matrice/deploy/utils/post_processing/usecases/face_emotion.py,sha256=eRfqBdryB0uNoOlz_y-JMuZL1BhPWrI-odqgx_9LT7s,39132
|
176
176
|
matrice/deploy/utils/post_processing/usecases/fashion_detection.py,sha256=f9gpzMDhIW-gyn46k9jgf8nY7YeoqAnTxGOzksabFbE,40457
|
177
177
|
matrice/deploy/utils/post_processing/usecases/field_mapping.py,sha256=JDwYX8pd2W-waDvBh98Y_o_uchJu7wEYbFxOliA4Iq4,39822
|
178
|
-
matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=
|
178
|
+
matrice/deploy/utils/post_processing/usecases/fire_detection.py,sha256=KU-6LEC7TNxbpASzRTUs1i44GKKe2eMvxIR8x7bFQCc,41293
|
179
179
|
matrice/deploy/utils/post_processing/usecases/flare_analysis.py,sha256=-egmS3Hs_iGOLeCMfapbkfQ04EWtZx97QRuUcDa-jMU,45340
|
180
180
|
matrice/deploy/utils/post_processing/usecases/flower_segmentation.py,sha256=4I7qMx9Ztxg_hy9KTVX-3qBhAN-QwDt_Yigf9fFjLus,52017
|
181
181
|
matrice/deploy/utils/post_processing/usecases/gender_detection.py,sha256=DEnCTRew6B7DtPcBQVCTtpd_IQMvMusBcu6nadUg2oM,40107
|
@@ -227,8 +227,8 @@ matrice/deployment/camera_manager.py,sha256=ReBZqm1CNXRImKcbcZ4uWAT3TUWkof1D28oB
|
|
227
227
|
matrice/deployment/deployment.py,sha256=PLIUD-PxTaC2Zxb3Y12wUddsryV-OJetjCjLoSUh7S4,48103
|
228
228
|
matrice/deployment/inference_pipeline.py,sha256=bXLgd29ViA7o0c7YWLFJl1otBUQfTPb61jS6VawQB0Y,37918
|
229
229
|
matrice/deployment/streaming_gateway_manager.py,sha256=w5swGsuFVfZIdOm2ZuBHRHlRdYYJMLopLsf2gb91lQ8,20946
|
230
|
-
matrice-1.0.
|
231
|
-
matrice-1.0.
|
232
|
-
matrice-1.0.
|
233
|
-
matrice-1.0.
|
234
|
-
matrice-1.0.
|
230
|
+
matrice-1.0.99160.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
|
231
|
+
matrice-1.0.99160.dist-info/METADATA,sha256=hsoq2uDW91xQqRhRCM0oV6esy5qMVpnjQZrcP1Myr34,14624
|
232
|
+
matrice-1.0.99160.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
233
|
+
matrice-1.0.99160.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
|
234
|
+
matrice-1.0.99160.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|