matrice-analytics 0.1.55__py3-none-any.whl → 0.1.56__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.
- matrice_analytics/post_processing/face_reg/embedding_manager.py +19 -9
- matrice_analytics/post_processing/face_reg/face_recognition.py +5 -5
- {matrice_analytics-0.1.55.dist-info → matrice_analytics-0.1.56.dist-info}/METADATA +1 -1
- {matrice_analytics-0.1.55.dist-info → matrice_analytics-0.1.56.dist-info}/RECORD +7 -7
- {matrice_analytics-0.1.55.dist-info → matrice_analytics-0.1.56.dist-info}/WHEEL +0 -0
- {matrice_analytics-0.1.55.dist-info → matrice_analytics-0.1.56.dist-info}/licenses/LICENSE.txt +0 -0
- {matrice_analytics-0.1.55.dist-info → matrice_analytics-0.1.56.dist-info}/top_level.txt +0 -0
|
@@ -175,11 +175,14 @@ class EmbeddingManager:
|
|
|
175
175
|
"""Load all staff embeddings from API and cache them."""
|
|
176
176
|
if not self.face_client:
|
|
177
177
|
self.logger.error("Face client not available for loading staff embeddings")
|
|
178
|
+
print("ERROR: Face client not available for loading staff embeddings")
|
|
178
179
|
return False
|
|
179
180
|
|
|
180
181
|
try:
|
|
181
182
|
self.logger.info("Loading staff embeddings from API...")
|
|
183
|
+
print("=============== LOADING STAFF EMBEDDINGS FROM API ===============")
|
|
182
184
|
response = await self.face_client.get_all_staff_embeddings()
|
|
185
|
+
print(f"API RESPONSE TYPE: {type(response)}, IS_LIST: {isinstance(response, list)}, LEN: {len(response) if isinstance(response, list) else 'N/A'}")
|
|
183
186
|
|
|
184
187
|
# Robust response handling: accept dict with data or raw list
|
|
185
188
|
embeddings_data: List[Dict[str, Any]] = []
|
|
@@ -270,26 +273,30 @@ class EmbeddingManager:
|
|
|
270
273
|
self.embedding_metadata = self.staff_embeddings.copy()
|
|
271
274
|
self.staff_embeddings_last_update = time.time()
|
|
272
275
|
self.logger.info(f"Successfully loaded and cached {len(self.staff_embeddings)} staff embeddings (dim={self.embeddings_matrix.shape[1]})")
|
|
276
|
+
print(f"=============== SUCCESS: LOADED {len(self.staff_embeddings)} EMBEDDINGS, MATRIX SHAPE: {self.embeddings_matrix.shape} ===============")
|
|
273
277
|
try:
|
|
274
278
|
# Quick sanity metrics
|
|
275
279
|
row0_sum = float(np.sum(self.embeddings_matrix[0])) if self.embeddings_matrix.shape[0] > 0 else 0.0
|
|
280
|
+
row0_norm = float(np.linalg.norm(self.embeddings_matrix[0])) if self.embeddings_matrix.shape[0] > 0 else 0.0
|
|
281
|
+
print(f"SANITY CHECK: row0_sum={row0_sum:.4f}, row0_norm={row0_norm:.4f} (should be ~1.0 after normalization)")
|
|
276
282
|
self.logger.debug(f"Embeddings matrix shape: {self.embeddings_matrix.shape}, dtype={self.embeddings_matrix.dtype}, row0_sum={row0_sum:.4f}")
|
|
277
|
-
except Exception:
|
|
278
|
-
|
|
283
|
+
except Exception as e:
|
|
284
|
+
print(f"ERROR in sanity check: {e}")
|
|
279
285
|
return True
|
|
280
286
|
else:
|
|
281
287
|
# Build diagnostics and raise to stop pipeline early with actionable info
|
|
282
288
|
dims_summary: Dict[int, int] = {}
|
|
283
289
|
for d in dims_observed:
|
|
284
290
|
dims_summary[d] = dims_summary.get(d, 0) + 1
|
|
285
|
-
|
|
286
|
-
"No valid staff embeddings loaded. Observed dimension distribution: "
|
|
287
|
-
f"
|
|
288
|
-
f"{mismatch_examples[:5]}"
|
|
289
|
-
)
|
|
290
|
-
raise RuntimeError(
|
|
291
|
-
f"Failed to load staff embeddings due to dimension mismatch. Observed dims: {dims_summary}"
|
|
291
|
+
error_msg = (
|
|
292
|
+
f"No valid staff embeddings loaded. Observed dimension distribution: {dims_summary}. "
|
|
293
|
+
f"Expected_dim={expected_dim}. Mismatch examples (staffId, dim): {mismatch_examples[:5]}"
|
|
292
294
|
)
|
|
295
|
+
self.logger.error(error_msg)
|
|
296
|
+
print(f"=============== ERROR: NO VALID EMBEDDINGS ===============")
|
|
297
|
+
print(f"ERROR: {error_msg}")
|
|
298
|
+
print(f"=============== STOPPING PIPELINE ===============")
|
|
299
|
+
raise RuntimeError(f"Failed to load staff embeddings due to dimension mismatch. Observed dims: {dims_summary}")
|
|
293
300
|
|
|
294
301
|
except Exception as e:
|
|
295
302
|
self.logger.error(f"Error loading staff embeddings: {e}", exc_info=True)
|
|
@@ -331,6 +338,7 @@ class EmbeddingManager:
|
|
|
331
338
|
"""Find best matching staff member using optimized matrix operations (thread-safe)."""
|
|
332
339
|
with self._embeddings_lock:
|
|
333
340
|
if self.embeddings_matrix is None or len(self.embedding_metadata) == 0:
|
|
341
|
+
print(f"ERROR: _find_best_local_match - embeddings_matrix is None={self.embeddings_matrix is None}, metadata_len={len(self.embedding_metadata)}")
|
|
334
342
|
return None
|
|
335
343
|
|
|
336
344
|
# Create local copies to avoid issues with concurrent modifications
|
|
@@ -345,6 +353,7 @@ class EmbeddingManager:
|
|
|
345
353
|
# Dimension check
|
|
346
354
|
if embeddings_matrix.shape[1] != query_array.shape[1]:
|
|
347
355
|
self.logger.warning(f"Query embedding dim mismatch: query={query_array.shape[1]} staff={embeddings_matrix.shape[1]}")
|
|
356
|
+
print(f"ERROR: DIMENSION MISMATCH - query={query_array.shape[1]} staff={embeddings_matrix.shape[1]}")
|
|
348
357
|
return None
|
|
349
358
|
|
|
350
359
|
# Normalize query embedding
|
|
@@ -382,6 +391,7 @@ class EmbeddingManager:
|
|
|
382
391
|
try:
|
|
383
392
|
query_array = np.array(query_embedding, dtype=np.float32).reshape(1, -1)
|
|
384
393
|
if embeddings_matrix.shape[1] != query_array.shape[1]:
|
|
394
|
+
print(f"ERROR: get_best_similarity DIMENSION MISMATCH - query={query_array.shape[1]} staff={embeddings_matrix.shape[1]}")
|
|
385
395
|
return 0.0
|
|
386
396
|
qn = np.linalg.norm(query_array)
|
|
387
397
|
if qn == 0:
|
|
@@ -1603,11 +1603,11 @@ class FaceRecognitionEmbeddingUseCase(BaseProcessor):
|
|
|
1603
1603
|
human_text_lines.append(f"\tRecognized: {face_summary.get('session_totals',{}).get('total_recognized', 0)}")
|
|
1604
1604
|
human_text_lines.append(f"\tUnknown: {face_summary.get('session_totals',{}).get('total_unknown', 0)}")
|
|
1605
1605
|
# Additional counts similar to compare_similarity HUD
|
|
1606
|
-
try:
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
except Exception:
|
|
1610
|
-
|
|
1606
|
+
# try:
|
|
1607
|
+
# human_text_lines.append(f"\tCurrent Faces (detections): {total_detections}")
|
|
1608
|
+
# human_text_lines.append(f"\tTotal Unique Tracks: {cumulative_total}")
|
|
1609
|
+
# except Exception:
|
|
1610
|
+
# pass
|
|
1611
1611
|
|
|
1612
1612
|
human_text = "\n".join(human_text_lines)
|
|
1613
1613
|
|
|
@@ -28,8 +28,8 @@ matrice_analytics/post_processing/core/config.py,sha256=uyxWndO-DE9PeGD_h5K3TeB0
|
|
|
28
28
|
matrice_analytics/post_processing/core/config_utils.py,sha256=QuAS-_JKSoNOtfUWgr7Alf_wsqODzN2rHlQu-cHRK0s,34311
|
|
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
|
-
matrice_analytics/post_processing/face_reg/embedding_manager.py,sha256=
|
|
32
|
-
matrice_analytics/post_processing/face_reg/face_recognition.py,sha256=
|
|
31
|
+
matrice_analytics/post_processing/face_reg/embedding_manager.py,sha256=euZdFxslvEStli7pcUrBhyvJ-FR5uUGjU7HkrQ2XIfU,41940
|
|
32
|
+
matrice_analytics/post_processing/face_reg/face_recognition.py,sha256=CkJaf1M4Ah7YSoxOjSVoSPqAp912QkrVS0v2cLeWMCQ,103595
|
|
33
33
|
matrice_analytics/post_processing/face_reg/face_recognition_client.py,sha256=eF2NYju1uWKXhILndI1rh4_VhWrKSGidui2jjbPQXgM,27596
|
|
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
|
|
@@ -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.
|
|
193
|
-
matrice_analytics-0.1.
|
|
194
|
-
matrice_analytics-0.1.
|
|
195
|
-
matrice_analytics-0.1.
|
|
196
|
-
matrice_analytics-0.1.
|
|
192
|
+
matrice_analytics-0.1.56.dist-info/licenses/LICENSE.txt,sha256=_uQUZpgO0mRYL5-fPoEvLSbNnLPv6OmbeEDCHXhK6Qc,1066
|
|
193
|
+
matrice_analytics-0.1.56.dist-info/METADATA,sha256=plXBTb5-QrbiN9-4ui3W5hj6bo15-ka3tgANA0Pxzpk,14378
|
|
194
|
+
matrice_analytics-0.1.56.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
195
|
+
matrice_analytics-0.1.56.dist-info/top_level.txt,sha256=STAPEU-e-rWTerXaspdi76T_eVRSrEfFpURSP7_Dt8E,18
|
|
196
|
+
matrice_analytics-0.1.56.dist-info/RECORD,,
|
|
File without changes
|
{matrice_analytics-0.1.55.dist-info → matrice_analytics-0.1.56.dist-info}/licenses/LICENSE.txt
RENAMED
|
File without changes
|
|
File without changes
|