matrice-analytics 0.1.2__tar.gz → 0.1.31__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 (203) hide show
  1. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/PKG-INFO +1 -1
  2. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/matrice_analytics.egg-info/PKG-INFO +1 -1
  3. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/matrice_analytics.egg-info/SOURCES.txt +35 -0
  4. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/advanced_tracker/matching.py +3 -3
  5. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/advanced_tracker/strack.py +1 -1
  6. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/face_reg/compare_similarity.py +5 -5
  7. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/face_reg/embedding_manager.py +14 -7
  8. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/face_reg/face_recognition.py +123 -34
  9. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/face_reg/face_recognition_client.py +589 -0
  10. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/face_reg/people_activity_logging.py +29 -22
  11. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/__init__.py +9 -0
  12. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/__init__.py +4 -0
  13. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/cli.py +33 -0
  14. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/dataset_stats.py +139 -0
  15. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/export.py +398 -0
  16. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/train.py +447 -0
  17. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/utils.py +129 -0
  18. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/valid.py +93 -0
  19. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/validate_dataset.py +240 -0
  20. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/visualize_augmentation.py +176 -0
  21. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/visualize_predictions.py +96 -0
  22. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/__init__.py +3 -0
  23. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/process.py +246 -0
  24. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/types.py +60 -0
  25. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/utils.py +87 -0
  26. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/__init__.py +3 -0
  27. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/config.py +82 -0
  28. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/hub.py +141 -0
  29. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/plate_recognizer.py +323 -0
  30. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/__init__.py +0 -0
  31. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/__init__.py +0 -0
  32. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/augmentation.py +101 -0
  33. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/dataset.py +97 -0
  34. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/__init__.py +0 -0
  35. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/config.py +114 -0
  36. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/layers.py +553 -0
  37. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/loss.py +55 -0
  38. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/metric.py +86 -0
  39. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/model_builders.py +95 -0
  40. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/model_schema.py +395 -0
  41. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/__init__.py +0 -0
  42. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/backend_utils.py +38 -0
  43. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/utils.py +214 -0
  44. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/ocr/postprocessing.py +0 -1
  45. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/post_processor.py +19 -5
  46. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/usecases/color/clip.py +392 -0
  47. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/color/color_mapper.py +2 -2
  48. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/color_detection.py +429 -355
  49. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/usecases/drone_traffic_monitoring.py +585 -0
  50. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/flare_analysis.py +1 -56
  51. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/license_plate_detection.py +476 -202
  52. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/license_plate_monitoring.py +252 -11
  53. matrice_analytics-0.1.31/src/matrice_analytics/post_processing/usecases/people_counting.py +705 -0
  54. matrice_analytics-0.1.2/src/matrice_analytics/post_processing/usecases/people_counting.py → matrice_analytics-0.1.31/src/matrice_analytics/post_processing/usecases/people_counting_bckp.py +26 -71
  55. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/vehicle_monitoring.py +39 -10
  56. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/__init__.py +8 -8
  57. matrice_analytics-0.1.31/src/matrice_analytics/py.typed +0 -0
  58. matrice_analytics-0.1.2/src/matrice_analytics/post_processing/face_reg/face_recognition_client.py +0 -339
  59. matrice_analytics-0.1.2/src/matrice_analytics/post_processing/usecases/color/clip.py +0 -232
  60. matrice_analytics-0.1.2/src/matrice_analytics/post_processing/usecases/drone_traffic_monitoring.py +0 -930
  61. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/LICENSE.txt +0 -0
  62. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/README.md +0 -0
  63. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/matrice_analytics.egg-info/dependency_links.txt +0 -0
  64. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/matrice_analytics.egg-info/not-zip-safe +0 -0
  65. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/matrice_analytics.egg-info/top_level.txt +0 -0
  66. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/pyproject.toml +0 -0
  67. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/setup.cfg +0 -0
  68. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/setup.py +0 -0
  69. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/__init__.py +0 -0
  70. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/boundary_drawing_internal/README.md +0 -0
  71. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/boundary_drawing_internal/__init__.py +0 -0
  72. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/boundary_drawing_internal/boundary_drawing_internal.py +0 -0
  73. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/boundary_drawing_internal/boundary_drawing_tool.py +0 -0
  74. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/boundary_drawing_internal/boundary_tool_template.html +0 -0
  75. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/boundary_drawing_internal/example_usage.py +0 -0
  76. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/boundary_drawing_internal/usage/README.md +0 -0
  77. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/boundary_drawing_internal/usage/boundary_drawer_launcher.py +0 -0
  78. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/boundary_drawing_internal/usage/simple_boundary_launcher.py +0 -0
  79. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/README.md +0 -0
  80. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/__init__.py +0 -0
  81. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/advanced_tracker/README.md +0 -0
  82. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/advanced_tracker/__init__.py +0 -0
  83. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/advanced_tracker/base.py +0 -0
  84. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/advanced_tracker/config.py +0 -0
  85. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/advanced_tracker/kalman_filter.py +0 -0
  86. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/advanced_tracker/tracker.py +0 -0
  87. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/config.py +0 -0
  88. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/core/__init__.py +0 -0
  89. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/core/base.py +0 -0
  90. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/core/config.py +0 -0
  91. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/core/config_utils.py +0 -0
  92. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/face_reg/__init__.py +0 -0
  93. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/ocr/__init__.py +0 -0
  94. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/ocr/easyocr_extractor.py +0 -0
  95. {matrice_analytics-0.1.2/src/matrice_analytics → matrice_analytics-0.1.31/src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38}/py.typed +0 -0
  96. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/ocr/preprocessing.py +0 -0
  97. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/__init__.py +0 -0
  98. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/run_tests.py +0 -0
  99. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/test_advanced_customer_service.py +0 -0
  100. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/test_basic_counting_tracking.py +0 -0
  101. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/test_comprehensive.py +0 -0
  102. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/test_config.py +0 -0
  103. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/test_customer_service.py +0 -0
  104. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/test_data_generators.py +0 -0
  105. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/test_people_counting.py +0 -0
  106. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/test_processor.py +0 -0
  107. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/test_utilities.py +0 -0
  108. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/test_cases/test_utils.py +0 -0
  109. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/Histopathological_Cancer_Detection_img.py +0 -0
  110. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/__init__.py +0 -0
  111. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/abandoned_object_detection.py +0 -0
  112. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/advanced_customer_service.py +0 -0
  113. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/age_detection.py +0 -0
  114. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/age_gender_detection.py +0 -0
  115. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/anti_spoofing_detection.py +0 -0
  116. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/assembly_line_detection.py +0 -0
  117. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/banana_defect_detection.py +0 -0
  118. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/basic_counting_tracking.py +0 -0
  119. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/blood_cancer_detection_img.py +0 -0
  120. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/car_damage_detection.py +0 -0
  121. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/car_part_segmentation.py +0 -0
  122. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/car_service.py +0 -0
  123. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/cardiomegaly_classification.py +0 -0
  124. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/cell_microscopy_segmentation.py +0 -0
  125. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/chicken_pose_detection.py +0 -0
  126. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/child_monitoring.py +0 -0
  127. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/color/clip_processor/merges.txt +0 -0
  128. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/color/clip_processor/preprocessor_config.json +0 -0
  129. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/color/clip_processor/special_tokens_map.json +0 -0
  130. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/color/clip_processor/tokenizer.json +0 -0
  131. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/color/clip_processor/tokenizer_config.json +0 -0
  132. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/color/clip_processor/vocab.json +0 -0
  133. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/color/color_map_utils.py +0 -0
  134. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/color_map_utils.py +0 -0
  135. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/concrete_crack_detection.py +0 -0
  136. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/crop_weed_detection.py +0 -0
  137. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/customer_service.py +0 -0
  138. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/defect_detection_products.py +0 -0
  139. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/distracted_driver_detection.py +0 -0
  140. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/drowsy_driver_detection.py +0 -0
  141. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/dwell_detection.py +0 -0
  142. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/emergency_vehicle_detection.py +0 -0
  143. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/face_emotion.py +0 -0
  144. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/face_recognition.py +0 -0
  145. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/fashion_detection.py +0 -0
  146. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/field_mapping.py +0 -0
  147. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/fire_detection.py +0 -0
  148. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/flower_segmentation.py +0 -0
  149. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/gas_leak_detection.py +0 -0
  150. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/gender_detection.py +0 -0
  151. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/human_activity_recognition.py +0 -0
  152. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/intrusion_detection.py +0 -0
  153. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/leaf.py +0 -0
  154. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/leaf_disease.py +0 -0
  155. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/leak_detection.py +0 -0
  156. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/litter_monitoring.py +0 -0
  157. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/mask_detection.py +0 -0
  158. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/natural_disaster.py +0 -0
  159. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/parking.py +0 -0
  160. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/parking_space_detection.py +0 -0
  161. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/pcb_defect_detection.py +0 -0
  162. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/pedestrian_detection.py +0 -0
  163. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/people_tracking.py +0 -0
  164. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/pipeline_detection.py +0 -0
  165. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/plaque_segmentation_img.py +0 -0
  166. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/pothole_segmentation.py +0 -0
  167. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/ppe_compliance.py +0 -0
  168. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/price_tag_detection.py +0 -0
  169. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/proximity_detection.py +0 -0
  170. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/road_lane_detection.py +0 -0
  171. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/road_traffic_density.py +0 -0
  172. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/road_view_segmentation.py +0 -0
  173. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/shelf_inventory_detection.py +0 -0
  174. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/shoplifting_detection.py +0 -0
  175. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/shopping_cart_analysis.py +0 -0
  176. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/skin_cancer_classification_img.py +0 -0
  177. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/smoker_detection.py +0 -0
  178. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/solar_panel.py +0 -0
  179. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/suspicious_activity_detection.py +0 -0
  180. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/template_usecase.py +0 -0
  181. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/theft_detection.py +0 -0
  182. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/traffic_sign_monitoring.py +0 -0
  183. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/underground_pipeline_defect_detection.py +0 -0
  184. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/underwater_pollution_detection.py +0 -0
  185. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/warehouse_object_segmentation.py +0 -0
  186. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/waterbody_segmentation.py +0 -0
  187. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/weapon_detection.py +0 -0
  188. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/weld_defect_detection.py +0 -0
  189. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/wildlife_monitoring.py +0 -0
  190. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/windmill_maintenance.py +0 -0
  191. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/usecases/wound_segmentation.py +0 -0
  192. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/advanced_counting_utils.py +0 -0
  193. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/advanced_helper_utils.py +0 -0
  194. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/advanced_tracking_utils.py +0 -0
  195. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/alerting_utils.py +0 -0
  196. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/category_mapping_utils.py +0 -0
  197. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/color_utils.py +0 -0
  198. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/counting_utils.py +0 -0
  199. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/filter_utils.py +0 -0
  200. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/format_utils.py +0 -0
  201. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/geometry_utils.py +0 -0
  202. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/smoothing_utils.py +0 -0
  203. {matrice_analytics-0.1.2 → matrice_analytics-0.1.31}/src/matrice_analytics/post_processing/utils/tracking_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_analytics
3
- Version: 0.1.2
3
+ Version: 0.1.31
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.2
3
+ Version: 0.1.31
4
4
  Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
@@ -44,6 +44,40 @@ src/matrice_analytics/post_processing/ocr/__init__.py
44
44
  src/matrice_analytics/post_processing/ocr/easyocr_extractor.py
45
45
  src/matrice_analytics/post_processing/ocr/postprocessing.py
46
46
  src/matrice_analytics/post_processing/ocr/preprocessing.py
47
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/__init__.py
48
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/py.typed
49
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/__init__.py
50
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/cli.py
51
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/dataset_stats.py
52
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/export.py
53
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/train.py
54
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/utils.py
55
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/valid.py
56
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/validate_dataset.py
57
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/visualize_augmentation.py
58
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/visualize_predictions.py
59
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/__init__.py
60
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/process.py
61
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/types.py
62
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/utils.py
63
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/__init__.py
64
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/config.py
65
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/hub.py
66
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/plate_recognizer.py
67
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/__init__.py
68
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/__init__.py
69
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/augmentation.py
70
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/dataset.py
71
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/__init__.py
72
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/config.py
73
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/layers.py
74
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/loss.py
75
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/metric.py
76
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/model_builders.py
77
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/model_schema.py
78
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/__init__.py
79
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/backend_utils.py
80
+ src/matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/utils.py
47
81
  src/matrice_analytics/post_processing/test_cases/__init__.py
