Skip to content
Cyber Search MatchFace indexing and visual search.
CS Match / Technical field guide

Face vectors, ArcFace and the recognition model

Understand our 512-value face embeddings, RGB preprocessing, L2 normalization, angular similarity and the difference between model training and inference.

Implementation checked · Cyber Search Match

CS Match uses a pretrained ArcFace recognition checkpoint to map each aligned face to 512 numerical values. It normalizes the output to unit length, then compares vector directions. Uploading a reference creates a representation for that comparison; it does not train a new neural network.

A model and a face representation are different things

The word model can mean two things in an explanation of face comparison. The neural network is a learned function with fixed parameters. A face embedding is the output of that function for one input image. Keeping those meanings separate explains why you can compare a new portrait without first collecting a training dataset for that person.

The current worker loads w600k_r50.onnx, an R50 recognition checkpoint from the InsightFace ecosystem. The checked model input has three colour channels and a 112 × 112 spatial size; its output contains 512 values. We use the pretrained checkpoint for inference. The Face Analysis route does not update its weights, build a personal recognizer or enrol the upload into the public index.

CS Match / Face AnalysisTechnical schematic
Training updates network weights from labelled examples; our inference path uses fixed weights to generate a 512-value embedding
Training and inference are separate. CS Match uses the pretrained checkpoint for inference; uploads do not update its weights.Open image for a closer look ↗

How an embedding network learns a useful space

In a training workflow, labelled examples are passed through the network, an objective measures error, and backpropagation updates the weights. Training needs multiple images per identity and careful separation of training and evaluation identities. Label errors, repeated photos across splits and unrepresentative capture conditions can distort what an evaluation appears to prove.

ArcFace introduces an additive angular margin in the training objective. With normalized features and class weights, it uses cos(θ + m) for the labelled class and a scale factor for the logits. Here θ is the angle between an embedding and the labelled class’s weight vector; m is an added angular margin. Cross-entropy over the logits guides weight updates. At inference, a pairwise comparison uses feature vectors rather than the training-time class decision. This explains the research principle, not a claim that CS Match trained this checkpoint or reproduced a published benchmark.

A deployed network can process a person who was not a labelled class in a training set. The task at inference is to produce a feature representation, not to look up the person’s name. In our application, a reference supplies the vector against which other vectors are compared. It does not become an additional output class or a new set of network weights.

From RGB pixels to a numerical tensor

After alignment, the worker converts the patch to floating-point RGB values. Each channel value is transformed with (value − 127.5) / 127.5. It then rearranges the array into channel-first order and adds a batch dimension. The model receives a tensor shaped as one image, three channels, 112 rows and 112 columns.

These details matter because a recognition checkpoint expects a particular input convention. Passing BGR instead of RGB, changing the alignment template or using a different normalization can change vectors even when the displayed photo looks unchanged. The same embedding coordinate system should be used on both sides of a comparison.

ONNX describes the stored computation graph, while ONNX Runtime executes it through an available execution provider. The worker can select configured providers that are installed; the production worker inspected for this material reported CPUExecutionProvider. CPU versus GPU execution is a runtime choice, not a different definition of identity or a new comparison mode.

Input: 1 × 3 × 112 × 112, float32 RGBpixel_normalized = (pixel − 127.5) / 127.5z = recognition_network(aligned_face) ∈ R^512

What the 512 coordinates represent

The R50 checkpoint uses a residual convolutional backbone. Convolutional layers apply learned filters across local regions and combine their responses through successive feature maps. Residual shortcuts let a block add a learned transformation to an existing representation, rather than requiring every block to replace it completely. This explains the architecture family; we do not assign a named facial measurement to each filter.

The recognition graph ultimately produces one fixed-length feature vector for the aligned patch. Network weights and preprocessing determine that mapping. The application loads and executes the stored graph rather than manually calculating eye-to-eye ratios or assembling a 512-field anatomical record. In a training process, gradients change the learned filters; in this inference process, the filters stay fixed and only their output changes.

