fix: pipeline timeline log, chunk lookup, face processor no fallback, Qdrant UUID script, delete safety rules

This commit is contained in:
Accusys
2026-05-18 00:36:14 +08:00
parent a880c80556
commit 088aefdac7
7 changed files with 503 additions and 29 deletions

View File

@@ -64,6 +64,27 @@ def process_face(
app = None
coreml_embedder = None
# 載入 CoreML FaceNet必要無 fallback
try:
import coremltools as ct
coreml_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"../models/facenet512.mlpackage"
)
if not os.path.exists(coreml_path):
raise FileNotFoundError(f"CoreML model not found at {coreml_path}")
coreml_embedder = ct.models.MLModel(coreml_path)
framework.publish_info("COREML_FACENET_LOADED")
except Exception as e:
error_msg = f"CoreML FaceNet512 load failed: {e}"
print(f"[FACE] {error_msg}")
framework.publish_error(error_msg)
result = {"metadata": {"status": "error", "error": error_msg}, "frames": {}}
with open(output_path, "w") as f:
json.dump(result, f, indent=2)
return result
try:
framework.publish_info("LOADING_INSIGHTFACE")
app = insightface.app.FaceAnalysis(
@@ -72,21 +93,6 @@ def process_face(
app.prepare(ctx_id=0, det_size=(320, 320))
framework.publish_info("INSIGHTFACE_LOADED")
# 嘗試載入 CoreML FaceNet 模型MIT license可用 ANE
try:
import coremltools as ct
coreml_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"../models/facenet512.mlpackage"
)
if os.path.exists(coreml_path):
coreml_embedder = ct.models.MLModel(coreml_path)
framework.publish_info("COREML_FACENET_LOADED")
else:
print(f"[FACE] CoreML model not found at {coreml_path}, using InsightFace embedding")
except Exception as e:
print(f"[FACE] CoreML load failed: {e}, using InsightFace embedding")
except Exception as e:
print(f"[FACE] InsightFace failed to load (REQUIRED): {e}")
error_msg = f"InsightFace failed to load (REQUIRED): {e}"
@@ -219,8 +225,7 @@ def process_face(
embedding = coreml_out[emb_key].flatten().tolist()
except Exception as e:
print(f"[FACE] CoreML embedding error for face at ({x1},{y1}): {e}")
if embedding is None and hasattr(face, "embedding"):
embedding = face.embedding.tolist()
landmarks = None
if hasattr(face, "kps"):