48
82
  src/matrice_analytics/post_processing/test_cases/run_tests.py
49
83
  src/matrice_analytics/post_processing/test_cases/test_advanced_customer_service.py
@@ -109,6 +143,7 @@ src/matrice_analytics/post_processing/usecases/parking_space_detection.py
109
143
  src/matrice_analytics/post_processing/usecases/pcb_defect_detection.py
110
144
  src/matrice_analytics/post_processing/usecases/pedestrian_detection.py
111
145
  src/matrice_analytics/post_processing/usecases/people_counting.py
146
+ src/matrice_analytics/post_processing/usecases/people_counting_bckp.py
112
147
  src/matrice_analytics/post_processing/usecases/people_tracking.py
113
148
  src/matrice_analytics/post_processing/usecases/pipeline_detection.py
114
149
  src/matrice_analytics/post_processing/usecases/plaque_segmentation_img.py
@@ -93,8 +93,8 @@ def iou_distance(atracks: list, btracks: list) -> np.ndarray:
93
93
  Compute cost based on Intersection over Union (IoU) between tracks.
94
94
 
95
95
  Args:
96
- atracks (List[STrack] | List[np.ndarray]): List of tracks 'a' or bounding boxes.
97
- btracks (List[STrack] | List[np.ndarray]): List of tracks 'b' or bounding boxes.
96
+ atracks (List[STrack] or List[np.ndarray]): List of tracks 'a' or bounding boxes.
97
+ btracks (List[STrack] or List[np.ndarray]): List of tracks 'b' or bounding boxes.
98
98
 
