matrice-analytics 0.1.31__tar.gz → 0.1.32__tar.gz

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.

Potentially problematic release.


This version of matrice-analytics might be problematic. Click here for more details.

Files changed (200) hide show
  1. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/PKG-INFO +1 -1
  2. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/matrice_analytics.egg-info/PKG-INFO +1 -1
  3. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/config.py +4 -0
  4. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/core/config.py +115 -12
  5. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/face_reg/embedding_manager.py +95 -1
  6. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/face_reg/face_recognition.py +52 -45
  7. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/face_reg/face_recognition_client.py +13 -12
  8. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/face_reg/people_activity_logging.py +40 -9
  9. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/post_processor.py +14 -7
  10. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color_detection.py +38 -40
  11. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/license_plate_monitoring.py +128 -44
  12. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/LICENSE.txt +0 -0
  13. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/README.md +0 -0
  14. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/matrice_analytics.egg-info/SOURCES.txt +0 -0
  15. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/matrice_analytics.egg-info/dependency_links.txt +0 -0
  16. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/matrice_analytics.egg-info/not-zip-safe +0 -0
  17. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/matrice_analytics.egg-info/top_level.txt +0 -0
  18. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/pyproject.toml +0 -0
  19. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/setup.cfg +0 -0
  20. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/setup.py +0 -0
  21. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/__init__.py +0 -0
  22. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/boundary_drawing_internal/README.md +0 -0
  23. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/boundary_drawing_internal/__init__.py +0 -0
  24. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/boundary_drawing_internal/boundary_drawing_internal.py +0 -0
  25. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/boundary_drawing_internal/boundary_drawing_tool.py +0 -0
  26. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/boundary_drawing_internal/boundary_tool_template.html +0 -0
  27. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/boundary_drawing_internal/example_usage.py +0 -0
  28. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/boundary_drawing_internal/usage/README.md +0 -0
  29. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/boundary_drawing_internal/usage/boundary_drawer_launcher.py +0 -0
  30. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/boundary_drawing_internal/usage/simple_boundary_launcher.py +0 -0
  31. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/README.md +0 -0
  32. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/__init__.py +0 -0
  33. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/advanced_tracker/README.md +0 -0
  34. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/advanced_tracker/__init__.py +0 -0
  35. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/advanced_tracker/base.py +0 -0
  36. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/advanced_tracker/config.py +0 -0
  37. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/advanced_tracker/kalman_filter.py +0 -0
  38. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/advanced_tracker/matching.py +0 -0
  39. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/advanced_tracker/strack.py +0 -0
  40. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/advanced_tracker/tracker.py +0 -0
  41. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/core/__init__.py +0 -0
  42. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/core/base.py +0 -0
  43. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/core/config_utils.py +0 -0
  44. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/face_reg/__init__.py +0 -0
  45. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/face_reg/compare_similarity.py +0 -0
  46. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/__init__.py +0 -0
  47. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/easyocr_extractor.py +0 -0
  48. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/__init__.py +0 -0
  49. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/__init__.py +0 -0
  50. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/cli.py +0 -0
  51. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/dataset_stats.py +0 -0
  52. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/export.py +0 -0
  53. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/train.py +0 -0
  54. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/utils.py +0 -0
  55. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/valid.py +0 -0
  56. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/validate_dataset.py +0 -0
  57. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/visualize_augmentation.py +0 -0
  58. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/visualize_predictions.py +0 -0
  59. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/__init__.py +0 -0
  60. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/process.py +0 -0
  61. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/types.py +0 -0
  62. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/utils.py +0 -0
  63. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/__init__.py +0 -0
  64. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/config.py +0 -0
  65. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/hub.py +0 -0
  66. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/plate_recognizer.py +0 -0
  67. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/py.typed +0 -0
  68. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/__init__.py +0 -0
  69. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/__init__.py +0 -0
  70. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/augmentation.py +0 -0
  71. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/dataset.py +0 -0
  72. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/__init__.py +0 -0
  73. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/config.py +0 -0
  74. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/layers.py +0 -0
  75. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/loss.py +0 -0
  76. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/metric.py +0 -0
  77. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/model_builders.py +0 -0
  78. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/model_schema.py +0 -0
  79. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/__init__.py +0 -0
  80. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/backend_utils.py +0 -0
  81. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/utils.py +0 -0
  82. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/postprocessing.py +0 -0
  83. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/ocr/preprocessing.py +0 -0
  84. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/__init__.py +0 -0
  85. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/run_tests.py +0 -0
  86. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/test_advanced_customer_service.py +0 -0
  87. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/test_basic_counting_tracking.py +0 -0
  88. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/test_comprehensive.py +0 -0
  89. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/test_config.py +0 -0
  90. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/test_customer_service.py +0 -0
  91. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/test_data_generators.py +0 -0
  92. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/test_people_counting.py +0 -0
  93. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/test_processor.py +0 -0
  94. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/test_utilities.py +0 -0
  95. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/test_cases/test_utils.py +0 -0
  96. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/Histopathological_Cancer_Detection_img.py +0 -0
  97. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/__init__.py +0 -0
  98. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/abandoned_object_detection.py +0 -0
  99. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/advanced_customer_service.py +0 -0
  100. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/age_detection.py +0 -0
  101. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/age_gender_detection.py +0 -0
  102. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/anti_spoofing_detection.py +0 -0
  103. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/assembly_line_detection.py +0 -0
  104. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/banana_defect_detection.py +0 -0
  105. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/basic_counting_tracking.py +0 -0
  106. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/blood_cancer_detection_img.py +0 -0
  107. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/car_damage_detection.py +0 -0
  108. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/car_part_segmentation.py +0 -0
  109. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/car_service.py +0 -0
  110. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/cardiomegaly_classification.py +0 -0
  111. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/cell_microscopy_segmentation.py +0 -0
  112. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/chicken_pose_detection.py +0 -0
  113. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/child_monitoring.py +0 -0
  114. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color/clip.py +0 -0
  115. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color/clip_processor/merges.txt +0 -0
  116. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color/clip_processor/preprocessor_config.json +0 -0
  117. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color/clip_processor/special_tokens_map.json +0 -0
  118. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color/clip_processor/tokenizer.json +0 -0
  119. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color/clip_processor/tokenizer_config.json +0 -0
  120. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color/clip_processor/vocab.json +0 -0
  121. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color/color_map_utils.py +0 -0
  122. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color/color_mapper.py +0 -0
  123. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/color_map_utils.py +0 -0
  124. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/concrete_crack_detection.py +0 -0
  125. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/crop_weed_detection.py +0 -0
  126. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/customer_service.py +0 -0
  127. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/defect_detection_products.py +0 -0
  128. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/distracted_driver_detection.py +0 -0
  129. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/drone_traffic_monitoring.py +0 -0
  130. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/drowsy_driver_detection.py +0 -0
  131. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/dwell_detection.py +0 -0
  132. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/emergency_vehicle_detection.py +0 -0
  133. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/face_emotion.py +0 -0
  134. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/face_recognition.py +0 -0
  135. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/fashion_detection.py +0 -0
  136. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/field_mapping.py +0 -0
  137. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/fire_detection.py +0 -0
  138. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/flare_analysis.py +0 -0
  139. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/flower_segmentation.py +0 -0
  140. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/gas_leak_detection.py +0 -0
  141. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/gender_detection.py +0 -0
  142. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/human_activity_recognition.py +0 -0
  143. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/intrusion_detection.py +0 -0
  144. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/leaf.py +0 -0
  145. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/leaf_disease.py +0 -0
  146. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/leak_detection.py +0 -0
  147. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/license_plate_detection.py +0 -0
  148. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/litter_monitoring.py +0 -0
  149. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/mask_detection.py +0 -0
  150. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/natural_disaster.py +0 -0
  151. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/parking.py +0 -0
  152. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/parking_space_detection.py +0 -0
  153. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/pcb_defect_detection.py +0 -0
  154. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/pedestrian_detection.py +0 -0
  155. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/people_counting.py +0 -0
  156. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/people_counting_bckp.py +0 -0
  157. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/people_tracking.py +0 -0
  158. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/pipeline_detection.py +0 -0
  159. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/plaque_segmentation_img.py +0 -0
  160. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/pothole_segmentation.py +0 -0
  161. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/ppe_compliance.py +0 -0
  162. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/price_tag_detection.py +0 -0
  163. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/proximity_detection.py +0 -0
  164. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/road_lane_detection.py +0 -0
  165. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/road_traffic_density.py +0 -0
  166. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/road_view_segmentation.py +0 -0
  167. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/shelf_inventory_detection.py +0 -0
  168. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/shoplifting_detection.py +0 -0
  169. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/shopping_cart_analysis.py +0 -0
  170. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/skin_cancer_classification_img.py +0 -0
  171. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/smoker_detection.py +0 -0
  172. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/solar_panel.py +0 -0
  173. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/suspicious_activity_detection.py +0 -0
  174. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/template_usecase.py +0 -0
  175. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/theft_detection.py +0 -0
  176. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/traffic_sign_monitoring.py +0 -0
  177. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/underground_pipeline_defect_detection.py +0 -0
  178. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/underwater_pollution_detection.py +0 -0
  179. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/vehicle_monitoring.py +0 -0
  180. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/warehouse_object_segmentation.py +0 -0
  181. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/waterbody_segmentation.py +0 -0
  182. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/weapon_detection.py +0 -0
  183. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/weld_defect_detection.py +0 -0
  184. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/wildlife_monitoring.py +0 -0
  185. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/windmill_maintenance.py +0 -0
  186. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/usecases/wound_segmentation.py +0 -0
  187. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/__init__.py +0 -0
  188. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/advanced_counting_utils.py +0 -0
  189. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/advanced_helper_utils.py +0 -0
  190. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/advanced_tracking_utils.py +0 -0
  191. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/alerting_utils.py +0 -0
  192. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/category_mapping_utils.py +0 -0
  193. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/color_utils.py +0 -0
  194. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/counting_utils.py +0 -0
  195. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/filter_utils.py +0 -0
  196. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/format_utils.py +0 -0
  197. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/geometry_utils.py +0 -0
  198. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/smoothing_utils.py +0 -0
  199. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/post_processing/utils/tracking_utils.py +0 -0
  200. {matrice_analytics-0.1.31 → matrice_analytics-0.1.32}/src/matrice_analytics/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_analytics
