Face identification for facility access, from one camera frame to a short list of names, on CPU.
IronClad is the second case study in the AI program I am taking at Johns Hopkins in fall 2026; the first was TechTrack. The scenario is a secure facility that wants to replace a badge check at the door with a camera. One frame of the person's face is matched against a gallery of enrolled employees, and the system hands the guard a short list of likely identities. It has to identify a person from a single frame, hold up when the lighting and the image quality change, scale to a gallery of millions, and let administrators add and remove people without retraining anything.
The access decision is made on the top name, so I score every experiment on whether the right person is at rank 1 first and on whether they are in the top N second. A wrong name waved through is the expensive error. A right person refused costs a retake at the door, and I kept that trade in front of me when I set the thresholds.
I built the retrieval service in Python around a pretrained FaceNet embedding, then the evaluation and enrolment pieces around it.
Both candidate weight sets (casia-webface and vggface2) arrived trained, so the analysis tunes the system around them rather than the network: the preprocessing, the index, the number of names returned, and how many images to enrol per person. The gallery holds 1,000 identities and 2,265 images, one to ten per person with a median of one, and the probe set is 999 images of 999 of those people, with no probe sharing a file with the gallery. I embedded everything once, cached the vectors, and made every experiment a re-read of that cache. That also mirrors the deployed system, where the gallery is embedded at enrolment and only the probe is embedded at the door. Every headline number carries a 95 percent bootstrap interval over probes, and every difference between two settings is a paired bootstrap on the same probes.
On the pipeline as I received it (the whole frame resized to 160 pixels, ImageNet normalisation), vggface2 found the right person at rank 1 for 50.7 percent of probes and casia-webface for 9.3, a paired gap of 41 points that held under every degradation I applied. Cosine and Euclidean gave the same ranking because the network normalises its output, so the similarity measure was never a decision. The surprise was brightness. Brightening a probe by 25 percent cost vggface2 23.5 points while darkening it by the same amount cost 5.6, and I read that asymmetry as the normalisation clipping bright pixels rather than as a property of faces. Neither model could support an acceptance threshold at this stage: holding simulated impostors to 1 percent admitted 5 percent of genuine employees.

| probe condition | casia-webface hit@1 | vggface2 hit@1 | gap (95% interval) |
|---|---|---|---|
| clean | 9.3 | 50.7 | 41.3 (38.0 to 44.7) |
| blur sigma 1 | 9.2 | 50.4 | 41.1 (37.8 to 44.5) |
| blur sigma 2 | 5.9 | 44.5 | 38.6 (35.5 to 41.6) |
| blur sigma 4 | 1.4 | 11.6 | 10.2 (8.1 to 12.1) |
| resized to 80 | 6.7 | 46.3 | 39.6 (36.5 to 42.7) |
| resized to 40 | 1.9 | 18.6 | 16.7 (14.3 to 19.0) |
| resized to 20 | 0.7 | 0.7 | 0.0 (-0.8 to 0.7) |
| brightness 0.5 | 1.3 | 17.8 | 16.5 (14.3 to 18.9) |
| brightness 0.75 | 6.9 | 45.0 | 38.1 (35.0 to 41.2) |
| brightness 1.25 | 6.4 | 27.1 | 20.7 (18.0 to 23.6) |
| brightness 1.5 | 4.4 | 10.6 | 6.2 (4.2 to 8.4) |

| model at target false accept rate | threshold | true accept | false reject | false accept |
|---|---|---|---|---|
| casia-webface at 1% | 0.958 | 0.5 | 98.6 | 0.80 |
| casia-webface at 0.1% | 0.967 | 0.2 | 99.5 | 0.00 |
| vggface2 at 1% | 0.848 | 5.4 | 93.5 | 1.00 |
| vggface2 at 0.1% | 0.895 | 1.7 | 98.2 | 0.00 |
I put MTCNN in front of the embedding to crop the face with a 20 pixel margin, and then replaced the ImageNet normalisation with the fixed standardisation the weights were trained with, (x minus 127.5) divided by 128. The crop alone added 34.5 points of rank-1 hit rate for vggface2 and 70.9 for casia-webface, and the normalisation added another 8 to 11 on top. Together they took vggface2 from 50.7 to 93.3 percent and casia-webface from 9.3 to 90.9, the brightness penalty disappeared, and the model gap shrank from 41 points to 2.4. Gating the crop on detector confidence bought nothing at 0.95 or 0.99 and cost 3 to 7 points at 0.999, so I log the confidence and treat a frame with no face as a retake instead. The detector costs 25 ms per frame on my CPU against 21 ms for the embedding. The acceptance rule moved from unusable to measurable: at a 1 percent false accept rate the final pipeline admits 69 percent of genuine employees and refuses 31, four fifths of them people the ranking had already identified.

