Unit 5: Data analysis · Bias in machine learning

Article

Bias in facial recognition

7 min read

Your phone unlocks when it sees your face. Now imagine it fails for you every second time, but works for your friend nearly always. The camera is the same and the phone is the same. What is different? Possibly, the program has seen many faces like your friend's and few like yours.

How facial recognition learns

Facial recognition is software that finds a face in a picture and decides whether it matches a face the system knows. It is built with machine learning. The training data is a very large set of face pictures. The model learns which patterns in a picture go with which person.

A model learns best from kinds of face it has seen many times. If some faces are rare in the training pictures, the model has less to learn from, so it makes more mistakes on them. Faces can differ in age, skin tone, hair, glasses, head coverings and the lighting they are photographed in. Gaps like this have been found in real systems, which is why this is an exam topic.

There are two kinds of mistake. Their results are very different:

MistakeWhat happensIf it is a phone unlockIf it is used to identify a person
Missed matchThe system fails to recognise the right personYou are annoyed and type a PINA person is not found, or cannot enter a place they may enter
Wrong matchThe system says it is person X, but it is notA stranger might get into the phoneAn innocent person is treated as someone else, perhaps questioned or accused

Check your understanding

A face recognition system makes many more mistakes for one group of people. What is the most likely cause?

Why consequences matter

The more important the decision, the more a mistake costs. A group that gets more mistakes carries those costs more often. If the system is used for a school door, a bank app, an airport check or an investigation, the people it fails most can be locked out, delayed or wrongly suspected.

So, the rule is: the higher the stakes, the more testing and human checking is needed. A match from a program is a clue, not proof.

Test on every group

An overall score can hide a group that does badly. The fix is to test each group separately:

Testing a face system before it is used

  1. Gather test photos

    New photos of every group of people who will use it.

    run
  2. Run the system

    Record right and wrong answers.

    split
  3. Score each group

    One result per group, not only one total.

    compare
  4. Look for gaps

    Is one group much worse off?

    if yes
  5. Fix and test again

    Add training photos for the weak group, then repeat.

Use photos the system has never seen, or it will look better than it is.

Worked example: a door system

A school buys a door system that opens when it recognises a student. The company says it is "94% correct". The school tests it on 1,000 new photos. The numbers are invented.

GroupPhotosCorrectPercent correct
Group 170068698%
Group 220018090%
Group 31007474%
Everyone1,00094094%

The overall figure is right: 686 + 180 + 74 = 940 out of 1,000. But a student in Group 3 is refused about one time in four. The company's training pictures were mostly of Group 1.

What should the school do? Ask the company to add training photos of Groups 2 and 3 and test again. Meanwhile, offer a PIN or an ID card so that nobody depends on the face system alone. Keep a person at the door who can let students in. And be open with students about how the system works.

Check your understanding

A school wants to use face recognition at its doors. Which test best shows whether it works fairly?

What reduces the bias

  • More diverse training data, including the faces and conditions the system will really meet.
  • Testing across groups before it is used, and again later.
  • Human review of any important match, never treating a match as proof.
  • An alternative for people the system fails, such as a PIN.
  • Transparency: tell people how accurate it is for each group and where it is used.
  • A varied team who think of users unlike themselves.

Common mistakes

  • "If it works for the developers, it works for everyone." They are only a few people, and probably alike.
  • "Some faces are just harder." Usually the model has seen fewer faces like them. The gap comes from the data and the testing, not from the people.
  • "A high overall percentage means it is fair." It can hide a group that does badly.
  • "A mistake is a small thing." It depends on what the system is used for.
  • "Test it on the training photos." The model already knows those. Use new photos.

On the exam

A typical question: a face system works worse for some people. The cause is usually training data that under-represents those people. The best fix is more representative data and testing across groups. If a question asks about the consequences, think about the use: a failed phone unlock is a small problem, but a wrong match in an investigation is a serious one.

Key words

Facial recognition: software that decides whether a face in a picture matches a known face.

Under-represented: having too few examples in the training data.

Missed match: failing to recognise a person who should be recognised.

Wrong match: saying a face belongs to one person when it belongs to another.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, this site. All lessons and questions here are written by JrCodex.