perf(people): batch face embedding inference into single ONNX call #623
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/face-embedding-batch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Replace per-face
session.run()loop indetect_and_embed()with single batched ONNX inference call.Changes
_preprocess_for_embeddinghelper: crops face region, pads 10%, resizes to 112x112, normalizes to [-1, 1]. Returns[3, 112, 112]tensor without batch dim.detect_and_embed: collect all face crops via_preprocess_for_embedding, stack into[N, 3, 112, 112], singlesession.run(), split output rows, L2-normalize each, assign to face dicts.Edge cases handled
(512,)to(1, 512)[N, 512]outputBackward compatibility
_extract_embeddingkept unchanged