(value)
| 10966 | return {"error": f"Volti insufficienti: A={len(embs_a)} B={len(embs_b)}"} |
| 10967 | |
| 10968 | def _coerce_face_vector(value): |
| 10969 | if isinstance(value, dict): |
| 10970 | for key in ("embedding", "vector", "data", "values"): |
| 10971 | if key in value: |
| 10972 | value = value.get(key) |
| 10973 | break |
| 10974 | else: |
| 10975 | value = list(value.values()) |
| 10976 | try: |
| 10977 | vec = np.asarray(value, dtype="float32").reshape(-1) |
| 10978 | except Exception: |
| 10979 | return None |
| 10980 | if vec.size == 0 or not np.all(np.isfinite(vec)): |
| 10981 | return None |
| 10982 | n = float(np.linalg.norm(vec) + 1e-12) |
| 10983 | if n <= 0: |
| 10984 | return None |
| 10985 | return vec / n |
| 10986 | |
| 10987 | ann_a = images_payload_a[0]["annotated"] if images_payload_a else "" |
| 10988 | ann_b = images_payload_b[0]["annotated"] if images_payload_b else "" |
nothing calls this directly
no outgoing calls
no test coverage detected