99
99
  Returns:
100
100
  (np.ndarray): Cost matrix computed based on IoU with shape (len(atracks), len(btracks)).
@@ -139,7 +139,7 @@ def embedding_distance(tracks: list, detections: list, metric: str = "cosine") -
139
139
  Compute distance between tracks and detections based on embeddings.
140
140
 
141
141
  Args:
142
- tracks (List[STrack]): List of tracks, where each track contains embedding features.
142
+ tracks (List[STrack] or List[np.ndarray]): List of tracks, where each track contains embedding features.
143
143
  detections (List[BaseTrack]): List of detections, where each detection contains embedding features.
144
144
  metric (str): Metric for distance computation. Supported metrics include 'cosine', 'euclidean', etc.
145
145
 
@@ -46,7 +46,7 @@ class STrack(BaseTrack):
46
46
  idx (int): Index or identifier for the object.
47
47
  frame_id (int): Current frame ID.
48
48
  start_frame (int): Frame where the object was first detected.
49
- angle (float | None): Optional angle information for oriented bounding boxes.
49
+ angle (float or None): Optional angle information for oriented bounding boxes.
50
50
  """
51
51
 
52
52
  shared_kalman = KalmanFilterXYAH()
@@ -62,11 +62,11 @@ class FaceTracker:
62
62
  self.tracks: Dict[str, Dict[str, object]] = {}
63
63
  self.track_counter: int = 1
64
64
 
65
- def _find_matching_track(self, new_embedding: List[float]) -> str | None:
65
+ def _find_matching_track(self, new_embedding: List[float]) -> Optional[str]:
66
66
  if not new_embedding:
67
67
  return None
68
68
  best_similarity: float = 0.0
69
- best_track_id: str | None = None
69
+ best_track_id: Optional[str] = None
70
70
  for track_id, data in self.tracks.items():
71
71
  stored_embedding = data.get("embedding")
72
72
  if stored_embedding:
@@ -76,7 +76,7 @@ class FaceTracker:
76
76
  best_track_id = track_id
77
77
  return best_track_id
78
78
 
79
- def assign_track_id(self, embedding: List[float], frame_id: int | None = None) -> str:
79
+ def assign_track_id(self, embedding: List[float], frame_id: Optional[int] = None) -> str:
80
80
  match_id = self._find_matching_track(embedding)
81
81
  if match_id is not None and match_id in self.tracks:
82
82
  # Update last seen frame for the matched track
@@ -139,7 +139,7 @@ def compute_pairwise_similarities(embeddings: List[List[float]]) -> Dict[Tuple[i
139
139
  return similarity_dict
140
140
 
141
141
 
142
- def get_embeddings_from_folder(folder_path: str, max_images: int | None = None) -> Tuple[List[List[float]], List[str]]:
142
+ def get_embeddings_from_folder(folder_path: str, max_images: Optional[int] = None) -> Tuple[List[List[float]], List[str]]:
143
143
  image_paths = sorted([p for p in Path(folder_path).iterdir() if p.suffix.lower() in {'.jpg', '.jpeg', '.png'}])
144
144
  if max_images is not None:
145
145
  image_paths = image_paths[:max_images]
@@ -155,7 +155,7 @@ def get_embeddings_from_folder(folder_path: str, max_images: int | None = None)
155
155
  return embeddings, img_names
156
156
 
157
157
 
158
- def get_embeddings_per_person(identity_root: str, max_images_per_person: int | None = None) -> Dict[str, List[List[float]]]:
158
+ def get_embeddings_per_person(identity_root: str, max_images_per_person: Optional[int] = None) -> Dict[str, List[List[float]]]:
159
159
  """Build a mapping: person (subdirectory name) -> list of embeddings from all images inside it."""
160
160
  root = Path(identity_root)
161
161
  if not root.exists():
@@ -87,10 +87,11 @@ class EmbeddingManager:
87
87
  return False
88
88
 
89
89
  try:
90
+ self.logger.info("Loading staff embeddings from API...")
90
91
  response = await self.face_client.get_all_staff_embeddings()
91
92
 
92
93
  if not response.get("success", False):
93
- self.logger.error(f"Failed to get staff embeddings: {response.get('error', 'Unknown error')}")
94
+ self.logger.error(f"Failed to get staff embeddings from API: {response.get('error', 'Unknown error')}")
94
95
  return False
95
96
 
96
97
  # The API response has the format: {"success": True, "data": [embedding_items]}
@@ -128,10 +129,11 @@ class EmbeddingManager:
128
129
 
129
130
  self.embedding_metadata = self.staff_embeddings.copy()
130
131
  self.staff_embeddings_last_update = time.time()
131
- self.logger.info(f"Loaded {len(self.staff_embeddings)} staff embeddings")
132
+ self.logger.info(f"Successfully loaded and cached {len(self.staff_embeddings)} staff embeddings")
133
+ self.logger.debug(f"Embeddings matrix shape: {self.embeddings_matrix.shape}")
132
134
  return True
133
135
  else:
134
- self.logger.warning("No active staff embeddings found")
136
+ self.logger.warning("No active staff embeddings found in API response")
135
137
  return False
136
138
 
137
139
  except Exception as e:
@@ -440,6 +442,7 @@ class EmbeddingManager:
440
442
 
441
443
  # Refresh staff embeddings if needed
442
444
  if self._should_refresh_embeddings() or self.embeddings_matrix is None:
445
+ self.logger.debug("Staff embeddings cache expired or empty, refreshing...")
443
446
  await self._load_staff_embeddings()
444
447
 
445
448
  # Always perform similarity search first
@@ -448,7 +451,8 @@ class EmbeddingManager:
448
451
 
449
452
  if local_match:
450
453
  staff_embedding, similarity_score = local_match
451
- self.logger.debug(f"Found local match for staff {staff_embedding.staff_id} with similarity {similarity_score:.3f}")
454
+ self.logger.info(f"Local embedding match found - staff_id={staff_embedding.staff_id}, similarity={similarity_score:.3f}, employee_id={staff_embedding.employee_id}")
455
+ self.logger.debug(f"Match details: staff_details={staff_embedding.staff_details}")
452
456
 
453
457
  current_search_result = SearchResult(
454
458
  employee_id=staff_embedding.employee_id,
@@ -466,6 +470,8 @@ class EmbeddingManager:
466
470
  employee_id = f"unknown_{int(time.time())}_{counter_value}"
467
471
  staff_id = track_id if track_id else f"unknown_{counter_value}"
468
472
 
473
+ self.logger.info(f"No local match found - creating unknown face entry: employee_id={employee_id}, track_id={track_id}")
474
+
469
475
  current_search_result = SearchResult(
470
476
  employee_id=employee_id,
471
477
  staff_id=staff_id,
@@ -482,13 +488,14 @@ class EmbeddingManager:
482
488
 
483
489
  # If current result is unknown, always continue checking even if cached
484
490
  if current_search_result.detection_type == "unknown":
485
- self.logger.debug(f"Unknown face with track_id: {track_id} - continuing to re-check for potential identification")
491
+ self.logger.debug(f"Unknown face with track_id={track_id} - not caching, will re-check for potential identification")
486
492
  # Still update cache if new result is better, but don't return cached result for unknowns
487
493
  if cached_result and current_search_result.similarity_score > cached_result.similarity_score:
488
- self._update_track_id_cache(track_id, current_search_result)
494
+ self._update_track_id_cache(track_id, current_search_result) # TODO: check if this is correct
495
+ self.logger.debug(f"Not updating cache for unknown face (track_id={track_id})")
489
496
  elif not cached_result:
490
497
  # Don't cache unknown results - let them be rechecked every time
491
- self.logger.debug(f"Not caching unknown face result for track_id: {track_id}")
498
+ self.logger.debug(f"Not caching unknown face result for track_id={track_id}")
492
499
  return current_search_result
493
500
 
494
501
  if cached_result:
@@ -14,6 +14,18 @@ Configuration options:
14
14
  - cache_max_size: Maximum number of cached track IDs (default: 1000)
15
15
  - cache_ttl: Cache time-to-live in seconds (default: 3600)
16
16
  """
