matrice 1.0.99396__tar.gz → 1.0.99398__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.
Files changed (273) hide show
  1. {matrice-1.0.99396/src/matrice.egg-info → matrice-1.0.99398}/PKG-INFO +1 -1
  2. {matrice-1.0.99396 → matrice-1.0.99398}/setup.py +1 -1
  3. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/__init__.py +3 -2
  4. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/license_plate_monitoring.py +163 -108
  5. {matrice-1.0.99396 → matrice-1.0.99398/src/matrice.egg-info}/PKG-INFO +1 -1
  6. {matrice-1.0.99396 → matrice-1.0.99398}/LICENSE.txt +0 -0
  7. {matrice-1.0.99396 → matrice-1.0.99398}/README.md +0 -0
  8. {matrice-1.0.99396 → matrice-1.0.99398}/setup.cfg +0 -0
  9. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/__init__.py +0 -0
  10. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/action.py +0 -0
  11. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/actionTracker.py +0 -0
  12. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/action_tracker.py +0 -0
  13. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/annotation.py +0 -0
  14. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/app_store.py +0 -0
  15. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/application.py +0 -0
  16. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute.py +0 -0
  17. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/__init__.py +0 -0
  18. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/action_instance.py +0 -0
  19. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/actions_manager.py +0 -0
  20. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/actions_scaledown_manager.py +0 -0
  21. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/instance_manager.py +0 -0
  22. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/instance_utils.py +0 -0
  23. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/prechecks.py +0 -0
  24. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/resources_tracker.py +0 -0
  25. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/scaling.py +0 -0
  26. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/shutdown_manager.py +0 -0
  27. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/compute_manager/task_utils.py +0 -0
  28. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/__init__.py +0 -0
  29. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/aug_server.py +0 -0
  30. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/aug_server_v2.py +0 -0
  31. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/__init__.py +0 -0
  32. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/base.py +0 -0
  33. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/__init__.py +0 -0
  34. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/bit_depth_reduction.py +0 -0
  35. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/blur.py +0 -0
  36. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/brightness_contrast.py +0 -0
  37. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/color_jitter.py +0 -0
  38. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/compression_artifacts.py +0 -0
  39. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/downscale_upscale.py +0 -0
  40. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/film_grain.py +0 -0
  41. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/flip.py +0 -0
  42. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/fog.py +0 -0
  43. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/horizontal_flip.py +0 -0
  44. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/hsv.py +0 -0
  45. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/iso_noise.py +0 -0
  46. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/low_light.py +0 -0
  47. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/posterize.py +0 -0
  48. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/rain.py +0 -0
  49. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/random_affine.py +0 -0
  50. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/salt_pepper.py +0 -0
  51. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/shadows.py +0 -0
  52. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/snow.py +0 -0
  53. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/speckle.py +0 -0
  54. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/augmentation_utils/strategies/sunflare.py +0 -0
  55. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/client.py +0 -0
  56. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/client_utils.py +0 -0
  57. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/create_dataset.py +0 -0
  58. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_augmentation.py +0 -0
  59. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_augmentor.py +0 -0
  60. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/__init__.py +0 -0
  61. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/imagenet_classification.py +0 -0
  62. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/labelbox_classification.py +0 -0
  63. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/labelbox_detection.py +0 -0
  64. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/mscoco_detection.py +0 -0
  65. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/pascalvoc_detection.py +0 -0
  66. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/unlabelled.py +0 -0
  67. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/video_davis_segmentation.py +0 -0
  68. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/video_detection_mscoco.py +0 -0
  69. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/video_imagenet_classification.py +0 -0
  70. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/video_kinetics_activity_recognition.py +0 -0
  71. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/video_mot_tracking.py +0 -0
  72. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/video_mscoco_detection.py +0 -0
  73. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/video_youtube_bb_tracking.py +0 -0
  74. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_formats/yolo_detection.py +0 -0
  75. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_labelling.py +0 -0
  76. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_prep.py +0 -0
  77. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/data_processor.py +0 -0
  78. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/image_augmentations.py +0 -0
  79. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/image_data_augmentation.py +0 -0
  80. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/new_data_augmentation.py +0 -0
  81. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/pipeline.py +0 -0
  82. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/server.py +0 -0
  83. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/server_utils.py +0 -0
  84. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/data_processing/video_server.py +0 -0
  85. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/dataset.py +0 -0
  86. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/aggregator/__init__.py +0 -0
  87. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/aggregator/aggregator.py +0 -0
  88. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/aggregator/analytics.py +0 -0
  89. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/aggregator/ingestor.py +0 -0
  90. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/aggregator/pipeline.py +0 -0
  91. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/aggregator/publisher.py +0 -0
  92. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/aggregator/synchronizer.py +0 -0
  93. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/__init__.py +0 -0
  94. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/auto_streaming/__init__.py +0 -0
  95. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/auto_streaming/auto_streaming.py +0 -0
  96. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/auto_streaming/auto_streaming_utils.py +0 -0
  97. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/client.py +0 -0
  98. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/client_stream_utils.py +0 -0
  99. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/client_utils.py +0 -0
  100. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/streaming_gateway/__init__.py +0 -0
  101. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/streaming_gateway/streaming_gateway.py +0 -0
  102. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/streaming_gateway/streaming_gateway_utils.py +0 -0
  103. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/client/streaming_gateway/streaming_results_handler.py +0 -0
  104. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/optimize/__init__.py +0 -0
  105. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/optimize/cache_manager.py +0 -0
  106. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/optimize/frame_comparators.py +0 -0
  107. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/optimize/frame_difference.py +0 -0
  108. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/optimize/transmission.py +0 -0
  109. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/__init__.py +0 -0
  110. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/inference/__init__.py +0 -0
  111. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/inference/batch_manager.py +0 -0
  112. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/inference/inference_interface.py +0 -0
  113. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/inference/model_manager.py +0 -0
  114. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/inference/triton_utils.py +0 -0
  115. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/proxy/__init__.py +0 -0
  116. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/proxy/proxy_interface.py +0 -0
  117. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/proxy/proxy_utils.py +0 -0
  118. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/server.py +0 -0
  119. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/stream/__init__.py +0 -0
  120. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/stream/inference_worker.py +0 -0
  121. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/stream/kafka_consumer_worker.py +0 -0
  122. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/stream/kafka_producer_worker.py +0 -0
  123. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/stream/stream_debug_logger.py +0 -0
  124. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/stream/stream_manager.py +0 -0
  125. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/server/stream/video_buffer.py +0 -0
  126. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/stream/__init__.py +0 -0
  127. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/stream/kafka_stream.py +0 -0
  128. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/stream/redis_stream.py +0 -0
  129. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/__init__.py +0 -0
  130. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/boundary_drawing_internal/__init__.py +0 -0
  131. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/boundary_drawing_internal/boundary_drawing_internal.py +0 -0
  132. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/boundary_drawing_internal/boundary_drawing_tool.py +0 -0
  133. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/boundary_drawing_internal/example_usage.py +0 -0
  134. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/__init__.py +0 -0
  135. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/advanced_tracker/__init__.py +0 -0
  136. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/advanced_tracker/base.py +0 -0
  137. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/advanced_tracker/config.py +0 -0
  138. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/advanced_tracker/kalman_filter.py +0 -0
  139. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/advanced_tracker/matching.py +0 -0
  140. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/advanced_tracker/strack.py +0 -0
  141. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/advanced_tracker/tracker.py +0 -0
  142. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/config.py +0 -0
  143. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/core/__init__.py +0 -0
  144. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/core/base.py +0 -0
  145. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/core/config.py +0 -0
  146. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/core/config_utils.py +0 -0
  147. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/ocr/__init__.py +0 -0
  148. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/ocr/easyocr_extractor.py +0 -0
  149. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/ocr/postprocessing.py +0 -0
  150. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/ocr/preprocessing.py +0 -0
  151. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/processor.py +0 -0
  152. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/__init__.py +0 -0
  153. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/run_tests.py +0 -0
  154. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/test_advanced_customer_service.py +0 -0
  155. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/test_basic_counting_tracking.py +0 -0
  156. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/test_comprehensive.py +0 -0
  157. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/test_config.py +0 -0
  158. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/test_customer_service.py +0 -0
  159. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/test_data_generators.py +0 -0
  160. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/test_people_counting.py +0 -0
  161. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/test_processor.py +0 -0
  162. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/test_utilities.py +0 -0
  163. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/test_cases/test_utils.py +0 -0
  164. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/Histopathological_Cancer_Detection_img.py +0 -0
  165. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/__init__.py +0 -0
  166. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/abandoned_object_detection.py +0 -0
  167. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/advanced_customer_service.py +0 -0
  168. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/age_detection.py +0 -0
  169. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/anti_spoofing_detection.py +0 -0
  170. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/assembly_line_detection.py +0 -0
  171. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/banana_defect_detection.py +0 -0
  172. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/basic_counting_tracking.py +0 -0
  173. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/blood_cancer_detection_img.py +0 -0
  174. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/car_damage_detection.py +0 -0
  175. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/car_part_segmentation.py +0 -0
  176. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/car_service.py +0 -0
  177. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/cardiomegaly_classification.py +0 -0
  178. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/chicken_pose_detection.py +0 -0
  179. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/child_monitoring.py +0 -0
  180. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/color_detection.py +0 -0
  181. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/color_map_utils.py +0 -0
  182. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/concrete_crack_detection.py +0 -0
  183. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/crop_weed_detection.py +0 -0
  184. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/customer_service.py +0 -0
  185. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/defect_detection_products.py +0 -0
  186. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/distracted_driver_detection.py +0 -0
  187. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/drowsy_driver_detection.py +0 -0
  188. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/emergency_vehicle_detection.py +0 -0
  189. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/face_emotion.py +0 -0
  190. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/face_recognition.py +0 -0
  191. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/fashion_detection.py +0 -0
  192. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/field_mapping.py +0 -0
  193. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/fire_detection.py +0 -0
  194. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/flare_analysis.py +0 -0
  195. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/flower_segmentation.py +0 -0
  196. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/gas_leak_detection.py +0 -0
  197. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/gender_detection.py +0 -0
  198. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/human_activity_recognition.py +0 -0
  199. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/intrusion_detection.py +0 -0
  200. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/leaf.py +0 -0
  201. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/leaf_disease.py +0 -0
  202. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/leak_detection.py +0 -0
  203. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/license_plate_detection.py +0 -0
  204. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/litter_monitoring.py +0 -0
  205. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/mask_detection.py +0 -0
  206. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/parking.py +0 -0
  207. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/parking_space_detection.py +0 -0
  208. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/pedestrian_detection.py +0 -0
  209. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/people_counting.py +0 -0
  210. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/pipeline_detection.py +0 -0
  211. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/plaque_segmentation_img.py +0 -0
  212. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/pothole_segmentation.py +0 -0
  213. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/ppe_compliance.py +0 -0
  214. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/price_tag_detection.py +0 -0
  215. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/proximity_detection.py +0 -0
  216. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/road_lane_detection.py +0 -0
  217. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/road_traffic_density.py +0 -0
  218. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/road_view_segmentation.py +0 -0
  219. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/shelf_inventory_detection.py +0 -0
  220. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/shoplifting_detection.py +0 -0
  221. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/shopping_cart_analysis.py +0 -0
  222. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/skin_cancer_classification_img.py +0 -0
  223. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/smoker_detection.py +0 -0
  224. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/solar_panel.py +0 -0
  225. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/template_usecase.py +0 -0
  226. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/theft_detection.py +0 -0
  227. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/traffic_sign_monitoring.py +0 -0
  228. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/underwater_pollution_detection.py +0 -0
  229. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/vehicle_monitoring.py +0 -0
  230. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/warehouse_object_segmentation.py +0 -0
  231. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/waterbody_segmentation.py +0 -0
  232. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/weapon_detection.py +0 -0
  233. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/weld_defect_detection.py +0 -0
  234. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/windmill_maintenance.py +0 -0
  235. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/usecases/wound_segmentation.py +0 -0
  236. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/__init__.py +0 -0
  237. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/advanced_counting_utils.py +0 -0
  238. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/advanced_helper_utils.py +0 -0
  239. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/advanced_tracking_utils.py +0 -0
  240. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/alerting_utils.py +0 -0
  241. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/category_mapping_utils.py +0 -0
  242. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/color_utils.py +0 -0
  243. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/counting_utils.py +0 -0
  244. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/filter_utils.py +0 -0
  245. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/format_utils.py +0 -0
  246. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/geometry_utils.py +0 -0
  247. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/smoothing_utils.py +0 -0
  248. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deploy/utils/post_processing/utils/tracking_utils.py +0 -0
  249. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deployment/__init__.py +0 -0
  250. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deployment/camera_manager.py +0 -0
  251. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deployment/deployment.py +0 -0
  252. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deployment/inference_pipeline.py +0 -0
  253. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/deployment/streaming_gateway_manager.py +0 -0
  254. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/docker_utils.py +0 -0
  255. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/drift_monitor.py +0 -0
  256. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/exported_model.py +0 -0
  257. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/local_test.py +0 -0
  258. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/metrics_calculator.py +0 -0
  259. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/metrics_calculator_oop.py +0 -0
  260. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/model_store.py +0 -0
  261. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/models.py +0 -0
  262. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/pipeline.py +0 -0
  263. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/projects.py +0 -0
  264. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/rpc.py +0 -0
  265. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/scaling.py +0 -0
  266. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/session.py +0 -0
  267. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/testing.py +0 -0
  268. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/token_auth.py +0 -0
  269. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice/utils.py +0 -0
  270. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice.egg-info/SOURCES.txt +0 -0
  271. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice.egg-info/dependency_links.txt +0 -0
  272. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice.egg-info/requires.txt +0 -0
  273. {matrice-1.0.99396 → matrice-1.0.99398}/src/matrice.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice
