matrice-analytics 0.1.96__py3-none-any.whl → 0.1.97__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_analytics/post_processing/__init__.py +14 -1
- matrice_analytics/post_processing/config.py +6 -2
- matrice_analytics/post_processing/core/config.py +62 -0
- matrice_analytics/post_processing/post_processor.py +8 -0
- matrice_analytics/post_processing/usecases/__init__.py +7 -1
- matrice_analytics/post_processing/usecases/vehicle_monitoring.py +14 -32
- matrice_analytics/post_processing/usecases/vehicle_monitoring_drone_view.py +1007 -0
- matrice_analytics/post_processing/usecases/vehicle_monitoring_parking_lot.py +1011 -0
- {matrice_analytics-0.1.96.dist-info → matrice_analytics-0.1.97.dist-info}/METADATA +1 -1
- {matrice_analytics-0.1.96.dist-info → matrice_analytics-0.1.97.dist-info}/RECORD +13 -11
- {matrice_analytics-0.1.96.dist-info → matrice_analytics-0.1.97.dist-info}/WHEEL +0 -0
- {matrice_analytics-0.1.96.dist-info → matrice_analytics-0.1.97.dist-info}/licenses/LICENSE.txt +0 -0
- {matrice_analytics-0.1.96.dist-info → matrice_analytics-0.1.97.dist-info}/top_level.txt +0 -0
|
@@ -85,7 +85,7 @@ from .usecases.leaf_disease import LeafDiseaseDetectionConfig, LeafDiseaseDetect
|
|
|
85
85
|
from .usecases.parking import ParkingConfig
|
|
86
86
|
from .usecases.abandoned_object_detection import AbandonedObjectConfig
|
|
87
87
|
from .usecases.footfall import FootFallConfig
|
|
88
|
-
|
|
88
|
+
from .usecases.vehicle_monitoring import VehicleMonitoringConfig
|
|
89
89
|
|
|
90
90
|
from .usecases.weld_defect_detection import WeldDefectConfig
|
|
91
91
|
from .usecases.weapon_detection import WeaponDetectionConfig
|
|
@@ -130,6 +130,8 @@ from .usecases.underground_pipeline_defect_detection import UndergroundPipelineD
|
|
|
130
130
|
from .usecases.suspicious_activity_detection import SusActivityConfig, SusActivityUseCase
|
|
131
131
|
from .usecases.natural_disaster import NaturalDisasterConfig, NaturalDisasterUseCase
|
|
132
132
|
from .usecases.footfall import FootFallUseCase
|
|
133
|
+
from .usecases.vehicle_monitoring_parking_lot import VehicleMonitoringParkingLotUseCase, VehicleMonitoringParkingLotConfig
|
|
134
|
+
from .usecases.vehicle_monitoring_drone_view import VehicleMonitoringDroneViewUseCase, VehicleMonitoringDroneViewConfig
|
|
133
135
|
|
|
134
136
|
#Put all IMAGE based usecases here
|
|
135
137
|
from .usecases.blood_cancer_detection_img import BloodCancerDetectionConfig, BloodCancerDetectionUseCase
|
|
@@ -208,6 +210,9 @@ from .usecases import (
|
|
|
208
210
|
SusActivityUseCase,
|
|
209
211
|
NaturalDisasterUseCase,
|
|
210
212
|
FootFallUseCase,
|
|
213
|
+
VehicleMonitoringParkingLotUseCase,
|
|
214
|
+
VehicleMonitoringDroneViewUseCase,
|
|
215
|
+
|
|
211
216
|
#Put all IMAGE based usecases here
|
|
212
217
|
BloodCancerDetectionUseCase,
|
|
213
218
|
SkinCancerClassificationUseCase,
|
|
@@ -289,6 +294,8 @@ _underground_pipeline_defect = UndergroundPipelineDefectUseCase()
|
|
|
289
294
|
_suspicious_activity_detection = SusActivityUseCase()
|
|
290
295
|
_natural_disaster = NaturalDisasterUseCase()
|
|
291
296
|
_footfall = FootFallUseCase()
|
|
297
|
+
_vehicle_monitoring_parking_lot = VehicleMonitoringParkingLotUseCase()
|
|
298
|
+
_vehicle_monitoring_drone_view = VehicleMonitoringDroneViewUseCase()
|
|
292
299
|
|
|
293
300
|
# Face recognition with embeddings
|
|
294
301
|
_face_recognition = FaceRecognitionEmbeddingUseCase()
|
|
@@ -374,6 +381,8 @@ registry.register_use_case(_underground_pipeline_defect.category, _underground_p
|
|
|
374
381
|
registry.register_use_case(_suspicious_activity_detection.category, _suspicious_activity_detection.name, SusActivityUseCase)
|
|
375
382
|
registry.register_use_case(_natural_disaster.category, _natural_disaster.name, NaturalDisasterUseCase)
|
|
376
383
|
registry.register_use_case(_footfall.category, _footfall.name, FaceEmotionUseCase)
|
|
384
|
+
registry.register_use_case(_vehicle_monitoring_parking_lot.category, _vehicle_monitoring_parking_lot.name, VehicleMonitoringParkingLotUseCase)
|
|
385
|
+
registry.register_use_case(_vehicle_monitoring_drone_view.category, _vehicle_monitoring_drone_view.name, VehicleMonitoringDroneViewUseCase)
|
|
377
386
|
|
|
378
387
|
#Put all IMAGE based usecases here
|
|
379
388
|
registry.register_use_case(_blood_cancer_detection.category, _blood_cancer_detection.name, BloodCancerDetectionUseCase)
|
|
@@ -580,6 +589,8 @@ __all__ = [
|
|
|
580
589
|
'NaturalDisasterConfig',
|
|
581
590
|
'VehiclePeopleDroneMonitoringConfig',
|
|
582
591
|
'FootFallConfig',
|
|
592
|
+
'VehicleMonitoringParkingLotConfig',
|
|
593
|
+
'VehicleMonitoringDroneViewConfig',
|
|
583
594
|
#Put all IMAGE based usecase CONFIGS here
|
|
584
595
|
'BloodCancerDetectionConfig',
|
|
585
596
|
'SkinCancerClassificationConfig',
|
|
@@ -654,6 +665,8 @@ __all__ = [
|
|
|
654
665
|
'SusActivityUseCase',
|
|
655
666
|
'NaturalDisasterUseCase',
|
|
656
667
|
'FootFallUseCase',
|
|
668
|
+
'VehicleMonitoringParkingLotUseCase',
|
|
669
|
+
'VehicleMonitoringDroneViewUseCase',
|
|
657
670
|
|
|
658
671
|
#Put all IMAGE based usecases here
|
|
659
672
|
'BloodCancerDetectionUseCase',
|
|
@@ -65,7 +65,9 @@ APP_NAME_TO_USECASE = {
|
|
|
65
65
|
"underground_pipeline_defect" : "underground_pipeline_defect",
|
|
66
66
|
"suspicious_activity_detection": "suspicious_activity_detection",
|
|
67
67
|
"natural_disaster_detection": "natural_disaster_detection",
|
|
68
|
-
"Foot Fall": "footfall"
|
|
68
|
+
"Foot Fall": "footfall",
|
|
69
|
+
"vehicle_monitoring_parking_lot": "vehicle_monitoring_parking_lot",
|
|
70
|
+
"vehicle_monitoring_drone_view": "vehicle_monitoring_drone_view",
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
APP_NAME_TO_CATEGORY = {
|
|
@@ -136,7 +138,9 @@ APP_NAME_TO_CATEGORY = {
|
|
|
136
138
|
"underground_pipeline_defect" : "general",
|
|
137
139
|
"suspicious_activity_detection": "security",
|
|
138
140
|
"natural_disaster_detection": "environmental",
|
|
139
|
-
"Foot Fall": "retail"
|
|
141
|
+
"Foot Fall": "retail",
|
|
142
|
+
"vehicle_monitoring_parking_lot": "traffic",
|
|
143
|
+
"vehicle_monitoring_drone_view": "traffic",
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
def get_usecase_from_app_name(app_name: str) -> str:
|
|
@@ -907,6 +907,8 @@ class ConfigManager:
|
|
|
907
907
|
'suspicious_activity_detection': None,
|
|
908
908
|
'natural_disaster_detection': None,
|
|
909
909
|
'footfall': None,
|
|
910
|
+
'vehicle_monitoring_parking_lot': None,
|
|
911
|
+
'vehicle_monitoring_drone_view': None,
|
|
910
912
|
|
|
911
913
|
#Put all image based usecases here::
|
|
912
914
|
'blood_cancer_detection_img': None,
|
|
@@ -1420,6 +1422,22 @@ class ConfigManager:
|
|
|
1420
1422
|
except ImportError:
|
|
1421
1423
|
return None
|
|
1422
1424
|
|
|
1425
|
+
def vehicle_monitoring_parking_lot_config_class(self):
|
|
1426
|
+
"""Register a configuration class for a use case."""
|
|
1427
|
+
try:
|
|
1428
|
+
from ..usecases.vehicle_monitoring_parking_lot import VehicleMonitoringParkingLotConfig
|
|
1429
|
+
return VehicleMonitoringParkingLotConfig
|
|
1430
|
+
except ImportError:
|
|
1431
|
+
return None
|
|
1432
|
+
|
|
1433
|
+
def vehicle_monitoring_drone_view_config_class(self):
|
|
1434
|
+
"""Register a configuration class for a use case."""
|
|
1435
|
+
try:
|
|
1436
|
+
from ..usecases.vehicle_monitoring_drone_view import VehicleMonitoringDroneViewConfig
|
|
1437
|
+
return VehicleMonitoringDroneViewConfig
|
|
1438
|
+
except ImportError:
|
|
1439
|
+
return None
|
|
1440
|
+
|
|
1423
1441
|
#put all image based usecases here::
|
|
1424
1442
|
def blood_cancer_detection_config_class(self):
|
|
1425
1443
|
"""Register a configuration class for a use case."""
|
|
@@ -2713,6 +2731,38 @@ class ConfigManager:
|
|
|
2713
2731
|
alert_config=alert_config,
|
|
2714
2732
|
**kwargs
|
|
2715
2733
|
)
|
|
2734
|
+
|
|
2735
|
+
elif usecase == "vehicle_monitoring_parking_lot":
|
|
2736
|
+
# Import here to avoid circular import
|
|
2737
|
+
from ..usecases.vehicle_monitoring_parking_lot import VehicleMonitoringParkingLotConfig
|
|
2738
|
+
|
|
2739
|
+
# Handle nested configurations
|
|
2740
|
+
alert_config = kwargs.pop("alert_config", None)
|
|
2741
|
+
if alert_config and isinstance(alert_config, dict):
|
|
2742
|
+
alert_config = AlertConfig(**alert_config)
|
|
2743
|
+
|
|
2744
|
+
config = VehicleMonitoringParkingLotConfig(
|
|
2745
|
+
category=category or "traffic",
|
|
2746
|
+
usecase=usecase,
|
|
2747
|
+
alert_config=alert_config,
|
|
2748
|
+
**kwargs
|
|
2749
|
+
)
|
|
2750
|
+
|
|
2751
|
+
elif usecase == "vehicle_monitoring_drone_view":
|
|
2752
|
+
# Import here to avoid circular import
|
|
2753
|
+
from ..usecases.vehicle_monitoring_drone_view import VehicleMonitoringDroneViewConfig
|
|
2754
|
+
|
|
2755
|
+
# Handle nested configurations
|
|
2756
|
+
alert_config = kwargs.pop("alert_config", None)
|
|
2757
|
+
if alert_config and isinstance(alert_config, dict):
|
|
2758
|
+
alert_config = AlertConfig(**alert_config)
|
|
2759
|
+
|
|
2760
|
+
config = VehicleMonitoringDroneViewConfig(
|
|
2761
|
+
category=category or "traffic",
|
|
2762
|
+
usecase=usecase,
|
|
2763
|
+
alert_config=alert_config,
|
|
2764
|
+
**kwargs
|
|
2765
|
+
)
|
|
2716
2766
|
|
|
2717
2767
|
#Add IMAGE based usecases here::
|
|
2718
2768
|
elif usecase == "blood_cancer_detection_img":
|
|
@@ -3271,6 +3321,18 @@ class ConfigManager:
|
|
|
3271
3321
|
default_config = FootFallConfig()
|
|
3272
3322
|
return default_config.to_dict()
|
|
3273
3323
|
|
|
3324
|
+
elif usecase == "vehicle_monitoring_parking_lot":
|
|
3325
|
+
# Import here to avoid circular import
|
|
3326
|
+
from ..usecases.vehicle_monitoring_parking_lot import VehicleMonitoringParkingLotConfig
|
|
3327
|
+
default_config = VehicleMonitoringParkingLotConfig()
|
|
3328
|
+
return default_config.to_dict()
|
|
3329
|
+
|
|
3330
|
+
elif usecase == "vehicle_monitoring_drone_view":
|
|
3331
|
+
# Import here to avoid circular import
|
|
3332
|
+
from ..usecases.vehicle_monitoring_drone_view import VehicleMonitoringDroneViewConfig
|
|
3333
|
+
default_config = VehicleMonitoringDroneViewConfig()
|
|
3334
|
+
return default_config.to_dict()
|
|
3335
|
+
|
|
3274
3336
|
|
|
3275
3337
|
elif usecase == "underground_pipeline_defect":
|
|
3276
3338
|
# Import here to avoid circular import
|
|
@@ -100,6 +100,8 @@ from .usecases import (
|
|
|
100
100
|
SusActivityUseCase,
|
|
101
101
|
NaturalDisasterUseCase,
|
|
102
102
|
FootFallUseCase,
|
|
103
|
+
VehicleMonitoringParkingLotUseCase,
|
|
104
|
+
VehicleMonitoringDroneViewUseCase,
|
|
103
105
|
# Put all IMAGE based usecases here
|
|
104
106
|
BloodCancerDetectionUseCase,
|
|
105
107
|
SkinCancerClassificationUseCase,
|
|
@@ -573,6 +575,12 @@ class PostProcessor:
|
|
|
573
575
|
registry.register_use_case(
|
|
574
576
|
"retail", "footfall", FootFallUseCase
|
|
575
577
|
)
|
|
578
|
+
registry.register_use_case(
|
|
579
|
+
"traffic", "vehicle_monitoring_parking_lot", VehicleMonitoringParkingLotUseCase
|
|
580
|
+
)
|
|
581
|
+
registry.register_use_case(
|
|
582
|
+
"traffic", "vehicle_monitoring_drone_view", VehicleMonitoringDroneViewUseCase
|
|
583
|
+
)
|
|
576
584
|
|
|
577
585
|
# Put all IMAGE based usecases here
|
|
578
586
|
registry.register_use_case(
|
|
@@ -86,7 +86,8 @@ from .underground_pipeline_defect_detection import UndergroundPipelineDefectConf
|
|
|
86
86
|
from .suspicious_activity_detection import SusActivityConfig, SusActivityUseCase
|
|
87
87
|
from .natural_disaster import NaturalDisasterConfig, NaturalDisasterUseCase
|
|
88
88
|
from .footfall import FootFallConfig, FootFallUseCase
|
|
89
|
-
|
|
89
|
+
from .vehicle_monitoring_parking_lot import VehicleMonitoringParkingLotUseCase, VehicleMonitoringParkingLotConfig
|
|
90
|
+
from .vehicle_monitoring_drone_view import VehicleMonitoringDroneViewUseCase, VehicleMonitoringDroneViewConfig
|
|
90
91
|
|
|
91
92
|
#Put all IMAGE based usecases here
|
|
92
93
|
from .blood_cancer_detection_img import BloodCancerDetectionConfig, BloodCancerDetectionUseCase
|
|
@@ -175,6 +176,8 @@ __all__ = [
|
|
|
175
176
|
'SusActivityUseCase',
|
|
176
177
|
'NaturalDisasterUseCase',
|
|
177
178
|
'FootFallUseCase',
|
|
179
|
+
'VehicleMonitoringParkingLotUseCase',
|
|
180
|
+
'VehicleMonitoringDroneViewUseCase',
|
|
178
181
|
|
|
179
182
|
#Put all IMAGE based usecases here
|
|
180
183
|
'BloodCancerDetectionUseCase',
|
|
@@ -258,6 +261,9 @@ __all__ = [
|
|
|
258
261
|
'SusActivityConfig',
|
|
259
262
|
'NaturalDisasterConfig',
|
|
260
263
|
'FootFallConfig',
|
|
264
|
+
'VehicleMonitoringParkingLotConfig',
|
|
265
|
+
'VehicleMonitoringDroneViewConfig',
|
|
266
|
+
|
|
261
267
|
#Put all IMAGE based usecase CONFIGS here
|
|
262
268
|
'BloodCancerDetectionConfig',
|
|
263
269
|
'SkinCancerClassificationConfig',
|
|
@@ -40,54 +40,35 @@ class VehicleMonitoringConfig(BaseConfig):
|
|
|
40
40
|
# )
|
|
41
41
|
usecase_categories: List[str] = field(
|
|
42
42
|
default_factory=lambda: [
|
|
43
|
-
|
|
44
|
-
"traffic light", "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog",
|
|
45
|
-
"horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella",
|
|
46
|
-
"handbag", "tie", "suitcase", "frisbee", "skis", "snowboard", "sports ball", "kite",
|
|
47
|
-
"baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle",
|
|
48
|
-
"wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich",
|
|
49
|
-
"orange", "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "couch",
|
|
50
|
-
"potted plant", "bed", "dining table", "toilet", "tv", "laptop", "mouse", "remote",
|
|
51
|
-
"keyboard", "cell phone", "microwave", "oven", "toaster", "sink", "refrigerator", "book",
|
|
52
|
-
"clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush"
|
|
43
|
+
'bicycle', 'motorcycle', 'car', 'van', 'bus', 'truck'
|
|
53
44
|
]
|
|
54
45
|
)
|
|
55
46
|
target_categories: List[str] = field(
|
|
56
47
|
default_factory=lambda: [
|
|
57
|
-
'car', '
|
|
48
|
+
'bicycle', 'motorcycle', 'car', 'van', 'bus', 'truck'
|
|
49
|
+
]
|
|
58
50
|
)
|
|
59
51
|
alert_config: Optional[AlertConfig] = None
|
|
60
52
|
index_to_category: Optional[Dict[int, str]] = field(
|
|
61
53
|
default_factory=lambda: {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
36: "skateboard", 37: "surfboard", 38: "tennis racket", 39: "bottle",
|
|
70
|
-
40: "wine glass", 41: "cup", 42: "fork", 43: "knife", 44: "spoon", 45: "bowl",
|
|
71
|
-
46: "banana", 47: "apple", 48: "sandwich", 49: "orange", 50: "broccoli",
|
|
72
|
-
51: "carrot", 52: "hot dog", 53: "pizza", 54: "donut", 55: "cake", 56: "chair",
|
|
73
|
-
57: "couch", 58: "potted plant", 59: "bed", 60: "dining table", 61: "toilet",
|
|
74
|
-
62: "tv", 63: "laptop", 64: "mouse", 65: "remote", 66: "keyboard",
|
|
75
|
-
67: "cell phone", 68: "microwave", 69: "oven", 70: "toaster", 71: "sink",
|
|
76
|
-
72: "refrigerator", 73: "book", 74: "clock", 75: "vase", 76: "scissors",
|
|
77
|
-
77: "teddy bear", 78: "hair drier", 79: "toothbrush"
|
|
78
|
-
}
|
|
54
|
+
0: "bicycle",
|
|
55
|
+
1: "motorcycle",
|
|
56
|
+
2: "car",
|
|
57
|
+
3: "van",
|
|
58
|
+
4: "bus",
|
|
59
|
+
5: "truck"
|
|
60
|
+
}
|
|
79
61
|
)
|
|
80
62
|
|
|
81
63
|
class VehicleMonitoringUseCase(BaseProcessor):
|
|
82
64
|
CATEGORY_DISPLAY = {
|
|
83
65
|
# Focus on vehicle-related COCO classes
|
|
84
66
|
"bicycle": "Bicycle",
|
|
85
|
-
"car": "Car",
|
|
86
67
|
"motorcycle": "Motorcycle",
|
|
68
|
+
"car": "Car",
|
|
69
|
+
"van": "Van",
|
|
87
70
|
"bus": "Bus",
|
|
88
71
|
"truck": "Truck",
|
|
89
|
-
"train": "Train",
|
|
90
|
-
"boat": "Boat"
|
|
91
72
|
}
|
|
92
73
|
|
|
93
74
|
def __init__(self):
|
|
@@ -95,7 +76,7 @@ class VehicleMonitoringUseCase(BaseProcessor):
|
|
|
95
76
|
self.category = "traffic"
|
|
96
77
|
self.CASE_TYPE: Optional[str] = 'vehicle_monitoring'
|
|
97
78
|
self.CASE_VERSION: Optional[str] = '1.0'
|
|
98
|
-
self.target_categories = ['car', '
|
|
79
|
+
self.target_categories = ['bicycle', 'motorcycle', 'car', 'van', 'bus', 'truck' ]
|
|
99
80
|
self.smoothing_tracker = None
|
|
100
81
|
self.tracker = None
|
|
101
82
|
self._total_frame_counter = 0
|
|
@@ -141,6 +122,7 @@ class VehicleMonitoringUseCase(BaseProcessor):
|
|
|
141
122
|
context.input_format = input_format
|
|
142
123
|
context.confidence_threshold = config.confidence_threshold
|
|
143
124
|
config.confidence_threshold = 0.25
|
|
125
|
+
# param to be updated
|
|
144
126
|
|
|
145
127
|
if config.confidence_threshold is not None:
|
|
146
128
|
processed_data = filter_by_confidence(data, config.confidence_threshold)
|