An embedding is a learned feature vector. Its coordinates jointly describe patterns useful to the training objective. They are not a list of 512 named measurements such as nose length, eye colour or cheek width. A coordinate should not be assigned an anatomical meaning just because it has a large value.

Two photos of the same person can yield different vectors because the pixels, pose, light, expression and image quality differ. Two different people can yield nearby vectors. The representation compresses useful visual information; it is neither a perfect identifier nor an ordinary image file that the interface can simply decode back into the original portrait.

The diagrams on this page reduce the geometry to a few dimensions to explain it. They do not show a recovered 3D face, a real coordinate plot from an uploaded person or a measured map of the entire index. The actual model output is 512-dimensional, and an attractive two-dimensional projection cannot preserve all of its distances.

CS Match / Face AnalysisTechnical schematic
Illustrative unit vectors with different angles and a 512-coordinate embedding strip
Low-dimensional teaching diagram. The actual embedding has 512 coordinates; directions and plotted examples are illustrative, not uploaded biometric data.Open image for a closer look ↗

L2 normalization keeps direction and removes length

The worker computes the Euclidean length of the raw output vector and divides every coordinate by that length. The result has length one. A zero-length output cannot be normalized and is treated as an unavailable representation. The comparison layer also rejects empty, non-finite, zero or dimension-mismatched vectors.

A small illustrative example is z = (3, 4, 0). Its length is 5, so the normalized vector is e = (0.6, 0.8, 0). This example explains the operation using three coordinates; it is not a real face embedding. Scaling z to (6, 8, 0) yields the same direction and the same normalized vector.

Normalization makes angular comparison practical. For unit vectors, the dot product equals cosine similarity. Our comparison function still computes both norms explicitly, so it can safely compare valid vectors without merely assuming they have already been normalized. Tiny floating-point differences are clamped to the valid cosine range.

||z||₂ = sqrt(z₁² + z₂² + … + z₅₁₂²)e = z / ||z||₂, so ||e||₂ = 1cosine(e, r) = (e · r) / (||e||₂ ||r||₂)

Why the angle is useful, and what it cannot tell you

For normalized vectors, a smaller angle corresponds to a larger dot product. Equal directions have cosine 1; perpendicular directions have cosine 0; opposite directions have cosine −1. These are geometric statements. They do not translate directly into the probability that two photographs show the same person.

The relationship to Euclidean distance is also useful: for two unit vectors, squared distance equals 2 − 2 × cosine. Changing from cosine to that distance does not add new evidence. The network, preprocessing and capture conditions still determine whether its geometry is informative for the photos being compared.

CS Match converts raw cosine into a separate display scale. A vector cosine of 0.8 is not the same concept as an 80% display score. With the current endpoints, 0.8 already reaches the top of the display scale. Read the raw vector value, normalized percentage and technical label together; the next guide works through the exact calculation.

For unit vectors: ||e − r||₂² = 2 − 2(e · r)Raw cosine and displayed percentage are different quantities.

Why version consistency matters

A vector belongs to a model and preprocessing convention. Equal-length outputs from different recognition checkpoints are not automatically comparable. Replacing a checkpoint, changing alignment or changing input normalization can alter the embedding space. Existing stored vectors may need to be rebuilt and the scoring thresholds re-evaluated.

The photo-to-reference tool calculates both sides through the current pipeline. It strips embeddings from the browser response and returns the crops and scores needed for the report. It does not expose a download of the 512 coordinates or provide a personal-model training control. The vector is an internal comparison representation, even though the interface shows its similarity score.

Questions about this workflow

Do you train a new model when I upload a reference?

No. The current tool runs inference with a pretrained network and calculates a vector for the selected reference. Its weights are not updated.

Does each coordinate describe one visible facial feature?

No. The 512 coordinates are learned features whose meaning comes from their combined representation.

Is the vector anonymous because it is not a photograph?

No. A numerical face representation can still be sensitive. Face Analysis does not add the uploaded representation to the public index.