17
+ import subprocess
18
+ import asyncio
19
+ import os
20
+ log_file = open("pip_jetson_btii.log", "w")
21
+ cmd = ["pip", "install", "httpx"]
22
+ subprocess.run(
23
+ cmd,
24
+ stdout=log_file,
25
+ stderr=subprocess.STDOUT,
26
+ preexec_fn=os.setpgrp
27
+ )
28
+ log_file.close()
17
29
 
18
30
  from typing import Any, Dict, List, Optional, Tuple
19
31
  import time
@@ -48,6 +60,8 @@ from .embedding_manager import EmbeddingManager, EmbeddingConfig
48
60
  from collections import deque, defaultdict
49
61
 
50
62
 
63
+
64
+
51
65
  def _normalize_embedding(vec: List[float]) -> List[float]:
52
66
  """Normalize an embedding vector to unit length (L2). Returns float32 list."""
53
67
  arr = np.asarray(vec, dtype=np.float32)
@@ -118,14 +132,13 @@ class TemporalIdentityManager:
118
132
  location=location,
119
133
  timestamp=timestamp,
120
134
  )
121
- except Exception:
135
+ except Exception as e:
136
+ self.logger.error(f"API ERROR: Failed to search similar faces in _compute_best_identity: {e}", exc_info=True)
122
137
  return None, "Unknown", 0.0, None, {}, "unknown"
