matrice-analytics 0.1.46__py3-none-any.whl → 0.1.48__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

@@ -126,6 +126,7 @@ class TemporalIdentityManager:
126
126
  if not emb or not isinstance(emb, list):
127
127
  return None, "Unknown", 0.0, None, {}, "unknown"
128
128
  try:
129
+ st10=time.time()
129
130
  resp = await self.face_client.search_similar_faces(
130
131
  face_embedding=emb,
131
132
  threshold=0.01, # low threshold to always get top-1
@@ -134,6 +135,10 @@ class TemporalIdentityManager:
134
135
  location=location,
135
136
  timestamp=timestamp,
136
137
  )
138
+ print("------------------FACE RECOG TEMPORAL IDENTITY MANAGER UPDATE - COMPUTE BEST IDENTITY----------------------------")
139
+ print("LATENCY:",(time.time() - st10)*1000,"| Throughput fps:",(1.0 / (time.time() - st10)) if (time.time() - st10) > 0 else None)
140
+ print("------------------FACE RECOG TEMPORAL IDENTITY MANAGER UPDATE - COMPUTE BEST IDENTITY----------------------------")
141
+
137
142
  except Exception as e:
138
143
  self.logger.error(f"API ERROR: Failed to search similar faces in _compute_best_identity: {e}", exc_info=True)
139
144
  return None, "Unknown", 0.0, None, {}, "unknown"
@@ -226,11 +231,19 @@ class TemporalIdentityManager:
226
231
  stable_employee_id = s.get("stable_employee_id")
227
232
  stable_score = float(s.get("stable_score", 0.0))
228
233
  stable_staff_details = s.get("stable_staff_details", {}) if isinstance(s.get("stable_staff_details"), dict) else {}
234
+ st7=time.time()
235
+ print("------------------FACE RECOG TEMPORAL IDENTITY MANAGER UPDATE - STABLE VALUES----------------------------")
236
+ print("LATENCY:",(time.time() - st7)*1000,"| Throughput fps:",(1.0 / (time.time() - st7)) if (time.time() - st7) > 0 else None)
237
+ print("------------------FACE RECOG TEMPORAL IDENTITY MANAGER UPDATE - STABLE VALUES----------------------------")
229
238
 
230
239
  if eligible_for_recognition and emb:
240
+ st8=time.time()
231
241
  staff_id, person_name, inst_score, employee_id, staff_details, det_type = await self._compute_best_identity(
232
242
  emb, location=location, timestamp=timestamp
233
243
  )
244
+ print("------------------FACE RECOG TEMPORAL IDENTITY MANAGER UPDATE - COMPUTE BEST IDENTITY----------------------------")
245
+ print("LATENCY:",(time.time() - st8)*1000,"| Throughput fps:",(1.0 / (time.time() - st8)) if (time.time() - st8) > 0 else None)
246
+ print("------------------FACE RECOG TEMPORAL IDENTITY MANAGER UPDATE - COMPUTE BEST IDENTITY----------------------------")
234
247
 
235
248
  is_inst_known = staff_id is not None and inst_score >= self.threshold
236
249
  if is_inst_known:
@@ -290,7 +303,12 @@ class TemporalIdentityManager:
290
303
  return stable_staff_id, stable_person_name or "Unknown", float(inst_score), stable_employee_id, stable_staff_details, "known"
291
304
 
292
305
  # Fallback: use prototype from history
306
+ st9=time.time()
293
307
  fb_staff_id, fb_name, fb_score, fb_employee_id, fb_details, fb_type = await self._compute_best_identity_from_history(s, location=location, timestamp=timestamp)