3
- Version: 1.0.99396
3
+ Version: 1.0.99398
4
4
  Summary: SDK for connecting to matrice.ai services
5
5
  Home-page: https://github.com/matrice-ai/python-sdk
6
6
  Author: Matrice.ai
@@ -14,7 +14,7 @@ long_description = (here / "README.md").read_text(encoding="utf-8")
14
14
  setup(
15
15
  name="matrice",
16
16
 
17
- version = "1.0.99396",
17
+ version = "1.0.99398",
18
18
 
19
19
  description="SDK for connecting to matrice.ai services",
20
20
  long_description=long_description,
@@ -18,9 +18,10 @@ dependencies_check(
18
18
  "python-snappy",
19
19
  "pyyaml",
20
20
  "imagehash",
21
- "easyocr",
22
21
  "torch",
23
- "opencv-python"
22
+ "opencv-python",
23
+ "onnxruntime-gpu",
24
+ "fast-plate-ocr[onnx-gpu]"
24
25
  ]
25
26
  )
26
27
 
@@ -18,18 +18,24 @@ from ..utils import (
18
18
  BBoxSmoothingConfig,
19
19
  BBoxSmoothingTracker
20
20
  )
21
- try:
22
- import cv2
23
- import numpy as np
24
- import torch
25
- from ..ocr.easyocr_extractor import EasyOCRExtractor
26
- from ..ocr.postprocessing import TextPostprocessor
27
- from ..ocr.preprocessing import ImagePreprocessor
28
- from ..core.config import BaseConfig, AlertConfig, ZoneConfig
29
-
30
- except:
31
- print("test-------------------------------------------------")
21
+ # External dependencies
22
+ import cv2
23
+ import numpy as np
24
+ #import torch
25
+ import re
32
26
 