123
138
 
124
139
  try:
125
140
  results: List[Any] = []
126
- print('----------------TOP@1 FROM API----------------------------')
127
- print(resp)
128
- print('----------------------------------------------------------')
141
+ self.logger.debug('API Response received for identity search')
129
142
  if isinstance(resp, dict):
130
143
  if isinstance(resp.get("data"), list):
131
144
  results = resp.get("data", [])
@@ -137,12 +150,11 @@ class TemporalIdentityManager:
137
150
  results = resp
138
151
 
139
152
  if not results:
153
+ self.logger.debug("No identity match found from API")
140
154
  return None, "Unknown", 0.0, None, {}, "unknown"
141
155
 
142
156
  item = results[0] if isinstance(results, list) else results
143
- print('----------------TOP@1 LISTT FROM API----------------------------')
144
- print(item)
145
- print('----------------------------------------------------------')
157
+ self.logger.debug(f'Top-1 match from API: {item}')
146
158
  # Be defensive with keys and types
147
159
  staff_id = item.get("staffId") if isinstance(item, dict) else None
148
160
  employee_id = str(item.get("_id")) if isinstance(item, dict) and item.get("_id") is not None else None
@@ -162,9 +174,12 @@ class TemporalIdentityManager:
162
174
  person_name = f"{first_name or ''} {last_name or ''}".strip() or "UnknowNN" #TODO:ebugging change to normal once done
163
175
  # If API says unknown or missing staff_id, treat as unknown
164
176
  if not staff_id: #or detection_type == "unknown"
177
+ self.logger.debug(f"API returned unknown or missing staff_id - score={score}, employee_id={employee_id}")
165
178
  return None, "Unknown", float(score), employee_id, staff_details if isinstance(staff_details, dict) else {}, "unknown"
179
+ self.logger.info(f"API identified face - staff_id={staff_id}, person_name={person_name}, score={score:.3f}")
166
180
  return str(staff_id), person_name, float(score), employee_id, staff_details if isinstance(staff_details, dict) else {}, "known"
167
- except Exception:
181
+ except Exception as e:
182
+ self.logger.error(f"Error parsing API response in _compute_best_identity: {e}", exc_info=True)
168
183
  return None, "Unknown", 0.0, None, {}, "unknown"
169
184
 
170
185
  async def _compute_best_identity_from_history(self, track_state: Dict[str, object], location: str = "", timestamp: str = "") -> Tuple[Optional[str], str, float, Optional[str], Dict[str, Any], str]:
@@ -172,9 +187,11 @@ class TemporalIdentityManager:
172
187
  if not hist:
