FaceSession
Face recognition session wrapping an SCRFD detector and an ArcFace recognizer. Detect() returns bounding boxes and landmarks; Recognize() additionally extracts 512-dim embeddings for identity comparison via Compare(). Example session := FaceSession->New("det_10g.onnx", "w600k_r50.onnx"); r1 := session->Recognize(image1_bytes, 0.5); r2 := session->Recognize(image2_bytes, 0.5); if(r1->GetSize() > 0 & r2->GetSize() > 0) { faces1 := r1->GetResults(); faces2 := r2->GetResults(); sim := FaceSession->Compare(faces1[0]->GetEmbedding(), faces2[0]->GetEmbedding()); "Similarity: {$sim}"->PrintLine(); # >0.35 = same person }; session->Close();
Operations
Compare
Compute cosine similarity between two L2-normalised ArcFace embeddings. Returns a value in [-1, 1]; typically >0.35 indicates the same person.
function : Compare(emb1:Float[], emb2:Float[]) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| emb1 | Float | first embedding (512 floats) |
| emb2 | Float | second embedding (512 floats) |
Return
| Type | Description |
|---|---|
| Float | cosine similarity score |
Detect
Detect all faces in an image.
method : public : Detect(image:Byte[], conf_threshold:Float) ~ FaceDetectionResultParameters
| Name | Type | Description |
|---|---|---|
| image | Byte | raw image bytes (JPEG/PNG) |
| conf_threshold | Float | detection confidence threshold [0, 1] |
Return
| Type | Description |
|---|---|
| FaceDetectionResult | array of FaceDetection results |
New
Constructor — detection only (no recognizer loaded).
New(det_model:String)Parameters
| Name | Type | Description |
|---|---|---|
| det_model | String | path to SCRFD detector ONNX model (e.g. det_10g.onnx) |
New
Constructor — detection + recognition.
New(det_model:String, rec_model:String)Parameters
| Name | Type | Description |
|---|---|---|
| det_model | String | path to SCRFD detector ONNX model (e.g. det_10g.onnx) |
| rec_model | String | path to ArcFace recognizer ONNX model (e.g. w600k_r50.onnx) |
New
Constructor with configuration options.
New(det_model:String, rec_model:String, config:Map<String,String>)Parameters
| Name | Type | Description |
|---|---|---|
| det_model | String | path to SCRFD detector ONNX model |
| rec_model | String | path to ArcFace recognizer ONNX model |
| config | Map<String,String> | key/value execution-provider options (e.g. "ep"->"cpu") |
Recognize
Detect faces and extract ArcFace embeddings for each. Requires the recognizer model to have been loaded.
method : public : Recognize(image:Byte[], conf_threshold:Float) ~ FaceRecognitionResultParameters
| Name | Type | Description |
|---|---|---|
| image | Byte | raw image bytes (JPEG/PNG) |
| conf_threshold | Float | detection confidence threshold [0, 1] |
Return
| Type | Description |
|---|---|
| FaceRecognitionResult | array of FaceResult (detection + 512-dim embedding) |