308
+ print("------------------FACE RECOG TEMPORAL IDENTITY MANAGER UPDATE - COMPUTE BEST IDENTITY FROM HISTORY----------------------------")
309
+ print("LATENCY:",(time.time() - st9)*1000,"| Throughput fps:",(1.0 / (time.time() - st9)) if (time.time() - st9) > 0 else None)
310
+ print("------------------FACE RECOG TEMPORAL IDENTITY MANAGER UPDATE - COMPUTE BEST IDENTITY FROM HISTORY----------------------------")
311
+
294
312
  if fb_staff_id is not None and fb_score >= max(0.0, self.threshold - self.fallback_margin):
295
313
  s["label_votes"][fb_staff_id] += 1 # type: ignore
296
314
  s["stable_staff_id"] = fb_staff_id
@@ -883,7 +901,7 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
883
901
  """Process face recognition for each detection with embeddings"""
884
902
 
885
903
  # Initialize face client only when needed and if credentials are available
886
- st=time.time()
904
+ st0=time.time()
887
905
  if not self.face_client:
888
906
  try:
889
907
  self.face_client = self._get_facial_recognition_client(config)
@@ -894,7 +912,7 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
894
912
  # No client available, return empty list (no results)
895
913
  return []
896
914
  print("------------------FACE RECOG CLIENT INIT----------------------------")
897
- print("LATENCY:",(time.time() - st)*1000,"| Throughput fps:",(1.0 / (time.time() - st)) if (time.time() - st) > 0 else None)
915
+ print("LATENCY:",(time.time() - st0)*1000,"| Throughput fps:",(1.0 / (time.time() - st0)) if (time.time() - st0) > 0 else None)
898
916
  print("------------------FACE RECOG CLIENT INIT----------------------------")
899
917
 
900
918
  # Initialize unknown faces storage if not exists
@@ -938,14 +956,14 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
938
956
  for detection in detections:
939
957
 
940
958
  # Process each detection sequentially with await to preserve order
941
- st=time.time()
959
+ st1=time.time()
942
960
  processed_detection = await self._process_face(
943
961
  detection, current_frame, location, current_timestamp, config,
944
962
  current_recognized_count, current_unknown_count,
945
963
  recognized_persons, current_frame_staff_details
946
964
  )
947
965
  print("------------------WHOLE FACE RECOG PROCESSING DETECTION----------------------------")
948
- print("LATENCY:",(time.time() - st)*1000,"| Throughput fps:",(1.0 / (time.time() - st)) if (time.time() - st) > 0 else None)
966
+ print("LATENCY:",(time.time() - st1)*1000,"| Throughput fps:",(1.0 / (time.time() - st1)) if (time.time() - st1) > 0 else None)
949
967
  print("------------------FACE RECOG PROCESSING DETECTION----------------------------")
950
968
 
951
969
  # Include both known and unknown faces in final detections (maintains original order)
@@ -977,7 +995,7 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
977
995
  ) -> Dict:
978
996
 
979
997
  # Extract and validate embedding using EmbeddingManager
980
- st=time.time()
998
+ st2=time.time()
981
999
  detection, embedding = self.embedding_manager.extract_embedding_from_detection(detection)
982
1000
  if not embedding:
983
1001
  return None
@@ -985,7 +1003,7 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
985
1003
  # Internal tracker-provided ID (from AdvancedTracker; ignore upstream IDs entirely)
986
1004
  track_id = detection.get("track_id")
987
1005
  print("------------------FACE RECOG EMBEDDING EXTRACTION----------------------------")
988
- print("LATENCY:",(time.time() - st)*1000,"| Throughput fps:",(1.0 / (time.time() - st)) if (time.time() - st) > 0 else None)
1006
+ print("LATENCY:",(time.time() - st2)*1000,"| Throughput fps:",(1.0 / (time.time() - st2)) if (time.time() - st2) > 0 else None)
989
1007
  print("------------------FACE RECOG EMBEDDING EXTRACTION----------------------------")
990
1008
 
991
1009
  # Determine if detection is eligible for recognition (similar to compare_similarity gating)
@@ -1049,7 +1067,7 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
1049
1067
  except Exception:
1050
1068
  pass
1051
1069
  else: #if eligible for recognition
