For creating FaceID using CoreML, we first need a model. This model will help us to detect the respective person to unlock the device. We have used 3 animals image data - [Cat - Dog - Horse] and created a model using CreateML image classfication.
We have assumed that the owner of the device is cat and it will unlock when it will get atleat 95% confident that the user is a cat.
I request you to first check CoreML and CreateML for better understaning: CoreML - Object Detection || CoreML - CreateML
Now let's jump back to our project, when you will open the app it will appear like this:
I have added tap gesture to the screen, this means when you will tap on the screen it will start scanning your face like this:
If identity is matched as cat with more than 95% confidence, it will unlock the screen. I will provide model + data from which the model is created so that you can use this functionality and practice more.
Don't worry if you aren't able to match the face within 3 seconds, passcode screen will appear so that you can unlock the device. and passcode is 123456.
You can change the screening time (3 sec) and passcode (123456).
Happy Learning !