Facial recognition

Last week, when we were inventing our new app, we discussed how Facial Recognition software might work. Jon explained that it often concentrates on the eyes to identify people’s identity. Can you work out which Code Club member is which below?

Each picture has a number for you to jot down your answers. Think carefully about which clues you used to recognise people. Remembering that a computer can’t just remember ‘soft’ details, such as what someone ‘looks like’, we examined which clues we had used to distinguish one person from the next. These were:

  • eye colour
  • eye shape
  • eyebrow shape
  • haircut
  • skin tone
  • distance between the eyes

But, we weren’t consciously thinking these things – these are our friends and we see them every day so we do tend to just ‘recognise’ them. But if they were strangers? We would definitely need to think more deeply! Add if we were a computer, we would need to know specific details in order to match photographs.

Tim & Jon explained yesterday that computers don’t think like us, and so they don’t physically compare what two faces, or two fingerprints, actually look like. Instead, the computer takes a series of measurements to create a unique (hopefully!) identification code for someone’s face or fingerprint and it stores that code. We can build up a large database of these codes so that a computer can check an entry against the database it already has and hopefully come up with a match.

Facial Nodal Points:











The lovely, helpful people at MorphoTrust USA (they have the contract to provide facial recognition technology to the US government) have sent you, via Twitter, this Infographic about Facial Recognition. I found it very interesting.

So, how could we go about designing an algorithm for this and maybe even create it in Scratch?

First, we created our database. We agreed on 3 defining features of each others’ faces. We measured the distance between our eyes, the length of our noses, and recorded the colour of our eyes. So we built up a database with 4 fields:

Name, Eye length, Nose length, Eye colour

And we had a record for each child, plus Nicola & Tim, so we had 14 records in our database. We built the database in Scratch using Lists, with a list for each field like this:


Next we needed a script that would compare an entry we put in against the records already in our database and return the one that matched.

Scratch needs to check each list independently. So we decided that the first input we would ask for would be the one with the least common occurrence. For example, we wouldn’t use eye colour as there are only 3 possible values for this, whereas the distance between eyes or nose length was far more widely distributed. So we agreed to first ask for an input of Distance Between Eyes. You have to be careful as you can’t choose the same name for a list as you do for a variable!

The sprite was then programmed to check through the first list for matches. This was Tim’s tip for this:

The children then had a go at designing a program to search the database and to suggest a matching name/ record. But, we were so busy talking & discussing that we ran out of time and didn’t get finished!

Our next challenge is what to do if 2 or more people have the same distance between their eyes. In our database, they do! We will be thinking about this after half term and will embed some of our finished projects here.

Some other things:

  • We are worried about identical twins!
  • We discussed the fact that when a computer compares 2 photographs of the same people, the photos may be different sizes & so the distance measurements wouldn’t be comparable. We think that actual facial recognition software may actually take comparative measurements eg the ratio of the distance between eyes to length of face, as this ratio would stay constant regardless of the size of photo. Or we thought maybe the computer always enlarges photos to be the same size.
  • What about faces that are slightly turned away from the camera in a photo? J has read that Facebook uses 3D modelling of  faces to overcome this.
  • What about the fact that, when we use emotions, our face shape changes in different directions? Have a look in the mirror as you pull a ‘happy face’ or a ‘sad face’, or a ‘cross face’ or a ‘confused face’. (C kindly modelled this for us!) Do you think your facial measurements change? O pointed out that in a passport photo we all have to look serious and we think that that’s to help identification.
  • How does the computer distinguish between a face and the background in a photograph?

The How Stuff Works website has some really interesting information about how Facial Recognition works. Some of it is complicated but there are bits that will definitely make sense to you!

Some interesting facts about our faces:

9 thoughts on “Facial recognition

  1. I think it may be Caleb as only he has that shape of eye. They’re also brown like Caleb’s he also has brown hair.


  2. I LOVE the work you have been doing on this. Do you know that at the moment I am studying facial recognition for my Masters degree in Psychology, so your work has been really interesting to read about!

    I thought you might like to know about one aspect of facial recognition that I find interesting – that babies and very young children look at individual parts of the face to identify a person, whereas as we get older, we look at the face as a whole. This means that sometimes a young child will not recognise someone if they do something different – like have their hair cut! Has that ever happened to any of you?

    I’ve been using some facial recognition software for my studies which helps to understand how the brain processes faces. It’s really fun (did you know faces that are upside down are a lot harder to identify – for me at least!) but I’ve certainly never built my own program to identify faces – that is very impressive (and very, very cool)!


    • @Zoe Ross: Thanks Zoe – guys Zoe is one of the most important people who teaches teachers computing, I have learned so much from her this year!

      I feel a new slideshow coming on…upside down faces! I’ll get it ready for next week’s club and we’ll see if we can identify upside down staff.


  3. I think Caleb you are right. Me and Isobel were thinking that but we weren’t quit so sure about how to do it. There must be some command where you can tell the computer to search for it.


  4. To distinguish a face from a background the computer would probably scan the image for the facial nodal points, this way it wouldn’t get mixed up with other random objects.


  5. I was really pleased to have attend this session, the code cub pupils really amazed me with their thinking skills. They really do have a intelligent questioning and answering skills to problem solving.


    • @Mark Hovell: Thanks Mark, as you know you are welcome anytime! The children LOVED your questions – they thought they were very intelligent questions and wanted to know how you knew to ask them.


    • Thanks Caleb, nice to hear from you! Don’t forget they are all saved in Scratch 2.0 so you could have a go during half term 🙂 http://scratch.mit.edu/ Email me or ask your lovely sister if you need the login details.


Leave a Reply

Your email address will not be published. Required fields are marked *