STS Central – A face recognition app using machine learning

How to Build a Face Recognition App in iOS and train ML model using CoreML 2 – Part 1

Posted by Farooq Nasim Ahmad on March 11, 2019

STS Central is a face recognition app. It can extract faces from a live video and give it to ML model to recognize it. It is primarily made to collect training images of the faces that user wants to recognize. User can upload this training set on our server. We will create a model from the given images and once ready user can download and install it with in the application. There is a built-in model that comes with the app. This model is trained to identify black and white photos of Einstein that are available on internet. All you are required to do is to launch the app. In order to explore it you can skip registration initially. Launch iPhone Camera and point it towards some black and white photos of Einstein. It will extract face and on top of face image it will display if it thinks that face is of Einstein or Not Einstein. Current model is trained on black and white pictures only and if you will point the camera to black and white picture of some photo that is not of Einstein it will also extract its face and will tell you that it is “Not Einstein”.

STS Central uses Vision framework for face detection. It detects faces in real-time video and draws a rectangle box around the face area. It has two modes

Detection mode

When application is launched and user goes inside iPhone camera by default it is launched in detection mode. The built-in model identifies photos of Einstein and also tells if it finds that photo is not of Einstein. As given in 3rd part of this article that explains the guidelines for selection of training images for a model. The CoreML 2 model works with better accuracy if it is trained on images of size at least 299x299. Therefore, STS central does not extract a face image unless it is of minimum size. Once it detects that image is greater than or equal to 299x299 it extracts the image and send it to model for recognition.

Face recognition

Training mode

Face collection name

Face collection

Sign up

Login home

Login

Export collected images

Once we receive the data our engineers will train a model and will notify user via his registered email. User can simply tap download button available on home and the custom trained model will be automatically installed within the app. This model will replace the default model that recognizes photos of Einstein and instead it will now recognize real-time faces from the people whose images are provided.

Downloaded model

It is recommended that user provide at least 100 images for each person and it should be acquired in scenario in which actual recognition is required. Like if the phone will be placed indoor in order to recognize persons the training data should also be acquired indoor.

Foscam

User can also user Foscam cameras instead of iPhone camera. A Foscam camera can be added by tapping the + button on home screen. It is highly recommended to select full HD models of Foscam as otherwise the detected faces will be smaller than 299x299 and cannot be acquired.

We do not store any user data and all data will be automatically deleted once the model is downloaded by the user.

Add Foscam camera

Conclusion

STS Central is a quite unique application that fully harness the power of CoreML 2 provided by Apple. It can be used with surveillance cameras in order to detect and record entries and exits of staff members of a company. It can also be used with surveillance cameras to detect friendly or unfriendly people entering a house and generate alarm. It can also be used just for fun with iPhone camera. Companies can integrate it with their HR systems and can use it for automatic attendance of their staff. If you want a testFlight release to further explore this application, please contact us at info@d2vision.com or visit www.d2vision.com. STS Central app will be finally connected with STS Control app and will automatically turn on lights, arm security systems on detection on unfriendly faces.