27
+ # Fast license-plate OCR (replaces EasyOCR)
28
+ from fast_plate_ocr import LicensePlateRecognizer
29
+
30
+ # Internal utilities that are still required
31
+ from ..ocr.preprocessing import ImagePreprocessor
32
+ from ..core.config import BaseConfig, AlertConfig, ZoneConfig
33
+
34
+ # (Catch import errors early in the logs)
35
+ try:
36
+ _ = LicensePlateRecognizer # noqa: B018 – reference to quiet linters
37
+ except Exception as _e:
38
+ print(f"Warning: fast_plate_ocr could not be imported ⇒ {_e}")
33
39
 
34
40
 
35
41
  @dataclass
@@ -71,6 +77,17 @@ class LicensePlateMonitorConfig(BaseConfig):
71
77
  class LicensePlateMonitorUseCase(BaseProcessor):
72
78
  CATEGORY_DISPLAY = {"License_Plate": "License Plate"}
73
79
 
80
+ # --------------------------------------------------------------
81
+ # Shared resources (initialised once per process)
82
+ # --------------------------------------------------------------
83
+ _ocr_model: Optional[LicensePlateRecognizer] = None # Fast plate OCR
84
+ _non_alnum_regex = re.compile(r"[^A-Za-z0-9]+")
85
+
86
+ # Minimum length for a valid plate (after cleaning)
87
+ _min_plate_len = 5
88
+ # number of consecutive frames a plate must appear to be considered "stable"
89
+ _stable_frames_required = 3
90
+
74
91
  def __init__(self):