1052
- st=time.time()
1070
+ st3=time.time()
1053
1071
  staff_id, person_name, similarity_score, employee_id, staff_details, detection_type = await self.temporal_identity_manager.update(
1054
1072
  track_id=track_key,
1055
1073
  emb=embedding,
@@ -1058,7 +1076,7 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
1058
1076
  timestamp=current_timestamp,
1059
1077
  )
1060
1078
  print("------------------FACE RECOG TEMPORAL IDENTITY MANAGER UPDATE----------------------------")
1061
- print("LATENCY:",(time.time() - st)*1000,"| Throughput fps:",(1.0 / (time.time() - st)) if (time.time() - st) > 0 else None)
1079
+ print("LATENCY:",(time.time() - st3)*1000,"| Throughput fps:",(1.0 / (time.time() - st3)) if (time.time() - st3) > 0 else None)
1062
1080
  print("------------------FACE RECOG TEMPORAL IDENTITY MANAGER UPDATE----------------------------")
1063
1081
  except Exception as e:
1064
1082
  self.logger.warning(f"TemporalIdentityManager update failed: {e}")
@@ -1133,21 +1151,21 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
1133
1151
  and employee_id
1134
1152
  and not str(employee_id).startswith("unknown_")
1135
1153
  ):
1136
- st=time.time()
1154
+ st4=time.time()
1137
1155
  await self.people_activity_logging.enqueue_detection(
1138
1156
  detection=detection,
1139
1157
  current_frame=current_frame,
1140
1158
  location=location,
1141
1159
  )
1142
1160
  print("------------------FACE RECOG ENQUEUEING DETECTION FOR ACTIVITY LOGGING----------------------------")
1143
- print("LATENCY:",(time.time() - st)*1000,"| Throughput fps:",(1.0 / (time.time() - st)) if (time.time() - st) > 0 else None)
1161
+ print("LATENCY:",(time.time() - st4)*1000,"| Throughput fps:",(1.0 / (time.time() - st4)) if (time.time() - st4) > 0 else None)
1144
1162
  print("------------------FACE RECOG ENQUEUEING DETECTION FOR ACTIVITY LOGGING----------------------------")
1145
1163
 
1146
1164
  self.logger.debug(f"Enqueued known face detection for activity logging: {detection.get('person_name', 'Unknown')}")
1147
1165
  except Exception as e:
1148
1166
  self.logger.error(f"Error enqueueing detection for activity logging: {e}")
1149
1167
  print("------------------FACE RECOG ENQUEUEING DETECTION FOR ACTIVITY LOGGING----------------------------")
1150
- print("LATENCY:",(time.time() - st)*1000,"| Throughput fps:",(1.0 / (time.time() - st)) if (time.time() - st) > 0 else None)
1168
+ print("LATENCY:",(time.time() - st2)*1000,"| Throughput fps:",(1.0 / (time.time() - st2)) if (time.time() - st2) > 0 else None)
1151
1169
  print("------------------FACE RECOG ENQUEUEING DETECTION FOR ACTIVITY LOGGING----------------------------")
1152
1170
 
1153
1171
  return detection
@@ -447,7 +447,7 @@ class FacialRecognitionClient:
447
447
  )
448
448
 
449
449
  embeddings_count = 0
450
- if response.get('success', False):
450
+ if response: #.get('success', False):
451
451
  data = response.get('data', [])
452
452
  embeddings_count = len(data) if isinstance(data, list) else 0
453
453
  self.logger.info(f"API RESPONSE: Retrieved {embeddings_count} staff embeddings")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_analytics
3
- Version: 0.1.46
3
+ Version: 0.1.48
4
4
  Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
@@ -29,8 +29,8 @@ matrice_analytics/post_processing/core/config_utils.py,sha256=QuAS-_JKSoNOtfUWgr
29
29
  matrice_analytics/post_processing/face_reg/__init__.py,sha256=yntaiGlW9vdjBpPZQXNuovALihJPzRlFyUE88l3MhBA,1364
