matrice-analytics 0.1.2__tar.gz → 0.1.3__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 (166) hide show
  1. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/PKG-INFO +1 -1
  2. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/matrice_analytics.egg-info/PKG-INFO +1 -1
  3. matrice_analytics-0.1.3/src/matrice_analytics/post_processing/usecases/color/clip.py +358 -0
  4. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/color_detection.py +412 -261
  5. matrice_analytics-0.1.2/src/matrice_analytics/post_processing/usecases/color/clip.py +0 -232
  6. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/LICENSE.txt +0 -0
  7. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/README.md +0 -0
  8. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/matrice_analytics.egg-info/SOURCES.txt +0 -0
  9. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/matrice_analytics.egg-info/dependency_links.txt +0 -0
  10. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/matrice_analytics.egg-info/not-zip-safe +0 -0
  11. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/matrice_analytics.egg-info/top_level.txt +0 -0
  12. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/pyproject.toml +0 -0
  13. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/setup.cfg +0 -0
  14. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/setup.py +0 -0
  15. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/__init__.py +0 -0
  16. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/boundary_drawing_internal/README.md +0 -0
  17. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/boundary_drawing_internal/__init__.py +0 -0
  18. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/boundary_drawing_internal/boundary_drawing_internal.py +0 -0
  19. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/boundary_drawing_internal/boundary_drawing_tool.py +0 -0
  20. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/boundary_drawing_internal/boundary_tool_template.html +0 -0
  21. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/boundary_drawing_internal/example_usage.py +0 -0
  22. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/boundary_drawing_internal/usage/README.md +0 -0
  23. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/boundary_drawing_internal/usage/boundary_drawer_launcher.py +0 -0
  24. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/boundary_drawing_internal/usage/simple_boundary_launcher.py +0 -0
  25. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/README.md +0 -0
  26. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/__init__.py +0 -0
  27. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/advanced_tracker/README.md +0 -0
  28. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/advanced_tracker/__init__.py +0 -0
  29. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/advanced_tracker/base.py +0 -0
  30. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/advanced_tracker/config.py +0 -0
  31. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/advanced_tracker/kalman_filter.py +0 -0
  32. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/advanced_tracker/matching.py +0 -0
  33. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/advanced_tracker/strack.py +0 -0
  34. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/advanced_tracker/tracker.py +0 -0
  35. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/config.py +0 -0
  36. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/core/__init__.py +0 -0
  37. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/core/base.py +0 -0
  38. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/core/config.py +0 -0
  39. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/core/config_utils.py +0 -0
  40. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/face_reg/__init__.py +0 -0
  41. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/face_reg/compare_similarity.py +0 -0
  42. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/face_reg/embedding_manager.py +0 -0
  43. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/face_reg/face_recognition.py +0 -0
  44. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/face_reg/face_recognition_client.py +0 -0
  45. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/face_reg/people_activity_logging.py +0 -0
  46. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/ocr/__init__.py +0 -0
  47. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/ocr/easyocr_extractor.py +0 -0
  48. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/ocr/postprocessing.py +0 -0
  49. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/ocr/preprocessing.py +0 -0
  50. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/post_processor.py +0 -0
  51. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/__init__.py +0 -0
  52. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/run_tests.py +0 -0
  53. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/test_advanced_customer_service.py +0 -0
  54. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/test_basic_counting_tracking.py +0 -0
  55. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/test_comprehensive.py +0 -0
  56. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/test_config.py +0 -0
  57. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/test_customer_service.py +0 -0
  58. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/test_data_generators.py +0 -0
  59. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/test_people_counting.py +0 -0
  60. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/test_processor.py +0 -0
  61. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/test_utilities.py +0 -0
  62. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/test_cases/test_utils.py +0 -0
  63. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/Histopathological_Cancer_Detection_img.py +0 -0
  64. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/__init__.py +0 -0
  65. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/abandoned_object_detection.py +0 -0
  66. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/advanced_customer_service.py +0 -0
  67. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/age_detection.py +0 -0
  68. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/age_gender_detection.py +0 -0
  69. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/anti_spoofing_detection.py +0 -0
  70. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/assembly_line_detection.py +0 -0
  71. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/banana_defect_detection.py +0 -0
  72. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/basic_counting_tracking.py +0 -0
  73. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/blood_cancer_detection_img.py +0 -0
  74. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/car_damage_detection.py +0 -0
  75. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/car_part_segmentation.py +0 -0
  76. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/car_service.py +0 -0
  77. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/cardiomegaly_classification.py +0 -0
  78. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/cell_microscopy_segmentation.py +0 -0
  79. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/chicken_pose_detection.py +0 -0
  80. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/child_monitoring.py +0 -0
  81. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/color/clip_processor/merges.txt +0 -0
  82. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/color/clip_processor/preprocessor_config.json +0 -0
  83. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/color/clip_processor/special_tokens_map.json +0 -0
  84. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/color/clip_processor/tokenizer.json +0 -0
  85. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/color/clip_processor/tokenizer_config.json +0 -0
  86. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/color/clip_processor/vocab.json +0 -0
  87. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/color/color_map_utils.py +0 -0
  88. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/color/color_mapper.py +0 -0
  89. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/color_map_utils.py +0 -0
  90. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/concrete_crack_detection.py +0 -0
  91. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/crop_weed_detection.py +0 -0
  92. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/customer_service.py +0 -0
  93. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/defect_detection_products.py +0 -0
  94. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/distracted_driver_detection.py +0 -0
  95. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/drone_traffic_monitoring.py +0 -0
  96. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/drowsy_driver_detection.py +0 -0
  97. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/dwell_detection.py +0 -0
  98. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/emergency_vehicle_detection.py +0 -0
  99. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/face_emotion.py +0 -0
  100. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/face_recognition.py +0 -0
  101. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/fashion_detection.py +0 -0
  102. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/field_mapping.py +0 -0
  103. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/fire_detection.py +0 -0
  104. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/flare_analysis.py +0 -0
  105. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/flower_segmentation.py +0 -0
  106. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/gas_leak_detection.py +0 -0
  107. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/gender_detection.py +0 -0
  108. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/human_activity_recognition.py +0 -0
  109. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/intrusion_detection.py +0 -0
  110. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/leaf.py +0 -0
  111. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/leaf_disease.py +0 -0
  112. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/leak_detection.py +0 -0
  113. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/license_plate_detection.py +0 -0
  114. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/license_plate_monitoring.py +0 -0
  115. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/litter_monitoring.py +0 -0
  116. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/mask_detection.py +0 -0
  117. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/natural_disaster.py +0 -0
  118. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/parking.py +0 -0
  119. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/parking_space_detection.py +0 -0
  120. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/pcb_defect_detection.py +0 -0
  121. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/pedestrian_detection.py +0 -0
  122. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/people_counting.py +0 -0
  123. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/people_tracking.py +0 -0
  124. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/pipeline_detection.py +0 -0
  125. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/plaque_segmentation_img.py +0 -0
  126. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/pothole_segmentation.py +0 -0
  127. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/ppe_compliance.py +0 -0
  128. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/price_tag_detection.py +0 -0
  129. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/proximity_detection.py +0 -0
  130. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/road_lane_detection.py +0 -0
  131. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/road_traffic_density.py +0 -0
  132. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/road_view_segmentation.py +0 -0
  133. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/shelf_inventory_detection.py +0 -0
  134. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/shoplifting_detection.py +0 -0
  135. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/shopping_cart_analysis.py +0 -0
  136. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/skin_cancer_classification_img.py +0 -0
  137. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/smoker_detection.py +0 -0
  138. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/solar_panel.py +0 -0
  139. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/suspicious_activity_detection.py +0 -0
  140. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/template_usecase.py +0 -0
  141. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/theft_detection.py +0 -0
  142. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/traffic_sign_monitoring.py +0 -0
  143. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/underground_pipeline_defect_detection.py +0 -0
  144. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/underwater_pollution_detection.py +0 -0
  145. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/vehicle_monitoring.py +0 -0
  146. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/warehouse_object_segmentation.py +0 -0
  147. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/waterbody_segmentation.py +0 -0
  148. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/weapon_detection.py +0 -0
  149. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/weld_defect_detection.py +0 -0
  150. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/wildlife_monitoring.py +0 -0
  151. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/windmill_maintenance.py +0 -0
  152. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/usecases/wound_segmentation.py +0 -0
  153. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/__init__.py +0 -0
  154. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/advanced_counting_utils.py +0 -0
  155. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/advanced_helper_utils.py +0 -0
  156. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/advanced_tracking_utils.py +0 -0
  157. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/alerting_utils.py +0 -0
  158. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/category_mapping_utils.py +0 -0
  159. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/color_utils.py +0 -0
  160. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/counting_utils.py +0 -0
  161. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/filter_utils.py +0 -0
  162. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/format_utils.py +0 -0
  163. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/geometry_utils.py +0 -0
  164. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/smoothing_utils.py +0 -0
  165. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/post_processing/utils/tracking_utils.py +0 -0
  166. {matrice_analytics-0.1.2 → matrice_analytics-0.1.3}/src/matrice_analytics/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_analytics