75
92
  super().__init__("license_plate_monitor")
76
93
  self.category = "license_plate_monitor"
@@ -91,10 +108,19 @@ class LicensePlateMonitorUseCase(BaseProcessor):
91
108
  self._seen_plate_texts = set()
92
109
  # CHANGE: Added _tracked_plate_texts to store the longest plate_text per track_id
93
110
  self._tracked_plate_texts: Dict[Any, str] = {}
94
- self._unique_plate_texts: Dict[str, str] = {}
111
+ # Containers for text stability & uniqueness
112
+ self._unique_plate_texts: Dict[str, str] = {} # cleaned_text -> original (longest)
95
113
  self.image_preprocessor = ImagePreprocessor()
96
- self.ocr_extractor = None # Initialized in process
97
- self.text_postprocessor = TextPostprocessor()
114
+ # Fast OCR model (shared across instances)
115
+ if LicensePlateMonitorUseCase._ocr_model is None:
116
+ try:
117
+ LicensePlateMonitorUseCase._ocr_model = LicensePlateRecognizer('cct-s-v1-global-model')
118
+ self.logger.info("LicensePlateRecognizer loaded successfully")
119
+ except Exception as e:
120
+ self.logger.error(f"Failed to initialise LicensePlateRecognizer: {e}")
121
+ self.ocr_model = LicensePlateMonitorUseCase._ocr_model
122
+ # OCR text history for stability checks (text → consecutive frame count)
123
+ self._text_history: Dict[str, int] = {}
98
124
 
