Class AntelopeFaceService
java.lang.Object
com.serinity.accesscontrol.service.AntelopeFaceService
Combined face detection + recognition service using AntelopeV2 ONNX models.
- Detection — SCRFD (scrfd_10g_bnkps.onnx)
- Recognition — ArcFace / GlinT R100 (glintr100.onnx)
- Since:
- 2026-02-27 AntelopeFaceService.java
- Version:
- 1.0
- Author:
- @ZouariOmar (zouariomar20@gmail.com)
-
Constructor Summary
ConstructorsConstructorDescriptionAntelopeFaceService(UserFaceRepository userFaceRepository) Creates a new face service and loads detection/recognition ONNX models. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes ONNX runtime resources used by this service.org.opencv.core.MatcropFaceSafely(org.opencv.core.Mat frame, org.opencv.core.Rect face) Crops the face region from the frame, clamped to frame boundaries.org.opencv.core.RectdetectBestFace(org.opencv.core.Mat frame) Returns the bounding box of the largest detected face, ornull.float[]extractEmbedding(org.opencv.core.Mat face) Extracts a 512-d L2-normalized ArcFace embedding from a face crop.recognizeUser(org.opencv.core.Mat face) Detects and recognizes a face in the full frame in one call.
-
Constructor Details
-
AntelopeFaceService
Creates a new face service and loads detection/recognition ONNX models.- Parameters:
userFaceRepository- repository used to fetch stored user embeddings- Throws:
Exception- if model loading fails
-
-
Method Details
-
detectBestFace
-
cropFaceSafely
public org.opencv.core.Mat cropFaceSafely(org.opencv.core.Mat frame, org.opencv.core.Rect face) Crops the face region from the frame, clamped to frame boundaries.- Parameters:
frame- source frameface- detected face rectangle- Returns:
- cropped face matrix
-
recognizeUser
-
extractEmbedding
-
close
public void close() throws ai.onnxruntime.OrtExceptionCloses ONNX runtime resources used by this service.- Throws:
ai.onnxruntime.OrtException- if resource cleanup fails
-