173
188
  return None, "Unknown", 0.0, None, {}, "unknown"
174
189
  try:
190
+ self.logger.debug(f"Computing identity from embedding history - history_size={len(hist)}")
175
191
  proto = np.mean(np.asarray(list(hist), dtype=np.float32), axis=0)
176
192
  proto_list = proto.tolist() if isinstance(proto, np.ndarray) else list(proto)
177
- except Exception:
193
+ except Exception as e:
194
+ self.logger.error(f"Error computing prototype from history: {e}", exc_info=True)
178
195
  proto_list = []
179
196
  return await self._compute_best_identity(proto_list, location=location, timestamp=timestamp)
180
197
 
@@ -337,6 +354,7 @@ class FaceRecognitionEmbeddingConfig(BaseConfig):
337
354
 
338
355
  facial_recognition_server_id: str = ""
339
356
  session: Any = None # Matrice session for face recognition client
357
+ deployment_id: Optional[str] = None # deployment ID for update_deployment call
340
358
 
341
359
  # Embedding configuration
342
360
  embedding_config: Optional[Any] = None # Will be set to EmbeddingConfig instance
@@ -356,7 +374,7 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
356
374
  # Human-friendly display names for categories
357
375
  CATEGORY_DISPLAY = {"face": "face"}
358
376
 
359
- def __init__(self):
377
+ def __init__(self, config: Optional[FaceRecognitionEmbeddingConfig] = None):
360
378
  super().__init__("face_recognition")
361
379
  self.category = "security"
362
380
 
@@ -413,11 +431,53 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
413
431
  self._min_face_h: int = 30
414
432
 
415
433
  self.start_timer = None
434
+
435
+ # Store config for async initialization
436
+ self._default_config = config
437
+ self._initialized = False
438
+
439
+ asyncio.run(self.initialize(config))
440
+
441
+ async def initialize(self, config: Optional[FaceRecognitionEmbeddingConfig] = None) -> None:
442
+ """
443
+ Async initialization method to set up face client and deployment update.
444
+ Should be called after __init__ to perform async setup operations.
445
+
446
+ Args:
447
+ config: Optional config to use. If not provided, uses config from __init__.
448
+ """
449
+ if self._initialized:
450
+ self.logger.debug("Use case already initialized, skipping")
451
+ return
452
+
453
+ # Use provided config or fall back to default config from __init__
454
+ init_config = config or self._default_config
455
+
456
+ if not init_config:
457
+ self.logger.warning("No config provided for initialization, will initialize on first process() call")
458
+ return
459
+
460
+ # Validate config type
461
+ if not isinstance(init_config, FaceRecognitionEmbeddingConfig):
462
+ self.logger.warning(f"Invalid config type for initialization: {type(init_config)}, skipping early initialization")
463
+ return
464
+
465
+ self.logger.info("Initializing face recognition use case with provided config")
466
+
467
+ # Initialize face client (includes deployment update)
468
+ try:
469
+ self.face_client = await self._get_facial_recognition_client(init_config)
470
+ self._initialized = True
471
+ self.logger.info("Face recognition use case initialized successfully")
472
+
473
+ except Exception as e:
474
+ 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()
416
476
 
417
- def _get_facial_recognition_client(
477
+ async def _get_facial_recognition_client(
418
478
  self, config: FaceRecognitionEmbeddingConfig
419
479
  ) -> FacialRecognitionClient:
420
- """Get facial recognition client"""
480
+ """Get facial recognition client and update deployment"""
421
481
  # Initialize face recognition client if not already done
422
482
  if self.face_client is None:
423
483
  self.logger.info(
@@ -427,6 +487,20 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
427
487
  server_id=config.facial_recognition_server_id, session=config.session
428
488
  )
429
489
  self.logger.info("Face recognition client initialized")
490
+
491
+ # Call update_deployment if deployment_id is provided
492
+ if config.deployment_id:
493
+ try:
494
+ self.logger.info(f"Updating deployment with ID: {config.deployment_id}")
495
+ response = await self.face_client.update_deployment(config.deployment_id)
496
+ if response.get('success', False):
497
+ self.logger.info(f"Successfully updated deployment {config.deployment_id}")
498
+ else:
499
+ self.logger.warning(f"Failed to update deployment: {response.get('error', 'Unknown error')}")
500
+ except Exception as e:
501
+ self.logger.error(f"Exception while updating deployment: {e}", exc_info=True)
502
+ else:
503
+ self.logger.debug("No deployment_id provided, skipping deployment update")
430
504
 
431
505
  return self.face_client
432
506
 
@@ -454,22 +528,37 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
454
528
  category=self.category,
455
529
  context=context,
456
530
  )
