Finding faces: masks versus learning from examples
About this app
Face detection as in the 1990s: an eye mask slides over a drawn street scene by cross-correlation and finds the frontal face, but misses shadow, sign and profile and takes headlights for eyes (1 of 5). A small neural network trained on 3909 drawn examples with answers finds all 5 faces in the same scene without a false alarm.
With explain mode: an AI tutor walks you through the app, points out what matters in the scene and answers your questions.
Rules versus examples
In the 1990s face detection was programmed with rules. A module specified a mask of what an eye should look like and moved it across the image. The match was measured, for example with normalized cross-correlation, which removes brightness and contrast. Such masks fit only under the conditions they were built for. Machine learning works differently: a model receives many images with the answer “face” or “no face” and adjusts its weights so that the answers come out right.
What the app shows
A drawn street scene; the app computes all numbers itself. An eye mask searches 112,014 positions and finds a well-lit face with 95 % similarity. In the same street with five faces it stays below the threshold of 60 % for shadow, sign, profile and a small face, and takes a car with round headlights for a face. A small neural network, trained on 3189 drawn images and 720 hard negatives, finds all five faces without a false alarm.
Try it yourself
Go through the three scenes step by step: let the mask glide across the image and watch the trail of similarity grow. Reveal in the disturbance scene which faces were missed. Then fill the example wall, let the network learn and apply it to the street. The numbers in the panel show positions searched, detections, false alarms and the training accuracy.
Frequently asked questions
- What is template matching?
- A fixed template (mask) is placed at every position of an image, and a similarity measure says how well the patch fits. Normalized cross-correlation subtracts mean and contrast and gives values between −1 and 1. Above a threshold the position counts as a detection.
- Why do fixed masks fail on faces?
- Shadow, occlusion, rotation and a different size change the brightness pattern more than a single mask allows. At the same time, things that happen to look similar, such as two round headlights, can exceed the threshold. Every disturbance would need its own rule.
- What does a model learn from example images?
- It learns weights for features such as edge directions, so that images with a face get high values and images without a face low ones. What it can do depends on which cases the examples cover: it must have seen shadow and profile in training.
- What can I try in the app?
- Three scenes with steps: the mask searches for a face, the same mask fails on disturbances and reports a false alarm, a network learns from examples and finds all faces. An explanation mode guides you through everything.
Subject: Machine Learning
More from Machine Learning
- AdaBoost
- Anatomy of a prompt
- Data privacy traffic lights
- Decision Tree
- Ensemble: Bagging vs. Boosting
- k-Means
- k-Nearest Neighbors (kNN)
- AI theatre
A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps