Face recognition: a close match is not a proven identity
人脸识别
Build and differentiate a small embedding CNN, compare triplet and angular losses, and test verification thresholds and unknown-person rejection.
face-recognitionThe closest face can still be the wrong person
Imagine a gallery containing two people and a query from a third. A nearest-neighbor search can always return a winner. That answers “which stored vector is closest?” It does not establish that the query belongs to either person.
Face recognition therefore has several distinct tasks. Verification compares a pair against a claimed identity: are these samples from the same person? Identification searches an enrolled gallery. In a closed-set test every query has an enrolled identity; in an open-set test, “not enrolled” must be a possible result. Finding a face in an image is detection, and predicting an attribute is another task again. Recognition and its error types
A practical pipeline captures an image, detects a face, checks whether the image is usable, normalizes the crop, extracts an embedding, and compares that embedding with enrollment templates. Each stage can fail independently. A detector’s box accuracy does not measure identity accuracy, and a high comparison score is not proof that a capture came from a live person.
We will implement a complete small embedding network and its gradients using synthetic patterns. Separate hand-constructed score examples will show threshold selection and unknown-person rejection. They are deliberately not reported as face-recognition performance.
Learn a representation, then evaluate a decision
What changed from eigenfaces to learned embeddings?
Turk and Pentland’s 1991 eigenfaces system represented aligned images in a low-dimensional principal-component space. With mean image μ and orthonormal basis columns U, the representation is:
The retained directions capture variation in the training images, not necessarily identity-specific variation. A change in illumination can occupy a large part of that variation. The paper distinguishes distance from the face subspace from distance to known face representations, and acknowledges earlier face coding work by Sirovich and Kirby. “Eigenfaces invented all face recognition” would erase that history. Original scanned paper
DeepFace, published at CVPR 2014, combined alignment with supervised feature learning. Its pipeline used a generic 3D model for frontalization and locally connected layers whose filters were not shared across positions. Training predicted known identity classes; an earlier fully connected layer supplied the representation. This design relied on aligned facial regions having different local statistics. Alignment and representation
FaceNet instead trained a compact unit-normalized embedding with a triplet objective. The CVPR 2015 paper describes tight face crops with scale and translation handling, rather than DeepFace-style 3D frontalization. Its 128-dimensional representation and the 512-dimensional representation in the ArcFace CVPR paper are choices of those systems, not requirements for every embedding. FaceNet method, ArcFace normalization
Normalization changes both the score and the gradient
Let a network produce a nonzero vector h. Unit normalization gives e, so cosine similarity is simply a dot product. For unit vectors e and g, squared Euclidean distance and similarity are related exactly:
Thus ordering by increasing squared distance equals ordering by decreasing cosine similarity under these assumptions. A cosine threshold t corresponds to squared-distance threshold 2−2t. This equivalence fails if unnormalized vectors are substituted without adjusting the metric. It also does not convert a similarity into a probability of shared identity.
Given an upstream gradient q with respect to e, differentiate normalization:
The radial component is removed: multiplying h by a positive constant leaves its direction unchanged. A zero vector has no direction; our implementation rejects near-zero vectors instead of returning a misleading score.
Triplets express a relative constraint
A triplet consists of anchor a, a positive p of the same identity, and a negative n of a different identity. With squared Euclidean distances and margin α:
On an active hinge, gradients for the anchor, positive and negative are respectively 2(en−ep), 2(ep−ea) and 2(ea−en). Inactive triplets contribute zero. Our batch loss averages over the supplied triplets, including inactive ones, and uses zero subgradient at the hinge boundary.
Most possible triplets can become uninformative. FaceNet’s semi-hard negatives lie farther from the anchor than its positive but still inside the margin. The paper also warns that choosing the hardest negatives early can harm training. Our deterministic small-batch miner chooses the nearest eligible negative and skips a pair when none exists; this declared policy is not a reproduction of the original training system. Loss and mining
ArcFace adds a training margin to an angle
Normalize both the embedding and the class weight vectors. Each weight becomes a learned class direction, not necessarily an empirical class mean. Let cj be its cosine with the embedding, y the training class, s a positive scale, and m an angular margin in radians. ArcFace changes the target logit before cross-entropy:
The target must overcome an extra angular penalty. Adding m to the angle differs from subtracting m from its cosine. The label is used during training; when comparing two new faces, their target training label is not known and this target-specific margin is not inserted into the pair score. Angular objective and pseudocode
For an interior cosine c, expand the target transformation and differentiate it:
The example differentiates this objective through the feature network and normalized class weights. It clips target cosines to ±(1−10⁻⁷), using a zero derivative outside the clip interval, and rejects target angles with θ+m at or beyond π. This makes its numerical/domain choices explicit; it does not silently turn a nonmonotonic tail into a different loss.
The fixed InsightFace loss file we inspected performs angular transformations inside torch.no_grad. Our analytic backward is therefore not claimed as a reproduction of that file’s training behavior. A named loss, a mathematical objective and a particular repository implementation are three things to compare, not interchangeable evidence. No upstream model was executed here. Fixed implementation
Choose a threshold without looking at the answer sheet
For similarity scores, our acceptance rule is score≥t. Let I be nonmate comparisons and G be genuine comparisons:
FMR measures false matches; FNMR measures missed genuine matches. Report their denominators. If one comparison type is absent, its rate is undefined, not zero. These definitions concern successfully produced comparison scores; capture failures and failures to enroll need separate accounting. Metric definitions
Choose the threshold on validation data, freeze it, and evaluate on a separate test set. Split by people or independent capture sessions as the intended deployment requires; random image splitting can leak near-duplicates. Our selector chooses the smallest next-representable score boundary meeting the requested empirical validation FMR. With validation nonmate scores [0.1,0.2,0.4,0.4,0.6] and zero allowed false matches, t must be just greater than 0.6. Rounding it back to 0.6 would accept the tied score under the declared rule.
The separate test fixture includes nonmate scores 0.65 and 0.7. The frozen threshold accepts both: validation success did not guarantee test success. Retuning on those test answers would destroy the independence of the reported test.
A larger gallery changes the question
For open-set identification, report false positive identification rate over unknown queries and failures over known queries at a specified candidate rank. Pairwise FMR uses a different denominator. Our example aggregates multiple templates for an identity by their maximum similarity, then returns the best identity only if its score passes the threshold. Other template aggregation choices change the decision rule. Gallery and identification
For an illustrative gallery of N independent, equal-rate nonmate comparisons, each with false-match probability p, the chance of at least one false alarm is:
At p=0.0001 and N=1000 this is about 9.52%, not 0.01%. This calculation is a thought experiment, not an estimate of a deployed system’s FPIR: scores against the same query are often dependent, and search algorithms need not perform independent pair comparisons. Measure the actual gallery operation.
Even observing zero errors does not establish a zero underlying rate. For n independent Bernoulli trials with zero observed errors, a one-sided 95% upper bound solves (1−p)^n=0.05:
For n=100 the bound is approximately 2.95%. Reusing the same identities in thousands of pairs does not create thousands of independent trials. The code implements the stated binomial calculation; it does not certify a confidence interval for dependent biometric data.
Run a complete small embedding network
Use Python 3.12 and NumPy 1.26.4. Save the code as face_embedding.py and run python face_embedding.py. The network has a 3×3 convolution, tanh, global average pooling, a linear embedding projection and normalized class weights: 64 trainable parameters in total. It receives 8×8 synthetic stripes and diagonals with noise, not face images.
The program includes every parameter gradient and input gradient, an angular-loss update, a separate triplet loss/miner, and verification/open-set evaluation helpers. Its hand-constructed evaluation scores are independent examples; they are not generated by the trained synthetic network. There is no face detector, alignment, pretrained backbone or presentation-attack detector hidden behind an API.
"""Original synthetic-pattern embedding, angular loss and evaluation operators.
Complete small CNN forward/backward; no real faces, detector, alignment,
pretrained recognition model, anti-spoofing system or benchmark reproduction.
"""
import json
import numpy as np
def finite(value, rank):
x = np.asarray(value, float)
if x.ndim != rank or not np.isfinite(x).all():
raise ValueError('finite array of specified rank required')
return x
def normalize(x, epsilon=1e-12):
x = finite(x, 2)
if min(x.shape) < 1 or not np.isfinite(epsilon) or epsilon <= 0:
raise ValueError('nonempty row vectors and positive epsilon required')
length = np.linalg.norm(x, axis=1, keepdims=True)
if np.any(length <= epsilon):
raise ValueError('zero or near-zero vectors have no usable direction')
return x/length, length
def normalize_backward(gradient, unit, length):
return (gradient-unit*(gradient*unit).sum(axis=1, keepdims=True))/length
def cosine_matrix(a, b):
a, _ = normalize(a); b, _ = normalize(b)
if a.shape[1] != b.shape[1]:
raise ValueError('matching embedding dimensions required')
return np.clip(a @ b.T, -1, 1)
def labels_of(labels, count, classes):
y = np.asarray(labels)
if y.shape != (count,) or y.dtype.kind not in 'iu' or np.any(y < 0) or np.any(y >= classes):
raise ValueError('one valid integer class per sample required')
return y
def angular_loss(features, weights, labels, scale=4., margin=.2):
"""Exact analytic gradient on the smooth interior of this angular objective.
Target cosines are clipped to +/- (1-1e-7), with zero clip derivative outside.
Require theta+margin<pi; reject the nonmonotonic tail instead of silently
adding a fallback branch. This is not fixed InsightFace detached backward.
"""
e, er = normalize(features); w, wr = normalize(weights)
if e.shape[1] != w.shape[1] or len(w) < 2 or not np.isfinite(scale) or scale <= 0:
raise ValueError('matching dimensions, >=2 classes and positive scale required')
if not np.isfinite(margin) or not 0 <= margin < np.pi/2:
raise ValueError('margin in [0,pi/2) required')
y = labels_of(labels, len(e), len(w)); row = np.arange(len(e))
cosine = e @ w.T
raw = cosine[row, y]
c = np.clip(raw, -1+1e-7, 1-1e-7)
if np.any(np.arccos(c)+margin >= np.pi):
raise ValueError('target angle outside the declared monotonic margin domain')
sine = np.sqrt(1-c*c)
target = c*np.cos(margin)-sine*np.sin(margin)
logits = scale*cosine.copy(); logits[row, y] = scale*target
shifted = logits-logits.max(axis=1, keepdims=True)
probability = np.exp(shifted); probability /= probability.sum(axis=1, keepdims=True)
loss = float(np.mean(np.log(np.exp(shifted).sum(axis=1))-shifted[row, y]))
dc = probability.copy(); dc[row, y] -= 1; dc *= scale/len(e)
derivative = np.cos(margin)+c/sine*np.sin(margin)
derivative *= (raw > -1+1e-7) & (raw < 1-1e-7)
dc[row, y] *= derivative
de = normalize_backward(dc @ w, e, er)
dw = normalize_backward(dc.T @ e, w, wr)
return loss, de, dw, logits
def triplet_loss(embedding, triplets, margin=.2):
"""Mean squared-distance hinge; caller may supply unit-normalized embeddings."""
e = finite(embedding, 2); t = np.asarray(triplets)
if min(e.shape) < 1 or t.ndim != 2 or t.shape[1] != 3 or t.dtype.kind not in 'iu' or np.any(t < 0) or np.any(t >= len(e)):
raise ValueError('embeddings and integer anchor/positive/negative indices required')
if not np.isfinite(margin) or margin < 0:
raise ValueError('nonnegative margin required')
grad = np.zeros_like(e)
if len(t) == 0:
return 0., grad
value = 0.
for a, p, n in t:
hinge = np.sum((e[a]-e[p])**2)-np.sum((e[a]-e[n])**2)+margin
if hinge > 0:
value += hinge
grad[a] += 2*(e[n]-e[p])/len(t)
grad[p] += 2*(e[p]-e[a])/len(t)
grad[n] += 2*(e[a]-e[n])/len(t)
return float(value/len(t)), grad
def semi_hard(embedding, labels, margin=.2):
"""Deterministic nearest eligible negative per ordered anchor-positive pair.
Strict d_ap < d_an < d_ap+margin. No eligible negative means skip, not an
automatic hardest-negative fallback; this is a declared small-batch policy.
"""
e = finite(embedding, 2); y = np.asarray(labels)
if min(e.shape) < 1 or y.shape != (len(e),) or not np.isfinite(margin) or margin <= 0:
raise ValueError('nonempty embeddings, labels and positive margin required')
dist = ((e[:, None]-e[None])**2).sum(axis=-1)
chosen = []
for a in range(len(e)):
for p in range(len(e)):
if a == p or y[a] != y[p]:
continue
possible = np.flatnonzero((y != y[a]) & (dist[a] > dist[a,p]) & (dist[a] < dist[a,p]+margin))
if len(possible):
n = possible[np.argmin(dist[a,possible])]
chosen.append((a,p,int(n)))
return np.asarray(chosen, dtype=int).reshape(-1,3)
def verification(genuine, impostor, threshold):
g, i = finite(genuine,1), finite(impostor,1)
if not np.isfinite(threshold):
raise ValueError('finite threshold required')
false_match, false_nonmatch = int((i >= threshold).sum()), int((g < threshold).sum())
return {'genuine':len(g),'impostor':len(i),'falseMatches':false_match,
'falseNonmatches':false_nonmatch,'FMR':false_match/len(i) if len(i) else None,
'FNMR':false_nonmatch/len(g) if len(g) else None}
def choose_threshold(validation_impostor, max_fmr=0.):
"""Smallest next-representable score boundary meeting empirical validation FMR.
Accept score>=threshold. Fits validation impostors only; it is not a
confidence guarantee and must never be refitted on the reported test set.
"""
scores = finite(validation_impostor,1)
if len(scores) == 0 or not np.isfinite(max_fmr) or not 0 <= max_fmr < 1:
raise ValueError('nonempty validation scores and FMR in [0,1) required')
for threshold in np.nextafter(np.unique(scores), np.inf):
if np.isfinite(threshold) and float((scores >= threshold).mean()) <= max_fmr:
return float(threshold)
raise ValueError('no finite threshold can reject the highest score')
def identify(probes, gallery, identity_labels, threshold):
"""One best-template score per identity (max aggregation), then top1 or reject.
Ties choose the first enrolled identity. No candidate from an empty gallery.
This is exhaustive search with explicit unknown handling, not a full NIST evaluator.
"""
p = finite(probes,2); g = finite(gallery,2)
ids = np.asarray(identity_labels)
if p.shape[1] != g.shape[1] or p.shape[1] == 0 or ids.shape != (len(g),) or ids.dtype.kind not in 'iu' or np.any(ids < 0) or not np.isfinite(threshold):
raise ValueError('matching dimensions, nonnegative integer identities and finite threshold required')
if len(g) == 0:
return [None]*len(p), [None]*len(p)
normalize(g)
if len(p) == 0:
return [], []
scores = cosine_matrix(p,g)
unique = list(dict.fromkeys(ids.tolist()))
grouped = np.stack([scores[:,ids==label].max(axis=1) for label in unique],axis=1)
best = grouped.argmax(axis=1); value = grouped[np.arange(len(p)),best]
result = [unique[k] if score >= threshold else None for k,score in zip(best,value)]
return result, value.tolist()
def identification_rates(predicted, truth, enrolled_ids):
"""Top1 thresholded identification: FPIR on unknown probes, misses on known probes."""
if len(predicted) != len(truth):
raise ValueError('one result per probe required')
enrolled = set(enrolled_ids)
if any(y is not None and y not in enrolled for y in predicted):
raise ValueError('accepted identities must be enrolled')
unknown = [i for i,y in enumerate(truth) if y not in enrolled]
known = [i for i,y in enumerate(truth) if y in enrolled]
false = sum(predicted[i] is not None for i in unknown)
misses = sum(predicted[i] != truth[i] for i in known)
return {'unknownProbes':len(unknown),'knownProbes':len(known),'falseIdentifications':false,
'knownMisses':misses,'FPIR':false/len(unknown) if unknown else None,
'top1FNIR':misses/len(known) if known else None}
def zero_error_upper(n, alpha=.05):
"""One-sided exact binomial upper bound ONLY for zero errors in n iid trials."""
if type(n) is not int or n < 1 or not 0 < alpha < 1:
raise ValueError('positive independent trial count and alpha in (0,1) required')
return float(-np.expm1(np.log(alpha)/n))
def gallery_false_alarm(pair_fmr, size):
"""Illustration under independent equal-rate nonmate comparisons, not measured FPIR."""
if not np.isfinite(pair_fmr) or not 0 <= pair_fmr <= 1 or type(size) is not int or size < 0:
raise ValueError('probability and nonnegative integer gallery size required')
if size == 0 or pair_fmr == 0: return 0.
if pair_fmr == 1: return 1.
return float(-np.expm1(size*np.log1p(-pair_fmr)))
def conv(x,k,b):
n,h,w,_=x.shape;size=k.shape[0];pad=size//2
padded=np.pad(x,((0,0),(pad,pad),(pad,pad),(0,0)))
out=np.broadcast_to(b,(n,h,w,len(b))).copy()
for y in range(size):
for z in range(size):out += padded[:,y:y+h,z:z+w] @ k[y,z]
return out
def conv_backward(x,k,gradient):
n,h,w,_=x.shape;size=k.shape[0];pad=size//2
padded=np.pad(x,((0,0),(pad,pad),(pad,pad),(0,0)))
dx,dk=np.zeros_like(padded),np.zeros_like(k)
for y in range(size):
for z in range(size):
dk[y,z]=np.einsum('nhwc,nhwf->cf',padded[:,y:y+h,z:z+w],gradient)
dx[:,y:y+h,z:z+w] += gradient @ k[y,z].T
return dx[:,pad:pad+h,pad:pad+w],dk,gradient.sum(axis=(0,1,2))
def parameters(seed=12):
rng=np.random.default_rng(seed)
return [rng.normal(0,.2,(3,3,1,4)),np.full(4,.1),rng.normal(0,.3,(4,3)),
np.array([.2,-.1,.3]),rng.normal(0,1,(3,3))]
def forward(images,p):
x=finite(images,4)
if min(x.shape)<1 or x.shape[3]!=1:raise ValueError('nonempty N,H,W,1 images required')
hidden=np.tanh(conv(x,p[0],p[1]));pooled=hidden.mean(axis=(1,2))
features=pooled @ p[2]+p[3]
unit,_=normalize(features)
return features,unit,(x,hidden,pooled)
def backward(p,cache,feature_gradient,weight_gradient):
x,h,pool=cache;df=finite(feature_gradient,2)
if df.shape!=(len(x),3) or np.shape(weight_gradient)!=p[4].shape:raise ValueError('matching head gradients required')
dk2=pool.T @ df;db2=df.sum(axis=0);dp=df @ p[2].T
dh=np.broadcast_to(dp[:,None,None,:]/(x.shape[1]*x.shape[2]),h.shape)*(1-h*h)
dx,dk,db=conv_backward(x,p[0],dh)
return [dk,db,dk2,db2,weight_gradient],dx
def demo():
rng=np.random.default_rng(31);y,x=np.indices((8,8))
bases=np.stack([(x<3).astype(float),(y<3).astype(float),(x==y).astype(float)])
images=np.stack([base+rng.normal(0,.05,base.shape) for base in bases for _ in range(2)])[...,None]
labels=np.repeat(np.arange(3),2);p=parameters()
features,embedding,cache=forward(images,p)
before,df,dw,_=angular_loss(features,p[4],labels)
gradients,dx=backward(p,cache,df,dw)
for value,grad in zip(p,gradients):value -= .01*grad
after=angular_loss(forward(images,p)[0],p[4],labels)[0]
assert after < before
threshold=choose_threshold([.1,.2,.4,.4,.6],max_fmr=0.)
validation=verification([.7,.8,.9],[.1,.2,.4,.4,.6],threshold)
test=verification([.55,.75,.85],[.2,.5,.65,.7],threshold)
chosen,scores=identify([[1,0],[0,1],[-1,0]],[[1,0],[0,1]],[10,20],threshold=.8)
rates=identification_rates(chosen,[10,20,99],[10,20])
return {'parameters':sum(v.size for v in p),'lossBefore':before,'lossAfterOneStep':after,
'inputGradientNorm':float(np.linalg.norm(dx)),'validationThreshold':threshold,
'validation':validation,'test':test,'openSetPredictions':chosen,'openSetScores':scores,
'openSetRates':rates,'zeroErrors100Upper95':zero_error_upper(100),
'independentGallery1000AtPairFMR1e4':gallery_false_alarm(.0001,1000),
'scope':'synthetic pattern CNN and separate score fixtures; no face-recognition accuracy claim'}
if __name__=='__main__':
print(json.dumps(demo(),indent=2))
Recorded output; final floating-point digits may vary slightly across platforms:
{
"parameters": 64,
"lossBefore": 3.0453347419335475,
"lossAfterOneStep": 2.809598287411779,
"inputGradientNorm": 0.04141402825974086,
"validationThreshold": 0.6000000000000001,
"validation": {
"genuine": 3,
"impostor": 5,
"falseMatches": 0,
"falseNonmatches": 0,
"FMR": 0.0,
"FNMR": 0.0
},
"test": {
"genuine": 3,
"impostor": 4,
"falseMatches": 2,
"falseNonmatches": 1,
"FMR": 0.5,
"FNMR": 0.3333333333333333
},
"openSetPredictions": [
10,
20,
null
],
"openSetScores": [
1.0,
1.0,
0.0
],
"openSetRates": {
"unknownProbes": 1,
"knownProbes": 2,
"falseIdentifications": 0,
"knownMisses": 0,
"FPIR": 0.0,
"top1FNIR": 0.0
},
"zeroErrors100Upper95": 0.029513049607039932,
"independentGallery1000AtPairFMR1e4": 0.09516710644145375,
"scope": "synthetic pattern CNN and separate score fixtures; no face-recognition accuracy claim"
}
The network loss falls from 3.04533 to 2.80960 after one update. This is evidence for the optimization calculation on the toy sample, not recognition quality. The score fixture exposes two false matches out of four nonmate test comparisons and one missed genuine match out of three. Returning None for the third gallery query demonstrates rejection rather than forcibly naming someone.
A convolution costs O(BHWk²CinCout). A dense normalized classifier with C classes and D-dimensional embeddings costs O(BCD) and stores O(CD) class weights. These training classes are not the enrollment gallery used at inference. Exhaustive comparison of Q queries with G gallery templates costs O(QGD); the explicit score matrix costs O(QG) memory. Our semi-hard miner forms O(B²D) distances but scans possible negatives for every ordered positive pair, so its worst-case search is O(B³). Production systems require more careful batching, indexing and sampling.
A score is only one part of a decision
Capture and attacks. Blur, occlusion, lighting, pose and aging can change the representation. Matching identity is distinct from determining whether a camera sees a real capture, a replay or a manipulated image. Test the capture and presentation-attack components as their own systems; neither cosine similarity nor a successful training run establishes resistance to those failures.
Unequal error costs. Rejected access and a false identity association have different consequences. Report error rates at the actual operating threshold, sample counts and relevant capture conditions. Preserve a way to reject an unusable sample or an unknown identity instead of forcing a label.
Population and evidence. NIST’s 2019 study documented demographic differentials that varied by algorithm and evaluation conditions. It did not train the submitted systems, establish the causes of the differences, or evaluate Internet and surveillance-video images. Those findings should not be converted into universal claims about every current model or confused with studies of attribute classification. Scope and omitted questions
Templates and versions. Embeddings remain identity-related data; replacing images with vectors is not a guarantee of anonymity. Restrict access, retention and use to the task’s actual needs. A model update can change embedding geometry and thresholds, so check compatibility with stored enrollment templates before mixing versions.
Reuse rights. The inspected InsightFace README distinguishes its code license from restrictions on supplied training data and models. Code availability does not automatically grant the same rights over weights and images. This example uses original code and generated patterns; no upstream weights or face dataset are redistributed. Fixed repository notice
Four decisions to make explicit
1. Translate a score threshold
Two embeddings have unit norm and cosine similarity 0.8. What is their squared Euclidean distance? Does the score mean an 80% chance of shared identity?
Answer: The squared distance is 2−2×0.8=0.4. Similarity is not a calibrated posterior probability. Its interpretation depends on the trained representation, comparison population and decision rule; unit normalization only supplies the geometric identity.
2. Explain the threshold tie
Validation nonmate scores are [0.1,0.2,0.4,0.4,0.6]. The acceptance rule is score≥t and the goal is zero empirical false matches. Why does the program return a value just above 0.6? What happens to nonmate test scores 0.65 and 0.7?
Answer: At exactly 0.6 the largest validation score is accepted, so the selector uses the next representable value above it. Both test scores still exceed that threshold and become false matches. The correct response is to report the test errors, not silently move the threshold using test labels.
3. Find the unknown-person failure
A gallery contains unit vectors (1,0) and (0,1), labelled 10 and 20. Query (−1,0) arrives. Compare unconditional nearest-neighbor identification with acceptance threshold 0.8.
Answer: Similarities are −1 and 0. An unconditional top1 rule returns identity 20 even though neither vector is close. The thresholded rule returns None. If the query is not enrolled, that is a correct rejection; the example does not prove that all unknown queries will be rejected.
4. Audit a performance claim
A team reports zero false matches in 100 independent nonmate trials and wants to claim a zero error rate for a gallery of 1000 identities. What should change in the report?
Answer: Report 0/100 observed errors, not a proven zero rate. Under the stated independent-binomial assumption the one-sided 95% upper bound is about 2.95%. A 1000-identity search needs its own unknown-query evaluation; the illustrative 1−(1−p)^N formula additionally assumes independent equal-rate comparisons. Repeated identities and correlated samples require an appropriate uncertainty analysis.
Keep method versions and measurement dates separate
The 1991 eigenfaces paper and DeepFace’s CVPR 2014 paper mark different approaches to representation. FaceNet’s first arXiv submission was 12 March 2015; ArcFace’s was 23 January 2018, preceding its CVPR 2019 paper. The current ArcFace arXiv entry includes a later journal expansion and a different author list; its additional material is not silently attributed to the four-author conference paper. Eigenfaces, DeepFace, FaceNet history, ArcFace history
NIST published report 8280 on 19 December 2019. Read its task definitions and test boundaries alongside its conclusions. A submission date, a conference year, a repository commit and a benchmark date describe different events. Publication record
A useful reproduction report states the crop/alignment rule, architecture and weights, training identities, label cleaning, loss and sampling, comparison metric, enrollment procedure, validation threshold and test protocol. Changing any of these may change the result. Our small program makes its own choices inspectable; it does not claim to reproduce the landmark systems’ accuracy.
Make a prediction, then check
An unknown query has a closest gallery template but its score is below threshold. What should this open-set system return?
Learning objectives
- Distinguish detection, verification, closed-set identification and open-set rejection.
- Differentiate normalized embeddings and an angular-margin training objective.
- Choose thresholds without test leakage and interpret the correct error denominators.
- Evaluate gallery size, dependence, capture conditions and version compatibility.
Prerequisites & connections
Explore related knowledge →References
- FaceNet: A Unified Embedding for Face Recognition and Clustering
Florian Schroff; Dmitry Kalenichenko; James Philbin · 2015 - ArcFace: Additive Angular Margin Loss for Deep Face Recognition
Jiankang Deng; Jia Guo; Niannan Xue; Stefanos Zafeiriou · 2019 - DeepFace: Closing the Gap to Human-Level Performance in Face Verification
Yaniv Taigman; Ming Yang; Marc’Aurelio Ranzato; Lior Wolf · 2014 - Face Recognition Vendor Test Part 3: Demographic Effects
Patrick Grother; Mei Ngan; Kayee Hanaoka · 2019 - Eigenfaces for Recognition
Matthew Turk; Alex Pentland · 1991 - InsightFace fixed angular loss implementation
InsightFace contributors · 2026 - InsightFace fixed code/data/model license notice
InsightFace contributors · 2026 - FaceNet: A Unified Embedding for Face Recognition and Clustering — submission history
Florian Schroff; Dmitry Kalenichenko; James Philbin · 2015 - ArcFace: Additive Angular Margin Loss for Deep Face Recognition — submission history
Jiankang Deng; Jia Guo; Jing Yang; Niannan Xue; Irene Kotsia; Stefanos Zafeiriou (current journal record) · 2018 - NISTIR8280 publication record
National Institute of Standards and Technology · 2019
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Codex · 2026-09-07 · Codex single-AI-author technical check: scoped original conference papers, scanned historical paper, fixed InsightFace source and NIST report; complete small-CNN/angular gradients, independent threshold/open-set tests, bilingual comparison and computed diagram binding. Not human peer review or biometric benchmark reproduction.
- Nineteen numerical tests plus four bilingual/output/metadata/diagram checks; all64 CNN parameters and48 inputs central differences, normalized/angular/triplet gradients, strict mining, score ties, validation/test separation, open-set denominators and confidence assumptions.
- Compared both complete texts, nine display equations, full code/output, four explained exercises and10 scoped sources. Kept training and evaluation fixtures separate, conference/journal versions distinct, no_grad implementation versus analytic objective explicit, and unknown rejection and privacy/rights limits intact.
Source locations checked:
- FaceNet: A Unified Embedding for Face Recognition and Clustering · Physical pages2–4 complete: unit128D embedding, squared-distance triplet hinge, online anchor-positive pairs, semi-hard negative selection, crop/scale/translation only versus 3D alignment, two architecture families and training context. Benchmark/results pages5–9 not audited. No quoted accuracy or compute reproduction.
- ArcFace: Additive Angular Margin Loss for Deep Face Recognition · Physical pages2–4 complete; page3 visually inspected: normalized features/class weights, target angular margin and scale, Eq3/pseudocode, comparison with cosine/multiplicative margins, opening experiment context. Later results not audited. CVPR2019 paper has four authors; arXiv2022 journal version is distinct.
- DeepFace: Closing the Gap to Human-Level Performance in Face Verification · Physical pages2–4 complete: iterative2D alignment, generic3D frontalization, locally connected layers without weight sharing, classification training and F7 representation, component scaling thenL2. No benchmark results or end-to-end reproduction; apparent C3 channel description not used.
- Face Recognition Vendor Test Part 3: Demographic Effects · Physical pages4,5,7,8,12,15 complete: study scope/results overview, verification versus identification, genuine/nonmate and FMR/FNMR definitions, gallery/unknown behavior, omitted causal/training/wild-image questions. Pages1–16 opening snippets located sections only. No exhaustive demographic tables or modern model benchmark audited.
- Eigenfaces for Recognition · Scanned PDF has no extracted text. Physical pages1,3,4 visually read: title/authors/copyright1991; PCA face-space/known-unknown decisions, Sirovich/Kirby antecedents, centered covariance and small Gram-matrix idea. Other pages not read; no performance numbers adopted.
- InsightFace fixed angular loss implementation · Complete loss file read: CombinedMarginLoss, ArcFace and CosFace, including no_grad angular transforms. Not executed.
- InsightFace fixed code/data/model license notice · License section lines29–41 and recognition project index lines141–148 read; other README content not audited.
- FaceNet: A Unified Embedding for Face Recognition and Clustering — submission history · Actual v1 submission history read; CVPR2015 PDF used for method reading. First submission 2015-03-12.
- ArcFace: Additive Angular Margin Loss for Deep Face Recognition — submission history · Actual v1 submission history read; current page v4 is2022 journal expansion with6authors. Original CVPR2019 four-author PDF used for method reading. First submission 2018-01-23.
- NISTIR8280 publication record · Official title, Published19December2019, authors and Created/Updated footer read.
Related topics