457
- #if context is None:
458
- context = ProcessingContext()
531
+ if context is None:
532
+ context = ProcessingContext()
533
+
534
+ # Defensive check: Ensure context is ProcessingContext object (production safety)
535
+ # This handles edge cases where parameter mismatch might pass a dict as context
536
+ if not isinstance(context, ProcessingContext):
537
+ self.logger.warning(
538
+ f"Context parameter is not ProcessingContext (got {type(context).__name__}, {context}). "
539
+ "Creating new ProcessingContext. This may indicate a parameter mismatch in the caller."
540
+ )
541
+ context = ProcessingContext()
459
542
 
543
+ # Ensure initialization is complete (handles lazy initialization if not done earlier)
544
+ 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
460
548
  if not self.face_client:
461
- self.face_client = self._get_facial_recognition_client(config)
549
+ self.face_client = await self._get_facial_recognition_client(config)
462
550
 
551
+ # Ensure confidence threshold is set
463
552
  if not config.confidence_threshold:
464
553
  config.confidence_threshold = 0.35
465
554
 
466
- # Initialize People activity logging if enabled
555
+ # Ensure People activity logging is initialized if enabled
467
556
  if config.enable_people_activity_logging and not self.people_activity_logging:
468
557
  self.people_activity_logging = PeopleActivityLogging(self.face_client)
469
558
  self.people_activity_logging.start_background_processing()
470
559
  self.logger.info("People activity logging enabled and started")
471
560
 
472
- # Initialize EmbeddingManager if not already done
561
+ # Ensure EmbeddingManager is initialized
473
562
  if not self.embedding_manager:
474
563
  # Create default embedding config if not provided
475
564
  if not config.embedding_config:
@@ -482,7 +571,7 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
482
571
  )
483
572
  self.embedding_manager = EmbeddingManager(config.embedding_config, self.face_client)
484
573
 
485
- # Initialize TemporalIdentityManager (top-1 via API with smoothing)
574
+ # Ensure TemporalIdentityManager is initialized (top-1 via API with smoothing)
486
575
  if not self.temporal_identity_manager:
487
576
  self.temporal_identity_manager = TemporalIdentityManager(
488
577
  face_client=self.face_client,
@@ -1285,23 +1374,23 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
1285
1374
  detections = []
1286
1375
  for detection in counting_summary.get("detections", []):
1287
1376
  bbox = detection.get("bounding_box", {})
1288
- category = detection.get("display_name", "") #detection.get("category", "face")
1289
- print(f"CATegory: {category}")
1377
+ category = detection.get("display_name", "")
1378
+
1290
1379
  detection_obj = self.create_detection_object(category, bbox)
1291
1380
  # Add face recognition specific fields
1292
- # detection_obj.update(
1293
- # {
1294
- # "person_id": detection.get("person_id"),
1295
- # # Use display_name for front-end label suppression policy
1296
- # "person_name": detection.get("display_name", ""),
1297
- # # Explicit label field for UI overlays
1298
- # "label": detection.get("display_name", ""),
1299
- # "recognition_status": detection.get(
1300
- # "recognition_status", "unknown"
1301
- # ),
1302
- # "enrolled": detection.get("enrolled", False),
1303
- # }
1304
- # )
1381
+ detection_obj.update(
1382
+ {
1383
+ "person_id": detection.get("person_id"),
1384
+ # Use display_name for front-end label suppression policy
1385
+ "person_name": detection.get("display_name", ""),
1386
+ # Explicit label field for UI overlays
1387
+ "label": detection.get("display_name", ""),
1388
+ "recognition_status": detection.get(
1389
+ "recognition_status", "unknown"
1390
+ ),
1391
+ "enrolled": detection.get("enrolled", False),
1392
+ }
1393
+ )
1305
1394
  detections.append(detection_obj)
1306
1395
 
1307
1396
  # Build alert_settings array in expected format
@@ -1867,4 +1956,4 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
1867
1956
  if hasattr(self, "people_activity_logging") and self.people_activity_logging:
1868
1957
  self.people_activity_logging.stop_background_processing()
1869
1958
  except:
1870
- pass
1959
+ pass