| probe condition | casia-webface hit@1 | vggface2 hit@1 | gap (95% interval) |
|---|---|---|---|
| clean | 90.9 | 93.3 | 2.4 (1.2 to 3.7) |
| blur sigma 1 | 89.8 | 92.7 | 2.9 (1.6 to 4.3) |
| blur sigma 2 | 83.6 | 87.3 | 3.7 (1.7 to 5.6) |
| blur sigma 4 | 11.2 | 40.9 | 29.7 (26.5 to 32.7) |
| resized to 80 | 85.6 | 87.8 | 2.2 (0.2 to 4.0) |
| resized to 40 | 24.6 | 47.9 | 23.3 (19.9 to 26.7) |
| resized to 20 | 0.2 | 0.8 | 0.6 (0.0 to 1.3) |
| brightness 0.5 | 89.3 | 92.4 | 3.1 (1.7 to 4.6) |
| brightness 0.75 | 90.5 | 92.4 | 1.9 (0.5 to 3.4) |
| brightness 1.25 | 90.5 | 92.9 | 2.4 (1.0 to 3.9) |
| brightness 1.5 | 88.0 | 91.4 | 3.4 (1.7 to 5.1) |

| model | crop | normalisation | hit@1 | hit@5 | MRR |
|---|---|---|---|---|---|
| casia-webface | none | ImageNet | 9.3 | 16.3 | 13.2 |
| casia-webface | none | fixed | 22.7 | 35.6 | 29.4 |
| casia-webface | MTCNN | ImageNet | 80.2 | 88.9 | 84.0 |
| casia-webface | MTCNN | fixed | 90.9 | 94.0 | 92.2 |
| vggface2 | none | ImageNet | 50.7 | 67.6 | 58.3 |
| vggface2 | none | fixed | 82.3 | 92.2 | 86.7 |
| vggface2 | MTCNN | ImageNet | 85.2 | 91.5 | 88.1 |
| vggface2 | MTCNN | fixed | 93.3 | 95.1 | 94.1 |
The gallery has 2,265 vectors and the target is millions, so I grew it synthetically. Each new entry is a convex mix of two real embeddings plus a little noise, renormalised, which keeps it near real faces instead of in empty space where it would never compete. I checked that rather than assumed it: a synthetic vector's nearest real neighbour sits at a median cosine of 0.72, against 0.81 for a real image's nearest real neighbour and 0.14 for a random vector. I built brute force, HNSW, and LSH at 2,265, 20,000, 100,000, and 500,000 vectors on one CPU thread and measured build time, size, latency, recall of the exact top 10, and hit rate on the real probes. Brute force stays exact and under half a millisecond at 500,000 but grows linearly. HNSW at efSearch 64 answers in 0.16 ms with 93 percent of the exact top 10 and the same hit@1, with a latency exponent of about 0.2. LSH was slower and less accurate than the alternative with the same memory at every size. I also measured the inverted-file family: IVF-Flat reaches 0.98 recall in under a millisecond but stores full vectors, and IVFPQ compresses to 76 bytes per vector, 76 GB at a billion against 2.3 TB for HNSW, at a cost of 6 points of hit@1 untuned.

| index | query ms at 500,000 | recall@10 at 500,000 | hit@1 at 500,000 | latency exponent | index GB at one billion |
|---|---|---|---|---|---|
| brute force | 0.427 | 1.000 | 90.0 | 0.87 | 2,048 |
| HNSW M=32, efSearch 16 | 0.072 | 0.876 | 89.8 | 0.24 | 2,320 |
| HNSW M=32, efSearch 64 | 0.164 | 0.926 | 90.2 | 0.20 | 2,320 |
| HNSW M=32, efSearch 256 | 0.576 | 0.962 | 90.3 | 0.22 | 2,320 |
| LSH 256 bits | 0.950 | 0.391 | 70.4 | 0.92 | 33 |
| LSH 1024 bits | 1.893 | 0.638 | 86.3 | 0.97 | 132 |
| LSH 4096 bits | 4.864 | 0.796 | 89.8 | 0.97 | 529 |
| IVF-Flat nprobe 32 | 0.913 | 0.981 | 89.6 | not fitted | 2,059 |
| IVFPQ 64x8 bits, nprobe 32 | 0.425 | 0.625 | 84.1 | not fitted | 76 |
N is the number of candidate identities handed to the guard, and every name past the first is a human comparison. I picked N as the smallest value where one more name adds less than half a point of hit rate. On the shipped gallery that rule gives 2 for vggface2 and 4 for casia-webface; on the 500,000-vector gallery it gives 3 to 4. The ceiling matters more than the slope. 4.6 percent of probes are not in the top 20, and no N recovers them. When I typed the 67 rank-1 misses for vggface2, 15 sat at rank 2 or 3, 6 at rank 4 to 20, and 46 beyond 20, and 59 of the 67 belonged to people enrolled with a single image. I set N to 3, which matches the HNSW choice at 500,000 and so survives the index change.