30
30
  matrice_analytics/post_processing/face_reg/compare_similarity.py,sha256=NlFc8b2a74k0PqSFAbuM_fUbA1BT3pr3VUgvSqRpJzQ,23396
31
31
  matrice_analytics/post_processing/face_reg/embedding_manager.py,sha256=qbh0df3-YbE0qvFDQvjpCg-JrsCZRJ5capjQ2LPOj1k,35619
32
- matrice_analytics/post_processing/face_reg/face_recognition.py,sha256=dLopUldzBCsRw1Zu0jewi1xf-JeUbgFx7_3L5pZ8wAg,96510
33
- matrice_analytics/post_processing/face_reg/face_recognition_client.py,sha256=VaMhjk_tk9zzcB4Vp_FCA_MtgtHtfpzhFJA2caNx9YU,27574
32
+ matrice_analytics/post_processing/face_reg/face_recognition.py,sha256=FrhNf-WFCYRiygl6aWluKiRMZLwKdouDd4xFR_7EtDM,98285
33
+ matrice_analytics/post_processing/face_reg/face_recognition_client.py,sha256=VxNUcFB0cDnCPZeebYjYKhQfve40V3hdcPVg4FcJmpM,27577
34
34
  matrice_analytics/post_processing/face_reg/people_activity_logging.py,sha256=vZbIvkK1h3h58ROeF0_ygF3lqr19O2h5222bN8XyIis,13675
35
35
  matrice_analytics/post_processing/ocr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  matrice_analytics/post_processing/ocr/easyocr_extractor.py,sha256=RMrRoGb2gMcJEGouQn8U9cCgCLXPT7qRa8liI4LNxFM,11555
@@ -189,8 +189,8 @@ matrice_analytics/post_processing/utils/format_utils.py,sha256=UTF7A5h9j0_S12xH9
189
189
  matrice_analytics/post_processing/utils/geometry_utils.py,sha256=BWfdM6RsdJTTLR1GqkWfdwpjMEjTCJyuBxA4zVGKdfk,9623
190
190
  matrice_analytics/post_processing/utils/smoothing_utils.py,sha256=78U-yucAcjUiZ0NIAc9NOUSIT0PWP1cqyIPA_Fdrjp0,14699
191
191
  matrice_analytics/post_processing/utils/tracking_utils.py,sha256=rWxuotnJ3VLMHIBOud2KLcu4yZfDp7hVPWUtNAq_2xw,8288
192
- matrice_analytics-0.1.46.dist-info/licenses/LICENSE.txt,sha256=_uQUZpgO0mRYL5-fPoEvLSbNnLPv6OmbeEDCHXhK6Qc,1066
193
- matrice_analytics-0.1.46.dist-info/METADATA,sha256=xzaR5W7et1MNAyYu-bK7bqBi_pLCs5GOfiLkBo_Olk4,14378
194
- matrice_analytics-0.1.46.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
195
- matrice_analytics-0.1.46.dist-info/top_level.txt,sha256=STAPEU-e-rWTerXaspdi76T_eVRSrEfFpURSP7_Dt8E,18
196
- matrice_analytics-0.1.46.dist-info/RECORD,,
192
+ matrice_analytics-0.1.48.dist-info/licenses/LICENSE.txt,sha256=_uQUZpgO0mRYL5-fPoEvLSbNnLPv6OmbeEDCHXhK6Qc,1066
193
+ matrice_analytics-0.1.48.dist-info/METADATA,sha256=ySzEz5ofuBlMN8KvcDsCa7G4eBO9rukOOPAx0fdBcHs,14378
194
+ matrice_analytics-0.1.48.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
195
+ matrice_analytics-0.1.48.dist-info/top_level.txt,sha256=STAPEU-e-rWTerXaspdi76T_eVRSrEfFpURSP7_Dt8E,18
196
+ matrice_analytics-0.1.48.dist-info/RECORD,,