3
- Version: 0.1.2
3
+ Version: 0.1.3
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.3
4
4
  Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
@@ -0,0 +1,358 @@
1
+ import numpy as np
2
+ from typing import List, Dict, Tuple, Optional
3
+ from dataclasses import dataclass, field
4
+ from pathlib import Path
5
+ import cv2
6
+ import os
7
+ import io
8
+ import threading
9
+ # from scipy.special import softmax
10
+ import requests
11
+ try:
12
+ from transformers import CLIPProcessor
13
+ import onnxruntime as ort
14
+ from PIL import Image
15
+ from importlib.resources import files as ir_files, as_file as ir_as_file
16
+
17
+ except:
18
+ ir_files = None
19
+ ir_as_file = None
20
+ print("Unable to import onnxruntime")
21
+
22
+ def load_model_from_checkpoint(checkpoint_url: str, providers: Optional[List] = None):
23
+ """
24
+ Load an ONNX model from a URL directly into memory without writing locally.
25
+ Enforces the specified providers (e.g., CUDAExecutionProvider) for execution.
26
+ """
27
+ try:
28
+ print(f"Loading model from checkpoint: {checkpoint_url}")
29
+
30
+ # Download the checkpoint with streaming
31
+ response = requests.get(checkpoint_url, stream=True, timeout=(30, 200))
32
+ response.raise_for_status()
33
+
34
+ # Read the content into bytes
35
+ model_bytes = io.BytesIO()
36
+ for chunk in response.iter_content(chunk_size=8192):
37
+ if chunk:
38
+ model_bytes.write(chunk)
39
+ model_bytes.seek(0) # reset pointer to start
40
+
41
+ # Prepare session options for performance
42
+ try:
43
+ sess_options = ort.SessionOptions()
44
+ # Enable all graph optimizations
45
+ sess_options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL
46
+ # Conservative thread usage – GPU work dominates
47
+ sess_options.intra_op_num_threads = 1
48
+ sess_options.inter_op_num_threads = 1
49
+ except Exception:
50
+ sess_options = None
51
+
52
+ # Resolve providers
53
+ available = ort.get_available_providers()
54
+ print("Available providers:", available)
55
+ use_providers = ["CUDAExecutionProvider"] #providers or
56
+
57
+ # Validate providers and enforce CUDA when requested
58
+ if any(
59
+ (isinstance(p, tuple) and p[0] == "CUDAExecutionProvider") or p == "CUDAExecutionProvider"
60
+ for p in use_providers
61
+ ):
62
+ if "CUDAExecutionProvider" not in available:
63
+ raise RuntimeError("CUDAExecutionProvider not available in this environment")
64
+
65
+ # Load ONNX model from bytes with enforced providers
66
+ model = ort.InferenceSession(
67
+ model_bytes.read(),
68
+ sess_options=sess_options,
69
+ providers=use_providers,
70
+ )
71
+
72
+ print("Session providers:", model.get_providers())
73
+ print("Model loaded successfully from checkpoint (in-memory)")
74
+ return model
75
+
76
+ except Exception as e:
77
+ print(f"Error loading model from checkpoint: {e}")
78
+ return None
79
+
80
+
81
+
82
+ class ClipProcessor:
83
+ def __init__(self,
84
+ image_model_path: str = 'https://s3.us-west-2.amazonaws.com/testing.resources/datasets/clip_image.onnx',
85
+ text_model_path: str = 'https://s3.us-west-2.amazonaws.com/testing.resources/datasets/clip_text.onnx',
86
+ processor_dir: Optional[str] = None,
87
+ providers: Optional[List[str]] = None):
88
+
89
+ self.color_category: List[str] = ["black", "white", "yellow", "gray", "red", "blue", "light blue",
90
+ "green", "brown"]
91
+
92
+ self.image_url: str = image_model_path
93
+ self.text_url: str = text_model_path
94
+ # Resolve processor_dir relative to this module, not CWD
95
+ self.processor_path: str = self._resolve_processor_dir(processor_dir)
96
+ print("PROCESSOR PATH->", self.processor_path)
97
+ cwd = os.getcwd()
98
+ print("Current working directory:", cwd)
99
+
100
+ # Determine and enforce providers (prefer CUDA only)
101
+ try:
102
+ available = ort.get_available_providers()
103
+ except Exception:
104
+ available = []
105
+
106
+ if providers is None:
107
+ if "CUDAExecutionProvider" in available:
108
+ self.providers = ["CUDAExecutionProvider"]
109
+ else:
110
+ # Enforce GPU-only per requirement; raise if not available
111
+ print("CUDAExecutionProvider not available; ensure CUDA-enabled onnxruntime-gpu is installed and GPU is visible")
112
+ else:
113
+ self.providers = providers
114
+
115
+ # Thread-safety to serialize processing
116
+ self._lock = threading.Lock()
117
+
118
+ self.image_sess = load_model_from_checkpoint(self.image_url, providers=self.providers)
119
+ self.text_sess = load_model_from_checkpoint(self.text_url, providers=self.providers)
120
+
121
+
122
+ # Load CLIPProcessor tokenizer/config from local package data if available
123
+ self.processor = None
124
+ try:
125
+ if self.processor_path and os.path.isdir(self.processor_path):
126
+ self.processor = CLIPProcessor.from_pretrained(self.processor_path, local_files_only=True)
127
+ else:
128
+ # Fallback to hub
129
+ self.processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
130
+ except Exception as e:
131
+ print(f"Falling back to remote CLIPProcessor due to error loading local assets: {e}")
132
+ self.processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
133
+
134
+ tok = self.processor.tokenizer(self.color_category, padding=True, return_tensors="np")
135
+ ort_inputs_text = {
136
+ "input_ids": tok["input_ids"].astype(np.int64),
137
+ "attention_mask": tok["attention_mask"].astype(np.int64)
138
+ }
139
+ text_out = self.text_sess.run(["text_embeds"], ort_inputs_text)[0].astype(np.float32)
140
+ self.text_embeds = text_out / np.linalg.norm(text_out, axis=-1, keepdims=True)
141
+
142
+ sample = self.processor(images=np.zeros((224, 224, 3), dtype=np.uint8), return_tensors="np")
143
+ self.pixel_template = sample["pixel_values"].astype(np.float32)
144
+ self.min_box_size = 32
145
+ self.max_batch = 32
146
+ # Classify every frame for stability unless changed by caller
147
+ self.frame_skip = 1
148
+ self.batch_pixels = np.zeros((self.max_batch, *self.pixel_template.shape[1:]), dtype=np.float32)
149
+
150
+ self.records: Dict[int, Dict[str, float]] = {}
151
+ self.frame_idx = 0
152
+ self.processed_frames = 0
153
+
154
+
155
+ def _resolve_processor_dir(self, processor_dir: Optional[str]) -> str:
156
+ """
157
+ Find the absolute path to the bundled 'clip_processor' assets directory in the
158
+ installed package, independent of current working directory.
159
+
160
+ Resolution order:
161
+ 1) Explicit processor_dir if provided.
162
+ 2) Directory next to this file: <module_dir>/clip_processor
163
+ 3) importlib.resources (Python 3.9+): matrice_analytics.post_processing.usecases.color/clip_processor
164
+ """
165
+ if processor_dir:
166
+ return os.path.abspath(processor_dir)
167
+
168
+ # 2) Try path next to this file
169
+ module_dir = Path(__file__).resolve().parent
170
+ candidate = module_dir / "clip_processor"
171
+ if candidate.is_dir():
172
+ return str(candidate)
173
+
174
+ # 3) Try importlib.resources if available
175
+ try:
176
+ if ir_files is not None:
177
+ pkg = "matrice_analytics.post_processing.usecases.color"
178
+ res = ir_files(pkg).joinpath("clip_processor")
179
+ try:
180
+ # If packaged in a zip, materialize to a temp path
181
+ with ir_as_file(res) as p:
182
+ if Path(p).is_dir():
183
+ return str(p)
184
+ except Exception:
185
+ # If already a concrete path
186
+ if res and str(res):
187
+ return str(res)
188
+ except Exception:
189
+ pass
190
+
191
+ # Fallback to CWD-relative (last resort)
192
+ return os.path.abspath("clip_processor")
193
+
194
+ def process_color_in_frame(self, detections, input_bytes, zones: Optional[Dict[str, List[List[float]]]], stream_info):
195
+ # Serialize processing to avoid concurrent access and potential frame drops
196
+ with self._lock:
197
+ print("=== process_color_in_frame called ===")
198
+ print(f"Number of detections: {len(detections) if detections else 0}")
199
+ print(f"Input bytes length: {len(input_bytes) if input_bytes else 0}")
200
+
201
+ boxes = []
202
+ tracked_ids: List[int] = []
203
+ frame_number: Optional[int] = None
204
+ print(detections)
205
+ self.frame_idx += 1
206
+
207
+ if not detections:
208
+ print(f"Frame {self.frame_idx}: No detections provided")
209
+ self.processed_frames += 1
210
+ return {}
211
+
212
+ nparr = np.frombuffer(input_bytes, np.uint8) # convert bytes to numpy array
213
+ image = cv2.imdecode(nparr, cv2.IMREAD_COLOR) # decode image
214
+
215
+ if image is None:
216
+ print(f"Frame {self.frame_idx}: Failed to decode image")
217
+ self.processed_frames += 1
218
+ return {}
219
+
220
+ # Step 2: Use decoded frame directly (BGR → RGB performed at crop time)
221
+ frame = image
222
+ if stream_info:
223
+ input_settings = stream_info.get("input_settings", {})
224
+ start_frame = input_settings.get("start_frame")
225
+ end_frame = input_settings.get("end_frame")
226
+ if start_frame is not None and end_frame is not None and start_frame == end_frame:
227
+ frame_number = start_frame
228
+
229
+ for det in detections:
230
+ bbox = det.get('bounding_box')
231
+ tid = det.get('track_id')
232
+ if not bbox or not tid:
233
+ continue
234
+ w = bbox['xmax'] - bbox['xmin']
235
+ h = bbox['ymax'] - bbox['ymin']
236
+ if w >= self.min_box_size and h >= self.min_box_size:
237
+ boxes.append(bbox)
238
+ tracked_ids.append(tid)
239
+
240
+ if not boxes:
241
+ print(f"Frame {self.frame_idx}: No cars in zone")
242
+ self.processed_frames += 1
243
+ return {}
244
+
245
+ # print(boxes)
246
+ # print(tracked_ids)
247
+ crops_for_model = []
248
+ map_trackidx_to_cropidx = []
249
+ for i, (bbox, tid) in enumerate(zip(boxes, tracked_ids)):
250
+ last_rec = self.records.get(tid)
251
+ should_classify = False
252
+ if last_rec is None:
253
+ should_classify = True
254
+ else:
255
+ if (self.frame_idx - last_rec.get("last_classified_frame", -999)) >= self.frame_skip:
256
+ should_classify = True
257
+ if should_classify:
258
+ x1, y1, x2, y2 = bbox['xmin'], bbox['ymin'], bbox['xmax'], bbox['ymax']
259
+ # crop safely - convert to integers
260
+ y1c, y2c = max(0, int(y1)), min(frame.shape[0], int(y2))
261
+ x1c, x2c = max(0, int(x1)), min(frame.shape[1], int(x2))
262
+ print(f"Cropping bbox: x1c={x1c}, y1c={y1c}, x2c={x2c}, y2c={y2c}, frame_shape={frame.shape}")
263
+ if y2c - y1c <= 0 or x2c - x1c <= 0:
264
+ print(f"Skipping invalid crop: dimensions {x2c-x1c}x{y2c-y1c}")
265
+ continue
266
+ crop = cv2.cvtColor(frame[y1c:y2c, x1c:x2c], cv2.COLOR_BGR2RGB)
267
+ map_trackidx_to_cropidx.append((tid, len(crops_for_model)))
268
+ # Pass raw numpy crop; resize handled in run_image_onnx_on_crops
269
+ crops_for_model.append(crop)
270
+ # print(f"Added crop for track_id {tid}")
271
+ # print(crops_for_model)
272
+
273
+ record = {} # Initialize record outside the if block
274
+ if crops_for_model:
275
+ img_embeds = self.run_image_onnx_on_crops(crops_for_model) # [N, D]
276
+ # compute similarity with text_embeds (shape [num_labels, D])
277
+ sims = img_embeds @ self.text_embeds.T # [N, num_labels]
278
+ # convert to probs
279
+ probs = np.exp(sims) / np.exp(sims).sum(axis=-1, keepdims=True) # softmax numerically simple
280
+ # print(probs)
281
+
282
+ # assign back to corresponding tracks
283
+ for (tid, crop_idx) in map_trackidx_to_cropidx:
284
+ prob = probs[crop_idx]
285
+ # print(prob)
286
+ best_idx = int(np.argmax(prob))
287
+ best_label = self.color_category[best_idx]
288
+ # print(best_label)
289
+ best_score = float(prob[best_idx])
290
+ # print(best_score)
291
+
292
+ rec = self.records.get(tid)
293
+ det_info = next((d for d in detections if d.get("track_id") == tid), {})
294
+ category_label = det_info.get("category", "unknown")
295
+ zone_name = det_info.get("zone_name", "Unknown_Zone")
296
+ record[tid] = {
297
+ "frame": self.frame_idx,
298
+ "color": best_label,
299
+ "confidence": best_score,
300
+ "track_id": tid,
301
+ "object_label": category_label,
302
+ "zone_name": zone_name,
303
+ "last_classified_frame": self.frame_idx,
304
+ }
305
+ print(record)
306
+
307
+ return record
308
+
309
+
310
+ def run_image_onnx_on_crops(self, crops):
311
+ valid_crops = []
312
+ for i, crop in enumerate(crops):
313
+ if isinstance(crop, Image.Image): # PIL.Image
314
+ crop = np.array(crop)
315
+ if not isinstance(crop, np.ndarray):
316
+ print(f"Skipping crop {i}: not a numpy array ({type(crop)})")
317
+ continue
318
+ if crop.size == 0:
319
+ print(f"Skipping crop {i}: empty array")
320
+ continue
321
+
322
+ try:
323
+ crop_resized = cv2.resize(crop, (224, 224), interpolation=cv2.INTER_LINEAR)
324
+ valid_crops.append(crop_resized)
325
+ except Exception as e:
326
+ print(f"Skipping crop {i}: resize failed ({e})")
327
+
328
+ if not valid_crops:
329
+ print("No valid crops to process")
330
+ return np.zeros((0, self.text_embeds.shape[-1]), dtype=np.float32)
331
+
332
+ # Convert all valid crops at once
333
+
334
+ #ToDO: Check if the processor and model.run is running on single thread and is uusing GPU. Latency should be <100ms.
335
+
336
+ pixel_values = self.processor(images=valid_crops, return_tensors="np")["pixel_values"]
337
+ n = pixel_values.shape[0]
338
+ self.batch_pixels[:n] = pixel_values
339
+
340
+ ort_inputs = {"pixel_values": self.batch_pixels[:n]}
341
+ img_out = self.image_sess.run(["image_embeds"], ort_inputs)[0].astype(np.float32)
342
+
343
+ return img_out / np.linalg.norm(img_out, axis=-1, keepdims=True)
344
+
345
+
346
+ def _is_in_zone(self, bbox, polygon: List[List[float]]) -> bool:
347
+ if not polygon:
348
+ return False
349
+ # print(bbox)
350
+ x1, y1, x2, y2 = bbox['xmin'], bbox['ymin'], bbox['xmax'], bbox['ymax']
351
+ # print(x1,x2,y1,y2)
352
+ # print(type(x1))
353
+ # print(polygon)
354
+ cx, cy = int((x1 + x2) / 2), int((y1 + y2) / 2)
355
+ polygon = np.array(polygon, dtype=np.int32)
356
+ return cv2.pointPolygonTest(polygon, (cx, cy), False) >= 0
357
+
358
+