3
- Version: 0.1.31
3
+ Version: 0.1.32
4
4
  Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_analytics
3
- Version: 0.1.31
3
+ Version: 0.1.32
4
4
  Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
@@ -53,7 +53,9 @@ APP_NAME_TO_USECASE = {
53
53
  "abandoned_object_detection" : "abandoned_object_detection",
54
54
  "gas_leak_detection": "gas_leak_detection",
55
55
  "color_detection": "color_detection",
56
+ "Color Detection": "color_detection",
56
57
  "License Plate Recognition" : "license_plate_monitor",
58
+ "License Plate Monitoring" : "license_plate_monitor",
57
59
  "cell_microscopy_segmentation": "cell_microscopy_segmentation",
58
60
  "Dwell Detection": "dwell",
59
61
  "age_gender_detection": "age_gender_detection",
@@ -120,7 +122,9 @@ APP_NAME_TO_CATEGORY = {
120
122
  "abandoned_object_detection" : "security",
121
123
  "gas_leak_detection": "oil_gas",
122
124
  "color_detection": "visual_appearance",
125
+ "Color Detection": "visual_appearance",
123
126
  "License Plate Recognition" : "license_plate_monitor",
127
+ "License Plate Monitoring" : "license_plate_monitor",
124
128
  "cell_microscopy_segmentation" : "healthcare",
125
129
  "Dwell Detection": "general",
126
130
  "age_gender_detection": "age_gender_detection",
@@ -10,10 +10,13 @@ from typing import Any, Dict, List, Optional, Union, get_type_hints
10
10
  from pathlib import Path
11
11
  import json
12
12
  import yaml
13
+ import logging
13
14
  from abc import ABC, abstractmethod
14
15
 
15
16
  from .base import ConfigProtocol
16
17
 
18
+ logger = logging.getLogger(__name__)
19
+
17
20
 
18
21
  class ConfigValidationError(Exception):
19
22
  """Raised when configuration validation fails."""
@@ -786,6 +789,43 @@ class PeopleTrackingConfig:
786
789
  return errors
787
790
 
788
791
 
792
+ def filter_config_kwargs(config_class: type, kwargs: Dict[str, Any]) -> Dict[str, Any]:
793
+ """
794
+ Filter kwargs to only include parameters that are valid for the config class.
795
+
796
+ Args:
797
+ config_class: The config class to create
798
+ kwargs: Dictionary of parameters to filter
799
+
800
+ Returns:
801
+ Dict[str, Any]: Filtered kwargs containing only valid parameters
802
+ """
803
+ if not hasattr(config_class, '__dataclass_fields__'):
804
+ # Not a dataclass, return kwargs as-is
805
+ return kwargs
806
+
807
+ # Get valid field names from the dataclass
808
+ valid_fields = set(config_class.__dataclass_fields__.keys())
809
+
810
+ # Filter kwargs to only include valid fields
811
+ filtered_kwargs = {}
812
+ ignored_params = []
813
+
814
+ for key, value in kwargs.items():
815
+ if key in valid_fields:
816
+ filtered_kwargs[key] = value
817
+ else:
818
+ ignored_params.append(key)
819
+
820
+ # Log ignored parameters for debugging
821
+ if ignored_params:
822
+ logger.debug(
823
+ f"Ignoring non-config parameters for {config_class.__name__}: {ignored_params}"
824
+ )
825
+
826
+ return filtered_kwargs
827
+
828
+
789
829
  class ConfigManager:
790
830
  """Centralized configuration management for post-processing operations."""
791
831
 
@@ -1423,6 +1463,19 @@ class ConfigManager:
1423
1463
  except ImportError:
1424
1464
  return None
1425
1465
 
1466
+ def _filter_kwargs_for_config(self, config_class: type, kwargs: Dict[str, Any]) -> Dict[str, Any]:
1467
+ """
1468
+ Filter kwargs to only include valid parameters for the config class.
1469
+
1470
+ Args:
1471
+ config_class: The config class
1472
+ kwargs: Dictionary of parameters
1473
+
1474
+ Returns:
1475
+ Filtered kwargs
1476
+ """
1477
+ return filter_config_kwargs(config_class, kwargs)
1478
+
1426
1479
  def create_config(self, usecase: str, category: Optional[str] = None, **kwargs) -> BaseConfig:
1427
1480
  """
1428
1481
  Create configuration for a specific use case.
@@ -1438,6 +1491,17 @@ class ConfigManager:
1438
1491
  Raises:
1439
1492
  ConfigValidationError: If configuration is invalid
1440
1493
  """
1494
+ # Filter out common non-config parameters that should never be passed to configs
1495
+ common_non_config_params = [
1496
+ 'deployment_id', 'stream_key', 'stream_id', 'camera_id', 'server_id',
1497
+ 'inference_id', 'timestamp', 'frame_id', 'frame_number', 'request_id',
1498
+ 'user_id', 'tenant_id', 'organization_id', 'app_name', 'app_id'
1499
+ ]
1500
+ for param in common_non_config_params:
1501
+ if param in kwargs:
1502
+ logger.debug(f"Removing non-config parameter '{param}' from config creation")
1503
+ kwargs.pop(param, None)
1504
+
1441
1505
  if usecase == "people_counting":
1442
1506
  # Handle nested configurations
1443
1507
  zone_config = kwargs.pop("zone_config", None)
@@ -1448,12 +1512,15 @@ class ConfigManager:
1448
1512
  if alert_config and isinstance(alert_config, dict):
1449
1513
  alert_config = AlertConfig(**alert_config)
1450
1514
 
1515
+ # Filter kwargs to only include valid parameters
1516
+ filtered_kwargs = self._filter_kwargs_for_config(PeopleCountingConfig, kwargs)
1517
+
1451
1518
  config = PeopleCountingConfig(
1452
1519
  category=category or "general",
1453
1520
  usecase=usecase,
1454
1521
  zone_config=zone_config,
1455
1522
  alert_config=alert_config,
1456
- **kwargs
1523
+ **filtered_kwargs
1457
1524
  )
1458
1525
 
1459
1526
 
@@ -1467,12 +1534,15 @@ class ConfigManager:
1467
1534
  if alert_config and isinstance(alert_config, dict):
1468
1535
  alert_config = AlertConfig(**alert_config)
1469
1536
 
1537
+ # Filter kwargs to only include valid parameters
1538
+ filtered_kwargs = self._filter_kwargs_for_config(PeopleTrackingConfig, kwargs)
1539
+
1470
1540
  config = PeopleTrackingConfig(
1471
1541
  category=category or "general",
1472
1542
  usecase=usecase,
1473
1543
  zone_config=zone_config,
1474
1544
  alert_config=alert_config,
1475
- **kwargs
1545
+ **filtered_kwargs
1476
1546
  )
1477
1547
 
1478
1548
  elif usecase == "intrusion_detection":
@@ -1485,12 +1555,15 @@ class ConfigManager:
1485
1555
  if alert_config and isinstance(alert_config, dict):
1486
1556
  alert_config = AlertConfig(**alert_config)
1487
1557
 
1558
+ # Filter kwargs to only include valid parameters
1559
+ filtered_kwargs = self._filter_kwargs_for_config(IntrusionConfig, kwargs)
1560
+
1488
1561
  config = IntrusionConfig(
1489
1562
  category=category or "security",
1490
1563
  usecase=usecase,
1491
1564
  zone_config=zone_config,
1492
1565
  alert_config=alert_config,
1493
- **kwargs
1566
+ **filtered_kwargs
1494
1567
  )
1495
1568
 
1496
1569
  elif usecase == "proximity_detection":
@@ -1503,12 +1576,15 @@ class ConfigManager:
1503
1576
  if alert_config and isinstance(alert_config, dict):
1504
1577
  alert_config = AlertConfig(**alert_config)
1505
1578
 
1579
+ # Filter kwargs to only include valid parameters
1580
+ filtered_kwargs = self._filter_kwargs_for_config(ProximityConfig, kwargs)
1581
+
1506
1582
  config = ProximityConfig(
1507
1583
  category=category or "security",
1508
1584
  usecase=usecase,
1509
1585
  zone_config=zone_config,
1510
1586
  alert_config=alert_config,
1511
- **kwargs
1587
+ **filtered_kwargs
1512
1588
  )
1513
1589
 
1514
1590
  elif usecase in ["customer_service", "advanced_customer_service"]:
@@ -1521,12 +1597,15 @@ class ConfigManager:
1521
1597
  if alert_config and isinstance(alert_config, dict):
1522
1598
  alert_config = AlertConfig(**alert_config)
1523
1599
 
1600
+ # Filter kwargs to only include valid parameters
1601
+ filtered_kwargs = self._filter_kwargs_for_config(CustomerServiceConfig, kwargs)
1602
+
1524
1603
  config = CustomerServiceConfig(
1525
1604
  category=category or "sales",
1526
1605
  usecase=usecase,
1527
1606
  tracking_config=tracking_config,
1528
1607
  alert_config=alert_config,
1529
- **kwargs
1608
+ **filtered_kwargs
1530
1609
  )
1531
1610
  elif usecase == "basic_counting_tracking":
1532
1611
  # Import here to avoid circular import
@@ -1552,6 +1631,9 @@ class ConfigManager:
1552
1631
  alert_cooldown = kwargs.pop("alert_cooldown", 60.0)
1553
1632
  enable_unique_counting = kwargs.pop("enable_unique_counting", True)
1554
1633
 
1634
+ # Filter kwargs to only include valid parameters
1635
+ filtered_kwargs = self._filter_kwargs_for_config(BasicCountingTrackingConfig, kwargs)
1636
+
1555
1637
  config = BasicCountingTrackingConfig(
1556
1638
  category=category or "general",
1557
1639
  usecase=usecase,
@@ -1564,7 +1646,7 @@ class ConfigManager:
1564
1646
  zone_thresholds=zone_thresholds,
1565
1647
  alert_cooldown=alert_cooldown,
1566
1648
  enable_unique_counting=enable_unique_counting,
1567
- **kwargs
1649
+ **filtered_kwargs
1568
1650
  )
1569
1651
  elif usecase == "license_plate_detection":
1570
1652
  # Import here to avoid circular import
@@ -1575,11 +1657,14 @@ class ConfigManager:
1575
1657
  if alert_config and isinstance(alert_config, dict):
1576
1658
  alert_config = AlertConfig(**alert_config)
1577
1659
 
1660
+ # Filter kwargs to only include valid parameters
1661
+ filtered_kwargs = self._filter_kwargs_for_config(LicensePlateConfig, kwargs)
1662
+
1578
1663
  config = LicensePlateConfig(
1579
1664
  category=category or "vehicle",
1580
1665
  usecase=usecase,
1581
1666
  alert_config=alert_config,
1582
- **kwargs
1667
+ **filtered_kwargs
1583
1668
  )
1584
1669
  elif usecase == "parking_space_detection":
1585
1670
  # Import here to avoid circular import
@@ -1590,11 +1675,14 @@ class ConfigManager:
1590
1675
  if alert_config and isinstance(alert_config, dict):
1591
1676
  alert_config = AlertConfig(**alert_config)
1592
1677
 
1678
+ # Filter kwargs to only include valid parameters
1679
+ filtered_kwargs = self._filter_kwargs_for_config(ParkingSpaceConfig, kwargs)
1680
+
1593
1681
  config = ParkingSpaceConfig(
1594
1682
  category=category or "parking_space",
1595
1683
  usecase=usecase,
1596
1684
  alert_config=alert_config,
1597
- **kwargs
1685
+ **filtered_kwargs
1598
1686
  )
1599
1687
  elif usecase == "field_mapping":
1600
1688
  # Import here to avoid circular import
@@ -1605,11 +1693,14 @@ class ConfigManager:
1605
1693
  if alert_config and isinstance(alert_config, dict):
1606
1694
  alert_config = AlertConfig(**alert_config)
1607
1695
 
1696
+ # Filter kwargs to only include valid parameters
1697
+ filtered_kwargs = self._filter_kwargs_for_config(FieldMappingConfig, kwargs)
1698
+
1608
1699
  config = FieldMappingConfig(
1609
1700
  category=category or "infrastructure",
1610
1701
  usecase=usecase,
1611
1702
  alert_config=alert_config,
1612
- **kwargs
1703
+ **filtered_kwargs
1613
1704
  )
1614
1705
 
1615
1706
  elif usecase == "leaf_disease_detection":
@@ -1621,6 +1712,9 @@ class ConfigManager:
1621
1712
  if alert_config and isinstance(alert_config, dict):
1622
1713
  alert_config = AlertConfig(**alert_config)
1623
1714
 
1715
+ # Filter kwargs to only include valid parameters
1716
+ filtered_kwargs = self._filter_kwargs_for_config(LeafDiseaseDetectionConfig, kwargs)
1717
+
1624
1718
  config = LeafDiseaseDetectionConfig(
1625
1719
  category=category or "agriculture",
1626
1720
  usecase=usecase,
@@ -1964,11 +2058,14 @@ class ConfigManager:
1964
2058
  if alert_config and isinstance(alert_config, dict):
1965
2059
  alert_config = AlertConfig(**alert_config)
1966
2060
 
2061
+ # Filter kwargs to only include valid parameters
2062
+ filtered_kwargs = self._filter_kwargs_for_config(ColorDetectionConfig, kwargs)
2063
+
1967
2064
  config = ColorDetectionConfig(
1968
2065
  category=category or "visual_appearance",
1969
2066
  usecase=usecase,
1970
2067
  alert_config=alert_config,
1971
- **kwargs
2068
+ **filtered_kwargs
1972
2069
  )
1973
2070
  elif usecase == "video_color_classification":
1974
2071
  # Alias for color_detection - Import here to avoid circular import
@@ -1979,11 +2076,14 @@ class ConfigManager:
1979
2076
  if alert_config and isinstance(alert_config, dict):
1980
2077
  alert_config = AlertConfig(**alert_config)
1981
2078
 
2079
+ # Filter kwargs to only include valid parameters
2080
+ filtered_kwargs = self._filter_kwargs_for_config(ColorDetectionConfig, kwargs)
2081
+
1982
2082
  config = ColorDetectionConfig(
1983
2083
  category=category or "visual_appearance",
1984
2084
  usecase="color_detection", # Use canonical name internally
1985
2085
  alert_config=alert_config,
1986
- **kwargs
2086
+ **filtered_kwargs
1987
2087
  )
1988
2088
  elif usecase == "ppe_compliance_detection":
1989
2089
  # Import here to avoid circular import
@@ -2478,11 +2578,14 @@ class ConfigManager:
2478
2578
  if alert_config and isinstance(alert_config, dict):
2479
2579
  alert_config = AlertConfig(**alert_config)
2480
2580
 
2581
+ # Filter kwargs to only include valid parameters
2582
+ filtered_kwargs = self._filter_kwargs_for_config(LicensePlateMonitorConfig, kwargs)
2583
+
2481
2584
  config = LicensePlateMonitorConfig(
2482
2585
  category=category or "license_plate_monitor",
2483
2586
  usecase=usecase,
2484
2587
  alert_config=alert_config,
2485
- **kwargs
2588
+ **filtered_kwargs
2486
2589
  )
2487
2590
 
2488
2591
  elif usecase == "dwell":
@@ -46,6 +46,10 @@ class EmbeddingConfig:
46
46
  # Search settings
47
47
  search_limit: int = 5
48
48
  search_collection: str = "staff_enrollment"
49
+
50
+ # Background embedding refresh settings
51
+ enable_background_refresh: bool = True
52
+ background_refresh_interval: int = 600 # Refresh embeddings every 10 minutes (600 seconds)
49
53
 
50
54
 
51
55
  class EmbeddingManager:
@@ -76,10 +80,93 @@ class EmbeddingManager:
76
80
  self._cache_lock = threading.Lock()
77
81
  self._embeddings_lock = threading.Lock()
78
82
 
83
+ # Background refresh thread
84
+ self._refresh_thread = None
85
+ self._is_running = False
86
+ self._stop_event = threading.Event()
87
+
88
+ # Start background refresh if enabled
89
+ if self.config.enable_background_refresh and self.face_client:
90
+ self.start_background_refresh()
91
+ self.logger.info(f"Background embedding refresh enabled - interval: {self.config.background_refresh_interval}s")
92
+
79
93
  def set_face_client(self, face_client: FacialRecognitionClient):
80
94
  """Set the face recognition client."""
81
95
  self.face_client = face_client
82
96
 
97
+ # Start background refresh if it wasn't started yet
98
+ if self.config.enable_background_refresh and not self._is_running:
99
+ self.start_background_refresh()
100
+ self.logger.info("Background embedding refresh started after setting face client")
101
+
102
+ def start_background_refresh(self):
103
+ """Start the background embedding refresh thread"""
104
+ if not self._is_running and self.face_client:
105
+ self._is_running = True
106
+ self._stop_event.clear()
107
+ self._refresh_thread = threading.Thread(
108
+ target=self._run_refresh_loop, daemon=True, name="EmbeddingRefreshThread"
109
+ )
110
+ self._refresh_thread.start()
111
+ self.logger.info("Started background embedding refresh thread")
112
+
113
+ def stop_background_refresh(self):
114
+ """Stop the background embedding refresh thread"""
115
+ if self._is_running:
116
+ self.logger.info("Stopping background embedding refresh thread...")
117
+ self._is_running = False
118
+ self._stop_event.set()
119
+ if self._refresh_thread:
120
+ self._refresh_thread.join(timeout=10.0)
121
+ self.logger.info("Background embedding refresh thread stopped")
122
+
123
+ def _run_refresh_loop(self):
124
+ """Run the embedding refresh loop in background thread"""
125
+ import asyncio
126
+
127
+ try:
128
+ # Create new event loop for this thread
129
+ loop = asyncio.new_event_loop()
130
+ asyncio.set_event_loop(loop)
131
+
132
+ # Run initial load
133
+ self.logger.info("Loading initial staff embeddings in background thread...")
134
+ loop.run_until_complete(self._load_staff_embeddings())
135
+
136
+ # Periodic refresh loop
137
+ while self._is_running and not self._stop_event.is_set():
138
+ try:
139
+ # Wait for refresh interval with ability to stop
140
+ if self._stop_event.wait(timeout=self.config.background_refresh_interval):
141
+ # Stop event was set
142
+ break
143
+
144
+ if not self._is_running:
145
+ break
146
+
147
+ # Refresh embeddings
148
+ self.logger.info("Refreshing staff embeddings from server...")
149
+ success = loop.run_until_complete(self._load_staff_embeddings())
150
+
151
+ if success:
152
+ self.logger.info("Successfully refreshed staff embeddings in background")
153
+ else:
154
+ self.logger.warning("Failed to refresh staff embeddings in background")
155
+
156
+ except Exception as e:
157
+ self.logger.error(f"Error in background embedding refresh loop: {e}", exc_info=True)
158
+ # Continue loop even on error
159
+ time.sleep(60) # Wait 1 minute before retry on error
160
+
161
+ except Exception as e:
162
+ self.logger.error(f"Fatal error in background refresh thread: {e}", exc_info=True)
163
+ finally:
164
+ try:
165
+ loop.close()
166
+ except:
167
+ pass
168
+ self.logger.info("Background embedding refresh loop ended")
169
+
83
170
  async def _load_staff_embeddings(self) -> bool:
84
171
  """Load all staff embeddings from API and cache them."""
85
172
  if not self.face_client:
@@ -685,4 +772,11 @@ class EmbeddingManager:
685
772
  self.logger.warning(f"Unknown detection type: {search_result.detection_type}")
686
773
  return None
687
774
 
688
- return detection
775
+ return detection
776
+
777
+ def __del__(self):
778
+ """Cleanup when object is destroyed"""
779
+ try:
780
+ self.stop_background_refresh()
781
+ except:
782
+ pass
@@ -15,6 +15,7 @@ Configuration options:
15
15
  - cache_ttl: Cache time-to-live in seconds (default: 3600)
16
16
  """
17
17
  import subprocess
18
+ import logging
18
19
  import asyncio
19
20
  import os
20
21
  log_file = open("pip_jetson_btii.log", "w")
@@ -93,6 +94,7 @@ class TemporalIdentityManager:
93
94
  switch_patience: int = 5,
94
95
  fallback_margin: float = 0.05,
95
96
  ) -> None:
97
+ self.logger = logging.getLogger(__name__)
96
98
  self.face_client = face_client
97
99
  self.threshold = float(recognition_threshold)
98
100
  self.history_size = int(history_size)
@@ -436,12 +438,14 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
436
438
  self._default_config = config
437
439
  self._initialized = False
438
440
 
439
- asyncio.run(self.initialize(config))
441
+ # Don't call asyncio.run() in __init__ - it will fail if called from async context
442
+ # Initialization must be done by calling await initialize(config) after instantiation
443
+ # This is handled in PostProcessor._get_use_case_instance()
440
444
 
441
445
  async def initialize(self, config: Optional[FaceRecognitionEmbeddingConfig] = None) -> None:
442
446
  """
443
- Async initialization method to set up face client and deployment update.
444
- Should be called after __init__ to perform async setup operations.
447
+ Async initialization method to set up face client and all components.
448
+ Must be called after __init__ before process() can be called.
445
449
 
446
450
  Args:
447
451
  config: Optional config to use. If not provided, uses config from __init__.
@@ -454,25 +458,53 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
454
458
  init_config = config or self._default_config
455
459
 
456
460
  if not init_config:
457
- self.logger.warning("No config provided for initialization, will initialize on first process() call")
458
- return
461
+ raise ValueError("No config provided for initialization - config is required")
459
462
 
460
463
  # Validate config type
461
464
  if not isinstance(init_config, FaceRecognitionEmbeddingConfig):
462
- self.logger.warning(f"Invalid config type for initialization: {type(init_config)}, skipping early initialization")
463
- return
465
+ raise TypeError(f"Invalid config type for initialization: {type(init_config)}, expected FaceRecognitionEmbeddingConfig")
464
466
 
465
467
  self.logger.info("Initializing face recognition use case with provided config")
466
468
 
467
469
  # Initialize face client (includes deployment update)
468
470
  try:
469
471
  self.face_client = await self._get_facial_recognition_client(init_config)
472
+
473
+ # Initialize People activity logging if enabled
474
+ if init_config.enable_people_activity_logging:
475
+ self.people_activity_logging = PeopleActivityLogging(self.face_client)
476
+ self.people_activity_logging.start_background_processing()
477
+ self.logger.info("People activity logging enabled and started")
478
+
479
+ # Initialize EmbeddingManager
480
+ if not init_config.embedding_config:
481
+ init_config.embedding_config = EmbeddingConfig(
482
+ similarity_threshold=init_config.similarity_threshold,
483
+ confidence_threshold=init_config.confidence_threshold,
484
+ enable_track_id_cache=init_config.enable_track_id_cache,
485
+ cache_max_size=init_config.cache_max_size,
486
+ cache_ttl=3600
487
+ )
488
+ self.embedding_manager = EmbeddingManager(init_config.embedding_config, self.face_client)
489
+ self.logger.info("Embedding manager initialized")
490
+
491
+ # Initialize TemporalIdentityManager
492
+ self.temporal_identity_manager = TemporalIdentityManager(
493
+ face_client=self.face_client,
494
+ recognition_threshold=float(init_config.similarity_threshold),
495
+ history_size=20,
496
+ unknown_patience=7,
497
+ switch_patience=5,
498
+ fallback_margin=0.05,
499
+ )
500
+ self.logger.info("Temporal identity manager initialized")
501
+
470
502
  self._initialized = True
471
- self.logger.info("Face recognition use case initialized successfully")
503
+ self.logger.info("Face recognition use case fully initialized")
472
504
 
473
505
  except Exception as e:
474
506
  self.logger.error(f"Error during use case initialization: {e}", exc_info=True)
475
- # Don't mark as initialized so it can retry during process()
507
+ raise RuntimeError(f"Failed to initialize face recognition use case: {e}") from e
476
508
 
477
509
  async def _get_facial_recognition_client(
478
510
  self, config: FaceRecognitionEmbeddingConfig
@@ -540,47 +572,16 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
540
572
  )
541
573
  context = ProcessingContext()
542
574
 
543
- # Ensure initialization is complete (handles lazy initialization if not done earlier)
575
+ # Ensure use case is initialized (should be done in _get_use_case_instance, not lazy loaded)
544
576
  if not self._initialized:
545
- await self.initialize(config)
546
-
547
- # Fallback: If initialization failed but we still need face_client, try to initialize it
548
- if not self.face_client:
549
- self.face_client = await self._get_facial_recognition_client(config)
577
+ raise RuntimeError(
578
+ "Face recognition use case not initialized. "
579
+ "This should be initialized eagerly in PostProcessor._get_use_case_instance()"
580
+ )
550
581
 
551
582
  # Ensure confidence threshold is set
552
583
  if not config.confidence_threshold:
553
584
  config.confidence_threshold = 0.35
554
-
555
- # Ensure People activity logging is initialized if enabled
556
- if config.enable_people_activity_logging and not self.people_activity_logging:
557
- self.people_activity_logging = PeopleActivityLogging(self.face_client)
558
- self.people_activity_logging.start_background_processing()
559
- self.logger.info("People activity logging enabled and started")
560
-
561
- # Ensure EmbeddingManager is initialized
562
- if not self.embedding_manager:
563
- # Create default embedding config if not provided
564
- if not config.embedding_config:
565
- config.embedding_config = EmbeddingConfig(
566
- similarity_threshold=config.similarity_threshold,
567
- confidence_threshold=config.confidence_threshold,
568
- enable_track_id_cache=config.enable_track_id_cache,
569
- cache_max_size=config.cache_max_size,
570
- cache_ttl=3600
571
- )
572
- self.embedding_manager = EmbeddingManager(config.embedding_config, self.face_client)
573
-
574
- # Ensure TemporalIdentityManager is initialized (top-1 via API with smoothing)
575
- if not self.temporal_identity_manager:
576
- self.temporal_identity_manager = TemporalIdentityManager(
577
- face_client=self.face_client,
578
- recognition_threshold=float(config.similarity_threshold),
579
- history_size=20,
580
- unknown_patience=7,
581
- switch_patience=5,
582
- fallback_margin=0.05,
583
- )
584
585
 
585
586
 
586
587
  # Detect input format and store in context
@@ -1957,3 +1958,9 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
1957
1958
  self.people_activity_logging.stop_background_processing()
1958
1959
  except:
1959
1960
  pass
1961
+
1962
+ try:
1963
+ if hasattr(self, "embedding_manager") and self.embedding_manager:
1964
+ self.embedding_manager.stop_background_refresh()
1965
+ except:
1966
+ pass
@@ -284,9 +284,10 @@ class FacialRecognitionClient:
284
284
  location: str,
285
285
  employee_id: Optional[str] = None,
286
286
  timestamp: str = datetime.now(timezone.utc).isoformat(),
287
- ) -> str:
287
+ image_data: Optional[str] = None,
288
+ ) -> Dict[str, Any]:
288
289
  """
289
- Store people activity data and return response with potential upload URLs
290
+ Store people activity data with optional image data
290
291
 
291
292
  API: POST /v1/facial_recognition/store_people_activity?projectId={projectId}&serverID={serverID}
292
293
 
@@ -297,10 +298,10 @@ class FacialRecognitionClient:
297
298
  location: Location identifier
298
299
  employee_id: Employee ID (for unknown faces, this will be generated)
299
300
  timestamp: Timestamp in ISO format
301
+ image_data: Base64-encoded JPEG image data (optional)
300
302
 
301
303
  Returns:
302
- Dict containing response data including uploadUrl and employeeId for unknown faces,
303
- or None if the request failed
304
+ Dict containing response data with success status
304
305
  """
305
306
  activity_request = {
306
307
  "staff_id": staff_id,
@@ -316,7 +317,11 @@ class FacialRecognitionClient:
316
317
  elif detection_type == "known" and employee_id:
317
318
  activity_request["employee_id"] = employee_id
318
319
 
319
- self.logger.info(f"API REQUEST: Storing people activity - type={detection_type}, staff_id={staff_id}, location={location}")
320
+ # Add image data if provided
321
+ if image_data:
322
+ activity_request["imageData"] = image_data
323
+
324
+ self.logger.info(f"API REQUEST: Storing people activity - type={detection_type}, staff_id={staff_id}, location={location}, has_image={bool(image_data)}")
320
325
  self.logger.debug(f"Activity request payload: bbox={bbox}, employee_id={employee_id}")
321
326
 
322
327
  try:
@@ -329,18 +334,14 @@ class FacialRecognitionClient:
329
334
  handled_response = self._handle_response(response)
330
335
 
331
336
  if handled_response.get("success", False):
332
- data = handled_response.get("data", {})
333
337
  self.logger.info(f"API RESPONSE: Successfully stored {detection_type} activity for staff_id={staff_id}")
334
- if not data:
335
- self.logger.warning(f"No data returned from store people activity for staff_id={staff_id}")
336
- return None
337
- return data
338
+ return handled_response
338
339
  else:
339
340
  self.logger.warning(f"Failed to store {detection_type} activity: {handled_response.get('error', 'Unknown error')}")
340
- return None
341
+ return handled_response
341
342
  except Exception as e:
342
343
  self.logger.error(f"API ERROR: Store people activity request failed - type={detection_type}, staff_id={staff_id} - {e}", exc_info=True)
343
- return None
344
+ return {"success": False, "error": str(e)}
344
345
 
345
346
  async def update_staff_images(self, image_url: str, employee_id: str) -> Dict[str, Any]:
346
347
  """Update staff images with uploaded image URL