Presentation

As we know, marketing is all about targeting people with the right advertising. Since few years, television screan have been placed in public spaces like in the metro. It costs for the compagny and it is even more costly when the publicity is not adapted with the audience.

Hence the publicity must be relevant.

It must target each people individualy with their own specificities. These caracteristics could be of different aspects:

  • Age : baby, children, teenager, adult, senior
  • Whether it is a group of peole: a couple, a family or an alone person
  • The sex of the person
  • How the person is dressed: we can deduce its personality

For this project we gonna focus on the age recognition of passerbys for targeting publicity.

Implementation

To create this AI, we're going to use ml5.js which is a JavaScript library. It is a machine learning for web tool that has the particularity to be easy to manipulate. It will help us with our face recognition. Since there is no pre-trained model of this kind, it will be our job to train the neuronal network. For our purpose, we gonna use a neuronal network network trained by Tensorflow and a special class called MobileNets.

Steps of the work:
First, we need face recognition. Above the publicity spot, there will be camera that will detect faces. To get started, we neend to download a JavaScript API, face-api.js just there and include it in the script:

Girl in a jacket

Secondly, The image classifier that we are going to train in our project will be able to classify faces to their respective age. The link below contained 13,000 labeled images of human faces that we will implement in our projet. Inside there is To download the dataset, simply click on the below link and you’ll find a sub-header named ‘Download the Database’ where you can select which file is most appropriate to download to use in your projects. The name of our database is Labeled Faces in the Wild, it provided 13,233 unique persons.
Link to the data base When you are in this page, you download the database.
Since it is a supervised learning, a humain need to correspond each face to an age. Since there is no way to know from these photo their exact age, we will devide age in groups.

age group denomination
0-4 years old baby
5-12 years old children
13-18 years old teenager
19-60 years old adult
above 60 years old eldery person


Hence for face reconition of our data base, we will have to attribute an age denomitation. For example:


adult
baby

And so on. Photos will be our input and age denomination outputs. Hence it will be our new data base.So here, we will use TensorFlow.js that is a library for developing and training ML models in JavaScript. From that, we will have a model that has get many many exemple. Here is a video that can help you to understand how train an Image Classifier with TensorFlow because that is what we do.



Then we will have to activate the camera and make preduction about faces that will be reconized with this code:




At the end by detecting the face of the individual, marketers will be able to provide better publicity more focus depending on the person in front of the screen.