99
125
  self.start_timer = None
100
126
  #self.reset_timer = "2025-08-19-04:22:47.187574 UTC"
@@ -112,24 +138,10 @@ class LicensePlateMonitorUseCase(BaseProcessor):
112
138
  self._tracked_plate_texts = {}
113
139
  self._total_frame_counter = 0
114
140
  self._global_frame_offset = 0
141
+ self._text_history = {}
142
+ self._unique_plate_texts = {}
115
143
  self.logger.info("Plate tracking state reset")
116
144
 
117
- # def _normalize_plate_text(self, text: str) -> str:
118
- # """Normalize plate text for comparison (e.g., remove spaces, convert to uppercase)."""
119
- # if not text or not text.strip():
120
- # return ""
121
- # text = text.replace(" ", "").upper()
122
- # # Map Arabic numerals to Latin to handle cases like ٠٠٤٦١٠
123
- # arabic_to_latin = str.maketrans("٠١٢٣٤٥٦٧٨٩", "0123456789")
124
- # text = text.translate(arabic_to_latin)
125
- # # Optional: Add OCR error corrections (e.g., 'O' to '0', 'I' to '1')
126
- # ocr_corrections = str.maketrans({'O': '0', 'I': '1', 'S': '5'})
127
- # text = text.translate(ocr_corrections)
128
- # # Validate: Ensure text is alphanumeric and at least 3 characters
129
- # if len(text) < 3 or not text.isalnum():
130
- # return ""
131
- # return text
132
-
133
145
  def reset_all_tracking(self) -> None:
134
146
  """Reset both advanced tracker and plate tracking state."""
135
147
  self.reset_tracker()
@@ -152,19 +164,19 @@ class LicensePlateMonitorUseCase(BaseProcessor):
152
164
  return self.create_error_result("input_bytes (video/image) is required for license plate monitoring",
153
165
  usecase=self.name, category=self.category, context=context)
154
166
 
155
- # if not data:
156
- # return self.create_result(
157
- # data={"agg_summary": {}},
158
- # usecase=self.name,
159
- # category=self.category,
160
- # context=context
161
- # )
162
- # return self.create_error_result("Detection data is required for license plate monitoring",
163
- # usecase=self.name, category=self.category, context=context)
164
-
165
167
  # Initialize OCR extractor if not already done
166
- if self.ocr_extractor is None:
167
- self.ocr_extractor = EasyOCRExtractor(lang=config.language, gpu=torch.cuda.is_available(), verbose=False)
168
+ if self.ocr_model is None:
169
+ self.logger.info("Lazy initialisation fallback (should rarely happen)")
170
+ try:
171
+ LicensePlateMonitorUseCase._ocr_model = LicensePlateRecognizer('cct-s-v1-global-model')
172
+ self.ocr_model = LicensePlateMonitorUseCase._ocr_model
173
+ except Exception as e:
174
+ return self.create_error_result(
175
+ f"Failed to initialise OCR model: {e}",
176
+ usecase=self.name,
177
+ category=self.category,
178
+ context=context,
179
+ )
168
180
 
169
181
  input_format = match_results_structure(data)
170
182
  context.input_format = input_format
@@ -226,6 +238,8 @@ class LicensePlateMonitorUseCase(BaseProcessor):
226
238
 
227
239
  # Step 8: Perform OCR on media
228
240
  ocr_analysis = self._analyze_ocr_in_media(processed_data, input_bytes, config)
241
+
242
+ print("ocr_analysis", ocr_analysis)
229
243
 
230
244
  # Step 9: Update plate texts
231
245
  processed_data = self._update_detections_with_ocr(processed_data, ocr_analysis)
@@ -299,6 +313,7 @@ class LicensePlateMonitorUseCase(BaseProcessor):
299
313
  def _analyze_ocr_in_media(self, data: Any, media_bytes: bytes, config: LicensePlateMonitorConfig) -> List[Dict[str, Any]]:
300
314
  """Analyze OCR of license plates in video frames or images."""
301
315
  is_video = self._is_video_bytes(media_bytes)
316
+ print('is_video',is_video)
302
317
  if is_video:
303
318
  return self._analyze_ocr_in_video(data, media_bytes, config)
304
319
  else:
@@ -348,13 +363,8 @@ class LicensePlateMonitorUseCase(BaseProcessor):
348
363
  if crop.size == 0:
349
364
  continue
350
365
 
