MCPcopy Create free account
hub / github.com/CScorza/IntelOSINT / _coerce_face_vector

Method _coerce_face_vector

IntelOSINT.py:10968–10985  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

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 ""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected