matrice 1.0.99218__py3-none-any.whl → 1.0.99219__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/config.py +2 -2
- matrice/deploy/utils/post_processing/core/config.py +35 -80
- matrice/deploy/utils/post_processing/processor.py +4 -2
- matrice/deploy/utils/post_processing/usecases/__init__.py +3 -3
- matrice/deploy/utils/post_processing/usecases/gas_leak_detection.py +835 -0
- matrice/deploy/utils/post_processing/usecases/human_activity.py +0 -4
- {matrice-1.0.99218.dist-info → matrice-1.0.99219.dist-info}/METADATA +1 -1
- {matrice-1.0.99218.dist-info → matrice-1.0.99219.dist-info}/RECORD +11 -11
- matrice/deploy/utils/post_processing/usecases/human_activity_recognition.py +0 -1984
- {matrice-1.0.99218.dist-info → matrice-1.0.99219.dist-info}/WHEEL +0 -0
- {matrice-1.0.99218.dist-info → matrice-1.0.99219.dist-info}/licenses/LICENSE.txt +0 -0
- {matrice-1.0.99218.dist-info → matrice-1.0.99219.dist-info}/top_level.txt +0 -0
@@ -44,10 +44,10 @@ APP_NAME_TO_USECASE = {
|
|
44
44
|
"drowsy_driver_detection": "drowsy_driver_detection",
|
45
45
|
"waterbody_segmentation": "waterbody_segmentation",
|
46
46
|
"litter_detection" : "litter_detection",
|
47
|
-
"human_activity_recognition": "human_activity_recognition",
|
48
47
|
"leak_detection": "leak_detection",
|
49
48
|
"fire_smoke_detection": "fire_smoke_detection",
|
50
49
|
"human_activity": "human_activity",
|
50
|
+
"gas_leak_detection": "gas_leak_detection",
|
51
51
|
}
|
52
52
|
|
53
53
|
APP_NAME_TO_CATEGORY = {
|
@@ -96,10 +96,10 @@ APP_NAME_TO_CATEGORY = {
|
|
96
96
|
"drowsy_driver_detection": "automobile",
|
97
97
|
"waterbody_segmentation": "agriculture",
|
98
98
|
"litter_detection" : "litter_detection",
|
99
|
-
"human_activity_recognition": "general",
|
100
99
|
"leak_detection": "oil_gas",
|
101
100
|
"fire_smoke_detection": "hazard",
|
102
101
|
"human_activity": "general",
|
102
|
+
"gas_leak_detection": "oil_gas",
|
103
103
|
}
|
104
104
|
|
105
105
|
def get_usecase_from_app_name(app_name: str) -> str:
|
@@ -327,63 +327,6 @@ class PeopleCountingConfig(BaseConfig):
|
|
327
327
|
|
328
328
|
return errors
|
329
329
|
|
330
|
-
@dataclass
|
331
|
-
class HumanActivityConfig(BaseConfig):
|
332
|
-
"""Configuration for Human Activity use case."""
|
333
|
-
|
334
|
-
# Smoothing configuration
|
335
|
-
enable_smoothing: bool = True
|
336
|
-
smoothing_algorithm: str = "observability" # "window" or "observability"
|
337
|
-
smoothing_window_size: int = 20
|
338
|
-
smoothing_cooldown_frames: int = 5
|
339
|
-
smoothing_confidence_range_factor: float = 0.5
|
340
|
-
|
341
|
-
# Zone configuration
|
342
|
-
zone_config: Optional[ZoneConfig] = None
|
343
|
-
|
344
|
-
# Counting parameters
|
345
|
-
enable_unique_counting: bool = True
|
346
|
-
time_window_minutes: int = 60
|
347
|
-
|
348
|
-
# Category mapping
|
349
|
-
activity_categories: List[str] = field(
|
350
|
-
default_factory=lambda: ["barbequing", "bartending", "breading or flooring", "celebrating",
|
351
|
-
"clapping", "cleaning floor", "cleaning gutters", "cleaning toilet",
|
352
|
-
"cleaning windows", "climbing ladder", "cooking chicken", "cooking egg",
|
353
|
-
"cooking sausages", "counting money", "cutting pineapple", "cutting watermelon",
|
354
|
-
"dining", "drinking", "drinking beer", "drinking shots", "eating burger", "eating cake",
|
355
|
-
"eating carrots", "eating chips", "eating doughnuts", "eating hotdog", "eating ice cream",
|
356
|
-
"eating spaghetti", "eating watermelon", "flipping pancake", "frying vegetables", "garbage collecting",
|
357
|
-
"making a cake", "making a sandwich", "making pizza making sushi", "making tea",
|
358
|
-
"mopping floor", "moving furniture", "peeling apples", "peeling potatos", "picking fruit",
|
359
|
-
"reading book", "reading newspaper", "setting table", "shaking hands", "smoking", "smoking hookah",
|
360
|
-
"sweeping floor", "tasting beer", "tasting food", "tossing salad", "washing hands",
|
361
|
-
"washing dishes", "texting", "using computer"]
|
362
|
-
)
|
363
|
-
index_to_category: Optional[Dict[int, str]] = None
|
364
|
-
|
365
|
-
# Alert configuration
|
366
|
-
alert_config: Optional[AlertConfig] = None
|
367
|
-
|
368
|
-
def validate(self) -> List[str]:
|
369
|
-
"""Validate human activity configuration."""
|
370
|
-
errors = super().validate()
|
371
|
-
|
372
|
-
if self.time_window_minutes <= 0:
|
373
|
-
errors.append("time_window_minutes must be positive")
|
374
|
-
|
375
|
-
if not self.activity_categories:
|
376
|
-
errors.append("activity_categories cannot be empty")
|
377
|
-
|
378
|
-
# Validate nested configurations
|
379
|
-
if self.zone_config:
|
380
|
-
errors.extend(self.zone_config.validate())
|
381
|
-
|
382
|
-
if self.alert_config:
|
383
|
-
errors.extend(self.alert_config.validate())
|
384
|
-
|
385
|
-
return errors
|
386
|
-
|
387
330
|
|
388
331
|
|
389
332
|
@dataclass
|
@@ -463,7 +406,6 @@ class ConfigManager:
|
|
463
406
|
"people_counting": PeopleCountingConfig,
|
464
407
|
"customer_service": CustomerServiceConfig,
|
465
408
|
"advanced_customer_service": CustomerServiceConfig,
|
466
|
-
"human_activity_recognition": HumanActivityConfig,
|
467
409
|
"basic_counting_tracking": None, # Will be set later to avoid circular import
|
468
410
|
"license_plate_detection": None, # Will be set later to avoid circular import
|
469
411
|
"ppe_compliance_detection": None,
|
@@ -515,6 +457,7 @@ class ConfigManager:
|
|
515
457
|
'litter_detection':None,
|
516
458
|
'leak_detection': None,
|
517
459
|
'human_activity': None,
|
460
|
+
'gas_leak_detection': None,
|
518
461
|
|
519
462
|
#Put all image based usecases here::
|
520
463
|
'blood_cancer_detection_img': None,
|
@@ -935,6 +878,14 @@ class ConfigManager:
|
|
935
878
|
except ImportError:
|
936
879
|
return None
|
937
880
|
|
881
|
+
def gas_leak_detection_config_class(self):
|
882
|
+
"""Register a configuration class for a use case."""
|
883
|
+
try:
|
884
|
+
from ..usecases.gas_leak_detection import GasLeakConfig
|
885
|
+
return GasLeakConfig
|
886
|
+
except ImportError:
|
887
|
+
return None
|
888
|
+
|
938
889
|
#put all image based usecases here::
|
939
890
|
def blood_cancer_detection_config_class(self):
|
940
891
|
"""Register a configuration class for a use case."""
|
@@ -1025,23 +976,6 @@ class ConfigManager:
|
|
1025
976
|
alert_config=alert_config,
|
1026
977
|
**kwargs
|
1027
978
|
)
|
1028
|
-
elif usecase == "human_activity_recognition":
|
1029
|
-
# Handle nested configurations
|
1030
|
-
zone_config = kwargs.pop("zone_config", None)
|
1031
|
-
if zone_config and isinstance(zone_config, dict):
|
1032
|
-
zone_config = ZoneConfig(**zone_config)
|
1033
|
-
|
1034
|
-
alert_config = kwargs.pop("alert_config", None)
|
1035
|
-
if alert_config and isinstance(alert_config, dict):
|
1036
|
-
alert_config = AlertConfig(**alert_config)
|
1037
|
-
|
1038
|
-
config = HumanActivityConfig(
|
1039
|
-
category=category or "general",
|
1040
|
-
usecase=usecase,
|
1041
|
-
zone_config=zone_config,
|
1042
|
-
alert_config=alert_config,
|
1043
|
-
**kwargs
|
1044
|
-
)
|
1045
979
|
elif usecase == "basic_counting_tracking":
|
1046
980
|
# Import here to avoid circular import
|
1047
981
|
from ..usecases.basic_counting_tracking import BasicCountingTrackingConfig
|
@@ -1924,11 +1858,6 @@ class ConfigManager:
|
|
1924
1858
|
# Import here to avoid circular import
|
1925
1859
|
from ..usecases.human_activity import HumanActivityRecognitionConfig
|
1926
1860
|
|
1927
|
-
# Handle nested configurations
|
1928
|
-
zone_config = kwargs.pop("zone_config", None)
|
1929
|
-
if zone_config and isinstance(zone_config, dict):
|
1930
|
-
zone_config = ZoneConfig(**zone_config)
|
1931
|
-
|
1932
1861
|
alert_config = kwargs.pop("alert_config", None)
|
1933
1862
|
if alert_config and isinstance(alert_config, dict):
|
1934
1863
|
alert_config = AlertConfig(**alert_config)
|
@@ -1940,6 +1869,22 @@ class ConfigManager:
|
|
1940
1869
|
alert_config=alert_config,
|
1941
1870
|
**kwargs
|
1942
1871
|
)
|
1872
|
+
|
1873
|
+
elif usecase == "gas_leak_detection":
|
1874
|
+
# Import here to avoid circular import
|
1875
|
+
from ..usecases.gas_leak_detection import GasLeakConfig
|
1876
|
+
|
1877
|
+
# Handle nested configurations
|
1878
|
+
alert_config = kwargs.pop("alert_config", None)
|
1879
|
+
if alert_config and isinstance(alert_config, dict):
|
1880
|
+
alert_config = AlertConfig(**alert_config)
|
1881
|
+
|
1882
|
+
config = GasLeakConfig(
|
1883
|
+
category=category or "oil_gas",
|
1884
|
+
usecase=usecase,
|
1885
|
+
alert_config=alert_config,
|
1886
|
+
**kwargs
|
1887
|
+
)
|
1943
1888
|
|
1944
1889
|
#Add IMAGE based usecases here::
|
1945
1890
|
elif usecase == "blood_cancer_detection_img":
|
@@ -2396,6 +2341,16 @@ class ConfigManager:
|
|
2396
2341
|
from ..usecases.leak_detection import LeakDetectionConfig
|
2397
2342
|
default_config = LeakDetectionConfig()
|
2398
2343
|
return default_config.to_dict()
|
2344
|
+
elif usecase == "human_activity":
|
2345
|
+
# Import here to avoid circular import
|
2346
|
+
from ..usecases.human_activity import HumanActivityRecognitionConfig
|
2347
|
+
default_config = HumanActivityRecognitionConfig()
|
2348
|
+
return default_config.to_dict()
|
2349
|
+
elif usecase == "gas_leak_detection":
|
2350
|
+
# Import here to avoid circular import
|
2351
|
+
from ..usecases.gas_leak_detection import GasLeakConfig
|
2352
|
+
default_config = GasLeakConfig()
|
2353
|
+
return default_config.to_dict()
|
2399
2354
|
|
2400
2355
|
#Add all image based usecases here
|
2401
2356
|
elif usecase == "blood_cancer_detection_img":
|
@@ -31,7 +31,6 @@ from .usecases import (
|
|
31
31
|
PeopleCountingUseCase,
|
32
32
|
CustomerServiceUseCase,
|
33
33
|
AdvancedCustomerServiceUseCase,
|
34
|
-
HumanActivityUseCase,
|
35
34
|
LicensePlateUseCase,
|
36
35
|
ColorDetectionUseCase,
|
37
36
|
PotholeSegmentationUseCase,
|
@@ -63,6 +62,7 @@ from .usecases import (
|
|
63
62
|
LitterDetectionUseCase,
|
64
63
|
LeakDetectionUseCase,
|
65
64
|
HumanActivityRecognitionUseCase,
|
65
|
+
GasLeakUseCase,
|
66
66
|
|
67
67
|
|
68
68
|
AgeDetectionUseCase,
|
@@ -223,9 +223,9 @@ class PostProcessor:
|
|
223
223
|
registry.register_use_case("automobile", "drowsy_driver_detection", DrowsyDriverUseCase)
|
224
224
|
registry.register_use_case("agriculture", "waterbody_segmentation", WaterBodyUseCase)
|
225
225
|
registry.register_use_case("litter_detection", "litter_detection", LitterDetectionUseCase)
|
226
|
-
registry.register_use_case("general", "human_activity_recognition", HumanActivityUseCase)
|
227
226
|
registry.register_use_case("oil_gas", "leak_detection", LeakDetectionUseCase)
|
228
227
|
registry.register_use_case("general", "human_activity", HumanActivityRecognitionUseCase)
|
228
|
+
registry.register_use_case("oil_gas", "gas_leak_detection", GasLeakUseCase)
|
229
229
|
|
230
230
|
#Put all IMAGE based usecases here
|
231
231
|
registry.register_use_case("healthcare", "bloodcancer_img_detection", BloodCancerDetectionUseCase)
|
@@ -402,6 +402,8 @@ class PostProcessor:
|
|
402
402
|
result = use_case.process(data, parsed_config, context, stream_info)
|
403
403
|
elif isinstance(use_case, HumanActivityRecognitionUseCase):
|
404
404
|
result = use_case.process(data, parsed_config, context, stream_info)
|
405
|
+
elif isinstance(use_case, GasLeakUseCase):
|
406
|
+
result = use_case.process(data, parsed_config, context, stream_info)
|
405
407
|
|
406
408
|
#Put all IMAGE based usecases here
|
407
409
|
elif isinstance(use_case, BloodCancerDetectionUseCase):
|
@@ -8,7 +8,6 @@ post-processing scenarios.
|
|
8
8
|
from .people_counting import PeopleCountingUseCase, PeopleCountingConfig
|
9
9
|
from .customer_service import CustomerServiceUseCase, CustomerServiceConfig
|
10
10
|
from .advanced_customer_service import AdvancedCustomerServiceUseCase
|
11
|
-
from .human_activity_recognition import HumanActivityUseCase, HumanActivityConfig
|
12
11
|
from .basic_counting_tracking import BasicCountingTrackingUseCase
|
13
12
|
from .license_plate_detection import LicensePlateUseCase, LicensePlateConfig
|
14
13
|
from .color_detection import ColorDetectionUseCase, ColorDetectionConfig
|
@@ -71,6 +70,7 @@ from .waterbody_segmentation import WaterBodyConfig, WaterBodyUseCase
|
|
71
70
|
from .litter_monitoring import LitterDetectionConfig,LitterDetectionUseCase
|
72
71
|
from .leak_detection import LeakDetectionConfig, LeakDetectionUseCase
|
73
72
|
from .human_activity import HumanActivityRecognitionConfig, HumanActivityRecognitionUseCase
|
73
|
+
from .gas_leak_detection import GasLeakConfig, GasLeakUseCase
|
74
74
|
|
75
75
|
#Put all IMAGE based usecases here
|
76
76
|
from .blood_cancer_detection_img import BloodCancerDetectionConfig, BloodCancerDetectionUseCase
|
@@ -83,7 +83,6 @@ __all__ = [
|
|
83
83
|
'PeopleCountingUseCase',
|
84
84
|
'CustomerServiceUseCase',
|
85
85
|
'AdvancedCustomerServiceUseCase',
|
86
|
-
'HumanActivityUseCase',
|
87
86
|
'BasicCountingTrackingUseCase',
|
88
87
|
'LicensePlateUseCase',
|
89
88
|
'ColorDetectionUseCase',
|
@@ -139,6 +138,7 @@ __all__ = [
|
|
139
138
|
'LitterDetectionUseCase',
|
140
139
|
'LeakDetectionUseCase',
|
141
140
|
'HumanActivityRecognitionUseCase',
|
141
|
+
'GasLeakUseCase',
|
142
142
|
|
143
143
|
#Put all IMAGE based usecases here
|
144
144
|
'BloodCancerDetectionUseCase',
|
@@ -153,7 +153,6 @@ __all__ = [
|
|
153
153
|
'ParkingSpaceConfig',
|
154
154
|
'CustomerServiceConfig',
|
155
155
|
'AdvancedCustomerServiceConfig',
|
156
|
-
'HumanActivityConfig',
|
157
156
|
'PPEComplianceConfig',
|
158
157
|
'LicensePlateConfig',
|
159
158
|
'PotholeConfig',
|
@@ -207,6 +206,7 @@ __all__ = [
|
|
207
206
|
'LitterDetectionConfig',
|
208
207
|
'LeakDetectionConfig',
|
209
208
|
'HumanActivityRecognitionConfig',
|
209
|
+
'GasLeakConfig',
|
210
210
|
|
211
211
|
|
212
212
|
#Put all IMAGE based usecase CONFIGS here
|