| model and index | N=1 | N=2 | N=3 | N=5 | N=10 | N=20 | chosen N |
|---|---|---|---|---|---|---|---|
| casia-webface, brute force | 90.9 | 92.4 | 93.0 | 94.0 | 94.8 | 95.0 | 4 |
| casia-webface, HNSW | 90.9 | 92.4 | 93.0 | 94.0 | 94.8 | 95.0 | 4 |
| casia-webface, LSH | 89.1 | 91.7 | 92.3 | 93.8 | 94.4 | 95.0 | 5 |
| vggface2, brute force | 93.3 | 94.4 | 94.8 | 95.1 | 95.4 | 95.4 | 2 |
| vggface2, HNSW | 93.3 | 94.4 | 94.8 | 95.1 | 95.4 | 95.4 | 2 |
| vggface2, LSH | 91.9 | 94.2 | 94.5 | 94.8 | 95.1 | 95.4 | 2 |
| where the right identity lands | vggface2 | of which single-image identity | casia-webface | of which single-image identity |
|---|---|---|---|---|
| rank 1 | 932 | 570 | 908 | 552 |
| rank 2 to 3 | 15 | 13 | 21 | 14 |
| rank 4 to 20 | 6 | 6 | 20 | 19 |
| beyond rank 20 | 46 | 40 | 50 | 44 |
The gallery holds one to ten images per person, and the question is how many are worth enrolling. I took the 123 identities with at least five images, enrolled each with m images drawn at random (m from 1 to 5, ten draws), kept everyone else in the gallery as a fixed background, and scored only those 123 probes. The second image is the one that matters: it adds 5.3 points for vggface2 and every draw agrees on the sign. The third adds 1.1, and the fourth and fifth add 0.2 each, inside the draw spread. Which single image gets enrolled moves the hit rate by several points on its own, and the medoid of a person's embeddings beats a random pick by 3.8 points. The acceptance rule told a second story. Enrolling everyone's images lifted true accept at a 1 percent false accept rate from 70 to 85 percent for the people with three or more images, but every added image gives an impostor one more chance at a near miss, so the threshold rose from 0.726 to 0.759 and the people still at one image fell from 71 to 63 percent. Enrolment has to be uniform before the threshold is reset.

| images per identity, m | casia-webface hit@1 (sd over draws) | identity bootstrap | vggface2 hit@1 (sd over draws) | identity bootstrap |
|---|---|---|---|---|
| 1 | 87.8 (1.6) | 83.7 to 91.4 | 92.1 (1.5) | 88.7 to 94.9 |
| 2 | 95.0 (1.1) | 91.7 to 97.8 | 97.4 (0.9) | 95.0 to 99.2 |
| 3 | 96.9 (0.9) | 93.8 to 99.2 | 98.5 (0.5) | 96.3 to 100.0 |
| 4 | 97.6 (0.7) | 94.7 to 99.7 | 98.7 (0.4) | 96.6 to 100.0 |
| 5 | 98.0 (0.4) | 95.3 to 100.0 | 98.9 (0.4) | 96.7 to 100.0 |
| enrolment (vggface2) | gallery vectors | threshold at 1% false accept | true accept | true accept, 3+ images | true accept, the rest | median genuine similarity | median impostor similarity |
|---|---|---|---|---|---|---|---|
| m=1, random image | 1,000 | 0.726 | 70.8 | 70.4 | 71.0 | 0.805 | 0.540 |
| m=1, medoid image | 1,000 | 0.721 | 75.3 | 83.9 | 72.4 | 0.811 | 0.539 |
| m=2 | 1,371 | 0.731 | 74.0 | 82.7 | 71.1 | 0.817 | 0.549 |
| m=3 | 1,624 | 0.741 | 72.3 | 84.6 | 68.1 | 0.821 | 0.553 |
| all images | 2,265 | 0.759 | 68.8 | 85.2 | 63.2 | 0.825 | 0.561 |
A crop and the right normalisation gained 43 points of rank-1 identification, and the 41 point model margin that looked decisive on the starting pipeline shrank to 2.4 on the right one. The brightness asymmetry that seemed like a robustness finding was the normalisation clipping bright pixels. A robustness result on the wrong preprocessing is a result about the preprocessing.
Enrolling more images lifted the people who got them from 70 to 85 percent true accept, and pushed the people who did not from 71 down to 63, because the impostor near misses rose with the gallery and the 1 percent threshold rose with them. The overall rate barely moved. Enrolment has to reach everyone before the threshold is reset, and the threshold itself stays provisional until real refused attempts can place it.
59 of the 67 rank-1 misses belong to identities enrolled with one photo, and 40 of the 46 that fall out of the top 20 do too. The fix is a second image at enrolment, not a longer list, and the one degradation nothing in the pipeline fixes is resolution, so the camera has to guarantee well over 80 pixels across the face.
Every decision in the report, the measurement it rests on, the requirement it serves, and the alternative I rejected.
The scaling is synthetic, and the billion-vector figures are a power law fitted on four points between 2,265 and 500,000 and read three orders of magnitude past the last one, so I treat them as the order of magnitude to plan hardware around and not as a prediction. The open-set numbers come from held-out identities rather than real intruders, and the threshold stays provisional until refused badge-in attempts can place it. I held the MTCNN crop margin at 20 pixels and did not sweep it; the margin is a free parameter of the detector stage, and that sweep is the first thing I would add. The probe and gallery images come from the same source, which hides the camera-to-enrolment shift a real door would have. The timing is one laptop CPU on a single FAISS thread.
Course repositories stay private under the university's rules, so this page summarizes my results and does not link the code.