351
- preprocessed_crop = self.image_preprocessor.preprocess(crop, grayscale=True)
352
- ocr_results = self.ocr_extractor.extract(preprocessed_crop, detail=1, paragraph=False)
353
- texts = [r['text'] for r in ocr_results]
354
- confs = [r['confidence'] for r in ocr_results]
355
- processed = self.text_postprocessor.postprocess(texts, confs, task="license_plate", region=config.country, confidence_threshold=0.3)
356
- valid_processed = [p for p in processed if p[2]]
357
- plate_text = valid_processed[0][0] if valid_processed else None
366
+ plate_text_raw = self._run_ocr(crop)
367
+ plate_text = plate_text_raw if plate_text_raw else None
358
368
 
359
369
  ocr_record = {
360
370
  "frame_id": frame_key,
@@ -388,26 +398,27 @@ class LicensePlateMonitorUseCase(BaseProcessor):
388
398
  rgb_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
389
399
  ocr_analysis = []
390
400
  detections = self._get_frame_detections(data, "0")
401
+
402
+ print("OCR-detections", detections)
391
403
 
392
404
  for detection in detections:
405
+ print("---------OCR DETECTION",detection)
393
406
  if detection.get("confidence", 1.0) < config.confidence_threshold:
394
407
  continue
395
408
 
396
409
  bbox = detection.get("bounding_box", detection.get("bbox"))
410
+ print("---------OCR BBOX",bbox)
397
411
  if not bbox:
398
412
  continue
399
413
 
400
414
  crop = self._crop_bbox(rgb_image, bbox, config.bbox_format)
415
+ print("---------OCR CROP SIZEE",crop.size)
401
416
  if crop.size == 0:
402
417
  continue
403
-
404
- preprocessed_crop = self.image_preprocessor.preprocess(crop, grayscale=True)
405
- ocr_results = self.ocr_extractor.extract(preprocessed_crop, detail=1, paragraph=False)
406
- texts = [r['text'] for r in ocr_results]
407
- confs = [r['confidence'] for r in ocr_results]
408
- processed = self.text_postprocessor.postprocess(texts, confs, task="license_plate", region=config.country, confidence_threshold=0.3)
409
- valid_processed = [p for p in processed if p[2]]
410
- plate_text = valid_processed[0][0] if valid_processed else None
418
+
419
+ plate_text_raw = self._run_ocr(crop)
420
+ print("---------OCR PLATE TEXT",plate_text_raw)
421
+ plate_text = plate_text_raw if plate_text_raw else None
411
422
 
412
423
  ocr_record = {
413
424
  "frame_id": "0",
@@ -450,6 +461,34 @@ class LicensePlateMonitorUseCase(BaseProcessor):
450
461
 
451
462
  return image[ymin:ymax, xmin:xmax]
452
463
 
464
+ # ------------------------------------------------------------------
465
+ # Fast OCR helpers
466
+ # ------------------------------------------------------------------
467
+ def _clean_text(self, text: str) -> str:
468
+ """Sanitise OCR output to keep only alphanumerics and uppercase."""
469
+ if not text:
470
+ return ""
471
+ return LicensePlateMonitorUseCase._non_alnum_regex.sub('', text).upper()
472
+
473
+ def _run_ocr(self, crop: np.ndarray) -> str:
474
+ """Run OCR on a cropped plate image and return cleaned text or empty string."""
475
+ print("---------OCR CROP22",crop)
476
+ print("---------OCR CROP SIZE22",crop.size)
477
+
478
+ if crop is None or crop.size == 0 or self.ocr_model is None:
479
+ return ""
480
+ try:
481
+ # fast_plate_ocr expects RGB
482
+ rgb_crop = cv2.cvtColor(crop, cv2.COLOR_BGR2RGB)
483
+ res = self.ocr_model.run(rgb_crop)
484
+ if isinstance(res, list):
485
+ res = res[0] if res else ""
486
+ cleaned = self._clean_text(str(res))
487
+ return cleaned if len(cleaned) >= self._min_plate_len else ""
488
+ except Exception as exc:
489
+ self.logger.warning(f"OCR failed: {exc}")
490
+ return ""
491
+
453
492
  def _get_frame_detections(self, data: Any, frame_key: str) -> List[Dict[str, Any]]:
454
493
  """Extract detections for a specific frame from data."""
455
494
  if isinstance(data, dict):
@@ -488,45 +527,42 @@ class LicensePlateMonitorUseCase(BaseProcessor):
488
527
  return detections
489
528
 
490
529
  def _count_categories(self, detections: List[Dict], config: LicensePlateMonitorConfig) -> Dict[str, Any]:
491
- """Count detections per category and include plate texts."""
492
- counts: Dict[str, int] = {}
493
- unique_keys_per_cat: Dict[str, set] = {}
494
- valid_detections = []
530
+ """Count unique licence-plate texts per frame and attach detections."""
531
+ unique_texts: set = set()
532
+ valid_detections: List[Dict[str, Any]] = []
495
533
 
534
+ print("---------SUMMARY COUNT CATEGORIES",detections)
496
535
  for det in detections:
497
536
  if not all(k in det for k in ['category', 'confidence', 'bounding_box']):
498
- self.logger.warning(f"Skipping invalid detection: {det}")
499
537
  continue
500
538
 
501
- cat = det.get('category', 'License_Plate')
502
- track_id = det.get('track_id')
503
- # Fallback to bbox tuple when track_id is missing
504
- bbox_key = tuple(sorted(det.get('bounding_box', {}).items())) if track_id is None else None
505
- unique_key = track_id if track_id is not None else bbox_key
506
-
507
- if unique_key is None:
508
- continue # Cannot determine uniqueness
539
+ cat = det.get('category', 'license_plate')
540
+ plate_text_raw = det.get('plate_text', '')
541
+ print("---------SUMMARY COUNT CATEGORIES PLATE TEXT RAW",plate_text_raw)
542
+ print("---------SUMMARY COUNT CATEGORIES PLATE TEXT RAW",det)
543
+ cleaned_text = self._clean_text(plate_text_raw)
509
544
 
510
- # Initialise storage for this category
511
- unique_keys_per_cat.setdefault(cat, set())
512
-
513
- # Only count once per unique key within the current frame
514
- if unique_key not in unique_keys_per_cat[cat]:
515
- unique_keys_per_cat[cat].add(unique_key)
516
- counts[cat] = counts.get(cat, 0) + 1
545
+ # Consider as unique only if meets criteria
546
+ if cleaned_text and len(cleaned_text) >= self._min_plate_len:
547
+ unique_texts.add(cleaned_text)
517
548
 
518
549
  valid_detections.append({
519
550
  "bounding_box": det.get("bounding_box"),
520
551
  "category": cat,
521
552
  "confidence": det.get("confidence"),
522
- "track_id": track_id,
553
+ "track_id": det.get('track_id'),
523
554
  "frame_id": det.get("frame_id"),
524
555
  "masks": det.get("masks", []),
525
- "plate_text": det.get("plate_text")
556
+ "plate_text": plate_text_raw
526
557
  })
527
- self.logger.debug(f"Valid detections after filtering: {len(valid_detections)}")
558
+
559
+ counts = {"License_Plate": len(unique_texts)} if unique_texts else {}
560
+
561
+ print("---------SUMMARY COUNT CATEGORIES VALID DETECTIONS",valid_detections)
562
+ print(len(unique_texts),'per_cat_count',counts)
563
+
528
564
  return {
529
- "total_count": sum(counts.values()),
565
+ "total_count": len(unique_texts),
530
566
  "per_category_count": counts,
531
567
  "detections": valid_detections
532
568
  }
@@ -547,21 +583,28 @@ class LicensePlateMonitorUseCase(BaseProcessor):
547
583
  camera_info = self.get_camera_info_from_stream(stream_info)
548
584
 
549
585
  human_text_lines = []
586
+ print("counting_summary", counting_summary)
550
587
  human_text_lines.append(f"CURRENT FRAME @ {current_timestamp}:")
551
588
  if total_detections > 0:
552
589
  category_counts = [f"{count} {cat}" for cat, count in per_category_count.items()]
553
590
  detection_text = category_counts[0] + " detected" if len(category_counts) == 1 else f"{', '.join(category_counts[:-1])}, and {category_counts[-1]} detected"
554
591
  human_text_lines.append(f"\t- {detection_text}")
555
592
  # Deduplicate plate texts for the current frame while preserving order
556
- seen_plate_texts = set()
557
- plate_texts = []
593
+ seen_cleaned = set()
594
+ display_texts = []
558
595
  for det in counting_summary.get("detections", []):
559
- text = det.get("plate_text")
560
- if text and text not in seen_plate_texts:
561
- seen_plate_texts.add(text)
562
- plate_texts.append(text)
563
- if plate_texts:
564
- human_text_lines.append(f"\t- License Plates: {', '.join(plate_texts)}")
596
+ raw = det.get("plate_text", "")
597
+ cleaned = self._clean_text(raw)
598
+ if cleaned and cleaned not in seen_cleaned:
599
+ seen_cleaned.add(cleaned)
600
+ # Display the longest raw variant seen in this frame for that cleaned text
601
+ longest_variant = max(
602
+ [d.get("plate_text", "") for d in counting_summary.get("detections", []) if self._clean_text(d.get("plate_text", "")) == cleaned],
603
+ key=len,
604
+ )
605
+ display_texts.append(longest_variant)
606
+ if display_texts:
607
+ human_text_lines.append(f"\t- License Plates: {', '.join(display_texts)}")
565
608
  else:
566
609
  human_text_lines.append(f"\t- No detections")
567
610
 
@@ -569,10 +612,9 @@ class LicensePlateMonitorUseCase(BaseProcessor):
569
612
  human_text_lines.append(f"TOTAL SINCE {start_timestamp}:")
570
613
  human_text_lines.append(f"\t- Total Detected: {cumulative_total}")
571
614
 
572
- if self._tracked_plate_texts:
615
+ if self._unique_plate_texts:
573
616
  human_text_lines.append("\t- Unique License Plates:")
574
- # Deduplicate license plate texts across different track IDs
575
- for text in sorted(set(self._tracked_plate_texts.values())):
617
+ for text in sorted(self._unique_plate_texts.values()):
576
618
  human_text_lines.append(f"\t\t- {text}")
577
619
 
578
620
  current_counts = [{"category": cat, "count": count} for cat, count in per_category_count.items() if count > 0 or total_detections > 0]
@@ -585,7 +627,7 @@ class LicensePlateMonitorUseCase(BaseProcessor):
585
627
  category = detection.get("category", "License_Plate")
586
628
  plate_text = detection.get("plate_text", "")
587
629
  segmentation = detection.get("masks", detection.get("segmentation", detection.get("mask", [])))
588
- detection_obj = self.create_detection_object(category, bbox, segmentation=segmentation, plate_text=plate_text)
630
+ detection_obj = self.create_detection_object(category, bbox, segmentation=None, plate_text=plate_text)
589
631
  detections.append(detection_obj)
590
632
 
591
633
  alert_settings = []
@@ -798,24 +840,37 @@ class LicensePlateMonitorUseCase(BaseProcessor):
798
840
  text = det.get('plate_text')
799
841
  track_id = det.get('track_id')
800
842
  if text and track_id is not None:
801
- # Skip text containing Unicode escape sequences (e.g., \u0664)
802
- if r'\u' in str(text):
803
- self.logger.debug(f"Skipping plate_text={text} for track_id={track_id} due to Unicode escape sequence")
804
- continue
805
- # Update _tracked_plate_texts with the longest text for this track_id
806
- print(f"Detected license plate text: {text} (track_id={track_id})")
807
- current_text = self._tracked_plate_texts.get(track_id, '')
808
- if len(text) > len(current_text):
809
- self._tracked_plate_texts[track_id] = text
810
- self.logger.debug(f"Updated track_id={track_id} with new longest plate_text={text}")
811
- # Maintain _seen_plate_texts for compatibility
812
- self._seen_plate_texts.add(text)
813
- self.logger.debug(f"Added plate_text={text} for track_id={track_id} to seen texts")
843
+ # Clean text again to guarantee consistency
844
+ text = self._clean_text(text)
845
+ if len(text) < self._min_plate_len:
846
+ continue # Too short to be a valid plate
847
+
848
+ # ----------------------------------------------------------
849
+ # Update consecutive frame appearance counter
850
+ # ----------------------------------------------------------
851
+ self._text_history[text] = self._text_history.get(text, 0) + 1
852
+
853
+ # Accept plate as stable only after N consecutive frames
854
+ if self._text_history[text] >= self._stable_frames_required:
855
+ # Track longest string variant per track_id
856
+ current_text = self._tracked_plate_texts.get(track_id, '')
857
+ if len(text) > len(current_text):
858
+ self._tracked_plate_texts[track_id] = text
859
+ # Maintain global unique mapping (cleaned -> original longest)
860
+ longest_variant = self._unique_plate_texts.get(text, '')
861
+ if len(text) > len(longest_variant):
862
+ self._unique_plate_texts[text] = text
863
+ self.logger.debug(f"Stable plate confirmed: {text} (track_id={track_id})")
864
+
865
+ # Reset counters for texts not seen in this frame
866
+ current_frame_texts = {self._clean_text(det.get('plate_text', '')) for det in detections if det.get('plate_text')}
867
+ for t in list(self._text_history.keys()):
868
+ if t not in current_frame_texts:
869
+ self._text_history[t] = 0
814
870
 
815
871
  def get_total_counts(self):
816
872
  """Return total unique license plate texts encountered so far."""
817
- # Count unique plate texts across *all* track_ids
818
- return {'License_Plate': len(set(self._tracked_plate_texts.values()))}
873
+ return {'License_Plate': len(self._unique_plate_texts)}
819
874
 
820
875
  def _get_track_ids_info(self, detections: List[Dict]) -> Dict[str, Any]:
821
876
  """Get detailed information about track IDs."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice
3
- Version: 1.0.99396
3
+ Version: 1.0.99398
4
4
  Summary: SDK for connecting to matrice.ai services
5
5
  Home-page: https://github.com/matrice-ai/python-sdk
6
6
  Author: Matrice.ai
File without changes
File without changes
File without changes